@aranova/tracking-react 1.17.0 → 1.19.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-BDLyF70h.d.ts} +61 -5
- package/dist/{bookings-DOh1WMhH.d.mts → bookings-v3HA8gsC.d.mts} +61 -5
- package/dist/client.d.mts +122 -5
- package/dist/client.d.ts +122 -5
- package/dist/client.js +1917 -193
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +1919 -193
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +17 -41
- package/dist/index.d.ts +17 -41
- package/dist/index.js +220 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +218 -39
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-D7I4aQ7p.d.ts → ingest-typed-BEFQd3WM.d.mts} +290 -2
- package/dist/{ingest-typed-BO6Arbw-.d.mts → ingest-typed-DChvvgwd.d.ts} +290 -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-B1u_IHLZ.d.mts → sales-Cu8M8I8k.d.ts} +1 -1
- package/dist/{sales-I2jXSS-l.d.ts → sales-DriCnCbM.d.mts} +1 -1
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- package/dist/sales.js +150 -38
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +150 -38
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
ConsentBanner: () => import_client.ConsentBanner,
|
|
37
37
|
DEFAULT_DECLINE_TTL_DAYS: () => DEFAULT_DECLINE_TTL_DAYS,
|
|
38
38
|
DEFAULT_PHONE_COUNTRY: () => DEFAULT_PHONE_COUNTRY,
|
|
39
|
+
DEFAULT_VIDEO_CHECKPOINTS: () => import_client5.DEFAULT_VIDEO_CHECKPOINTS,
|
|
39
40
|
EVENT_SEMANTICS: () => EVENT_SEMANTICS,
|
|
40
41
|
GoogleAdsTracking: () => import_client.GoogleAdsTracking,
|
|
41
42
|
LEAD_FORM_KINDS: () => LEAD_FORM_KINDS,
|
|
@@ -49,6 +50,8 @@ __export(src_exports, {
|
|
|
49
50
|
SUPPORTED_CURRENCIES: () => SUPPORTED_CURRENCIES,
|
|
50
51
|
TRACKING_PARAM_KEYS: () => TRACKING_PARAM_KEYS,
|
|
51
52
|
TRACKING_RANGES: () => TRACKING_RANGES,
|
|
53
|
+
TrackedVideo: () => import_client5.TrackedVideo,
|
|
54
|
+
TrackedVideoStage: () => import_client5.TrackedVideoStage,
|
|
52
55
|
bookableSlots: () => bookableSlots,
|
|
53
56
|
buildBookingHandoffUrl: () => buildBookingHandoffUrl,
|
|
54
57
|
captureTrackingParamsFromLocation: () => captureTrackingParamsFromLocation,
|
|
@@ -73,6 +76,7 @@ __export(src_exports, {
|
|
|
73
76
|
getTrackingConfigRuntime: () => getTrackingConfigRuntime,
|
|
74
77
|
groupBookingOptions: () => groupBookingOptions,
|
|
75
78
|
leadFormPrimitiveSchemas: () => leadFormPrimitiveSchemas,
|
|
79
|
+
mergeVideoRanges: () => mergeVideoRanges,
|
|
76
80
|
newBookingAttemptKey: () => newBookingAttemptKey,
|
|
77
81
|
onConsentChange: () => onConsentChange,
|
|
78
82
|
optIn: () => optIn,
|
|
@@ -82,6 +86,7 @@ __export(src_exports, {
|
|
|
82
86
|
resetConsent: () => resetConsent,
|
|
83
87
|
resolveConversionConfig: () => resolveConversionConfig,
|
|
84
88
|
resolveTrackingConfigUrl: () => resolveTrackingConfigUrl,
|
|
89
|
+
roundVideoSeconds: () => roundVideoSeconds,
|
|
85
90
|
saleCreateSchema: () => saleCreateSchema,
|
|
86
91
|
saleItemSchema: () => saleItemSchema,
|
|
87
92
|
saleServiceSchema: () => saleServiceSchema,
|
|
@@ -91,6 +96,9 @@ __export(src_exports, {
|
|
|
91
96
|
shopToday: () => shopToday,
|
|
92
97
|
slotFields: () => slotFields,
|
|
93
98
|
stashUserData: () => stashUserData,
|
|
99
|
+
streamManifestUrl: () => import_client5.streamManifestUrl,
|
|
100
|
+
streamPosterUrl: () => import_client5.streamPosterUrl,
|
|
101
|
+
sumVideoRangesSeconds: () => sumVideoRangesSeconds,
|
|
94
102
|
timeWindow: () => timeWindow,
|
|
95
103
|
toE164: () => toE164,
|
|
96
104
|
toMinor: () => toMinor,
|
|
@@ -104,6 +112,7 @@ __export(src_exports, {
|
|
|
104
112
|
useGclid: () => import_client.useGclid,
|
|
105
113
|
usePhoneConfig: () => import_client2.usePhoneConfig,
|
|
106
114
|
usePhoneField: () => import_client2.usePhoneField,
|
|
115
|
+
useTrackedVideoConfig: () => import_client5.useTrackedVideoConfig,
|
|
107
116
|
useTrackingParams: () => import_client.useTrackingParams
|
|
108
117
|
});
|
|
109
118
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -331,7 +340,8 @@ var TRACKING_CAPABILITIES = [
|
|
|
331
340
|
"form_capture",
|
|
332
341
|
"phone_click_capture",
|
|
333
342
|
"phone_fields",
|
|
334
|
-
"typed_form_submit"
|
|
343
|
+
"typed_form_submit",
|
|
344
|
+
"video_tracking"
|
|
335
345
|
];
|
|
336
346
|
var CAPABILITY_DOM_ATTRIBUTE = "data-aranova-capability";
|
|
337
347
|
var registered = /* @__PURE__ */ new Set();
|
|
@@ -872,8 +882,48 @@ function parseTrigger(value) {
|
|
|
872
882
|
if (typeof t.threshold_seconds === "number") spec.threshold_seconds = t.threshold_seconds;
|
|
873
883
|
if (typeof t.page_threshold === "number") spec.page_threshold = t.page_threshold;
|
|
874
884
|
if (typeof t.page_name === "string") spec.page_name = t.page_name;
|
|
885
|
+
if (t.metric === "percent" || t.metric === "seconds") spec.metric = t.metric;
|
|
886
|
+
if (typeof t.threshold === "number") spec.threshold = t.threshold;
|
|
887
|
+
if (typeof t.video_id === "string" || t.video_id === null) spec.video_id = t.video_id;
|
|
875
888
|
return spec;
|
|
876
889
|
}
|
|
890
|
+
function parseVideoEntry(fallbackKey2, entry) {
|
|
891
|
+
const key = typeof entry.key === "string" && entry.key ? entry.key : fallbackKey2;
|
|
892
|
+
if (!key) return null;
|
|
893
|
+
const host = typeof entry.host === "string" ? entry.host : "";
|
|
894
|
+
const title = typeof entry.title === "string" && entry.title ? entry.title : key;
|
|
895
|
+
const sourcesRaw = isRecord(entry.sources) ? entry.sources : null;
|
|
896
|
+
const desktop = sourcesRaw && typeof sourcesRaw.desktop === "string" ? sourcesRaw.desktop : typeof entry.desktop_uid === "string" ? entry.desktop_uid : "";
|
|
897
|
+
if (!host || !desktop) return null;
|
|
898
|
+
const mobile = sourcesRaw && typeof sourcesRaw.mobile === "string" ? sourcesRaw.mobile : typeof entry.mobile_uid === "string" ? entry.mobile_uid : null;
|
|
899
|
+
const posterTime = typeof entry.poster_time === "number" ? entry.poster_time : typeof entry.poster_time_s === "number" ? entry.poster_time_s : 4;
|
|
900
|
+
return {
|
|
901
|
+
key,
|
|
902
|
+
title,
|
|
903
|
+
host,
|
|
904
|
+
sources: { desktop, mobile },
|
|
905
|
+
poster_time: posterTime,
|
|
906
|
+
duration_s: typeof entry.duration_s === "number" ? entry.duration_s : null
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
function parseVideos(value) {
|
|
910
|
+
const out = {};
|
|
911
|
+
if (Array.isArray(value)) {
|
|
912
|
+
for (const item of value) {
|
|
913
|
+
if (!isRecord(item)) continue;
|
|
914
|
+
const parsed = parseVideoEntry("", item);
|
|
915
|
+
if (parsed) out[parsed.key] = parsed;
|
|
916
|
+
}
|
|
917
|
+
return out;
|
|
918
|
+
}
|
|
919
|
+
if (!isRecord(value)) return out;
|
|
920
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
921
|
+
if (!isRecord(entry)) continue;
|
|
922
|
+
const parsed = parseVideoEntry(key, entry);
|
|
923
|
+
if (parsed) out[parsed.key] = parsed;
|
|
924
|
+
}
|
|
925
|
+
return out;
|
|
926
|
+
}
|
|
877
927
|
function parseConversionConfig(raw) {
|
|
878
928
|
if (!raw || typeof raw !== "object") return null;
|
|
879
929
|
const obj = raw;
|
|
@@ -924,7 +974,8 @@ function parseConversionConfig(raw) {
|
|
|
924
974
|
goals,
|
|
925
975
|
linked_hostnames: Array.isArray(obj.linked_hostnames) ? obj.linked_hostnames.filter((h) => typeof h === "string" && h.length > 0) : [],
|
|
926
976
|
integrations: parseIntegrations(obj.integrations),
|
|
927
|
-
lead_forms: parseLeadForms(obj.lead_forms)
|
|
977
|
+
lead_forms: parseLeadForms(obj.lead_forms),
|
|
978
|
+
videos: parseVideos(obj.videos)
|
|
928
979
|
};
|
|
929
980
|
}
|
|
930
981
|
function parseLeadForms(value) {
|
|
@@ -1170,6 +1221,21 @@ function automaticThresholdMet(goal, eventType, metadata) {
|
|
|
1170
1221
|
case "form_start":
|
|
1171
1222
|
case "phone_click":
|
|
1172
1223
|
return true;
|
|
1224
|
+
case "video_play":
|
|
1225
|
+
return trigger.video_id == null || hasStringField(metadata, "video_id") && metadata.video_id === trigger.video_id;
|
|
1226
|
+
case "video_progress": {
|
|
1227
|
+
if (trigger.video_id != null && (!hasStringField(metadata, "video_id") || metadata.video_id !== trigger.video_id)) {
|
|
1228
|
+
return false;
|
|
1229
|
+
}
|
|
1230
|
+
if (typeof trigger.threshold !== "number") return false;
|
|
1231
|
+
if (trigger.metric === "seconds") {
|
|
1232
|
+
return hasNumberField(metadata, "watched_s") && metadata.watched_s >= trigger.threshold;
|
|
1233
|
+
}
|
|
1234
|
+
if (trigger.metric === "percent") {
|
|
1235
|
+
return hasNumberField(metadata, "max_percent") && metadata.max_percent >= trigger.threshold || hasNumberField(metadata, "watched_percent") && metadata.watched_percent >= trigger.threshold;
|
|
1236
|
+
}
|
|
1237
|
+
return false;
|
|
1238
|
+
}
|
|
1173
1239
|
default:
|
|
1174
1240
|
return false;
|
|
1175
1241
|
}
|
|
@@ -1229,6 +1295,9 @@ var RETRY_BASE_MS = 5e3;
|
|
|
1229
1295
|
var RETRY_MAX_MS = 5 * 6e4;
|
|
1230
1296
|
var runtimes = /* @__PURE__ */ new Map();
|
|
1231
1297
|
var configuredIds = /* @__PURE__ */ new Set();
|
|
1298
|
+
var EMPTY_GOALS = [];
|
|
1299
|
+
var EMPTY_STRINGS = [];
|
|
1300
|
+
var EMPTY_VIDEOS = {};
|
|
1232
1301
|
var scriptLoad = null;
|
|
1233
1302
|
var jsInitialized = false;
|
|
1234
1303
|
function cacheKey2(url) {
|
|
@@ -1419,11 +1488,11 @@ var TrackingConfigRuntime = class {
|
|
|
1419
1488
|
void this.flush();
|
|
1420
1489
|
}
|
|
1421
1490
|
listGoals() {
|
|
1422
|
-
return this.current?.goals ??
|
|
1491
|
+
return this.current?.goals ?? EMPTY_GOALS;
|
|
1423
1492
|
}
|
|
1424
1493
|
/** Sibling hostnames for the linker — read from the cached object even while unconfirmed. */
|
|
1425
1494
|
linkedHostnames() {
|
|
1426
|
-
return this.current?.linked_hostnames ??
|
|
1495
|
+
return this.current?.linked_hostnames ?? EMPTY_STRINGS;
|
|
1427
1496
|
}
|
|
1428
1497
|
/**
|
|
1429
1498
|
* Integration blocks, from the cached object even while unconfirmed: the booking fallback
|
|
@@ -1436,6 +1505,14 @@ var TrackingConfigRuntime = class {
|
|
|
1436
1505
|
leadForms() {
|
|
1437
1506
|
return this.current?.lead_forms ?? null;
|
|
1438
1507
|
}
|
|
1508
|
+
/** Configured Cloudflare Stream tracked videos for this site. */
|
|
1509
|
+
videos() {
|
|
1510
|
+
return this.current?.videos ?? EMPTY_VIDEOS;
|
|
1511
|
+
}
|
|
1512
|
+
/** Look up one configured Cloudflare Stream tracked video by key. */
|
|
1513
|
+
getVideo(key) {
|
|
1514
|
+
return this.current?.videos?.[key] ?? null;
|
|
1515
|
+
}
|
|
1439
1516
|
async revalidateNow() {
|
|
1440
1517
|
try {
|
|
1441
1518
|
const headers = {};
|
|
@@ -1592,6 +1669,16 @@ var TrackingConfigRuntime = class {
|
|
|
1592
1669
|
this.scheduleRetry();
|
|
1593
1670
|
return;
|
|
1594
1671
|
}
|
|
1672
|
+
if (outcome === "fired" && typeof window !== "undefined" && typeof window.fbq === "function") {
|
|
1673
|
+
try {
|
|
1674
|
+
window.fbq("trackCustom", item.key, {
|
|
1675
|
+
...value != null ? { value } : {},
|
|
1676
|
+
...currency ? { currency } : {},
|
|
1677
|
+
...item.transactionId ? { transaction_id: item.transactionId } : {}
|
|
1678
|
+
});
|
|
1679
|
+
} catch {
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1595
1682
|
this.conversionQueue.shift();
|
|
1596
1683
|
}
|
|
1597
1684
|
}
|
|
@@ -1778,6 +1865,13 @@ var EVENT_SEMANTICS = {
|
|
|
1778
1865
|
outcomeRole: "engagement",
|
|
1779
1866
|
clientVisibility: "detailed"
|
|
1780
1867
|
},
|
|
1868
|
+
// Adds to the submit it names; counting it as a lead would double every lead.
|
|
1869
|
+
form_details: {
|
|
1870
|
+
label: "Form details added",
|
|
1871
|
+
category: "lead",
|
|
1872
|
+
outcomeRole: "engagement",
|
|
1873
|
+
clientVisibility: "detailed"
|
|
1874
|
+
},
|
|
1781
1875
|
form_submit: {
|
|
1782
1876
|
label: "Form submitted",
|
|
1783
1877
|
category: "lead",
|
|
@@ -1807,6 +1901,18 @@ var EVENT_SEMANTICS = {
|
|
|
1807
1901
|
category: "page",
|
|
1808
1902
|
outcomeRole: "navigation",
|
|
1809
1903
|
clientVisibility: "simple"
|
|
1904
|
+
},
|
|
1905
|
+
video_play: {
|
|
1906
|
+
label: "Video played",
|
|
1907
|
+
category: "engagement",
|
|
1908
|
+
outcomeRole: "engagement",
|
|
1909
|
+
clientVisibility: "simple"
|
|
1910
|
+
},
|
|
1911
|
+
video_progress: {
|
|
1912
|
+
label: "Video watched",
|
|
1913
|
+
category: "engagement",
|
|
1914
|
+
outcomeRole: "engagement",
|
|
1915
|
+
clientVisibility: "detailed"
|
|
1810
1916
|
}
|
|
1811
1917
|
};
|
|
1812
1918
|
function getEventSemantics(eventName) {
|
|
@@ -1836,7 +1942,6 @@ var jsonValueSchema = z2.lazy(
|
|
|
1836
1942
|
])
|
|
1837
1943
|
).register(z2.globalRegistry, { id: "JsonSerializableValue" });
|
|
1838
1944
|
var contractNameSchema = z2.string().check(z2.regex(/^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?$/));
|
|
1839
|
-
var contractName = contractNameSchema;
|
|
1840
1945
|
var violationRole = z2.string().check(
|
|
1841
1946
|
z2.maxLength(200),
|
|
1842
1947
|
z2.regex(
|
|
@@ -1848,38 +1953,41 @@ var contractViolationSchema = z2.strictObject({
|
|
|
1848
1953
|
role: z2.nullable(violationRole),
|
|
1849
1954
|
rule: z2.string().check(z2.regex(/^[a-z][a-z_]{0,47}$/))
|
|
1850
1955
|
});
|
|
1956
|
+
var formFieldSchema = z2.strictObject({
|
|
1957
|
+
name: z2.string(),
|
|
1958
|
+
type: z2.string(),
|
|
1959
|
+
label: z2.nullable(z2.string()),
|
|
1960
|
+
value: jsonValueSchema,
|
|
1961
|
+
role: z2.optional(z2.nullable(contractNameSchema))
|
|
1962
|
+
});
|
|
1963
|
+
var formExtraSchema = z2.optional(
|
|
1964
|
+
z2.nullable(
|
|
1965
|
+
z2.array(
|
|
1966
|
+
z2.strictObject({
|
|
1967
|
+
key: z2.string().check(z2.maxLength(64)),
|
|
1968
|
+
label: z2.string().check(z2.maxLength(200)),
|
|
1969
|
+
value: jsonValueSchema
|
|
1970
|
+
})
|
|
1971
|
+
).check(z2.maxLength(20))
|
|
1972
|
+
)
|
|
1973
|
+
);
|
|
1974
|
+
var contractVersionSchema = z2.optional(z2.nullable(z2.int().check(z2.gte(1))));
|
|
1975
|
+
var contractHashSchema = z2.optional(z2.nullable(z2.string().check(z2.maxLength(64))));
|
|
1976
|
+
var formContractViolationsSchema = z2.optional(
|
|
1977
|
+
z2.nullable(z2.array(contractViolationSchema).check(z2.maxLength(MAX_CONTRACT_VIOLATIONS)))
|
|
1978
|
+
);
|
|
1851
1979
|
var formSubmitMetadataSchema = z2.strictObject({
|
|
1852
1980
|
form: z2.strictObject({
|
|
1853
1981
|
id: z2.string(),
|
|
1854
1982
|
action: z2.nullable(z2.string()),
|
|
1855
|
-
fields: z2.optional(
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
})
|
|
1864
|
-
)
|
|
1865
|
-
),
|
|
1866
|
-
kind: z2.optional(z2.nullable(contractName)),
|
|
1867
|
-
contract_version: z2.optional(z2.nullable(z2.int().check(z2.gte(1)))),
|
|
1868
|
-
contract_hash: z2.optional(z2.nullable(z2.string().check(z2.maxLength(64)))),
|
|
1869
|
-
extra: z2.optional(
|
|
1870
|
-
z2.nullable(
|
|
1871
|
-
z2.array(
|
|
1872
|
-
z2.strictObject({
|
|
1873
|
-
key: z2.string().check(z2.maxLength(64)),
|
|
1874
|
-
label: z2.string().check(z2.maxLength(200)),
|
|
1875
|
-
value: jsonValueSchema
|
|
1876
|
-
})
|
|
1877
|
-
).check(z2.maxLength(20))
|
|
1878
|
-
)
|
|
1879
|
-
),
|
|
1880
|
-
contract_violations: z2.optional(
|
|
1881
|
-
z2.nullable(z2.array(contractViolationSchema).check(z2.maxLength(MAX_CONTRACT_VIOLATIONS)))
|
|
1882
|
-
)
|
|
1983
|
+
fields: z2.optional(z2.array(formFieldSchema)),
|
|
1984
|
+
kind: z2.optional(z2.nullable(contractNameSchema)),
|
|
1985
|
+
contract_version: contractVersionSchema,
|
|
1986
|
+
contract_hash: contractHashSchema,
|
|
1987
|
+
extra: formExtraSchema,
|
|
1988
|
+
contract_violations: formContractViolationsSchema,
|
|
1989
|
+
// Minted per submit; a later `form_details` names it to add answers to this lead.
|
|
1990
|
+
submission_id: z2.optional(z2.nullable(z2.uuidv4()))
|
|
1883
1991
|
}),
|
|
1884
1992
|
page: z2.strictObject({
|
|
1885
1993
|
path: z2.string()
|
|
@@ -1887,6 +1995,36 @@ var formSubmitMetadataSchema = z2.strictObject({
|
|
|
1887
1995
|
});
|
|
1888
1996
|
var formSubmitConfigSchema = z2.strictObject({});
|
|
1889
1997
|
|
|
1998
|
+
// ../tracking-core/src/video-ranges.ts
|
|
1999
|
+
function roundVideoSeconds(value) {
|
|
2000
|
+
if (!Number.isFinite(value) || value < 0) return 0;
|
|
2001
|
+
return Math.round(value * 100) / 100;
|
|
2002
|
+
}
|
|
2003
|
+
function mergeVideoRanges(ranges, epsilonSeconds = 0.25) {
|
|
2004
|
+
const valid = ranges.filter((r) => Number.isFinite(r.start_s) && Number.isFinite(r.end_s) && r.end_s > r.start_s).map((r) => ({
|
|
2005
|
+
start_s: roundVideoSeconds(r.start_s),
|
|
2006
|
+
end_s: roundVideoSeconds(r.end_s)
|
|
2007
|
+
})).filter((r) => r.end_s - r.start_s >= 0.05).sort((a, b) => a.start_s - b.start_s || a.end_s - b.end_s);
|
|
2008
|
+
if (valid.length === 0) return [];
|
|
2009
|
+
const merged = [{ ...valid[0] }];
|
|
2010
|
+
for (let i = 1; i < valid.length; i += 1) {
|
|
2011
|
+
const cur = valid[i];
|
|
2012
|
+
const last = merged[merged.length - 1];
|
|
2013
|
+
if (cur.start_s <= last.end_s + epsilonSeconds) {
|
|
2014
|
+
last.end_s = roundVideoSeconds(Math.max(last.end_s, cur.end_s));
|
|
2015
|
+
} else {
|
|
2016
|
+
merged.push({ ...cur });
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
return merged;
|
|
2020
|
+
}
|
|
2021
|
+
function sumVideoRangesSeconds(ranges, durationSeconds = 0) {
|
|
2022
|
+
const merged = mergeVideoRanges(ranges);
|
|
2023
|
+
const raw = merged.reduce((acc, r) => acc + Math.max(0, r.end_s - r.start_s), 0);
|
|
2024
|
+
const clamped = durationSeconds > 0 ? Math.min(raw, durationSeconds) : raw;
|
|
2025
|
+
return roundVideoSeconds(clamped);
|
|
2026
|
+
}
|
|
2027
|
+
|
|
1890
2028
|
// ../tracking-core/src/ingest-typed.ts
|
|
1891
2029
|
var clientSettings = /* @__PURE__ */ new WeakMap();
|
|
1892
2030
|
function typedClientSettings(client) {
|
|
@@ -2011,10 +2149,10 @@ var KNOWN_ROLES = new Set(LEAD_FORM_ROLES);
|
|
|
2011
2149
|
var ROLE_ORDER = new Map(LEAD_FORM_ROLES.map((role, index) => [role, index]));
|
|
2012
2150
|
var ADD_ON = /^add_on:[a-z0-9_-]{1,48}$/;
|
|
2013
2151
|
var CONTRACT_NAME = /^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?$/;
|
|
2014
|
-
function judgeLeadForm(kind, formId, fields, contracts, settings) {
|
|
2152
|
+
function judgeLeadForm(kind, formId, fields, contracts, settings, { partial = false } = {}) {
|
|
2015
2153
|
const generated = contracts?.contracts[kind];
|
|
2016
2154
|
const live = liveContract(settings.trackingConfig, kind);
|
|
2017
|
-
const violations = check(live === void 0 ? generated : fromLive(live), fields);
|
|
2155
|
+
const violations = check(live === void 0 ? generated : fromLive(live), fields, partial);
|
|
2018
2156
|
const liveHash = live === void 0 ? void 0 : live?.contract_hash ?? null;
|
|
2019
2157
|
if (contracts && (liveHash !== void 0 && (generated?.hash ?? null) !== liveHash || contracts.registryVersion !== LEAD_FORM_REGISTRY_VERSION)) {
|
|
2020
2158
|
violations.push({ role: null, rule: "contract_behind" });
|
|
@@ -2046,7 +2184,7 @@ function fromLive(live) {
|
|
|
2046
2184
|
options: Object.fromEntries(live.options.map((o) => [o.role, o.options.map((x) => x.key)]))
|
|
2047
2185
|
};
|
|
2048
2186
|
}
|
|
2049
|
-
function check(contract, fields) {
|
|
2187
|
+
function check(contract, fields, partial) {
|
|
2050
2188
|
const answered = new Map(fields);
|
|
2051
2189
|
const violations = [];
|
|
2052
2190
|
for (const [role, value] of fields) {
|
|
@@ -2064,6 +2202,7 @@ function check(contract, fields) {
|
|
|
2064
2202
|
violations.push({ role, rule: "unknown_option" });
|
|
2065
2203
|
}
|
|
2066
2204
|
}
|
|
2205
|
+
if (partial) return violations;
|
|
2067
2206
|
for (const { role, requiredWhen } of contract?.requires ?? []) {
|
|
2068
2207
|
const owing = requiredWhen === null || optionKeys(answered.get(requiredWhen.role)).some((key) => requiredWhen.anyOf.includes(key));
|
|
2069
2208
|
if (owing && !answered.has(role)) violations.push({ role, rule: "missing_required" });
|
|
@@ -2668,7 +2807,7 @@ var zSaleItemEntitySchema = z4.object({
|
|
|
2668
2807
|
external_item_id: z4.nullable(z4.string()),
|
|
2669
2808
|
id: z4.uuid(),
|
|
2670
2809
|
name: z4.nullable(z4.string()),
|
|
2671
|
-
quantity: z4.string()
|
|
2810
|
+
quantity: z4.string(),
|
|
2672
2811
|
unit_cost_cents: z4.nullable(z4.int()),
|
|
2673
2812
|
unit_price_cents: z4.int()
|
|
2674
2813
|
});
|
|
@@ -2732,12 +2871,15 @@ var zSmsWithheldReason = z4.enum([
|
|
|
2732
2871
|
"test_or_bot_session",
|
|
2733
2872
|
"invalid_phone",
|
|
2734
2873
|
"recently_texted",
|
|
2874
|
+
"owner_not_alerted",
|
|
2875
|
+
"no_new_details",
|
|
2735
2876
|
"do_not_contact",
|
|
2736
2877
|
"do_not_text_tag",
|
|
2737
2878
|
"missing_value",
|
|
2738
2879
|
"us_texting_pending",
|
|
2739
2880
|
"us_texting_rejected",
|
|
2740
|
-
"texts_paused"
|
|
2881
|
+
"texts_paused",
|
|
2882
|
+
"outside_nanp"
|
|
2741
2883
|
]);
|
|
2742
2884
|
var zSaleSmsStatusSchema = z4.object({
|
|
2743
2885
|
can_send_now: z4._default(z4.boolean(), false),
|
|
@@ -2787,6 +2929,17 @@ var zApiErrorSchema = z4.object({
|
|
|
2787
2929
|
errors: z4._default(z4.nullish(z4.array(zValidationErrorItem)), null),
|
|
2788
2930
|
request_id: z4._default(z4.nullish(z4.string()), null)
|
|
2789
2931
|
});
|
|
2932
|
+
var zWritebackCorrectionAction = z4.enum(["retry", "restate_now"]);
|
|
2933
|
+
var zWritebackCorrectionState = z4.enum([
|
|
2934
|
+
"queued",
|
|
2935
|
+
"sent",
|
|
2936
|
+
"restated",
|
|
2937
|
+
"failed",
|
|
2938
|
+
"limit_reached",
|
|
2939
|
+
"voided",
|
|
2940
|
+
"date_changed",
|
|
2941
|
+
"dry_run_ok"
|
|
2942
|
+
]);
|
|
2790
2943
|
var zWritebackEmailSource = z4.enum(["NONE", "SALE", "CUSTOMER", "HARVESTED"]);
|
|
2791
2944
|
var zWritebackEnrichmentStatus = z4.enum(["NONE", "MATCHED", "AMBIGUOUS"]);
|
|
2792
2945
|
var zWritebackSaleUploadCounts = z4.object({
|
|
@@ -2797,9 +2950,28 @@ var zWritebackSaleUploadCounts = z4.object({
|
|
|
2797
2950
|
total: z4._default(z4.int(), 0),
|
|
2798
2951
|
uploaded: z4._default(z4.int(), 0)
|
|
2799
2952
|
});
|
|
2953
|
+
var zWritebackValueDrift = z4.enum(["none", "open", "failed"]);
|
|
2954
|
+
var zWritebackCorrectionSchema = z4.object({
|
|
2955
|
+
action: z4.nullable(zWritebackCorrectionAction),
|
|
2956
|
+
can_restate: z4._default(z4.boolean(), false),
|
|
2957
|
+
drift: zWritebackValueDrift,
|
|
2958
|
+
error_message: z4.nullable(z4.string()),
|
|
2959
|
+
google_currency: z4.string(),
|
|
2960
|
+
google_value_cents: z4.int(),
|
|
2961
|
+
restated_at: z4.nullable(z4.iso.datetime({ offset: true })),
|
|
2962
|
+
restated_from_cents: z4.nullable(z4.int()),
|
|
2963
|
+
restatement_limit: z4.int(),
|
|
2964
|
+
restatements_used: z4.int(),
|
|
2965
|
+
sale_currency: z4.string(),
|
|
2966
|
+
sale_value_cents: z4.int(),
|
|
2967
|
+
sends_at: z4.nullable(z4.iso.datetime({ offset: true })),
|
|
2968
|
+
state: zWritebackCorrectionState,
|
|
2969
|
+
upload_id: z4.uuid()
|
|
2970
|
+
});
|
|
2800
2971
|
var zSaleWritebackStatusSchema = z4.object({
|
|
2801
2972
|
blocked_reason: z4.nullable(z4.string()),
|
|
2802
2973
|
can_dispatch: z4._default(z4.boolean(), false),
|
|
2974
|
+
correction: z4.nullable(zWritebackCorrectionSchema),
|
|
2803
2975
|
email_source: z4.nullable(zWritebackEmailSource),
|
|
2804
2976
|
enrichment_status: z4.nullable(zWritebackEnrichmentStatus),
|
|
2805
2977
|
gclid_attached: z4._default(z4.boolean(), false),
|
|
@@ -2817,7 +2989,6 @@ var zSaleWritebackStatusSchema = z4.object({
|
|
|
2817
2989
|
"out_of_window",
|
|
2818
2990
|
"blocked"
|
|
2819
2991
|
]),
|
|
2820
|
-
stale: z4._default(z4.boolean(), false),
|
|
2821
2992
|
uncovered_service_ids: z4.array(z4.uuid()),
|
|
2822
2993
|
uploads: zWritebackSaleUploadCounts
|
|
2823
2994
|
});
|
|
@@ -2944,6 +3115,7 @@ function phoneField(name, raw, country, label = null) {
|
|
|
2944
3115
|
var import_client2 = require("@aranova/tracking-react/client");
|
|
2945
3116
|
var import_client3 = require("@aranova/tracking-react/client");
|
|
2946
3117
|
var import_client4 = require("@aranova/tracking-react/client");
|
|
3118
|
+
var import_client5 = require("@aranova/tracking-react/client");
|
|
2947
3119
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2948
3120
|
0 && (module.exports = {
|
|
2949
3121
|
AdPlatformTracking,
|
|
@@ -2952,6 +3124,7 @@ var import_client4 = require("@aranova/tracking-react/client");
|
|
|
2952
3124
|
ConsentBanner,
|
|
2953
3125
|
DEFAULT_DECLINE_TTL_DAYS,
|
|
2954
3126
|
DEFAULT_PHONE_COUNTRY,
|
|
3127
|
+
DEFAULT_VIDEO_CHECKPOINTS,
|
|
2955
3128
|
EVENT_SEMANTICS,
|
|
2956
3129
|
GoogleAdsTracking,
|
|
2957
3130
|
LEAD_FORM_KINDS,
|
|
@@ -2965,6 +3138,8 @@ var import_client4 = require("@aranova/tracking-react/client");
|
|
|
2965
3138
|
SUPPORTED_CURRENCIES,
|
|
2966
3139
|
TRACKING_PARAM_KEYS,
|
|
2967
3140
|
TRACKING_RANGES,
|
|
3141
|
+
TrackedVideo,
|
|
3142
|
+
TrackedVideoStage,
|
|
2968
3143
|
bookableSlots,
|
|
2969
3144
|
buildBookingHandoffUrl,
|
|
2970
3145
|
captureTrackingParamsFromLocation,
|
|
@@ -2989,6 +3164,7 @@ var import_client4 = require("@aranova/tracking-react/client");
|
|
|
2989
3164
|
getTrackingConfigRuntime,
|
|
2990
3165
|
groupBookingOptions,
|
|
2991
3166
|
leadFormPrimitiveSchemas,
|
|
3167
|
+
mergeVideoRanges,
|
|
2992
3168
|
newBookingAttemptKey,
|
|
2993
3169
|
onConsentChange,
|
|
2994
3170
|
optIn,
|
|
@@ -2998,6 +3174,7 @@ var import_client4 = require("@aranova/tracking-react/client");
|
|
|
2998
3174
|
resetConsent,
|
|
2999
3175
|
resolveConversionConfig,
|
|
3000
3176
|
resolveTrackingConfigUrl,
|
|
3177
|
+
roundVideoSeconds,
|
|
3001
3178
|
saleCreateSchema,
|
|
3002
3179
|
saleItemSchema,
|
|
3003
3180
|
saleServiceSchema,
|
|
@@ -3007,6 +3184,9 @@ var import_client4 = require("@aranova/tracking-react/client");
|
|
|
3007
3184
|
shopToday,
|
|
3008
3185
|
slotFields,
|
|
3009
3186
|
stashUserData,
|
|
3187
|
+
streamManifestUrl,
|
|
3188
|
+
streamPosterUrl,
|
|
3189
|
+
sumVideoRangesSeconds,
|
|
3010
3190
|
timeWindow,
|
|
3011
3191
|
toE164,
|
|
3012
3192
|
toMinor,
|
|
@@ -3020,6 +3200,7 @@ var import_client4 = require("@aranova/tracking-react/client");
|
|
|
3020
3200
|
useGclid,
|
|
3021
3201
|
usePhoneConfig,
|
|
3022
3202
|
usePhoneField,
|
|
3203
|
+
useTrackedVideoConfig,
|
|
3023
3204
|
useTrackingParams
|
|
3024
3205
|
});
|
|
3025
3206
|
//# sourceMappingURL=index.js.map
|