@aranova/tracking-react 1.9.0 → 1.11.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 +7 -3
- package/dist/{bookings-DtcwdM_I.d.mts → bookings-BnXZGgwr.d.mts} +16 -3
- package/dist/{bookings-Bx7totlS.d.ts → bookings-vM_aCNOS.d.ts} +16 -3
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +25 -3
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +25 -3
- package/dist/client.mjs.map +1 -1
- package/dist/{form-submit-BLb28aCk.d.mts → form-submit-CX-CxJjQ.d.mts} +9 -37
- package/dist/{form-submit-BLb28aCk.d.ts → form-submit-CX-CxJjQ.d.ts} +9 -37
- package/dist/index.d.mts +179 -8
- package/dist/index.d.ts +179 -8
- package/dist/index.js +133 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-B-BgEZdW.d.ts → ingest-typed-BS9agXM5.d.ts} +12 -3
- package/dist/{ingest-typed-C2OvZ7dp.d.mts → ingest-typed-TI6KqVzL.d.mts} +12 -3
- package/dist/{phone-utils-CM8eUPz8.d.mts → phone-utils-BNiSqeF7.d.mts} +1 -1
- package/dist/{phone-utils-l8ey3Zdm.d.ts → phone-utils-D12FW8tT.d.ts} +1 -1
- package/dist/phone.d.mts +2 -2
- package/dist/phone.d.ts +2 -2
- package/dist/{sales-DJJpMY_c.d.ts → sales-BegN5t_z.d.ts} +1 -1
- package/dist/{sales-Dil7TNV_.d.mts → sales-CSV0H3iG.d.mts} +1 -1
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- package/dist/sales.js +2 -1
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +2 -1
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38,6 +38,11 @@ __export(src_exports, {
|
|
|
38
38
|
DEFAULT_PHONE_COUNTRY: () => DEFAULT_PHONE_COUNTRY,
|
|
39
39
|
EVENT_SEMANTICS: () => EVENT_SEMANTICS,
|
|
40
40
|
GoogleAdsTracking: () => import_client.GoogleAdsTracking,
|
|
41
|
+
LEAD_FORM_KINDS: () => LEAD_FORM_KINDS,
|
|
42
|
+
LEAD_FORM_PRIMITIVES: () => LEAD_FORM_PRIMITIVES,
|
|
43
|
+
LEAD_FORM_REGISTRY_VERSION: () => LEAD_FORM_REGISTRY_VERSION,
|
|
44
|
+
LEAD_FORM_ROLES: () => LEAD_FORM_ROLES,
|
|
45
|
+
LEAD_FORM_ROLE_SPECS: () => LEAD_FORM_ROLE_SPECS,
|
|
41
46
|
NAMED_RANGES: () => NAMED_RANGES,
|
|
42
47
|
PhoneField: () => import_client2.PhoneField,
|
|
43
48
|
SALE_SOURCES: () => SALE_SOURCES,
|
|
@@ -66,6 +71,7 @@ __export(src_exports, {
|
|
|
66
71
|
getEventSemantics: () => getEventSemantics,
|
|
67
72
|
getTrackingConfigRuntime: () => getTrackingConfigRuntime,
|
|
68
73
|
groupBookingOptions: () => groupBookingOptions,
|
|
74
|
+
leadFormPrimitiveSchemas: () => leadFormPrimitiveSchemas,
|
|
69
75
|
newBookingAttemptKey: () => newBookingAttemptKey,
|
|
70
76
|
onConsentChange: () => onConsentChange,
|
|
71
77
|
optIn: () => optIn,
|
|
@@ -904,9 +910,15 @@ function parseConversionConfig(raw) {
|
|
|
904
910
|
services,
|
|
905
911
|
goals,
|
|
906
912
|
linked_hostnames: Array.isArray(obj.linked_hostnames) ? obj.linked_hostnames.filter((h) => typeof h === "string" && h.length > 0) : [],
|
|
907
|
-
integrations: parseIntegrations(obj.integrations)
|
|
913
|
+
integrations: parseIntegrations(obj.integrations),
|
|
914
|
+
lead_forms: parseLeadForms(obj.lead_forms)
|
|
908
915
|
};
|
|
909
916
|
}
|
|
917
|
+
function parseLeadForms(value) {
|
|
918
|
+
if (!value || typeof value !== "object") return null;
|
|
919
|
+
const version = value.registry_version;
|
|
920
|
+
return typeof version === "number" ? { registry_version: version } : null;
|
|
921
|
+
}
|
|
910
922
|
var CACHE_PREFIX = "_aranova_cfg_";
|
|
911
923
|
function cacheKey(url) {
|
|
912
924
|
return `${CACHE_PREFIX}${url}`;
|
|
@@ -2006,7 +2018,8 @@ function createSalesBookingsClient(config, firing) {
|
|
|
2006
2018
|
const body = {
|
|
2007
2019
|
idempotency_key: attemptKey,
|
|
2008
2020
|
vehicle: details.vehicle ?? null,
|
|
2009
|
-
notes: details.notes?.trim() || null
|
|
2021
|
+
notes: details.notes?.trim() || null,
|
|
2022
|
+
heard_via: details.heardVia?.trim() || null
|
|
2010
2023
|
};
|
|
2011
2024
|
try {
|
|
2012
2025
|
const response = await salesRequest(
|
|
@@ -2538,6 +2551,118 @@ function phoneField(name, raw, country) {
|
|
|
2538
2551
|
return { name, type: "phone", value: toE164(raw, country) };
|
|
2539
2552
|
}
|
|
2540
2553
|
|
|
2554
|
+
// ../tracking-core/src/lead-forms/lead-forms.gen.ts
|
|
2555
|
+
var z4 = __toESM(require("zod/mini"));
|
|
2556
|
+
var LEAD_FORM_REGISTRY_VERSION = 1;
|
|
2557
|
+
var LEAD_FORM_KINDS = ["booking", "quote", "contact", "consult", "callback"];
|
|
2558
|
+
var LEAD_FORM_ROLES = [
|
|
2559
|
+
"given_name",
|
|
2560
|
+
"family_name",
|
|
2561
|
+
"phone",
|
|
2562
|
+
"email",
|
|
2563
|
+
"service",
|
|
2564
|
+
"preferred_date",
|
|
2565
|
+
"preferred_time",
|
|
2566
|
+
"note",
|
|
2567
|
+
"visit",
|
|
2568
|
+
"intent",
|
|
2569
|
+
"vehicle",
|
|
2570
|
+
"drop_off",
|
|
2571
|
+
"address",
|
|
2572
|
+
"patient_type",
|
|
2573
|
+
"matter",
|
|
2574
|
+
"language",
|
|
2575
|
+
"products",
|
|
2576
|
+
"goal",
|
|
2577
|
+
"business_type",
|
|
2578
|
+
"lead_volume",
|
|
2579
|
+
"attribution"
|
|
2580
|
+
];
|
|
2581
|
+
var LEAD_FORM_PRIMITIVES = [
|
|
2582
|
+
"string",
|
|
2583
|
+
"text",
|
|
2584
|
+
"enum",
|
|
2585
|
+
"multi_enum",
|
|
2586
|
+
"bool",
|
|
2587
|
+
"date",
|
|
2588
|
+
"time_window",
|
|
2589
|
+
"phone",
|
|
2590
|
+
"email",
|
|
2591
|
+
"address",
|
|
2592
|
+
"number"
|
|
2593
|
+
];
|
|
2594
|
+
var leadFormPrimitiveSchemas = {
|
|
2595
|
+
string: z4.string().check(z4.maxLength(120)),
|
|
2596
|
+
text: z4.string().check(z4.maxLength(2e3)),
|
|
2597
|
+
enum: z4.string().check(z4.regex(/^[a-z0-9-]{1,48}$/)),
|
|
2598
|
+
multi_enum: z4.array(z4.string().check(z4.regex(/^[a-z0-9-]{1,48}$/))).check(z4.maxLength(10)),
|
|
2599
|
+
bool: z4.boolean(),
|
|
2600
|
+
date: z4.string().check(z4.regex(/^\d{4}-\d{2}-\d{2}$/)),
|
|
2601
|
+
time_window: z4.strictObject({
|
|
2602
|
+
start: z4.string().check(z4.regex(/^([01]\d|2[0-3]):[0-5]\d$/)),
|
|
2603
|
+
end: z4.nullable(z4.string().check(z4.regex(/^([01]\d|2[0-3]):[0-5]\d$/))),
|
|
2604
|
+
label: z4.optional(z4.string().check(z4.maxLength(60)))
|
|
2605
|
+
}),
|
|
2606
|
+
phone: z4.string().check(z4.regex(/^\+[1-9]\d{6,14}$/)),
|
|
2607
|
+
email: z4.string().check(z4.maxLength(320), z4.regex(/^[^\s@]+@[^\s@]+$/)),
|
|
2608
|
+
address: z4.strictObject({
|
|
2609
|
+
line1: z4.string().check(z4.maxLength(120)),
|
|
2610
|
+
line2: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2611
|
+
city: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2612
|
+
region: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2613
|
+
postal_code: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2614
|
+
country: z4.optional(z4.string().check(z4.maxLength(120)))
|
|
2615
|
+
}),
|
|
2616
|
+
number: z4.number()
|
|
2617
|
+
};
|
|
2618
|
+
var LEAD_FORM_ROLE_SPECS = {
|
|
2619
|
+
given_name: { primitive: "string", smsLabel: "", contactIdentity: true },
|
|
2620
|
+
family_name: { primitive: "string", smsLabel: "", contactIdentity: true },
|
|
2621
|
+
phone: { primitive: "phone", smsLabel: "", contactIdentity: true },
|
|
2622
|
+
email: { primitive: "email", smsLabel: "", contactIdentity: true },
|
|
2623
|
+
service: { primitive: "enum", smsLabel: "Service" },
|
|
2624
|
+
preferred_date: { primitive: "date", smsLabel: "Date" },
|
|
2625
|
+
preferred_time: { primitive: "time_window", smsLabel: "Time" },
|
|
2626
|
+
note: { primitive: "text", smsLabel: "Note" },
|
|
2627
|
+
visit: {
|
|
2628
|
+
primitive: "enum",
|
|
2629
|
+
smsLabel: "Visit",
|
|
2630
|
+
options: [
|
|
2631
|
+
{ key: "in-shop", label: "In shop" },
|
|
2632
|
+
{ key: "in-home", label: "In home" },
|
|
2633
|
+
{ key: "remote", label: "Remote" },
|
|
2634
|
+
{ key: "on-site", label: "On site" }
|
|
2635
|
+
]
|
|
2636
|
+
},
|
|
2637
|
+
intent: {
|
|
2638
|
+
primitive: "enum",
|
|
2639
|
+
smsLabel: "Wants",
|
|
2640
|
+
options: [
|
|
2641
|
+
{ key: "book", label: "Book" },
|
|
2642
|
+
{ key: "quote", label: "Quote" }
|
|
2643
|
+
]
|
|
2644
|
+
},
|
|
2645
|
+
vehicle: { primitive: "string", smsLabel: "Vehicle" },
|
|
2646
|
+
drop_off: {
|
|
2647
|
+
primitive: "enum",
|
|
2648
|
+
smsLabel: "Drop-off",
|
|
2649
|
+
options: [
|
|
2650
|
+
{ key: "wait-for-it", label: "Waiting" },
|
|
2651
|
+
{ key: "drop-off", label: "Dropping off" }
|
|
2652
|
+
]
|
|
2653
|
+
},
|
|
2654
|
+
address: { primitive: "address", smsLabel: "Address" },
|
|
2655
|
+
patient_type: { primitive: "enum", smsLabel: "Patient" },
|
|
2656
|
+
matter: { primitive: "enum", smsLabel: "Matter" },
|
|
2657
|
+
language: { primitive: "enum", smsLabel: "Language" },
|
|
2658
|
+
products: { primitive: "multi_enum", smsLabel: "Products" },
|
|
2659
|
+
goal: { primitive: "enum", smsLabel: "Goal" },
|
|
2660
|
+
business_type: { primitive: "enum", smsLabel: "Business" },
|
|
2661
|
+
lead_volume: { primitive: "enum", smsLabel: "Lead volume" },
|
|
2662
|
+
add_on: { primitive: "bool", smsLabel: "" },
|
|
2663
|
+
attribution: { primitive: "enum", smsLabel: "", uninteresting: true }
|
|
2664
|
+
};
|
|
2665
|
+
|
|
2541
2666
|
// src/index.ts
|
|
2542
2667
|
var import_client2 = require("@aranova/tracking-react/client");
|
|
2543
2668
|
var import_client3 = require("@aranova/tracking-react/client");
|
|
@@ -2551,6 +2676,11 @@ var import_client3 = require("@aranova/tracking-react/client");
|
|
|
2551
2676
|
DEFAULT_PHONE_COUNTRY,
|
|
2552
2677
|
EVENT_SEMANTICS,
|
|
2553
2678
|
GoogleAdsTracking,
|
|
2679
|
+
LEAD_FORM_KINDS,
|
|
2680
|
+
LEAD_FORM_PRIMITIVES,
|
|
2681
|
+
LEAD_FORM_REGISTRY_VERSION,
|
|
2682
|
+
LEAD_FORM_ROLES,
|
|
2683
|
+
LEAD_FORM_ROLE_SPECS,
|
|
2554
2684
|
NAMED_RANGES,
|
|
2555
2685
|
PhoneField,
|
|
2556
2686
|
SALE_SOURCES,
|
|
@@ -2579,6 +2709,7 @@ var import_client3 = require("@aranova/tracking-react/client");
|
|
|
2579
2709
|
getEventSemantics,
|
|
2580
2710
|
getTrackingConfigRuntime,
|
|
2581
2711
|
groupBookingOptions,
|
|
2712
|
+
leadFormPrimitiveSchemas,
|
|
2582
2713
|
newBookingAttemptKey,
|
|
2583
2714
|
onConsentChange,
|
|
2584
2715
|
optIn,
|