@aranova/tracking-react 1.14.0 → 1.14.1

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.
@@ -1,103 +1,6 @@
1
- import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations, T as TrackingConfigReference } from './bookings-Bw2ImtPd.js';
2
1
  import * as zod_v4_core from 'zod/v4/core';
3
2
  import * as z from 'zod/mini';
4
- import { J as JsonValue, a as FormSubmitConfig, b as FormSubmitMetadata } from './form-submit-C_vJXCxh.js';
5
- import { n as LeadFormKind, p as LeadFormRole, m as LEAD_FORM_ROLE_SPECS, l as LEAD_FORM_ROLES, b as TrackingEnvironment } from './phone-utils-D2TGPCQW.js';
6
-
7
- type BookingProvider = "autoleap";
8
- /** One service choice on the booking form, by the site's own key. */
9
- interface BookingOption {
10
- key: string;
11
- label: string;
12
- /** The shop's service category, for a heading over its choices; null when it has none. */
13
- group: string | null;
14
- /** Optional helper text to show under the label. */
15
- description: string | null;
16
- }
17
- /** One heading on the form and the choices under it; `group` null holds the ungrouped ones. */
18
- interface BookingOptionGroup {
19
- group: string | null;
20
- options: BookingOption[];
21
- }
22
- /** The booking rules in camelCase, all in the shop's wall time. */
23
- interface BookingRules {
24
- minDaysAhead: number;
25
- maxDaysAhead: number;
26
- /** Start hours per weekday, `monday` … `sunday`; both lists empty = closed. */
27
- hours: Record<string, BookingDayWindows>;
28
- /** `YYYY-MM-DD` shop dates with no bookings although the weekday is open. */
29
- closedDates: string[];
30
- /** `YYYY-MM-DD` shop dates whose start hours replace their weekday's. */
31
- specialHours: Record<string, BookingDayWindows>;
32
- vehicleRequired: boolean;
33
- /** The vehicle may come after booking: send it with `bookings.updateBooking`. */
34
- vehicleDeferred: boolean;
35
- /** `waitForIt` / `dropOff`; empty when the shop hides the question. */
36
- dropOffOptions: string[];
37
- }
38
- interface BookingIntegration {
39
- provider: BookingProvider;
40
- /** False: render only the handoff link. Never block the customer on it. */
41
- enabled: boolean;
42
- /** The shop's own booking page. */
43
- fallbackUrl: string;
44
- /** True when the site may post a booking: `enabled`, rules captured and options mapped. */
45
- acceptsBookings: boolean;
46
- /** The shop's IANA timezone; every date and hour here is its wall time. */
47
- timezone: string;
48
- /** Sent back with each booking; a stale one is refused and the config refetched. */
49
- configVersion: number | null;
50
- rules: BookingRules | null;
51
- options: BookingOption[];
52
- /**
53
- * Where a booking from this page goes: `live` in production; on a development config `test`
54
- * (the shop's test lead source) or `simulated` (never sent). Show a banner when not `live`.
55
- */
56
- mode: BookingMode;
57
- }
58
- /** What the visitor already typed, carried onto the shop's booking page. */
59
- interface BookingHandoffPrefill {
60
- /** A single full-name field; split on the first space when `firstName` is not given. */
61
- name?: string | null;
62
- firstName?: string | null;
63
- lastName?: string | null;
64
- /** Any format; sent as national digits (no country code), as the shop's portal stores it. */
65
- phone?: string | null;
66
- email?: string | null;
67
- }
68
- /** The enabled-or-fallback booking provider in a config's integrations, if any. */
69
- declare function getBookingIntegration(integrations: ConversionIntegrations | null | undefined): BookingIntegration | null;
70
- /** One bookable day: its start hours split as the shop's portal shows them. */
71
- interface BookableDay {
72
- /** `YYYY-MM-DD`, shop-local. */
73
- date: string;
74
- /** `monday` … `sunday`. */
75
- weekday: string;
76
- /** Start hours before noon (8 = 08:00). */
77
- morning: number[];
78
- /** Start hours from noon on. */
79
- afternoon: number[];
80
- }
81
- /** Today's date in `timeZone` as `YYYY-MM-DD`; the server judges notice by the same date. */
82
- declare function shopToday(timeZone: string, now?: Date): string;
83
- /**
84
- * Every day a customer may book, from the minimum notice to the end of the window, with its
85
- * start hours. Exactly what the server accepts: closed dates removed, special hours applied.
86
- */
87
- declare function bookableSlots(rules: BookingRules, { timeZone, now }: {
88
- timeZone: string;
89
- now?: Date;
90
- }): BookableDay[];
91
- /**
92
- * The handoff URL with the visitor's details prefilled, or null when `fallbackUrl` is not an
93
- * https link on the shop's booking host (a config value never becomes an arbitrary redirect).
94
- */
95
- declare function buildBookingHandoffUrl(fallbackUrl: string, prefill?: BookingHandoffPrefill): string | null;
96
- /**
97
- * The options as headed sections, in published order: one per category, choices in order
98
- * under it. The API saves them grouped, so a category is never split; this keeps the first run.
99
- */
100
- declare function groupBookingOptions(options: readonly BookingOption[]): BookingOptionGroup[];
3
+ import { J as JsonValue, j as FormSubmitConfig, k as FormSubmitMetadata } from './phone-utils-CYr6AmEP.mjs';
101
4
 
102
5
  /**
103
6
  * Metadata for a manually fired `cta_click` event.
@@ -1030,157 +933,4 @@ interface TypedTrackingClient<TRegistry extends TriggerRegistryConfig> {
1030
933
  getVisitorId(): string;
1031
934
  }
1032
935
 
1033
- /** One required role; `requiredWhen` is the one-level condition (ADR-0024 §3). */
1034
- interface LeadFormRequirementDecl {
1035
- readonly role: LeadFormRole;
1036
- readonly requiredWhen: {
1037
- readonly role: LeadFormRole;
1038
- readonly anyOf: readonly string[];
1039
- } | null;
1040
- /** An operator recorded a waiver: optional in the type, still reported when missing. */
1041
- readonly waived?: boolean;
1042
- }
1043
- /** What one kind of form must collect, as generated for the site. */
1044
- interface LeadFormKindDecl {
1045
- /** The published contract hash; null when nothing is bound for the kind. */
1046
- readonly hash: string | null;
1047
- readonly requires: readonly LeadFormRequirementDecl[];
1048
- /** Each group is satisfied by any one of its roles. */
1049
- readonly requiresAny: readonly (readonly LeadFormRole[])[];
1050
- /** Live option keys per choice role; deprecated keys are left out. */
1051
- readonly options: {
1052
- readonly [role: string]: readonly string[];
1053
- };
1054
- }
1055
- /** The module `aranova-tracking forms gen` writes: `ARANOVA_LEAD_FORMS`. */
1056
- interface LeadFormContracts {
1057
- readonly registryVersion: number;
1058
- readonly siteId: string | null;
1059
- readonly contracts: {
1060
- readonly [K in LeadFormKind]?: LeadFormKindDecl;
1061
- };
1062
- }
1063
- /** `{ start: "HH:MM", end: "HH:MM" | null, label? }`, business-local; pinned to the zod by test. */
1064
- interface LeadFormTimeWindow {
1065
- start: string;
1066
- end: string | null;
1067
- label?: string;
1068
- }
1069
- interface LeadFormAddress {
1070
- line1: string;
1071
- line2?: string;
1072
- city?: string;
1073
- region?: string;
1074
- postal_code?: string;
1075
- country?: string;
1076
- }
1077
- type Specs = typeof LEAD_FORM_ROLE_SPECS;
1078
- type RegistryRole = (typeof LEAD_FORM_ROLES)[number];
1079
- type AddOnRole = `add_on:${string}`;
1080
- type SpecOf<R> = R extends AddOnRole ? Specs["add_on"] : R extends keyof Specs ? Specs[R] : never;
1081
- type PrimitiveOf<R> = SpecOf<R>["primitive"];
1082
- type EmptyKind = {
1083
- hash: null;
1084
- requires: readonly [];
1085
- requiresAny: readonly [];
1086
- options: Record<string, never>;
1087
- };
1088
- type KindOf<C extends LeadFormContracts, K extends LeadFormKind> = C["contracts"][K] extends LeadFormKindDecl ? C["contracts"][K] : EmptyKind;
1089
- /** The site's live keys for a choice role, else the registry's fixed ones, else any key. */
1090
- type OptionKey<D extends LeadFormKindDecl, R> = R extends keyof D["options"] ? D["options"][R][number] : SpecOf<R> extends {
1091
- options: readonly {
1092
- key: infer Key;
1093
- }[];
1094
- } ? Key : string;
1095
- interface PrimitiveValues {
1096
- string: string;
1097
- text: string;
1098
- phone: string;
1099
- email: string;
1100
- date: string;
1101
- bool: boolean;
1102
- number: number;
1103
- time_window: LeadFormTimeWindow;
1104
- address: LeadFormAddress;
1105
- }
1106
- /** The value a role takes: option keys for a choice role, never labels. */
1107
- type LeadFormValue<D extends LeadFormKindDecl, R> = PrimitiveOf<R> extends "enum" ? OptionKey<D, R> : PrimitiveOf<R> extends "multi_enum" ? readonly OptionKey<D, R>[] : PrimitiveValues[Extract<PrimitiveOf<R>, keyof PrimitiveValues>];
1108
- type Blank = null | undefined;
1109
- type RequiredRoles<D extends LeadFormKindDecl> = Exclude<Extract<D["requires"][number], {
1110
- readonly requiredWhen: null;
1111
- }>, {
1112
- readonly waived: true;
1113
- }>["role"];
1114
- type AnyOf<D extends LeadFormKindDecl, G extends readonly string[]> = {
1115
- [R in G[number]]: {
1116
- [P in R]: LeadFormValue<D, P>;
1117
- };
1118
- }[G[number]];
1119
- type AllGroups<D extends LeadFormKindDecl, Gs> = Gs extends readonly [
1120
- infer H extends readonly string[],
1121
- ...infer T
1122
- ] ? AnyOf<D, H> & AllGroups<D, T> : unknown;
1123
- /**
1124
- * The `fields` of one kind's submit: unconditionally required roles are required keys, each
1125
- * any-of group needs one of its roles, everything else in the registry is optional (blank is
1126
- * omitted); a `required_when` role is optional here and checked at runtime.
1127
- */
1128
- type LeadFormFields<C extends LeadFormContracts, K extends LeadFormKind> = {
1129
- [R in RequiredRoles<KindOf<C, K>>]: LeadFormValue<KindOf<C, K>, R>;
1130
- } & {
1131
- [R in Exclude<RegistryRole, RequiredRoles<KindOf<C, K>>>]?: LeadFormValue<KindOf<C, K>, R> | Blank;
1132
- } & {
1133
- [R in AddOnRole]?: boolean | Blank;
1134
- } & AllGroups<KindOf<C, K>, KindOf<C, K>["requiresAny"]>;
1135
- interface LeadFormExtraField {
1136
- key: string;
1137
- label: string;
1138
- value: JsonValue;
1139
- }
1140
- interface LeadFormSubmitInput<C extends LeadFormContracts, K extends LeadFormKind> {
1141
- /** The `<form id>`, so `form_start` and `form_submit` line up. */
1142
- formId: string;
1143
- kind: K;
1144
- fields: LeadFormFields<C, K>;
1145
- /** Questions with no registry role yet: shown beside the contract, never texted. */
1146
- extra?: LeadFormExtraField[];
1147
- action?: string | null;
1148
- }
1149
- /** Anything that can send a `form_submit`: `useTracking()` with `form_submit` registered. */
1150
- interface LeadFormTracking {
1151
- trackEvent(eventType: "form_submit", metadata: FormSubmitMetadata): void;
1152
- }
1153
- interface LeadFormSubmitOptions {
1154
- /** Defaults to the tracking client's `createTracking({ debug })`. Throws on a violation. */
1155
- debug?: boolean;
1156
- /** Defaults to the tracking client's; `development` logs every violation. */
1157
- environment?: TrackingEnvironment;
1158
- /** Defaults to the tracking client's; validation and the hash use its live contracts. */
1159
- trackingConfig?: TrackingConfigReference;
1160
- }
1161
- interface LeadFormSubmitter<C extends LeadFormContracts> {
1162
- /** Send one typed `form_submit`; returns the metadata sent, violations included. */
1163
- submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata;
1164
- }
1165
- /**
1166
- * Bind a tracking client to the site's generated contracts (`ARANOVA_LEAD_FORMS`).
1167
- *
1168
- * @example
1169
- * ```ts
1170
- * const leadForms = createLeadFormSubmit(useTracking(), ARANOVA_LEAD_FORMS);
1171
- * leadForms.submit({ formId: "booking-form", kind: "booking", fields: { given_name, phone } });
1172
- * ```
1173
- */
1174
- declare function createLeadFormSubmit<C extends LeadFormContracts>(tracking: LeadFormTracking, contracts: C, options?: LeadFormSubmitOptions): LeadFormSubmitter<C>;
1175
- /**
1176
- * A picked slot as `preferred_date` + `preferred_time`, in the business's wall time.
1177
- * Takes `YYYY-MM-DD[T ]HH:MM` with no offset; a `Z`/`±HH:MM` instant or a `Date` would be re-zoned.
1178
- */
1179
- declare function slotFields(dateTime: string): {
1180
- preferred_date: string;
1181
- preferred_time: LeadFormTimeWindow;
1182
- };
1183
- /** A `time_window` value: `timeWindow("09:00", "12:00", "Morning")`; an exact time has no end. */
1184
- declare function timeWindow(start: string, end?: string | null, label?: string): LeadFormTimeWindow;
1185
-
1186
- export { type SiteLinkClickConfig as $, type AutomaticEventName as A, type BookableDay as B, type CtaClickConfig as C, type LeadFormTimeWindow as D, EVENT_SEMANTICS as E, type FormStartConfig as F, type LeadFormTracking as G, type LeadFormValue as H, type MultiPageSessionConfig as I, type MultiPageSessionMetadata as J, type PageExitMetadata as K, type LeadFormAddress as L, type ManualEventName as M, type PageIdentity as N, type PageViewConfig as O, type PageExitConfig as P, type PageViewMetadata as Q, type PhoneClickConfig as R, type PhoneClickMetadata as S, type RegisteredAutomaticEvents as T, type RegisteredManualEvents as U, type ScrollDepthConfig as V, type ScrollDepthMetadata as W, type SdkHeartbeatConfig as X, type SdkHeartbeatMetadata as Y, type SiteLinkArrivalConfig as Z, type SiteLinkArrivalMetadata as _, type BookingHandoffPrefill as a, type SiteLinkClickMetadata as a0, type SpecificPageName as a1, type SpecificPageVisitConfig as a2, type SpecificPageVisitMetadata as a3, type TimeOnSiteConfig as a4, type TimeOnSiteMetadata as a5, type TrackableEvent as a6, type TriggerRegistryConfig as a7, type TypedTrackEventOptions as a8, type TypedTrackingClient as a9, bookableSlots as aa, buildBookingHandoffUrl as ab, getBookingIntegration as ac, getEventSemantics as ad, groupBookingOptions as ae, shopToday as af, slotFields as ag, timeWindow as ah, createLeadFormSubmit as ai, type BookingIntegration as b, type BookingOption as c, type BookingOptionGroup as d, type BookingProvider as e, type BookingRules as f, type CtaClickMetadata as g, type EventCategory as h, type EventClientVisibility as i, type EventConfig as j, type EventKind as k, type EventMetadata as l, type EventName as m, type EventOutcomeRole as n, type EventSemantics as o, type FormStartMetadata as p, type FormStepConfig as q, type FormStepMetadata as r, type LeadFormContracts as s, type LeadFormExtraField as t, type LeadFormFields as u, type LeadFormKindDecl as v, type LeadFormRequirementDecl as w, type LeadFormSubmitInput as x, type LeadFormSubmitOptions as y, type LeadFormSubmitter as z };
936
+ export { type AutomaticEventName as A, type SiteLinkClickConfig as B, type CtaClickConfig as C, type SiteLinkClickMetadata as D, EVENT_SEMANTICS as E, type FormStartConfig as F, type SpecificPageName as G, type SpecificPageVisitConfig as H, type SpecificPageVisitMetadata as I, type TimeOnSiteMetadata as J, type TrackableEvent as K, type TriggerRegistryConfig as L, type ManualEventName as M, type TypedTrackEventOptions as N, type TypedTrackingClient as O, type PageExitConfig as P, getEventSemantics as Q, type RegisteredAutomaticEvents as R, type ScrollDepthConfig as S, type TimeOnSiteConfig as T, type CtaClickMetadata as a, type EventCategory as b, type EventClientVisibility as c, type EventConfig as d, type EventKind as e, type EventMetadata as f, type EventName as g, type EventOutcomeRole as h, type EventSemantics as i, type FormStartMetadata as j, type FormStepConfig as k, type FormStepMetadata as l, type MultiPageSessionConfig as m, type MultiPageSessionMetadata as n, type PageExitMetadata as o, type PageIdentity as p, type PageViewConfig as q, type PageViewMetadata as r, type PhoneClickConfig as s, type PhoneClickMetadata as t, type RegisteredManualEvents as u, type ScrollDepthMetadata as v, type SdkHeartbeatConfig as w, type SdkHeartbeatMetadata as x, type SiteLinkArrivalConfig as y, type SiteLinkArrivalMetadata as z };
@@ -1,103 +1,6 @@
1
- import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations, T as TrackingConfigReference } from './bookings-CDGNZUaH.mjs';
2
1
  import * as zod_v4_core from 'zod/v4/core';
3
2
  import * as z from 'zod/mini';
4
- import { J as JsonValue, a as FormSubmitConfig, b as FormSubmitMetadata } from './form-submit-C_vJXCxh.mjs';
5
- import { n as LeadFormKind, p as LeadFormRole, m as LEAD_FORM_ROLE_SPECS, l as LEAD_FORM_ROLES, b as TrackingEnvironment } from './phone-utils-Cfdx474X.mjs';
6
-
7
- type BookingProvider = "autoleap";
8
- /** One service choice on the booking form, by the site's own key. */
9
- interface BookingOption {
10
- key: string;
11
- label: string;
12
- /** The shop's service category, for a heading over its choices; null when it has none. */
13
- group: string | null;
14
- /** Optional helper text to show under the label. */
15
- description: string | null;
16
- }
17
- /** One heading on the form and the choices under it; `group` null holds the ungrouped ones. */
18
- interface BookingOptionGroup {
19
- group: string | null;
20
- options: BookingOption[];
21
- }
22
- /** The booking rules in camelCase, all in the shop's wall time. */
23
- interface BookingRules {
24
- minDaysAhead: number;
25
- maxDaysAhead: number;
26
- /** Start hours per weekday, `monday` … `sunday`; both lists empty = closed. */
27
- hours: Record<string, BookingDayWindows>;
28
- /** `YYYY-MM-DD` shop dates with no bookings although the weekday is open. */
29
- closedDates: string[];
30
- /** `YYYY-MM-DD` shop dates whose start hours replace their weekday's. */
31
- specialHours: Record<string, BookingDayWindows>;
32
- vehicleRequired: boolean;
33
- /** The vehicle may come after booking: send it with `bookings.updateBooking`. */
34
- vehicleDeferred: boolean;
35
- /** `waitForIt` / `dropOff`; empty when the shop hides the question. */
36
- dropOffOptions: string[];
37
- }
38
- interface BookingIntegration {
39
- provider: BookingProvider;
40
- /** False: render only the handoff link. Never block the customer on it. */
41
- enabled: boolean;
42
- /** The shop's own booking page. */
43
- fallbackUrl: string;
44
- /** True when the site may post a booking: `enabled`, rules captured and options mapped. */
45
- acceptsBookings: boolean;
46
- /** The shop's IANA timezone; every date and hour here is its wall time. */
47
- timezone: string;
48
- /** Sent back with each booking; a stale one is refused and the config refetched. */
49
- configVersion: number | null;
50
- rules: BookingRules | null;
51
- options: BookingOption[];
52
- /**
53
- * Where a booking from this page goes: `live` in production; on a development config `test`
54
- * (the shop's test lead source) or `simulated` (never sent). Show a banner when not `live`.
55
- */
56
- mode: BookingMode;
57
- }
58
- /** What the visitor already typed, carried onto the shop's booking page. */
59
- interface BookingHandoffPrefill {
60
- /** A single full-name field; split on the first space when `firstName` is not given. */
61
- name?: string | null;
62
- firstName?: string | null;
63
- lastName?: string | null;
64
- /** Any format; sent as national digits (no country code), as the shop's portal stores it. */
65
- phone?: string | null;
66
- email?: string | null;
67
- }
68
- /** The enabled-or-fallback booking provider in a config's integrations, if any. */
69
- declare function getBookingIntegration(integrations: ConversionIntegrations | null | undefined): BookingIntegration | null;
70
- /** One bookable day: its start hours split as the shop's portal shows them. */
71
- interface BookableDay {
72
- /** `YYYY-MM-DD`, shop-local. */
73
- date: string;
74
- /** `monday` … `sunday`. */
75
- weekday: string;
76
- /** Start hours before noon (8 = 08:00). */
77
- morning: number[];
78
- /** Start hours from noon on. */
79
- afternoon: number[];
80
- }
81
- /** Today's date in `timeZone` as `YYYY-MM-DD`; the server judges notice by the same date. */
82
- declare function shopToday(timeZone: string, now?: Date): string;
83
- /**
84
- * Every day a customer may book, from the minimum notice to the end of the window, with its
85
- * start hours. Exactly what the server accepts: closed dates removed, special hours applied.
86
- */
87
- declare function bookableSlots(rules: BookingRules, { timeZone, now }: {
88
- timeZone: string;
89
- now?: Date;
90
- }): BookableDay[];
91
- /**
92
- * The handoff URL with the visitor's details prefilled, or null when `fallbackUrl` is not an
93
- * https link on the shop's booking host (a config value never becomes an arbitrary redirect).
94
- */
95
- declare function buildBookingHandoffUrl(fallbackUrl: string, prefill?: BookingHandoffPrefill): string | null;
96
- /**
97
- * The options as headed sections, in published order: one per category, choices in order
98
- * under it. The API saves them grouped, so a category is never split; this keeps the first run.
99
- */
100
- declare function groupBookingOptions(options: readonly BookingOption[]): BookingOptionGroup[];
3
+ import { J as JsonValue, j as FormSubmitConfig, k as FormSubmitMetadata } from './phone-utils-CYr6AmEP.js';
101
4
 
102
5
  /**
103
6
  * Metadata for a manually fired `cta_click` event.
@@ -1030,157 +933,4 @@ interface TypedTrackingClient<TRegistry extends TriggerRegistryConfig> {
1030
933
  getVisitorId(): string;
1031
934
  }
1032
935
 
1033
- /** One required role; `requiredWhen` is the one-level condition (ADR-0024 §3). */
1034
- interface LeadFormRequirementDecl {
1035
- readonly role: LeadFormRole;
1036
- readonly requiredWhen: {
1037
- readonly role: LeadFormRole;
1038
- readonly anyOf: readonly string[];
1039
- } | null;
1040
- /** An operator recorded a waiver: optional in the type, still reported when missing. */
1041
- readonly waived?: boolean;
1042
- }
1043
- /** What one kind of form must collect, as generated for the site. */
1044
- interface LeadFormKindDecl {
1045
- /** The published contract hash; null when nothing is bound for the kind. */
1046
- readonly hash: string | null;
1047
- readonly requires: readonly LeadFormRequirementDecl[];
1048
- /** Each group is satisfied by any one of its roles. */
1049
- readonly requiresAny: readonly (readonly LeadFormRole[])[];
1050
- /** Live option keys per choice role; deprecated keys are left out. */
1051
- readonly options: {
1052
- readonly [role: string]: readonly string[];
1053
- };
1054
- }
1055
- /** The module `aranova-tracking forms gen` writes: `ARANOVA_LEAD_FORMS`. */
1056
- interface LeadFormContracts {
1057
- readonly registryVersion: number;
1058
- readonly siteId: string | null;
1059
- readonly contracts: {
1060
- readonly [K in LeadFormKind]?: LeadFormKindDecl;
1061
- };
1062
- }
1063
- /** `{ start: "HH:MM", end: "HH:MM" | null, label? }`, business-local; pinned to the zod by test. */
1064
- interface LeadFormTimeWindow {
1065
- start: string;
1066
- end: string | null;
1067
- label?: string;
1068
- }
1069
- interface LeadFormAddress {
1070
- line1: string;
1071
- line2?: string;
1072
- city?: string;
1073
- region?: string;
1074
- postal_code?: string;
1075
- country?: string;
1076
- }
1077
- type Specs = typeof LEAD_FORM_ROLE_SPECS;
1078
- type RegistryRole = (typeof LEAD_FORM_ROLES)[number];
1079
- type AddOnRole = `add_on:${string}`;
1080
- type SpecOf<R> = R extends AddOnRole ? Specs["add_on"] : R extends keyof Specs ? Specs[R] : never;
1081
- type PrimitiveOf<R> = SpecOf<R>["primitive"];
1082
- type EmptyKind = {
1083
- hash: null;
1084
- requires: readonly [];
1085
- requiresAny: readonly [];
1086
- options: Record<string, never>;
1087
- };
1088
- type KindOf<C extends LeadFormContracts, K extends LeadFormKind> = C["contracts"][K] extends LeadFormKindDecl ? C["contracts"][K] : EmptyKind;
1089
- /** The site's live keys for a choice role, else the registry's fixed ones, else any key. */
1090
- type OptionKey<D extends LeadFormKindDecl, R> = R extends keyof D["options"] ? D["options"][R][number] : SpecOf<R> extends {
1091
- options: readonly {
1092
- key: infer Key;
1093
- }[];
1094
- } ? Key : string;
1095
- interface PrimitiveValues {
1096
- string: string;
1097
- text: string;
1098
- phone: string;
1099
- email: string;
1100
- date: string;
1101
- bool: boolean;
1102
- number: number;
1103
- time_window: LeadFormTimeWindow;
1104
- address: LeadFormAddress;
1105
- }
1106
- /** The value a role takes: option keys for a choice role, never labels. */
1107
- type LeadFormValue<D extends LeadFormKindDecl, R> = PrimitiveOf<R> extends "enum" ? OptionKey<D, R> : PrimitiveOf<R> extends "multi_enum" ? readonly OptionKey<D, R>[] : PrimitiveValues[Extract<PrimitiveOf<R>, keyof PrimitiveValues>];
1108
- type Blank = null | undefined;
1109
- type RequiredRoles<D extends LeadFormKindDecl> = Exclude<Extract<D["requires"][number], {
1110
- readonly requiredWhen: null;
1111
- }>, {
1112
- readonly waived: true;
1113
- }>["role"];
1114
- type AnyOf<D extends LeadFormKindDecl, G extends readonly string[]> = {
1115
- [R in G[number]]: {
1116
- [P in R]: LeadFormValue<D, P>;
1117
- };
1118
- }[G[number]];
1119
- type AllGroups<D extends LeadFormKindDecl, Gs> = Gs extends readonly [
1120
- infer H extends readonly string[],
1121
- ...infer T
1122
- ] ? AnyOf<D, H> & AllGroups<D, T> : unknown;
1123
- /**
1124
- * The `fields` of one kind's submit: unconditionally required roles are required keys, each
1125
- * any-of group needs one of its roles, everything else in the registry is optional (blank is
1126
- * omitted); a `required_when` role is optional here and checked at runtime.
1127
- */
1128
- type LeadFormFields<C extends LeadFormContracts, K extends LeadFormKind> = {
1129
- [R in RequiredRoles<KindOf<C, K>>]: LeadFormValue<KindOf<C, K>, R>;
1130
- } & {
1131
- [R in Exclude<RegistryRole, RequiredRoles<KindOf<C, K>>>]?: LeadFormValue<KindOf<C, K>, R> | Blank;
1132
- } & {
1133
- [R in AddOnRole]?: boolean | Blank;
1134
- } & AllGroups<KindOf<C, K>, KindOf<C, K>["requiresAny"]>;
1135
- interface LeadFormExtraField {
1136
- key: string;
1137
- label: string;
1138
- value: JsonValue;
1139
- }
1140
- interface LeadFormSubmitInput<C extends LeadFormContracts, K extends LeadFormKind> {
1141
- /** The `<form id>`, so `form_start` and `form_submit` line up. */
1142
- formId: string;
1143
- kind: K;
1144
- fields: LeadFormFields<C, K>;
1145
- /** Questions with no registry role yet: shown beside the contract, never texted. */
1146
- extra?: LeadFormExtraField[];
1147
- action?: string | null;
1148
- }
1149
- /** Anything that can send a `form_submit`: `useTracking()` with `form_submit` registered. */
1150
- interface LeadFormTracking {
1151
- trackEvent(eventType: "form_submit", metadata: FormSubmitMetadata): void;
1152
- }
1153
- interface LeadFormSubmitOptions {
1154
- /** Defaults to the tracking client's `createTracking({ debug })`. Throws on a violation. */
1155
- debug?: boolean;
1156
- /** Defaults to the tracking client's; `development` logs every violation. */
1157
- environment?: TrackingEnvironment;
1158
- /** Defaults to the tracking client's; validation and the hash use its live contracts. */
1159
- trackingConfig?: TrackingConfigReference;
1160
- }
1161
- interface LeadFormSubmitter<C extends LeadFormContracts> {
1162
- /** Send one typed `form_submit`; returns the metadata sent, violations included. */
1163
- submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata;
1164
- }
1165
- /**
1166
- * Bind a tracking client to the site's generated contracts (`ARANOVA_LEAD_FORMS`).
1167
- *
1168
- * @example
1169
- * ```ts
1170
- * const leadForms = createLeadFormSubmit(useTracking(), ARANOVA_LEAD_FORMS);
1171
- * leadForms.submit({ formId: "booking-form", kind: "booking", fields: { given_name, phone } });
1172
- * ```
1173
- */
1174
- declare function createLeadFormSubmit<C extends LeadFormContracts>(tracking: LeadFormTracking, contracts: C, options?: LeadFormSubmitOptions): LeadFormSubmitter<C>;
1175
- /**
1176
- * A picked slot as `preferred_date` + `preferred_time`, in the business's wall time.
1177
- * Takes `YYYY-MM-DD[T ]HH:MM` with no offset; a `Z`/`±HH:MM` instant or a `Date` would be re-zoned.
1178
- */
1179
- declare function slotFields(dateTime: string): {
1180
- preferred_date: string;
1181
- preferred_time: LeadFormTimeWindow;
1182
- };
1183
- /** A `time_window` value: `timeWindow("09:00", "12:00", "Morning")`; an exact time has no end. */
1184
- declare function timeWindow(start: string, end?: string | null, label?: string): LeadFormTimeWindow;
1185
-
1186
- export { type SiteLinkClickConfig as $, type AutomaticEventName as A, type BookableDay as B, type CtaClickConfig as C, type LeadFormTimeWindow as D, EVENT_SEMANTICS as E, type FormStartConfig as F, type LeadFormTracking as G, type LeadFormValue as H, type MultiPageSessionConfig as I, type MultiPageSessionMetadata as J, type PageExitMetadata as K, type LeadFormAddress as L, type ManualEventName as M, type PageIdentity as N, type PageViewConfig as O, type PageExitConfig as P, type PageViewMetadata as Q, type PhoneClickConfig as R, type PhoneClickMetadata as S, type RegisteredAutomaticEvents as T, type RegisteredManualEvents as U, type ScrollDepthConfig as V, type ScrollDepthMetadata as W, type SdkHeartbeatConfig as X, type SdkHeartbeatMetadata as Y, type SiteLinkArrivalConfig as Z, type SiteLinkArrivalMetadata as _, type BookingHandoffPrefill as a, type SiteLinkClickMetadata as a0, type SpecificPageName as a1, type SpecificPageVisitConfig as a2, type SpecificPageVisitMetadata as a3, type TimeOnSiteConfig as a4, type TimeOnSiteMetadata as a5, type TrackableEvent as a6, type TriggerRegistryConfig as a7, type TypedTrackEventOptions as a8, type TypedTrackingClient as a9, bookableSlots as aa, buildBookingHandoffUrl as ab, getBookingIntegration as ac, getEventSemantics as ad, groupBookingOptions as ae, shopToday as af, slotFields as ag, timeWindow as ah, createLeadFormSubmit as ai, type BookingIntegration as b, type BookingOption as c, type BookingOptionGroup as d, type BookingProvider as e, type BookingRules as f, type CtaClickMetadata as g, type EventCategory as h, type EventClientVisibility as i, type EventConfig as j, type EventKind as k, type EventMetadata as l, type EventName as m, type EventOutcomeRole as n, type EventSemantics as o, type FormStartMetadata as p, type FormStepConfig as q, type FormStepMetadata as r, type LeadFormContracts as s, type LeadFormExtraField as t, type LeadFormFields as u, type LeadFormKindDecl as v, type LeadFormRequirementDecl as w, type LeadFormSubmitInput as x, type LeadFormSubmitOptions as y, type LeadFormSubmitter as z };
936
+ export { type AutomaticEventName as A, type SiteLinkClickConfig as B, type CtaClickConfig as C, type SiteLinkClickMetadata as D, EVENT_SEMANTICS as E, type FormStartConfig as F, type SpecificPageName as G, type SpecificPageVisitConfig as H, type SpecificPageVisitMetadata as I, type TimeOnSiteMetadata as J, type TrackableEvent as K, type TriggerRegistryConfig as L, type ManualEventName as M, type TypedTrackEventOptions as N, type TypedTrackingClient as O, type PageExitConfig as P, getEventSemantics as Q, type RegisteredAutomaticEvents as R, type ScrollDepthConfig as S, type TimeOnSiteConfig as T, type CtaClickMetadata as a, type EventCategory as b, type EventClientVisibility as c, type EventConfig as d, type EventKind as e, type EventMetadata as f, type EventName as g, type EventOutcomeRole as h, type EventSemantics as i, type FormStartMetadata as j, type FormStepConfig as k, type FormStepMetadata as l, type MultiPageSessionConfig as m, type MultiPageSessionMetadata as n, type PageExitMetadata as o, type PageIdentity as p, type PageViewConfig as q, type PageViewMetadata as r, type PhoneClickConfig as s, type PhoneClickMetadata as t, type RegisteredManualEvents as u, type ScrollDepthMetadata as v, type SdkHeartbeatConfig as w, type SdkHeartbeatMetadata as x, type SiteLinkArrivalConfig as y, type SiteLinkArrivalMetadata as z };
@@ -1,7 +1,60 @@
1
- import { J as JsonValue } from './form-submit-C_vJXCxh.mjs';
2
1
  import * as z from 'zod/mini';
3
2
  import { CountryCode } from 'libphonenumber-js';
4
3
 
4
+ /**
5
+ * JSON-serializable value accepted by `form_submit.fields[].value`.
6
+ *
7
+ * This intentionally excludes `undefined`, functions, symbols, `Date`
8
+ * instances, and non-finite numbers. Values are stored in PostgreSQL JSONB, so
9
+ * consumers should send only data that has a stable JSON representation.
10
+ */
11
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
12
+ [key: string]: JsonValue;
13
+ };
14
+ /** What the SDK's ladder found wrong with a submit it sent anyway (ADR-0024 §6). */
15
+ declare const contractViolationSchema: z.ZodMiniObject<{
16
+ role: z.ZodMiniNullable<z.ZodMiniString<string>>;
17
+ rule: z.ZodMiniString<string>;
18
+ }, z.core.$strict>;
19
+ type FormContractViolation = z.infer<typeof contractViolationSchema>;
20
+ declare const formSubmitMetadataSchema: z.ZodMiniObject<{
21
+ form: z.ZodMiniObject<{
22
+ id: z.ZodMiniString<string>;
23
+ action: z.ZodMiniNullable<z.ZodMiniString<string>>;
24
+ fields: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
25
+ name: z.ZodMiniString<string>;
26
+ type: z.ZodMiniString<string>;
27
+ label: z.ZodMiniNullable<z.ZodMiniString<string>>;
28
+ value: z.ZodMiniType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
29
+ role: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
30
+ }, z.core.$strict>>>;
31
+ kind: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
32
+ contract_version: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniInt>>;
33
+ contract_hash: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
34
+ extra: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniObject<{
35
+ key: z.ZodMiniString<string>;
36
+ label: z.ZodMiniString<string>;
37
+ value: z.ZodMiniType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
38
+ }, z.core.$strict>>>>;
39
+ contract_violations: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniObject<{
40
+ role: z.ZodMiniNullable<z.ZodMiniString<string>>;
41
+ rule: z.ZodMiniString<string>;
42
+ }, z.core.$strict>>>>;
43
+ }, z.core.$strict>;
44
+ page: z.ZodMiniObject<{
45
+ path: z.ZodMiniString<string>;
46
+ }, z.core.$strict>;
47
+ }, z.core.$strict>;
48
+ type FormSubmitMetadata = z.infer<typeof formSubmitMetadataSchema>;
49
+ /**
50
+ * Registration config for `form_submit`.
51
+ *
52
+ * This event is manual-only and currently has no registration options. The
53
+ * empty object enables typed `trackEvent('form_submit', ...)` calls.
54
+ */
55
+ declare const formSubmitConfigSchema: z.ZodMiniObject<{}, z.core.$strict>;
56
+ type FormSubmitConfig = z.infer<typeof formSubmitConfigSchema>;
57
+
5
58
  /** Bump-on-change registry version; travels on every contract-typed form_submit. */
6
59
  declare const LEAD_FORM_REGISTRY_VERSION = 2;
7
60
  declare const LEAD_FORM_KINDS: readonly ["booking", "quote", "contact", "consult", "callback"];
@@ -569,4 +622,4 @@ declare function optOut(options?: SetConsentOptions): void;
569
622
  */
570
623
  declare function resetConsent(): void;
571
624
 
572
- export { leadFormPrimitiveSchemas as A, onConsentChange as B, type ConsentChoice as C, DEFAULT_DECLINE_TTL_DAYS as D, optIn as E, optOut as F, type GtagEnvironmentMap as G, parsePhone as H, phoneField as I, resetConsent as J, setConsentState as K, LEAD_FORM_KINDS as L, type MetaPixelEnvironmentMap as M, toE164 as N, type ParsedPhone as P, type SetConsentOptions as S, type TrackingParams as T, type TrackingInstallSurface as a, type TrackingEnvironment as b, type TrackingClientContext as c, type TrackingEventCreatePayload as d, type TrackingSessionUpsertPayload as e, type ConsentChoiceState as f, type ConsentSource as g, type ConsentState as h, DEFAULT_PHONE_COUNTRY as i, LEAD_FORM_PRIMITIVES as j, LEAD_FORM_REGISTRY_VERSION as k, LEAD_FORM_ROLES as l, LEAD_FORM_ROLE_SPECS as m, type LeadFormKind as n, type LeadFormPrimitive as o, type LeadFormRole as p, type LeadFormRoleOption as q, type LeadFormRoleSpec as r, type PhoneConfig as s, type PhoneDisplayFormat as t, type TrackedField as u, type TrackingInitConfig as v, formatPhone as w, formatPhoneAsTyped as x, getConsentChoice as y, getConsentState as z };
625
+ export { getConsentChoice as A, getConsentState as B, type ConsentChoice as C, DEFAULT_DECLINE_TTL_DAYS as D, leadFormPrimitiveSchemas as E, type FormContractViolation as F, type GtagEnvironmentMap as G, onConsentChange as H, optIn as I, type JsonValue as J, optOut as K, LEAD_FORM_KINDS as L, type MetaPixelEnvironmentMap as M, parsePhone as N, phoneField as O, type ParsedPhone as P, resetConsent as Q, setConsentState as R, type SetConsentOptions as S, type TrackingParams as T, toE164 as U, type TrackingInstallSurface as a, type TrackingEnvironment as b, type TrackingClientContext as c, type TrackingEventCreatePayload as d, type TrackingSessionUpsertPayload as e, type ConsentChoiceState as f, type ConsentSource as g, type ConsentState as h, DEFAULT_PHONE_COUNTRY as i, type FormSubmitConfig as j, type FormSubmitMetadata as k, LEAD_FORM_PRIMITIVES as l, LEAD_FORM_REGISTRY_VERSION as m, LEAD_FORM_ROLES as n, LEAD_FORM_ROLE_SPECS as o, type LeadFormKind as p, type LeadFormPrimitive as q, type LeadFormRole as r, type LeadFormRoleOption as s, type LeadFormRoleSpec as t, type PhoneConfig as u, type PhoneDisplayFormat as v, type TrackedField as w, type TrackingInitConfig as x, formatPhone as y, formatPhoneAsTyped as z };