@aranova/tracking-react 1.11.0 → 1.13.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 +5 -3
- package/dist/{bookings-vM_aCNOS.d.ts → bookings-C1HMPjQl.d.ts} +36 -0
- package/dist/{bookings-BnXZGgwr.d.mts → bookings-CHpplXU7.d.mts} +36 -0
- package/dist/client.d.mts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +57 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +57 -4
- 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 +357 -286
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -286
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-TI6KqVzL.d.mts → ingest-typed-Ckt4R731.d.mts} +1 -1
- package/dist/{ingest-typed-BS9agXM5.d.ts → ingest-typed-sCDoPInT.d.ts} +1 -1
- package/dist/{sales-BegN5t_z.d.ts → sales-CNvzyF5T.d.ts} +1 -1
- package/dist/{sales-CSV0H3iG.d.mts → sales-YUH3bQl9.d.mts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +193 -171
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +193 -171
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -362,9 +362,11 @@ await submit({
|
|
|
362
362
|
`[{ group, options }]` in order, so render one heading per group with its choices under it.
|
|
363
363
|
- `useBookingSlots` / `bookableSlots(rules, { timeZone })` offer exactly the portal's start hours,
|
|
364
364
|
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.
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
a retry, and sends the visit's `form_submit` once: don't send your own for this form. It is a
|
|
366
|
+
typed `booking` submit (ADR-0024): every field carries its contract `role`, `service` is the
|
|
367
|
+
option keys, `preferred_date` is `YYYY-MM-DD`, `preferred_time` is
|
|
368
|
+
`{ start: "HH:00", end: null }`, and `drop_off` is `wait-for-it` / `drop-off`. Add the form's own questions with
|
|
369
|
+
`formSubmit.extraFields`; a name the booking already reports (`phone`, `email`, ...) is dropped.
|
|
368
370
|
- Ask for the last name separately, and a mobile number (the shop's confirmation text goes to it).
|
|
369
371
|
- Details after booking (when `booking.rules.vehicleDeferred`, for extra notes, or for the site's
|
|
370
372
|
own "How did you hear about us?" answer):
|
|
@@ -51,6 +51,40 @@ interface ConversionConfig {
|
|
|
51
51
|
interface LeadFormsConfig {
|
|
52
52
|
/** The registry version the object was published under. */
|
|
53
53
|
registry_version: number;
|
|
54
|
+
/** One per form kind a bound consumer needs something from; an absent kind needs nothing. */
|
|
55
|
+
contracts: LeadFormContract[];
|
|
56
|
+
}
|
|
57
|
+
/** What one kind of form must collect for this business, derived server-side. */
|
|
58
|
+
interface LeadFormContract {
|
|
59
|
+
form_kind: string;
|
|
60
|
+
requires: LeadFormRequirement[];
|
|
61
|
+
/** Each group is satisfied by any one of its roles. */
|
|
62
|
+
requires_any: Array<{
|
|
63
|
+
roles: string[];
|
|
64
|
+
waived: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
options: Array<{
|
|
67
|
+
role: string;
|
|
68
|
+
options: LeadFormContractOption[];
|
|
69
|
+
}>;
|
|
70
|
+
/** Echo on `form_submit` as `form.contract_hash`. */
|
|
71
|
+
contract_hash: string;
|
|
72
|
+
}
|
|
73
|
+
interface LeadFormRequirement {
|
|
74
|
+
role: string;
|
|
75
|
+
/** Required only when `role` holds one of `any_of`; never nested. */
|
|
76
|
+
required_when: {
|
|
77
|
+
role: string;
|
|
78
|
+
any_of: string[];
|
|
79
|
+
} | null;
|
|
80
|
+
waived: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface LeadFormContractOption {
|
|
83
|
+
key: string;
|
|
84
|
+
label: string;
|
|
85
|
+
is_non_answer: boolean;
|
|
86
|
+
/** Dropped from the form; still accepted from a cached config. */
|
|
87
|
+
deprecated: boolean;
|
|
54
88
|
}
|
|
55
89
|
/** Bookable start hours on one weekday, shop wall time (8 = 08:00); both empty = closed. */
|
|
56
90
|
interface BookingDayWindows {
|
|
@@ -263,6 +297,8 @@ declare class TrackingConfigRuntime {
|
|
|
263
297
|
* link is safe to show stale. Same reference until the next adopt, for `useSyncExternalStore`.
|
|
264
298
|
*/
|
|
265
299
|
integrations(): ConversionIntegrations | null;
|
|
300
|
+
/** The lead-form contracts, from the cached object like `integrations()`. */
|
|
301
|
+
leadForms(): LeadFormsConfig | null;
|
|
266
302
|
private revalidateNow;
|
|
267
303
|
private expireAuthority;
|
|
268
304
|
private confirm;
|
|
@@ -51,6 +51,40 @@ interface ConversionConfig {
|
|
|
51
51
|
interface LeadFormsConfig {
|
|
52
52
|
/** The registry version the object was published under. */
|
|
53
53
|
registry_version: number;
|
|
54
|
+
/** One per form kind a bound consumer needs something from; an absent kind needs nothing. */
|
|
55
|
+
contracts: LeadFormContract[];
|
|
56
|
+
}
|
|
57
|
+
/** What one kind of form must collect for this business, derived server-side. */
|
|
58
|
+
interface LeadFormContract {
|
|
59
|
+
form_kind: string;
|
|
60
|
+
requires: LeadFormRequirement[];
|
|
61
|
+
/** Each group is satisfied by any one of its roles. */
|
|
62
|
+
requires_any: Array<{
|
|
63
|
+
roles: string[];
|
|
64
|
+
waived: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
options: Array<{
|
|
67
|
+
role: string;
|
|
68
|
+
options: LeadFormContractOption[];
|
|
69
|
+
}>;
|
|
70
|
+
/** Echo on `form_submit` as `form.contract_hash`. */
|
|
71
|
+
contract_hash: string;
|
|
72
|
+
}
|
|
73
|
+
interface LeadFormRequirement {
|
|
74
|
+
role: string;
|
|
75
|
+
/** Required only when `role` holds one of `any_of`; never nested. */
|
|
76
|
+
required_when: {
|
|
77
|
+
role: string;
|
|
78
|
+
any_of: string[];
|
|
79
|
+
} | null;
|
|
80
|
+
waived: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface LeadFormContractOption {
|
|
83
|
+
key: string;
|
|
84
|
+
label: string;
|
|
85
|
+
is_non_answer: boolean;
|
|
86
|
+
/** Dropped from the form; still accepted from a cached config. */
|
|
87
|
+
deprecated: boolean;
|
|
54
88
|
}
|
|
55
89
|
/** Bookable start hours on one weekday, shop wall time (8 = 08:00); both empty = closed. */
|
|
56
90
|
interface BookingDayWindows {
|
|
@@ -263,6 +297,8 @@ declare class TrackingConfigRuntime {
|
|
|
263
297
|
* link is safe to show stale. Same reference until the next adopt, for `useSyncExternalStore`.
|
|
264
298
|
*/
|
|
265
299
|
integrations(): ConversionIntegrations | null;
|
|
300
|
+
/** The lead-form contracts, from the cached object like `integrations()`. */
|
|
301
|
+
leadForms(): LeadFormsConfig | null;
|
|
266
302
|
private revalidateNow;
|
|
267
303
|
private expireAuthority;
|
|
268
304
|
private confirm;
|
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-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-
|
|
5
|
-
import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-
|
|
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-CHpplXU7.mjs';
|
|
5
|
+
import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-Ckt4R731.mjs';
|
|
6
6
|
import { CountryCode } from 'libphonenumber-js';
|
|
7
7
|
import './form-submit-CX-CxJjQ.mjs';
|
|
8
8
|
import 'zod/mini';
|
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-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-
|
|
5
|
-
import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-
|
|
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-C1HMPjQl.js';
|
|
5
|
+
import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-sCDoPInT.js';
|
|
6
6
|
import { CountryCode } from 'libphonenumber-js';
|
|
7
7
|
import './form-submit-CX-CxJjQ.js';
|
|
8
8
|
import 'zod/mini';
|
package/dist/client.js
CHANGED
|
@@ -1133,9 +1133,58 @@ function parseConversionConfig(raw) {
|
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
1135
|
function parseLeadForms(value) {
|
|
1136
|
-
if (!value || typeof value !== "
|
|
1137
|
-
|
|
1138
|
-
|
|
1136
|
+
if (!isRecord(value) || typeof value.registry_version !== "number") return null;
|
|
1137
|
+
return {
|
|
1138
|
+
registry_version: value.registry_version,
|
|
1139
|
+
contracts: records(value.contracts).flatMap(
|
|
1140
|
+
(c) => typeof c.form_kind === "string" && typeof c.contract_hash === "string" ? [
|
|
1141
|
+
{
|
|
1142
|
+
form_kind: c.form_kind,
|
|
1143
|
+
requires: records(c.requires).flatMap(
|
|
1144
|
+
(r) => typeof r.role === "string" ? [
|
|
1145
|
+
{
|
|
1146
|
+
role: r.role,
|
|
1147
|
+
required_when: parseCondition(r.required_when),
|
|
1148
|
+
waived: r.waived === true
|
|
1149
|
+
}
|
|
1150
|
+
] : []
|
|
1151
|
+
),
|
|
1152
|
+
requires_any: records(c.requires_any).map((g) => ({
|
|
1153
|
+
roles: strings(g.roles),
|
|
1154
|
+
waived: g.waived === true
|
|
1155
|
+
})),
|
|
1156
|
+
options: records(c.options).flatMap(
|
|
1157
|
+
(o) => typeof o.role === "string" ? [{ role: o.role, options: records(o.options).flatMap(parseContractOption) }] : []
|
|
1158
|
+
),
|
|
1159
|
+
contract_hash: c.contract_hash
|
|
1160
|
+
}
|
|
1161
|
+
] : []
|
|
1162
|
+
)
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
function parseCondition(value) {
|
|
1166
|
+
if (!isRecord(value) || typeof value.role !== "string") return null;
|
|
1167
|
+
return { role: value.role, any_of: strings(value.any_of) };
|
|
1168
|
+
}
|
|
1169
|
+
function parseContractOption(value) {
|
|
1170
|
+
if (typeof value.key !== "string" || typeof value.label !== "string") return [];
|
|
1171
|
+
return [
|
|
1172
|
+
{
|
|
1173
|
+
key: value.key,
|
|
1174
|
+
label: value.label,
|
|
1175
|
+
is_non_answer: value.is_non_answer === true,
|
|
1176
|
+
deprecated: value.deprecated === true
|
|
1177
|
+
}
|
|
1178
|
+
];
|
|
1179
|
+
}
|
|
1180
|
+
function isRecord(value) {
|
|
1181
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
1182
|
+
}
|
|
1183
|
+
function records(value) {
|
|
1184
|
+
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
1185
|
+
}
|
|
1186
|
+
function strings(value) {
|
|
1187
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
1139
1188
|
}
|
|
1140
1189
|
var CACHE_PREFIX = "_aranova_cfg_";
|
|
1141
1190
|
function cacheKey(url) {
|
|
@@ -1565,6 +1614,10 @@ var TrackingConfigRuntime = class {
|
|
|
1565
1614
|
integrations() {
|
|
1566
1615
|
return this.current?.integrations ?? null;
|
|
1567
1616
|
}
|
|
1617
|
+
/** The lead-form contracts, from the cached object like `integrations()`. */
|
|
1618
|
+
leadForms() {
|
|
1619
|
+
return this.current?.lead_forms ?? null;
|
|
1620
|
+
}
|
|
1568
1621
|
async revalidateNow() {
|
|
1569
1622
|
try {
|
|
1570
1623
|
const headers = {};
|
|
@@ -4031,7 +4084,7 @@ function GoogleAdsTracking(props) {
|
|
|
4031
4084
|
var import_react6 = require("react");
|
|
4032
4085
|
|
|
4033
4086
|
// package.json
|
|
4034
|
-
var version = "1.
|
|
4087
|
+
var version = "1.13.0";
|
|
4035
4088
|
|
|
4036
4089
|
// ../tracking-core/src/phone-react.tsx
|
|
4037
4090
|
var import_react5 = require("react");
|