@aranova/tracking-react 1.10.0 → 1.12.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/dist/{bookings-CUes6H05.d.mts → bookings-Lmi0o_PA.d.mts} +41 -1
- package/dist/{bookings-D5TT6D8w.d.ts → bookings-v_ucn93l.d.ts} +41 -1
- package/dist/client.d.mts +4 -4
- package/dist/client.d.ts +4 -4
- package/dist/client.js +74 -3
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +74 -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 +180 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-CNeWyI0U.d.ts → ingest-typed-B9I1c7jr.d.ts} +12 -3
- package/dist/{ingest-typed-CfjE2F18.d.mts → ingest-typed-PKFEuJ8E.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-CY6gbYud.d.mts → sales-6vMEcopj.d.mts} +1 -1
- package/dist/{sales-5AdaCCUc.d.ts → sales-DXLGjJQ6.d.ts} +1 -1
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- 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,64 @@ 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 (!isRecord(value) || typeof value.registry_version !== "number") return null;
|
|
919
|
+
return {
|
|
920
|
+
registry_version: value.registry_version,
|
|
921
|
+
contracts: records(value.contracts).flatMap(
|
|
922
|
+
(c) => typeof c.form_kind === "string" && typeof c.contract_hash === "string" ? [
|
|
923
|
+
{
|
|
924
|
+
form_kind: c.form_kind,
|
|
925
|
+
requires: records(c.requires).flatMap(
|
|
926
|
+
(r) => typeof r.role === "string" ? [
|
|
927
|
+
{
|
|
928
|
+
role: r.role,
|
|
929
|
+
required_when: parseCondition(r.required_when),
|
|
930
|
+
waived: r.waived === true
|
|
931
|
+
}
|
|
932
|
+
] : []
|
|
933
|
+
),
|
|
934
|
+
requires_any: records(c.requires_any).map((g) => ({
|
|
935
|
+
roles: strings(g.roles),
|
|
936
|
+
waived: g.waived === true
|
|
937
|
+
})),
|
|
938
|
+
options: records(c.options).flatMap(
|
|
939
|
+
(o) => typeof o.role === "string" ? [{ role: o.role, options: records(o.options).flatMap(parseContractOption) }] : []
|
|
940
|
+
),
|
|
941
|
+
contract_hash: c.contract_hash
|
|
942
|
+
}
|
|
943
|
+
] : []
|
|
944
|
+
)
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
function parseCondition(value) {
|
|
948
|
+
if (!isRecord(value) || typeof value.role !== "string") return null;
|
|
949
|
+
return { role: value.role, any_of: strings(value.any_of) };
|
|
950
|
+
}
|
|
951
|
+
function parseContractOption(value) {
|
|
952
|
+
if (typeof value.key !== "string" || typeof value.label !== "string") return [];
|
|
953
|
+
return [
|
|
954
|
+
{
|
|
955
|
+
key: value.key,
|
|
956
|
+
label: value.label,
|
|
957
|
+
is_non_answer: value.is_non_answer === true,
|
|
958
|
+
deprecated: value.deprecated === true
|
|
959
|
+
}
|
|
960
|
+
];
|
|
961
|
+
}
|
|
962
|
+
function isRecord(value) {
|
|
963
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
964
|
+
}
|
|
965
|
+
function records(value) {
|
|
966
|
+
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
967
|
+
}
|
|
968
|
+
function strings(value) {
|
|
969
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
970
|
+
}
|
|
910
971
|
var CACHE_PREFIX = "_aranova_cfg_";
|
|
911
972
|
function cacheKey(url) {
|
|
912
973
|
return `${CACHE_PREFIX}${url}`;
|
|
@@ -2539,6 +2600,118 @@ function phoneField(name, raw, country) {
|
|
|
2539
2600
|
return { name, type: "phone", value: toE164(raw, country) };
|
|
2540
2601
|
}
|
|
2541
2602
|
|
|
2603
|
+
// ../tracking-core/src/lead-forms/lead-forms.gen.ts
|
|
2604
|
+
var z4 = __toESM(require("zod/mini"));
|
|
2605
|
+
var LEAD_FORM_REGISTRY_VERSION = 1;
|
|
2606
|
+
var LEAD_FORM_KINDS = ["booking", "quote", "contact", "consult", "callback"];
|
|
2607
|
+
var LEAD_FORM_ROLES = [
|
|
2608
|
+
"given_name",
|
|
2609
|
+
"family_name",
|
|
2610
|
+
"phone",
|
|
2611
|
+
"email",
|
|
2612
|
+
"service",
|
|
2613
|
+
"preferred_date",
|
|
2614
|
+
"preferred_time",
|
|
2615
|
+
"note",
|
|
2616
|
+
"visit",
|
|
2617
|
+
"intent",
|
|
2618
|
+
"vehicle",
|
|
2619
|
+
"drop_off",
|
|
2620
|
+
"address",
|
|
2621
|
+
"patient_type",
|
|
2622
|
+
"matter",
|
|
2623
|
+
"language",
|
|
2624
|
+
"products",
|
|
2625
|
+
"goal",
|
|
2626
|
+
"business_type",
|
|
2627
|
+
"lead_volume",
|
|
2628
|
+
"attribution"
|
|
2629
|
+
];
|
|
2630
|
+
var LEAD_FORM_PRIMITIVES = [
|
|
2631
|
+
"string",
|
|
2632
|
+
"text",
|
|
2633
|
+
"enum",
|
|
2634
|
+
"multi_enum",
|
|
2635
|
+
"bool",
|
|
2636
|
+
"date",
|
|
2637
|
+
"time_window",
|
|
2638
|
+
"phone",
|
|
2639
|
+
"email",
|
|
2640
|
+
"address",
|
|
2641
|
+
"number"
|
|
2642
|
+
];
|
|
2643
|
+
var leadFormPrimitiveSchemas = {
|
|
2644
|
+
string: z4.string().check(z4.maxLength(120)),
|
|
2645
|
+
text: z4.string().check(z4.maxLength(2e3)),
|
|
2646
|
+
enum: z4.string().check(z4.regex(/^[a-z0-9-]{1,48}$/)),
|
|
2647
|
+
multi_enum: z4.array(z4.string().check(z4.regex(/^[a-z0-9-]{1,48}$/))).check(z4.maxLength(10)),
|
|
2648
|
+
bool: z4.boolean(),
|
|
2649
|
+
date: z4.string().check(z4.regex(/^\d{4}-\d{2}-\d{2}$/)),
|
|
2650
|
+
time_window: z4.strictObject({
|
|
2651
|
+
start: z4.string().check(z4.regex(/^([01]\d|2[0-3]):[0-5]\d$/)),
|
|
2652
|
+
end: z4.nullable(z4.string().check(z4.regex(/^([01]\d|2[0-3]):[0-5]\d$/))),
|
|
2653
|
+
label: z4.optional(z4.string().check(z4.maxLength(60)))
|
|
2654
|
+
}),
|
|
2655
|
+
phone: z4.string().check(z4.regex(/^\+[1-9]\d{6,14}$/)),
|
|
2656
|
+
email: z4.string().check(z4.maxLength(320), z4.regex(/^[^\s@]+@[^\s@]+$/)),
|
|
2657
|
+
address: z4.strictObject({
|
|
2658
|
+
line1: z4.string().check(z4.maxLength(120)),
|
|
2659
|
+
line2: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2660
|
+
city: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2661
|
+
region: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2662
|
+
postal_code: z4.optional(z4.string().check(z4.maxLength(120))),
|
|
2663
|
+
country: z4.optional(z4.string().check(z4.maxLength(120)))
|
|
2664
|
+
}),
|
|
2665
|
+
number: z4.number()
|
|
2666
|
+
};
|
|
2667
|
+
var LEAD_FORM_ROLE_SPECS = {
|
|
2668
|
+
given_name: { primitive: "string", smsLabel: "", contactIdentity: true },
|
|
2669
|
+
family_name: { primitive: "string", smsLabel: "", contactIdentity: true },
|
|
2670
|
+
phone: { primitive: "phone", smsLabel: "", contactIdentity: true },
|
|
2671
|
+
email: { primitive: "email", smsLabel: "", contactIdentity: true },
|
|
2672
|
+
service: { primitive: "enum", smsLabel: "Service" },
|
|
2673
|
+
preferred_date: { primitive: "date", smsLabel: "Date" },
|
|
2674
|
+
preferred_time: { primitive: "time_window", smsLabel: "Time" },
|
|
2675
|
+
note: { primitive: "text", smsLabel: "Note" },
|
|
2676
|
+
visit: {
|
|
2677
|
+
primitive: "enum",
|
|
2678
|
+
smsLabel: "Visit",
|
|
2679
|
+
options: [
|
|
2680
|
+
{ key: "in-shop", label: "In shop" },
|
|
2681
|
+
{ key: "in-home", label: "In home" },
|
|
2682
|
+
{ key: "remote", label: "Remote" },
|
|
2683
|
+
{ key: "on-site", label: "On site" }
|
|
2684
|
+
]
|
|
2685
|
+
},
|
|
2686
|
+
intent: {
|
|
2687
|
+
primitive: "enum",
|
|
2688
|
+
smsLabel: "Wants",
|
|
2689
|
+
options: [
|
|
2690
|
+
{ key: "book", label: "Book" },
|
|
2691
|
+
{ key: "quote", label: "Quote" }
|
|
2692
|
+
]
|
|
2693
|
+
},
|
|
2694
|
+
vehicle: { primitive: "string", smsLabel: "Vehicle" },
|
|
2695
|
+
drop_off: {
|
|
2696
|
+
primitive: "enum",
|
|
2697
|
+
smsLabel: "Drop-off",
|
|
2698
|
+
options: [
|
|
2699
|
+
{ key: "wait-for-it", label: "Waiting" },
|
|
2700
|
+
{ key: "drop-off", label: "Dropping off" }
|
|
2701
|
+
]
|
|
2702
|
+
},
|
|
2703
|
+
address: { primitive: "address", smsLabel: "Address" },
|
|
2704
|
+
patient_type: { primitive: "enum", smsLabel: "Patient" },
|
|
2705
|
+
matter: { primitive: "enum", smsLabel: "Matter" },
|
|
2706
|
+
language: { primitive: "enum", smsLabel: "Language" },
|
|
2707
|
+
products: { primitive: "multi_enum", smsLabel: "Products" },
|
|
2708
|
+
goal: { primitive: "enum", smsLabel: "Goal" },
|
|
2709
|
+
business_type: { primitive: "enum", smsLabel: "Business" },
|
|
2710
|
+
lead_volume: { primitive: "enum", smsLabel: "Lead volume" },
|
|
2711
|
+
add_on: { primitive: "bool", smsLabel: "" },
|
|
2712
|
+
attribution: { primitive: "enum", smsLabel: "", uninteresting: true }
|
|
2713
|
+
};
|
|
2714
|
+
|
|
2542
2715
|
// src/index.ts
|
|
2543
2716
|
var import_client2 = require("@aranova/tracking-react/client");
|
|
2544
2717
|
var import_client3 = require("@aranova/tracking-react/client");
|
|
@@ -2552,6 +2725,11 @@ var import_client3 = require("@aranova/tracking-react/client");
|
|
|
2552
2725
|
DEFAULT_PHONE_COUNTRY,
|
|
2553
2726
|
EVENT_SEMANTICS,
|
|
2554
2727
|
GoogleAdsTracking,
|
|
2728
|
+
LEAD_FORM_KINDS,
|
|
2729
|
+
LEAD_FORM_PRIMITIVES,
|
|
2730
|
+
LEAD_FORM_REGISTRY_VERSION,
|
|
2731
|
+
LEAD_FORM_ROLES,
|
|
2732
|
+
LEAD_FORM_ROLE_SPECS,
|
|
2555
2733
|
NAMED_RANGES,
|
|
2556
2734
|
PhoneField,
|
|
2557
2735
|
SALE_SOURCES,
|
|
@@ -2580,6 +2758,7 @@ var import_client3 = require("@aranova/tracking-react/client");
|
|
|
2580
2758
|
getEventSemantics,
|
|
2581
2759
|
getTrackingConfigRuntime,
|
|
2582
2760
|
groupBookingOptions,
|
|
2761
|
+
leadFormPrimitiveSchemas,
|
|
2583
2762
|
newBookingAttemptKey,
|
|
2584
2763
|
onConsentChange,
|
|
2585
2764
|
optIn,
|