@financial-times/custom-code-component 1.9.3 → 1.9.4
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/custom-code-component.js +361 -349
- package/dist/tracking.d.ts +22 -0
- package/package.json +1 -1
- package/src/custom-code-component.ts +12 -9
- package/src/tracking.ts +141 -0
- package/dist/analytics.d.ts +0 -11
- package/src/analytics.ts +0 -137
|
@@ -28,7 +28,7 @@ w.prototype.on = function(t, e, n, o) {
|
|
|
28
28
|
throw new TypeError("Invalid event type: " + t);
|
|
29
29
|
if (typeof e == "function" && (o = n, n = e, e = null), o === void 0 && (o = this.captureForType(t)), typeof n != "function")
|
|
30
30
|
throw new TypeError("Handler must be a type of Function");
|
|
31
|
-
return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a =
|
|
31
|
+
return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a = Et) : /^#[a-z0-9\-_]+$/i.test(e) ? (c = e.slice(1), a = xt) : (c = e, a = Element.prototype.matches) : (c = null, a = vt.bind(this)), i[t].push({
|
|
32
32
|
selector: e,
|
|
33
33
|
handler: n,
|
|
34
34
|
matcher: a,
|
|
@@ -53,11 +53,11 @@ w.prototype.off = function(t, e, n, o) {
|
|
|
53
53
|
w.prototype.handle = function(t) {
|
|
54
54
|
let e, n;
|
|
55
55
|
const o = t.type;
|
|
56
|
-
let r, i, a, c, s = [],
|
|
56
|
+
let r, i, a, c, s = [], u;
|
|
57
57
|
const l = "ftLabsDelegateIgnore";
|
|
58
58
|
if (t[l] === !0)
|
|
59
59
|
return;
|
|
60
|
-
switch (
|
|
60
|
+
switch (u = t.target, u.nodeType === 3 && (u = u.parentNode), u.correspondingUseElement && (u = u.correspondingUseElement), r = this.rootElement, i = t.eventPhase || (t.target !== t.currentTarget ? 3 : 2), i) {
|
|
61
61
|
case 1:
|
|
62
62
|
s = this.listenerMap[1][o];
|
|
63
63
|
break;
|
|
@@ -68,17 +68,17 @@ w.prototype.handle = function(t) {
|
|
|
68
68
|
s = this.listenerMap[0][o];
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
|
-
let
|
|
72
|
-
for (n = s.length;
|
|
71
|
+
let f = [];
|
|
72
|
+
for (n = s.length; u && n; ) {
|
|
73
73
|
for (e = 0; e < n && (a = s[e], !!a); e++)
|
|
74
|
-
|
|
75
|
-
if (
|
|
74
|
+
u.tagName && ["button", "input", "select", "textarea"].indexOf(u.tagName.toLowerCase()) > -1 && u.hasAttribute("disabled") ? f = [] : a.matcher.call(u, a.matcherParam, u) && f.push([t, u, a]);
|
|
75
|
+
if (u === r || (n = s.length, u = u.parentElement || u.parentNode, u instanceof HTMLDocument))
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
let d;
|
|
79
|
-
for (e = 0; e <
|
|
80
|
-
if (!(this._removedListeners.indexOf(
|
|
81
|
-
|
|
79
|
+
for (e = 0; e < f.length; e++)
|
|
80
|
+
if (!(this._removedListeners.indexOf(f[e][2]) > -1) && (c = this.fire.apply(this, f[e]), c === !1)) {
|
|
81
|
+
f[e][0][l] = !0, f[e][0].preventDefault(), d = !1;
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
return d;
|
|
@@ -86,10 +86,10 @@ w.prototype.handle = function(t) {
|
|
|
86
86
|
w.prototype.fire = function(t, e, n) {
|
|
87
87
|
return n.handler.call(e, t, e);
|
|
88
88
|
};
|
|
89
|
-
function
|
|
89
|
+
function Et(t, e) {
|
|
90
90
|
return t.toLowerCase() === e.tagName.toLowerCase();
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function vt(t, e) {
|
|
93
93
|
return this.rootElement === window ? (
|
|
94
94
|
// Match the outer document (dispatched from document)
|
|
95
95
|
e === document || // The <html> element (dispatched from document.body or document.documentElement)
|
|
@@ -97,14 +97,14 @@ function Ot(t, e) {
|
|
|
97
97
|
e === window
|
|
98
98
|
) : this.rootElement === e;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function xt(t, e) {
|
|
101
101
|
return t === e.id;
|
|
102
102
|
}
|
|
103
103
|
w.prototype.destroy = function() {
|
|
104
104
|
this.off(), this.root();
|
|
105
105
|
};
|
|
106
|
-
const
|
|
107
|
-
function
|
|
106
|
+
const K = { config: {} };
|
|
107
|
+
function tt(t) {
|
|
108
108
|
if (t === void 0)
|
|
109
109
|
return t;
|
|
110
110
|
switch (Object.prototype.toString.call(t)) {
|
|
@@ -116,28 +116,28 @@ function ot(t) {
|
|
|
116
116
|
return t;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
119
|
+
function kt(t, e) {
|
|
120
|
+
K[t] = tt(e);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
122
|
+
function Ot(t) {
|
|
123
|
+
return tt(K[t]);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
delete
|
|
125
|
+
function Q(t) {
|
|
126
|
+
delete K[t];
|
|
127
127
|
}
|
|
128
|
-
const C =
|
|
129
|
-
let
|
|
130
|
-
const
|
|
128
|
+
const C = kt, h = Ot;
|
|
129
|
+
let A = 0;
|
|
130
|
+
const H = 4, _ = 36, et = Math.pow(_, H), F = function(e, n) {
|
|
131
131
|
const o = "000000000" + e;
|
|
132
132
|
return o.substr(o.length - n);
|
|
133
|
-
},
|
|
134
|
-
return
|
|
135
|
-
},
|
|
136
|
-
const e = "c", n = (/* @__PURE__ */ new Date()).getTime().toString(
|
|
133
|
+
}, U = function() {
|
|
134
|
+
return F((Math.random() * et << 0).toString(_), H);
|
|
135
|
+
}, nt = () => (A = A < et ? A : 0, A++, A - 1), p = function() {
|
|
136
|
+
const e = "c", n = (/* @__PURE__ */ new Date()).getTime().toString(_), o = p.fingerprint(), r = U() + U(), i = F(nt().toString(_), H);
|
|
137
137
|
return e + n + i + o + r;
|
|
138
138
|
};
|
|
139
139
|
p.slug = function() {
|
|
140
|
-
const e = (/* @__PURE__ */ new Date()).getTime().toString(36), n = p.fingerprint().slice(0, 1) + p.fingerprint().slice(-1), o =
|
|
140
|
+
const e = (/* @__PURE__ */ new Date()).getTime().toString(36), n = p.fingerprint().slice(0, 1) + p.fingerprint().slice(-1), o = U().slice(-2), r = nt().toString(36).slice(-4);
|
|
141
141
|
return e.slice(-2) + r + n + o;
|
|
142
142
|
};
|
|
143
143
|
p.globalCount = function() {
|
|
@@ -150,10 +150,10 @@ p.globalCount = function() {
|
|
|
150
150
|
return p.globalCount = () => e, e;
|
|
151
151
|
};
|
|
152
152
|
p.fingerprint = function() {
|
|
153
|
-
return
|
|
153
|
+
return F((navigator.mimeTypes.length + navigator.userAgent.length).toString(36) + p.globalCount().toString(36), 4);
|
|
154
154
|
};
|
|
155
|
-
const
|
|
156
|
-
function
|
|
155
|
+
const X = [];
|
|
156
|
+
function P(...t) {
|
|
157
157
|
if (h("config").test && window.console)
|
|
158
158
|
for (const e of t)
|
|
159
159
|
window.console.log(e);
|
|
@@ -168,13 +168,13 @@ function m(t, e) {
|
|
|
168
168
|
o = t[n], r = e[n], t !== r && typeof r < "u" && r !== null && (t[n] = o === Object(o) && !y(o, "function") ? m(o, r) : r);
|
|
169
169
|
return t;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function V(t) {
|
|
172
172
|
return window.encodeURIComponent ? window.encodeURIComponent(t) : window.escape(t);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Ct(t) {
|
|
175
175
|
return window.decodeURIComponent ? window.decodeURIComponent(t) : window.unescape(t);
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function z(t, e, n) {
|
|
178
178
|
t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent("on" + e, n);
|
|
179
179
|
}
|
|
180
180
|
function v(t, e, n) {
|
|
@@ -187,27 +187,27 @@ function v(t, e, n) {
|
|
|
187
187
|
} catch {
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
for (let t = 0; t <
|
|
192
|
-
|
|
190
|
+
function St() {
|
|
191
|
+
for (let t = 0; t < X.length; t++)
|
|
192
|
+
X[t]();
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Y(t) {
|
|
195
195
|
return document.cookie.match(t) && RegExp.$1 !== "" && RegExp.$1 !== "null" ? RegExp.$1 : null;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function At(t, e) {
|
|
198
198
|
const n = {};
|
|
199
199
|
for (const o of e)
|
|
200
200
|
t[o] && (n[o] = t[o]);
|
|
201
201
|
return n;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function R(t) {
|
|
204
204
|
return typeof t == "string" ? t.trim() : t;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function N(t, e) {
|
|
207
207
|
for (const n in t)
|
|
208
208
|
e[n] ? console.warn(`You can't set a custom property called ${n}`) : e[n] = t[n];
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function ot(t) {
|
|
211
211
|
const e = /* @__PURE__ */ new WeakSet(), n = [];
|
|
212
212
|
function o(r, i) {
|
|
213
213
|
if (e.has(r)) {
|
|
@@ -222,7 +222,7 @@ function st(t) {
|
|
|
222
222
|
}
|
|
223
223
|
return o(t, ""), n;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function rt(t) {
|
|
226
226
|
const e = /* @__PURE__ */ new WeakSet();
|
|
227
227
|
function n(o) {
|
|
228
228
|
if (e.has(o))
|
|
@@ -238,7 +238,7 @@ function at(t) {
|
|
|
238
238
|
t
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function q(t, e) {
|
|
242
242
|
if (t === e)
|
|
243
243
|
return !0;
|
|
244
244
|
if (t && e && typeof t == "object" && typeof e == "object") {
|
|
@@ -249,7 +249,7 @@ function H(t, e) {
|
|
|
249
249
|
if (r !== e.length)
|
|
250
250
|
return !1;
|
|
251
251
|
for (let i = r; i-- !== 0; )
|
|
252
|
-
if (!
|
|
252
|
+
if (!q(t[i], e[i]))
|
|
253
253
|
return !1;
|
|
254
254
|
return !0;
|
|
255
255
|
}
|
|
@@ -267,13 +267,13 @@ function H(t, e) {
|
|
|
267
267
|
return !1;
|
|
268
268
|
for (let r = o; r-- !== 0; ) {
|
|
269
269
|
const i = n[r];
|
|
270
|
-
if (!
|
|
270
|
+
if (!q(t[i], e[i]))
|
|
271
271
|
return !1;
|
|
272
272
|
}
|
|
273
273
|
return !0;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const S = function(t, e = {}) {
|
|
277
277
|
const n = "o-tracking";
|
|
278
278
|
if (typeof t != "string" || t === "") {
|
|
279
279
|
const s = new Error("You must specify a name for the store.");
|
|
@@ -287,8 +287,8 @@ const A = function(t, e = {}) {
|
|
|
287
287
|
load: function(s) {
|
|
288
288
|
return window.localStorage.getItem(s);
|
|
289
289
|
},
|
|
290
|
-
save: function(s,
|
|
291
|
-
return window.localStorage.setItem(s,
|
|
290
|
+
save: function(s, u) {
|
|
291
|
+
return window.localStorage.setItem(s, u);
|
|
292
292
|
},
|
|
293
293
|
remove: function(s) {
|
|
294
294
|
return i(s), window.localStorage.removeItem(s);
|
|
@@ -296,18 +296,18 @@ const A = function(t, e = {}) {
|
|
|
296
296
|
};
|
|
297
297
|
function o(s) {
|
|
298
298
|
s = s + "=";
|
|
299
|
-
const
|
|
300
|
-
let l,
|
|
301
|
-
for (l = 0; l <
|
|
302
|
-
if (
|
|
303
|
-
return
|
|
299
|
+
const u = window.document.cookie.split(";");
|
|
300
|
+
let l, f;
|
|
301
|
+
for (l = 0; l < u.length; l = l + 1)
|
|
302
|
+
if (f = u[l].replace(/^\s+|\s+$/g, ""), f.indexOf(s) === 0)
|
|
303
|
+
return Ct(f.substring(s.length, f.length));
|
|
304
304
|
return null;
|
|
305
305
|
}
|
|
306
|
-
function r(s,
|
|
307
|
-
let
|
|
308
|
-
y(l, "number") && (
|
|
309
|
-
const
|
|
310
|
-
window.document.cookie =
|
|
306
|
+
function r(s, u, l) {
|
|
307
|
+
let f, d = "";
|
|
308
|
+
y(l, "number") && (f = /* @__PURE__ */ new Date(), f.setTime(f.getTime() + l), d = "expires=" + f.toUTCString() + ";");
|
|
309
|
+
const bt = V(s) + "=" + V(u) + ";" + d + "path=/;" + (e.domain ? "domain=." + e.domain + ";" : "");
|
|
310
|
+
window.document.cookie = bt;
|
|
311
311
|
}
|
|
312
312
|
function i(s) {
|
|
313
313
|
r(s, "", -1);
|
|
@@ -330,8 +330,8 @@ const A = function(t, e = {}) {
|
|
|
330
330
|
else {
|
|
331
331
|
const s = JSON.parse(c);
|
|
332
332
|
this.data ? Object.assign(this.data, s) : this.data = s;
|
|
333
|
-
for (const
|
|
334
|
-
|
|
333
|
+
for (const u of Object.keys(s))
|
|
334
|
+
u !== "spoor-id" && i(u);
|
|
335
335
|
}
|
|
336
336
|
} catch (s) {
|
|
337
337
|
v("oErrors", "log", {
|
|
@@ -341,31 +341,31 @@ const A = function(t, e = {}) {
|
|
|
341
341
|
}
|
|
342
342
|
return this;
|
|
343
343
|
};
|
|
344
|
-
|
|
344
|
+
S.prototype.read = function() {
|
|
345
345
|
return this.data;
|
|
346
346
|
};
|
|
347
|
-
|
|
347
|
+
S.prototype.write = function(t) {
|
|
348
348
|
this.data = t;
|
|
349
349
|
let e;
|
|
350
350
|
if (typeof this.data == "string")
|
|
351
351
|
e = this.data;
|
|
352
352
|
else {
|
|
353
|
-
if (
|
|
353
|
+
if (rt(this.data)) {
|
|
354
354
|
const n = `o-tracking does not support circular references in the analytics data.
|
|
355
355
|
Please remove the circular references in the data.
|
|
356
356
|
Here are the paths in the data which are circular:
|
|
357
|
-
` + JSON.stringify(
|
|
357
|
+
` + JSON.stringify(ot(this.data), void 0, 4);
|
|
358
358
|
throw new Error(n);
|
|
359
359
|
}
|
|
360
360
|
e = JSON.stringify(this.data);
|
|
361
361
|
}
|
|
362
362
|
return this.storage.save(this.storageKey, e), this;
|
|
363
363
|
};
|
|
364
|
-
|
|
364
|
+
S.prototype.destroy = function() {
|
|
365
365
|
return this.data = null, this.storage.remove(this.storageKey), this;
|
|
366
366
|
};
|
|
367
|
-
let O,
|
|
368
|
-
function
|
|
367
|
+
let O, B;
|
|
368
|
+
function Pt(t, e) {
|
|
369
369
|
const n = {
|
|
370
370
|
storage: "cookie",
|
|
371
371
|
name: "spoor-id",
|
|
@@ -374,46 +374,46 @@ function Nt(t, e) {
|
|
|
374
374
|
// Set the store cookie domain to .ft.com for ft.com and all its subdomains
|
|
375
375
|
domain: location.hostname.match(/^(?:.+\.)?ft\.com$/) ? "ft.com" : null
|
|
376
376
|
};
|
|
377
|
-
e && (n.domain = e),
|
|
378
|
-
let o =
|
|
379
|
-
return o || (o = t),
|
|
377
|
+
e && (n.domain = e), B = new S(n.name, n);
|
|
378
|
+
let o = B.read();
|
|
379
|
+
return o || (o = t), it(o);
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
return O = t, O || (O = p()),
|
|
381
|
+
function it(t) {
|
|
382
|
+
return O = t, O || (O = p()), B.write(O), O;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function Nt() {
|
|
385
385
|
return O;
|
|
386
386
|
}
|
|
387
|
-
let
|
|
388
|
-
const
|
|
387
|
+
let $;
|
|
388
|
+
const _t = {
|
|
389
389
|
storage: "best",
|
|
390
390
|
name: "session",
|
|
391
391
|
expires: 30 * 60 * 1e3
|
|
392
392
|
// 30 minutes
|
|
393
393
|
};
|
|
394
|
-
function
|
|
394
|
+
function $t(t) {
|
|
395
395
|
const e = /* @__PURE__ */ new Date();
|
|
396
|
-
e.setTime(e.getTime() +
|
|
396
|
+
e.setTime(e.getTime() + $.config.expires), $.write({
|
|
397
397
|
value: t,
|
|
398
398
|
expiry: e.valueOf()
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
|
-
function
|
|
402
|
-
const t =
|
|
401
|
+
function st() {
|
|
402
|
+
const t = $.read();
|
|
403
403
|
let e, n = !1;
|
|
404
404
|
if (t) {
|
|
405
405
|
const o = (/* @__PURE__ */ new Date()).valueOf();
|
|
406
406
|
parseInt(t.expiry, 10) >= o ? e = t.value : (e = p(), n = !0);
|
|
407
407
|
}
|
|
408
|
-
return e || (e = p(), n = !0),
|
|
408
|
+
return e || (e = p(), n = !0), $t(e), {
|
|
409
409
|
id: e,
|
|
410
410
|
isNew: n
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function Lt(t) {
|
|
414
414
|
y(t, "string") && (t = { name: t }), y(t) && (t = {});
|
|
415
|
-
const e = m(
|
|
416
|
-
return e.storage === "cookie" && t.name && (e.nameOverride = e.name),
|
|
415
|
+
const e = m(_t, t);
|
|
416
|
+
return e.storage === "cookie" && t.name && (e.nameOverride = e.name), $ = new S(e.name, e), st();
|
|
417
417
|
}
|
|
418
418
|
function b(t) {
|
|
419
419
|
if (y(t)) {
|
|
@@ -423,7 +423,7 @@ function b(t) {
|
|
|
423
423
|
info: { module: "o-tracking" }
|
|
424
424
|
}), e;
|
|
425
425
|
}
|
|
426
|
-
return this.queue = [], this.storage = new
|
|
426
|
+
return this.queue = [], this.storage = new S(t), this.storage.read() && (this.queue = this.storage.read()), this;
|
|
427
427
|
}
|
|
428
428
|
b.prototype.all = function() {
|
|
429
429
|
if (this.queue.length === 0)
|
|
@@ -473,7 +473,7 @@ b.prototype.shift = function() {
|
|
|
473
473
|
b.prototype.save = function() {
|
|
474
474
|
return this.storage.write(this.queue), this;
|
|
475
475
|
};
|
|
476
|
-
function
|
|
476
|
+
function It() {
|
|
477
477
|
const t = new window.XMLHttpRequest();
|
|
478
478
|
return {
|
|
479
479
|
name: "xhr",
|
|
@@ -489,7 +489,7 @@ function Mt() {
|
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function Dt() {
|
|
493
493
|
let t, e;
|
|
494
494
|
const n = new Promise((o, r) => {
|
|
495
495
|
t = o, e = r;
|
|
@@ -504,39 +504,39 @@ function Rt() {
|
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Rt() {
|
|
508
508
|
const t = new Image(1, 1);
|
|
509
509
|
return {
|
|
510
510
|
name: "image",
|
|
511
511
|
send: function(e, n) {
|
|
512
|
-
e = e.replace("https://spoor-api.ft.com/ingest", "https://spoor-api.ft.com/px.gif"), t.src = e + (e.indexOf("?") > -1 ? "&" : "?") + "data=" +
|
|
512
|
+
e = e.replace("https://spoor-api.ft.com/ingest", "https://spoor-api.ft.com/px.gif"), t.src = e + (e.indexOf("?") > -1 ? "&" : "?") + "data=" + V(n);
|
|
513
513
|
},
|
|
514
514
|
complete: function(e) {
|
|
515
515
|
t.addEventListener ? (t.addEventListener("error", e), t.addEventListener("load", () => e())) : (t.attachEvent("onerror", e), t.attachEvent("onload", () => e()));
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
|
-
const
|
|
520
|
-
function
|
|
521
|
-
if (
|
|
522
|
-
return
|
|
519
|
+
const G = {};
|
|
520
|
+
function j(t) {
|
|
521
|
+
if (G.transport)
|
|
522
|
+
return G.transport;
|
|
523
523
|
switch (t) {
|
|
524
524
|
case "xhr":
|
|
525
|
-
return
|
|
525
|
+
return It;
|
|
526
526
|
case "sendBeacon":
|
|
527
|
-
return
|
|
527
|
+
return Dt;
|
|
528
528
|
case "image":
|
|
529
|
-
return
|
|
529
|
+
return Rt;
|
|
530
530
|
default:
|
|
531
531
|
return;
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
let g;
|
|
535
|
-
function
|
|
535
|
+
function at() {
|
|
536
536
|
return (h("config") || {}).queue === !0 ? !1 : !!navigator.sendBeacon;
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
const n = t.queueTime, o = (/* @__PURE__ */ new Date()).getTime() - n, r =
|
|
538
|
+
function ct(t, e) {
|
|
539
|
+
const n = t.queueTime, o = (/* @__PURE__ */ new Date()).getTime() - n, r = at() ? j("sendBeacon")() : window.XMLHttpRequest && "withCredentials" in new window.XMLHttpRequest() ? j("xhr")() : j("image")(), i = t.callback, a = h("config") && h("config").system || {}, c = m(a, {
|
|
540
540
|
version: h("version"),
|
|
541
541
|
// Version of the tracking client e.g. '1.2'
|
|
542
542
|
source: h("source"),
|
|
@@ -544,27 +544,27 @@ function lt(t, e) {
|
|
|
544
544
|
transport: r.name
|
|
545
545
|
// The transport method used.
|
|
546
546
|
});
|
|
547
|
-
if (h("config").test || h("config").test_data ? c.is_live = !1 : c.is_live = !0, t = m({ system: c }, t), o > 1e3 && o < 12 * 30 * 24 * 60 * 60 * 1e3 && (t.time = t.time || {}, t.time.offset = o), delete t.callback, delete t.type, delete t.queueTime,
|
|
547
|
+
if (h("config").test || h("config").test_data ? c.is_live = !1 : c.is_live = !0, t = m({ system: c }, t), o > 1e3 && o < 12 * 30 * 24 * 60 * 60 * 1e3 && (t.time = t.time || {}, t.time.offset = o), delete t.callback, delete t.type, delete t.queueTime, P("user_callback", i), P("PreSend", t), rt(t)) {
|
|
548
548
|
const l = `o-tracking does not support circular references in the analytics data.
|
|
549
549
|
Please remove the circular references in the data.
|
|
550
550
|
Here are the paths in the data which are circular:
|
|
551
|
-
` + JSON.stringify(
|
|
551
|
+
` + JSON.stringify(ot(t), void 0, 4);
|
|
552
552
|
throw new Error(l);
|
|
553
553
|
}
|
|
554
554
|
const s = JSON.stringify(t);
|
|
555
555
|
r.complete(function(l) {
|
|
556
|
-
y(i, "function") && (i.call(t),
|
|
556
|
+
y(i, "function") && (i.call(t), P("calling user_callback")), l ? (t.queueTime = n, g.add(t).save(), v("oErrors", "log", {
|
|
557
557
|
error: l.message,
|
|
558
558
|
info: { module: "o-tracking" }
|
|
559
559
|
})) : e && e();
|
|
560
560
|
});
|
|
561
|
-
let
|
|
562
|
-
t && t.category && t.action && (
|
|
561
|
+
let u = "https://spoor-api.ft.com/ingest";
|
|
562
|
+
t && t.category && t.action && (u += `?type=${t.category}:${t.action}`), r.send(u, s);
|
|
563
563
|
}
|
|
564
|
-
function
|
|
565
|
-
t.queueTime = (/* @__PURE__ */ new Date()).getTime(),
|
|
564
|
+
function Mt(t) {
|
|
565
|
+
t.queueTime = (/* @__PURE__ */ new Date()).getTime(), at() ? ct(t) : g.add(t).save(), P("AddedToQueue", g);
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function L(t = function() {
|
|
568
568
|
}) {
|
|
569
569
|
const e = g.all();
|
|
570
570
|
if (e.length > 200) {
|
|
@@ -584,58 +584,58 @@ function I(t = function() {
|
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
const n = function() {
|
|
587
|
-
|
|
587
|
+
L(), t();
|
|
588
588
|
}, o = g.shift();
|
|
589
|
-
return o ?
|
|
589
|
+
return o ? ct(o, n) : t();
|
|
590
590
|
}
|
|
591
|
-
function
|
|
592
|
-
|
|
591
|
+
function Tt(t) {
|
|
592
|
+
Mt(t), L();
|
|
593
593
|
}
|
|
594
|
-
function
|
|
595
|
-
return g = new b("requests"),
|
|
596
|
-
|
|
597
|
-
}),
|
|
594
|
+
function jt() {
|
|
595
|
+
return g = new b("requests"), z(window, "online", function() {
|
|
596
|
+
L();
|
|
597
|
+
}), L(), g;
|
|
598
598
|
}
|
|
599
|
-
let
|
|
600
|
-
function
|
|
601
|
-
return
|
|
599
|
+
let I;
|
|
600
|
+
function ut() {
|
|
601
|
+
return I = p(), I;
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
return
|
|
603
|
+
function ft() {
|
|
604
|
+
return I || ut(), I;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function Jt(t, e = function() {
|
|
607
607
|
}) {
|
|
608
|
-
const n =
|
|
608
|
+
const n = st(), o = {
|
|
609
609
|
callback: e,
|
|
610
610
|
context: {
|
|
611
611
|
id: t.id || p(),
|
|
612
612
|
// Use a supplied id or generate one for this request
|
|
613
|
-
root_id:
|
|
613
|
+
root_id: ft()
|
|
614
614
|
},
|
|
615
615
|
user: {
|
|
616
|
-
ft_session:
|
|
617
|
-
ft_session_s:
|
|
616
|
+
ft_session: Y(/FTSession=([^;]+)/),
|
|
617
|
+
ft_session_s: Y(/FTSession_s=([^;]+)/)
|
|
618
618
|
},
|
|
619
619
|
device: {
|
|
620
620
|
spoor_session: n.id,
|
|
621
621
|
spoor_session_is_new: n.isNew,
|
|
622
|
-
spoor_id:
|
|
622
|
+
spoor_id: Nt()
|
|
623
623
|
}
|
|
624
624
|
}, r = h("config") || {};
|
|
625
|
-
return r.context && m(o.context, r.context), r.user && m(o.user, r.user), r.device && m(o.device, r.device), m(o, t),
|
|
625
|
+
return r.context && m(o.context, r.context), r.user && m(o.user, r.user), r.device && m(o.device, r.device), m(o, t), P("Core.Track", o), Tt(o), o;
|
|
626
626
|
}
|
|
627
627
|
const x = {
|
|
628
|
-
setRootID:
|
|
629
|
-
getRootID:
|
|
630
|
-
track:
|
|
631
|
-
},
|
|
628
|
+
setRootID: ut,
|
|
629
|
+
getRootID: ft,
|
|
630
|
+
track: Jt
|
|
631
|
+
}, Ut = function() {
|
|
632
632
|
return {
|
|
633
633
|
category: "event",
|
|
634
634
|
action: "generic",
|
|
635
635
|
context: {}
|
|
636
636
|
};
|
|
637
637
|
};
|
|
638
|
-
function
|
|
638
|
+
function M(t, e) {
|
|
639
639
|
if (y(t.detail.category) || y(t.detail.action)) {
|
|
640
640
|
const r = "Missing category or action values";
|
|
641
641
|
throw v("oErrors", "log", {
|
|
@@ -643,22 +643,22 @@ function J(t, e) {
|
|
|
643
643
|
info: { module: "o-tracking" }
|
|
644
644
|
}), r;
|
|
645
645
|
}
|
|
646
|
-
const n = m(
|
|
646
|
+
const n = m(Ut(), {
|
|
647
647
|
category: t.detail.category,
|
|
648
648
|
action: t.detail.action,
|
|
649
649
|
context: t.detail
|
|
650
650
|
});
|
|
651
651
|
delete n.context.category, delete n.context.action;
|
|
652
|
-
const o =
|
|
653
|
-
o && (n.context.component_name = o.getAttribute("data-o-component"), n.context.component_id = n.context.component_id ||
|
|
652
|
+
const o = Vt(t);
|
|
653
|
+
o && (n.context.component_name = o.getAttribute("data-o-component"), n.context.component_id = n.context.component_id || qt(o)), x.track(n, e);
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function Vt(t) {
|
|
656
656
|
const e = t.target || t.srcElement;
|
|
657
657
|
if (e && e.getAttribute("data-o-component"))
|
|
658
658
|
return e;
|
|
659
659
|
}
|
|
660
|
-
function
|
|
661
|
-
const e =
|
|
660
|
+
function qt(t) {
|
|
661
|
+
const e = Bt(t);
|
|
662
662
|
if (typeof e > "u")
|
|
663
663
|
return;
|
|
664
664
|
const n = e[0], o = function(a) {
|
|
@@ -677,15 +677,15 @@ function Ht(t) {
|
|
|
677
677
|
const c = a.nodeName.toLowerCase();
|
|
678
678
|
return c.indexOf("#") === 0 ? i + "<" + c + ">" : i + "<" + c + ' id="' + (a.id || "") + '">';
|
|
679
679
|
}, "");
|
|
680
|
-
return
|
|
680
|
+
return Kt(r + "_siblingIndex=" + o);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function Bt(t) {
|
|
683
683
|
const e = [];
|
|
684
684
|
for (; t; )
|
|
685
685
|
e.push(t), t = t.parentElement;
|
|
686
686
|
return e;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function Kt(t) {
|
|
689
689
|
let e = t.length, n = 1 ^ e, o = 0, r;
|
|
690
690
|
for (; e >= 4; )
|
|
691
691
|
r = t.charCodeAt(o) & 255 | (t.charCodeAt(++o) & 255) << 8 | (t.charCodeAt(++o) & 255) << 16 | (t.charCodeAt(++o) & 255) << 24, r = (r & 65535) * 1540483477 + (((r >>> 16) * 1540483477 & 65535) << 16), r ^= r >>> 24, r = (r & 65535) * 1540483477 + (((r >>> 16) * 1540483477 & 65535) << 16), n = (n & 65535) * 1540483477 + (((n >>> 16) * 1540483477 & 65535) << 16) ^ r, e -= 4, ++o;
|
|
@@ -702,12 +702,12 @@ function zt(t) {
|
|
|
702
702
|
}
|
|
703
703
|
return n ^= n >>> 13, n = (n & 65535) * 1540483477 + (((n >>> 16) * 1540483477 & 65535) << 16), n ^= n >>> 15, n >>> 0;
|
|
704
704
|
}
|
|
705
|
-
const
|
|
706
|
-
|
|
705
|
+
const Ht = function() {
|
|
706
|
+
z(window, "oTracking.event", M);
|
|
707
707
|
};
|
|
708
|
-
|
|
708
|
+
M.init = Ht;
|
|
709
709
|
C("page_has_already_been_viewed", !1);
|
|
710
|
-
const
|
|
710
|
+
const Ft = function() {
|
|
711
711
|
return {
|
|
712
712
|
category: "page",
|
|
713
713
|
action: "view",
|
|
@@ -717,23 +717,23 @@ const Qt = function() {
|
|
|
717
717
|
}
|
|
718
718
|
};
|
|
719
719
|
};
|
|
720
|
-
function
|
|
721
|
-
t = m(
|
|
720
|
+
function T(t, e) {
|
|
721
|
+
t = m(Ft(), {
|
|
722
722
|
context: t
|
|
723
|
-
}), h("page_has_already_been_viewed") && x.setRootID(), C("page_has_already_been_viewed", !0),
|
|
723
|
+
}), h("page_has_already_been_viewed") && x.setRootID(), C("page_has_already_been_viewed", !0), zt(t) ? h("config").test && console.warn("A page event has already been sent for this page, refusing to send a duplicate page event.") : (x.track(t, e), St());
|
|
724
724
|
}
|
|
725
|
-
let
|
|
726
|
-
function
|
|
725
|
+
let Z = {};
|
|
726
|
+
function zt(t) {
|
|
727
727
|
const e = JSON.parse(JSON.stringify(t));
|
|
728
|
-
return delete e.context.id, delete e.context.root_id,
|
|
728
|
+
return delete e.context.id, delete e.context.root_id, q(Z, e) ? !0 : (Z = e, !1);
|
|
729
729
|
}
|
|
730
|
-
function
|
|
731
|
-
|
|
730
|
+
function Wt(t) {
|
|
731
|
+
T(t.detail);
|
|
732
732
|
}
|
|
733
|
-
const
|
|
734
|
-
|
|
733
|
+
const Qt = function() {
|
|
734
|
+
z(window, "oTracking.page", Wt);
|
|
735
735
|
};
|
|
736
|
-
|
|
736
|
+
T.init = Qt;
|
|
737
737
|
function E(t) {
|
|
738
738
|
this.listenerMap = [{}, {}], t && this.root(t), this.handle = E.prototype.handle.bind(this), this._removedListeners = [];
|
|
739
739
|
}
|
|
@@ -764,7 +764,7 @@ E.prototype.on = function(t, e, n, o) {
|
|
|
764
764
|
throw new TypeError("Invalid event type: " + t);
|
|
765
765
|
if (typeof e == "function" && (o = n, n = e, e = null), o === void 0 && (o = this.captureForType(t)), typeof n != "function")
|
|
766
766
|
throw new TypeError("Handler must be a type of Function");
|
|
767
|
-
return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a =
|
|
767
|
+
return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a = Xt) : /^#[a-z0-9\-_]+$/i.test(e) ? (c = e.slice(1), a = Gt) : (c = e, a = Element.prototype.matches) : (c = null, a = Yt.bind(this)), i[t].push({
|
|
768
768
|
selector: e,
|
|
769
769
|
handler: n,
|
|
770
770
|
matcher: a,
|
|
@@ -789,11 +789,11 @@ E.prototype.off = function(t, e, n, o) {
|
|
|
789
789
|
E.prototype.handle = function(t) {
|
|
790
790
|
let e, n;
|
|
791
791
|
const o = t.type;
|
|
792
|
-
let r, i, a, c, s = [],
|
|
792
|
+
let r, i, a, c, s = [], u;
|
|
793
793
|
const l = "ftLabsDelegateIgnore";
|
|
794
794
|
if (t[l] === !0)
|
|
795
795
|
return;
|
|
796
|
-
switch (
|
|
796
|
+
switch (u = t.target, u.nodeType === 3 && (u = u.parentNode), u.correspondingUseElement && (u = u.correspondingUseElement), r = this.rootElement, i = t.eventPhase || (t.target !== t.currentTarget ? 3 : 2), i) {
|
|
797
797
|
case 1:
|
|
798
798
|
s = this.listenerMap[1][o];
|
|
799
799
|
break;
|
|
@@ -804,17 +804,17 @@ E.prototype.handle = function(t) {
|
|
|
804
804
|
s = this.listenerMap[0][o];
|
|
805
805
|
break;
|
|
806
806
|
}
|
|
807
|
-
let
|
|
808
|
-
for (n = s.length;
|
|
807
|
+
let f = [];
|
|
808
|
+
for (n = s.length; u && n; ) {
|
|
809
809
|
for (e = 0; e < n && (a = s[e], !!a); e++)
|
|
810
|
-
|
|
811
|
-
if (
|
|
810
|
+
u.tagName && ["button", "input", "select", "textarea"].indexOf(u.tagName.toLowerCase()) > -1 && u.hasAttribute("disabled") ? f = [] : a.matcher.call(u, a.matcherParam, u) && f.push([t, u, a]);
|
|
811
|
+
if (u === r || (n = s.length, u = u.parentElement || u.parentNode, u instanceof HTMLDocument))
|
|
812
812
|
break;
|
|
813
813
|
}
|
|
814
814
|
let d;
|
|
815
|
-
for (e = 0; e <
|
|
816
|
-
if (!(this._removedListeners.indexOf(
|
|
817
|
-
|
|
815
|
+
for (e = 0; e < f.length; e++)
|
|
816
|
+
if (!(this._removedListeners.indexOf(f[e][2]) > -1) && (c = this.fire.apply(this, f[e]), c === !1)) {
|
|
817
|
+
f[e][0][l] = !0, f[e][0].preventDefault(), d = !1;
|
|
818
818
|
break;
|
|
819
819
|
}
|
|
820
820
|
return d;
|
|
@@ -822,10 +822,10 @@ E.prototype.handle = function(t) {
|
|
|
822
822
|
E.prototype.fire = function(t, e, n) {
|
|
823
823
|
return n.handler.call(e, t, e);
|
|
824
824
|
};
|
|
825
|
-
function
|
|
825
|
+
function Xt(t, e) {
|
|
826
826
|
return t.toLowerCase() === e.tagName.toLowerCase();
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function Yt(t, e) {
|
|
829
829
|
return this.rootElement === window ? (
|
|
830
830
|
// Match the outer document (dispatched from document)
|
|
831
831
|
e === document || // The <html> element (dispatched from document.body or document.documentElement)
|
|
@@ -833,113 +833,113 @@ function te(t, e) {
|
|
|
833
833
|
e === window
|
|
834
834
|
) : this.rootElement === e;
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function Gt(t, e) {
|
|
837
837
|
return t === e.id;
|
|
838
838
|
}
|
|
839
839
|
E.prototype.destroy = function() {
|
|
840
840
|
this.off(), this.root();
|
|
841
841
|
};
|
|
842
|
-
const
|
|
842
|
+
const Zt = (t, e, n) => {
|
|
843
843
|
const o = Array.from(t.querySelectorAll(n)), r = o.findIndex((i) => i === e);
|
|
844
844
|
if (r !== -1)
|
|
845
845
|
return {
|
|
846
846
|
siblings: o.length,
|
|
847
847
|
position: r
|
|
848
848
|
};
|
|
849
|
-
},
|
|
849
|
+
}, lt = [
|
|
850
850
|
"nodeName",
|
|
851
851
|
"className",
|
|
852
852
|
"id",
|
|
853
853
|
"href",
|
|
854
854
|
"text",
|
|
855
855
|
"role"
|
|
856
|
-
],
|
|
856
|
+
], te = (t) => {
|
|
857
857
|
const e = {};
|
|
858
|
-
for (const n of
|
|
858
|
+
for (const n of lt) {
|
|
859
859
|
const o = t[n] || t.getAttribute(n) || t.hasAttribute(n);
|
|
860
|
-
o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] =
|
|
860
|
+
o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] = R(o));
|
|
861
861
|
}
|
|
862
862
|
return e;
|
|
863
|
-
},
|
|
863
|
+
}, ee = (t) => {
|
|
864
864
|
try {
|
|
865
865
|
const e = JSON.parse(t), n = Object.prototype.toString.call(e);
|
|
866
866
|
return [n === "[object Object]" || n === "[object Array]", e];
|
|
867
867
|
} catch {
|
|
868
868
|
return [!1, null];
|
|
869
869
|
}
|
|
870
|
-
},
|
|
871
|
-
const [e, n] =
|
|
870
|
+
}, ne = (t) => {
|
|
871
|
+
const [e, n] = ee(t);
|
|
872
872
|
return e ? n : t;
|
|
873
|
-
},
|
|
873
|
+
}, oe = (t, e) => (t.filter((n) => n.name.match(/^data-trackable|^data-o-|^aria-/i)).forEach((n) => {
|
|
874
874
|
e[n.name] = n.value;
|
|
875
|
-
}), e),
|
|
875
|
+
}), e), re = (t, e, n) => {
|
|
876
876
|
const o = {};
|
|
877
|
-
return n &&
|
|
877
|
+
return n && lt.forEach((r) => {
|
|
878
878
|
typeof e[r] < "u" && r !== "id" && (o[r] = e[r]);
|
|
879
879
|
}), t.filter((r) => r.name.match(/^data-trackable-context-/i)).forEach((r) => {
|
|
880
|
-
o[r.name.replace("data-trackable-context-", "")] =
|
|
880
|
+
o[r.name.replace("data-trackable-context-", "")] = ne(r.value);
|
|
881
881
|
}), o;
|
|
882
882
|
};
|
|
883
|
-
function
|
|
883
|
+
function dt(t) {
|
|
884
884
|
const e = document, n = t, o = n.getAttribute("data-trackable") ? `[data-trackable="${n.getAttribute("data-trackable")}"]` : n.nodeName, r = [], i = {};
|
|
885
885
|
for (; t && t !== e; ) {
|
|
886
|
-
const a =
|
|
887
|
-
let s =
|
|
886
|
+
const a = te(t), c = Array.from(t.attributes);
|
|
887
|
+
let s = oe(c, a);
|
|
888
888
|
s["data-trackable"] && (s = Object.assign(
|
|
889
889
|
s,
|
|
890
|
-
|
|
890
|
+
Zt(t, n, o)
|
|
891
891
|
)), r.push(s);
|
|
892
|
-
const
|
|
893
|
-
|
|
892
|
+
const u = re(c, a, t === n);
|
|
893
|
+
N(u, i), t = t.parentNode;
|
|
894
894
|
}
|
|
895
895
|
return { trace: r, customContext: i };
|
|
896
896
|
}
|
|
897
|
-
let
|
|
898
|
-
const
|
|
897
|
+
let J;
|
|
898
|
+
const ie = [
|
|
899
899
|
"ctrlKey",
|
|
900
900
|
"altKey",
|
|
901
901
|
"shiftKey",
|
|
902
902
|
"metaKey"
|
|
903
|
-
],
|
|
903
|
+
], se = (t) => {
|
|
904
904
|
const e = {};
|
|
905
|
-
for (const n of
|
|
905
|
+
for (const n of ie)
|
|
906
906
|
if (t[n])
|
|
907
907
|
try {
|
|
908
|
-
e[n] =
|
|
908
|
+
e[n] = R(t[n]);
|
|
909
909
|
} catch (o) {
|
|
910
910
|
console.log(o);
|
|
911
911
|
}
|
|
912
912
|
return e;
|
|
913
|
-
},
|
|
913
|
+
}, ae = (t) => (e, n) => {
|
|
914
914
|
if (n.getAttribute("data-o-tracking-do-not-track") === "true")
|
|
915
915
|
return;
|
|
916
|
-
const o =
|
|
917
|
-
o.domPathTokens = r, o.url = window.document.location.href || null, o.source_id = x.getRootID(),
|
|
916
|
+
const o = se(e), { trace: r, customContext: i } = dt(n);
|
|
917
|
+
o.domPathTokens = r, o.url = window.document.location.href || null, o.source_id = x.getRootID(), N(i, o), t.context = o;
|
|
918
918
|
const a = m(h("config"), t);
|
|
919
919
|
x.track(a);
|
|
920
|
-
},
|
|
920
|
+
}, ce = (t, e) => {
|
|
921
921
|
e = e || 'a, button, input, [role="button"]';
|
|
922
922
|
const n = {
|
|
923
923
|
action: "click",
|
|
924
924
|
category: t || "o-tracking"
|
|
925
925
|
};
|
|
926
|
-
|
|
926
|
+
J = J || new E(document.body), J.on("click", e, ae(n), !0);
|
|
927
927
|
const o = new b("clicks");
|
|
928
|
-
|
|
928
|
+
ht(o);
|
|
929
929
|
};
|
|
930
|
-
function
|
|
930
|
+
function ht(t) {
|
|
931
931
|
const e = t.shift();
|
|
932
|
-
e && x.track(e, () =>
|
|
932
|
+
e && x.track(e, () => ht(t));
|
|
933
933
|
}
|
|
934
|
-
const
|
|
935
|
-
init:
|
|
936
|
-
},
|
|
934
|
+
const ue = {
|
|
935
|
+
init: ce
|
|
936
|
+
}, fe = [
|
|
937
937
|
"componentContentId",
|
|
938
938
|
"type",
|
|
939
939
|
"subtype",
|
|
940
940
|
"component"
|
|
941
|
-
],
|
|
942
|
-
const { trace: o, customContext: r } =
|
|
941
|
+
], le = (t, e, n) => {
|
|
942
|
+
const { trace: o, customContext: r } = dt(e);
|
|
943
943
|
let i;
|
|
944
944
|
if (n.getContextData) {
|
|
945
945
|
if (typeof n.getContextData != "function")
|
|
@@ -947,11 +947,11 @@ const de = {
|
|
|
947
947
|
const a = n.getContextData(e);
|
|
948
948
|
if (typeof a != "object")
|
|
949
949
|
throw new Error("opts.getContextData function should return {object}");
|
|
950
|
-
i =
|
|
950
|
+
i = At(a, fe);
|
|
951
951
|
} else
|
|
952
952
|
i = {};
|
|
953
|
-
i.domPathTokens = o, i.url = window.document.location.href || null,
|
|
954
|
-
},
|
|
953
|
+
i.domPathTokens = o, i.url = window.document.location.href || null, N(r, i), t.context = i;
|
|
954
|
+
}, de = (t = {}) => {
|
|
955
955
|
if (!window.IntersectionObserver) {
|
|
956
956
|
console.warn('o-tracking: Unable to track component view events as "window.IntersectionObserver" is not supported.');
|
|
957
957
|
return;
|
|
@@ -966,39 +966,39 @@ const de = {
|
|
|
966
966
|
action: t.action || "view",
|
|
967
967
|
category: t.category || "component"
|
|
968
968
|
}, s = a.target;
|
|
969
|
-
|
|
969
|
+
le(c, s, t), x.track(c), r.unobserve(s);
|
|
970
970
|
}
|
|
971
971
|
});
|
|
972
972
|
}
|
|
973
973
|
const r = new IntersectionObserver(o, { threshold: [1] });
|
|
974
974
|
n.forEach((i) => r.observe(i));
|
|
975
|
-
},
|
|
976
|
-
init:
|
|
977
|
-
},
|
|
978
|
-
function
|
|
975
|
+
}, he = {
|
|
976
|
+
init: de
|
|
977
|
+
}, pe = M.init, me = T.init, W = "4.5.4", pt = "o-tracking";
|
|
978
|
+
function mt(t) {
|
|
979
979
|
let e = h("config") || {};
|
|
980
|
-
e = m(e, t), C("config", e), e.user && e.user.user_id &&
|
|
980
|
+
e = m(e, t), C("config", e), e.user && e.user.user_id && it(e.user.user_id);
|
|
981
981
|
}
|
|
982
|
-
function
|
|
983
|
-
k.initialised = !1,
|
|
982
|
+
function ge() {
|
|
983
|
+
k.initialised = !1, Q("config"), Q("page_sent");
|
|
984
984
|
}
|
|
985
|
-
function
|
|
986
|
-
return "oTracking version " +
|
|
985
|
+
function ye() {
|
|
986
|
+
return "oTracking version " + W;
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function we(t = {}) {
|
|
989
989
|
if (k.initialised)
|
|
990
990
|
return k;
|
|
991
|
-
if (!!
|
|
991
|
+
if (!!gt() && (t = be(t)), Object.keys(t).length === 0 && t.constructor === Object)
|
|
992
992
|
return null;
|
|
993
|
-
C("version",
|
|
993
|
+
C("version", W), C("source", pt), C("page_sent", !1);
|
|
994
994
|
const n = t ? t.cookieDomain : "";
|
|
995
|
-
return
|
|
995
|
+
return Pt("", n), mt(t), Lt(t.session), jt(), pe(), me(), k.initialised = !0, k;
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function gt() {
|
|
998
998
|
return document.querySelector("script[data-o-tracking-config]");
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const e =
|
|
1000
|
+
function be(t) {
|
|
1001
|
+
const e = gt();
|
|
1002
1002
|
let n;
|
|
1003
1003
|
if (e)
|
|
1004
1004
|
n = e.textContent || e.innerText || e.innerHTML;
|
|
@@ -1023,151 +1023,164 @@ const k = {
|
|
|
1023
1023
|
* @type {boolean}
|
|
1024
1024
|
*/
|
|
1025
1025
|
initialised: !1,
|
|
1026
|
-
version:
|
|
1027
|
-
updateConfig:
|
|
1028
|
-
source:
|
|
1029
|
-
destroy:
|
|
1030
|
-
toString:
|
|
1031
|
-
init:
|
|
1032
|
-
click:
|
|
1033
|
-
event:
|
|
1034
|
-
page:
|
|
1035
|
-
view:
|
|
1026
|
+
version: W,
|
|
1027
|
+
updateConfig: mt,
|
|
1028
|
+
source: pt,
|
|
1029
|
+
destroy: ge,
|
|
1030
|
+
toString: ye,
|
|
1031
|
+
init: we,
|
|
1032
|
+
click: ue,
|
|
1033
|
+
event: M,
|
|
1034
|
+
page: T,
|
|
1035
|
+
view: he,
|
|
1036
1036
|
getRootID: x.getRootID
|
|
1037
1037
|
};
|
|
1038
|
-
function
|
|
1039
|
-
k.init(), document.removeEventListener("o.DOMContentLoaded",
|
|
1038
|
+
function yt() {
|
|
1039
|
+
k.init(), document.removeEventListener("o.DOMContentLoaded", yt);
|
|
1040
1040
|
}
|
|
1041
|
-
typeof document < "u" && document.addEventListener("o.DOMContentLoaded",
|
|
1042
|
-
const
|
|
1041
|
+
typeof document < "u" && document.addEventListener("o.DOMContentLoaded", yt);
|
|
1042
|
+
const Ee = (t, e, n) => {
|
|
1043
1043
|
const o = Array.from(t.querySelectorAll(n)), r = o.findIndex((i) => i === e);
|
|
1044
1044
|
if (r !== -1)
|
|
1045
1045
|
return {
|
|
1046
1046
|
siblings: o.length,
|
|
1047
1047
|
position: r
|
|
1048
1048
|
};
|
|
1049
|
-
},
|
|
1049
|
+
}, wt = [
|
|
1050
1050
|
"nodeName",
|
|
1051
1051
|
"className",
|
|
1052
1052
|
"id",
|
|
1053
1053
|
"href",
|
|
1054
1054
|
"text",
|
|
1055
1055
|
"role"
|
|
1056
|
-
],
|
|
1056
|
+
], ve = (t) => {
|
|
1057
1057
|
const e = {};
|
|
1058
|
-
for (const n of
|
|
1058
|
+
for (const n of wt) {
|
|
1059
1059
|
const o = t[n] || t.getAttribute(n) || t.hasAttribute(n);
|
|
1060
|
-
o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] =
|
|
1060
|
+
o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] = R(o));
|
|
1061
1061
|
}
|
|
1062
1062
|
return e;
|
|
1063
|
-
},
|
|
1063
|
+
}, xe = (t) => {
|
|
1064
1064
|
try {
|
|
1065
1065
|
const e = JSON.parse(t), n = Object.prototype.toString.call(e);
|
|
1066
1066
|
return [n === "[object Object]" || n === "[object Array]", e];
|
|
1067
1067
|
} catch {
|
|
1068
1068
|
return [!1, null];
|
|
1069
1069
|
}
|
|
1070
|
-
},
|
|
1071
|
-
const [e, n] =
|
|
1070
|
+
}, ke = (t) => {
|
|
1071
|
+
const [e, n] = xe(t);
|
|
1072
1072
|
return e ? n : t;
|
|
1073
|
-
},
|
|
1073
|
+
}, Oe = (t, e) => (t.filter(
|
|
1074
1074
|
(n) => n.name.match(/^data-trackable|^data-o-|^aria-/i)
|
|
1075
1075
|
).forEach((n) => {
|
|
1076
1076
|
e[n.name] = n.value;
|
|
1077
|
-
}), e),
|
|
1077
|
+
}), e), Ce = (t, e, n) => {
|
|
1078
1078
|
const o = {};
|
|
1079
|
-
return n &&
|
|
1079
|
+
return n && wt.forEach((r) => {
|
|
1080
1080
|
typeof e[r] < "u" && r !== "id" && (o[r] = e[r]);
|
|
1081
1081
|
}), t.filter((r) => r.name.match(/^data-trackable-context-/i)).forEach((r) => {
|
|
1082
|
-
o[r.name.replace("data-trackable-context-", "")] =
|
|
1082
|
+
o[r.name.replace("data-trackable-context-", "")] = ke(r.value);
|
|
1083
1083
|
}), o;
|
|
1084
1084
|
};
|
|
1085
|
-
function
|
|
1085
|
+
function Se(t, e) {
|
|
1086
1086
|
const n = t, o = n.getAttribute("data-trackable") ? `[data-trackable="${n.getAttribute("data-trackable")}"]` : n.nodeName, r = [], i = {};
|
|
1087
1087
|
for (; t && t !== e; ) {
|
|
1088
|
-
const a =
|
|
1089
|
-
let s =
|
|
1088
|
+
const a = ve(t), c = Array.from(t.attributes);
|
|
1089
|
+
let s = Oe(c, a);
|
|
1090
1090
|
s["data-trackable"] && (s = Object.assign(
|
|
1091
1091
|
s,
|
|
1092
|
-
|
|
1092
|
+
Ee(t, n, o)
|
|
1093
1093
|
)), r.push(s);
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1094
|
+
const u = Ce(c, a, t === n);
|
|
1095
|
+
N(u, i), t = t.parentNode;
|
|
1096
1096
|
}
|
|
1097
1097
|
return { trace: r, customContext: i };
|
|
1098
1098
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
component: {
|
|
1131
|
-
id: S,
|
|
1132
|
-
name: S,
|
|
1099
|
+
const Ae = ["ctrlKey", "altKey", "shiftKey", "metaKey"];
|
|
1100
|
+
class Pe {
|
|
1101
|
+
constructor({
|
|
1102
|
+
id: e = "ccc-component",
|
|
1103
|
+
subtype: n = "interactive",
|
|
1104
|
+
teamName: o = "djd",
|
|
1105
|
+
shadowRoot: r = null,
|
|
1106
|
+
category: i = "cta",
|
|
1107
|
+
elements: a = 'a, button, input, [role="button"]'
|
|
1108
|
+
} = {}) {
|
|
1109
|
+
this.cccName = e, this.subtype = n, this.teamName = o, this.shadowRoot = r, this.category = i, this.elements = a, this.isInitialised = !1;
|
|
1110
|
+
}
|
|
1111
|
+
// Get properties for the event (as opposed to properties of the clicked element)
|
|
1112
|
+
getEventProperties(e) {
|
|
1113
|
+
const n = {};
|
|
1114
|
+
for (const o of Ae)
|
|
1115
|
+
if (e[o])
|
|
1116
|
+
try {
|
|
1117
|
+
n[o] = R(e[o]);
|
|
1118
|
+
} catch (r) {
|
|
1119
|
+
console.log(r);
|
|
1120
|
+
}
|
|
1121
|
+
return n;
|
|
1122
|
+
}
|
|
1123
|
+
// Controller for handling click events
|
|
1124
|
+
handleClickEvent(e, n) {
|
|
1125
|
+
return (o, r) => {
|
|
1126
|
+
const i = this.getEventProperties(o), { trace: a, customContext: c } = Se(r, n);
|
|
1127
|
+
i.custom = r.dataset && r.dataset.custom ? JSON.parse(r.dataset.custom) : null, i.domPathTokens = a, i.component = {
|
|
1128
|
+
id: this.cccName,
|
|
1129
|
+
name: this.cccName,
|
|
1133
1130
|
type: "custom-code-component",
|
|
1134
|
-
subtype:
|
|
1131
|
+
subtype: this.subtype
|
|
1132
|
+
}, i.teamName = this.teamName, N(c, i), e.context = i, e.method = "ftCustomAnalytics", document.body.dispatchEvent(
|
|
1133
|
+
new CustomEvent("oTracking.event", {
|
|
1134
|
+
detail: e,
|
|
1135
|
+
bubbles: !0,
|
|
1136
|
+
composed: !0
|
|
1137
|
+
})
|
|
1138
|
+
);
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
sendSpoorEvent(e, n) {
|
|
1142
|
+
const o = {
|
|
1143
|
+
category: "component",
|
|
1144
|
+
action: "act",
|
|
1145
|
+
context: {
|
|
1146
|
+
component: {
|
|
1147
|
+
id: this.cccName,
|
|
1148
|
+
name: this.cccName,
|
|
1149
|
+
type: "custom-code-component",
|
|
1150
|
+
subtype: this.subtype
|
|
1151
|
+
},
|
|
1152
|
+
teamName: this.teamName,
|
|
1153
|
+
trigger_action: e,
|
|
1154
|
+
custom: n
|
|
1135
1155
|
},
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
detail: n,
|
|
1145
|
-
bubbles: !0,
|
|
1146
|
-
composed: !0
|
|
1147
|
-
})
|
|
1148
|
-
);
|
|
1149
|
-
}
|
|
1150
|
-
function De(t, e, n, o) {
|
|
1151
|
-
if (!M.isInitialised) {
|
|
1152
|
-
M.isInitialised = !0, t && (S = t.id || S, T = t.subtype || T), k.init({ queue: !0, test: !0 });
|
|
1153
|
-
const r = o || 'a, button, input, [role="button"]', i = {
|
|
1154
|
-
action: "click",
|
|
1155
|
-
category: n || "cta"
|
|
1156
|
-
}, a = e == null ? void 0 : e.querySelector("#component-root");
|
|
1157
|
-
e && new w(a).on(
|
|
1158
|
-
"click",
|
|
1159
|
-
r,
|
|
1160
|
-
Le(i, a),
|
|
1161
|
-
!0
|
|
1156
|
+
method: "ftCustomAnalytics"
|
|
1157
|
+
};
|
|
1158
|
+
document.body.dispatchEvent(
|
|
1159
|
+
new CustomEvent("oTracking.event", {
|
|
1160
|
+
detail: o,
|
|
1161
|
+
bubbles: !0,
|
|
1162
|
+
composed: !0
|
|
1163
|
+
})
|
|
1162
1164
|
);
|
|
1163
1165
|
}
|
|
1166
|
+
init() {
|
|
1167
|
+
var e;
|
|
1168
|
+
if (!this.isInitialised) {
|
|
1169
|
+
this.isInitialised = !0, k.init({ queue: !0, test: !0 });
|
|
1170
|
+
const n = {
|
|
1171
|
+
action: "click",
|
|
1172
|
+
category: this.category
|
|
1173
|
+
}, o = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#component-root");
|
|
1174
|
+
this.shadowRoot && new w(o).on(
|
|
1175
|
+
"click",
|
|
1176
|
+
this.elements,
|
|
1177
|
+
this.handleClickEvent(n, o),
|
|
1178
|
+
!0
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1164
1182
|
}
|
|
1165
|
-
|
|
1166
|
-
init: De,
|
|
1167
|
-
isInitialised: !1,
|
|
1168
|
-
sendSpoorEvent: Ie
|
|
1169
|
-
};
|
|
1170
|
-
class Te extends HTMLElement {
|
|
1183
|
+
class Ne extends HTMLElement {
|
|
1171
1184
|
constructor() {
|
|
1172
1185
|
super(...arguments), this.RESERVED_ATTRS = /* @__PURE__ */ new Set([
|
|
1173
1186
|
"iframe",
|
|
@@ -1188,14 +1201,19 @@ class Te extends HTMLElement {
|
|
|
1188
1201
|
const e = this.shadowRoot ?? this.attachShadow({ mode: this.mode }), n = this.app, o = JSON.parse(this.getAttribute("data-component-props")), r = Object.fromEntries(
|
|
1189
1202
|
[...this.attributes].filter((s) => !this.RESERVED_ATTRS.has(s.name)).map((s) => [s.name, s.value])
|
|
1190
1203
|
);
|
|
1191
|
-
(c = this.shadowRoot) == null || c.replaceChildren()
|
|
1204
|
+
(c = this.shadowRoot) == null || c.replaceChildren(), this.tracking = new Pe({
|
|
1205
|
+
id: `${this.getAttribute("path")}@${this.getAttribute("version")}`,
|
|
1206
|
+
subtype: "interactive",
|
|
1207
|
+
teamName: "djd",
|
|
1208
|
+
shadowRoot: this.shadowRoot
|
|
1209
|
+
});
|
|
1192
1210
|
const { unmount: i, onmessage: a } = n(
|
|
1193
1211
|
e,
|
|
1194
1212
|
{
|
|
1195
1213
|
...r,
|
|
1196
1214
|
data: o,
|
|
1197
1215
|
port: this.channel.port2,
|
|
1198
|
-
tracking:
|
|
1216
|
+
tracking: this.tracking
|
|
1199
1217
|
},
|
|
1200
1218
|
...this.children
|
|
1201
1219
|
) || {};
|
|
@@ -1212,8 +1230,8 @@ class Te extends HTMLElement {
|
|
|
1212
1230
|
if (!(!i || !a || !c)) {
|
|
1213
1231
|
this.source = r ? `http://localhost:5173/src/${i}/index.jsx` : `https://www.ft.com/__component/${c}/${a}${n ? `@${n}` : "@latest"}/${i}/${i}.js`;
|
|
1214
1232
|
try {
|
|
1215
|
-
this.app = await new Promise((
|
|
1216
|
-
const
|
|
1233
|
+
this.app = await new Promise((u, l) => {
|
|
1234
|
+
const f = setTimeout(() => {
|
|
1217
1235
|
this.dispatchEvent(
|
|
1218
1236
|
new CustomEvent("ccc-timeout", {
|
|
1219
1237
|
bubbles: !0,
|
|
@@ -1231,17 +1249,17 @@ class Te extends HTMLElement {
|
|
|
1231
1249
|
/* @vite-ignore */
|
|
1232
1250
|
).then(({ default: d }) => {
|
|
1233
1251
|
if (d)
|
|
1234
|
-
clearTimeout(
|
|
1252
|
+
clearTimeout(f), u(d);
|
|
1235
1253
|
else
|
|
1236
|
-
throw new
|
|
1254
|
+
throw new D(
|
|
1237
1255
|
"No component renderer default export found"
|
|
1238
1256
|
);
|
|
1239
|
-
}).catch((d) => l(new
|
|
1257
|
+
}).catch((d) => l(new D(d)));
|
|
1240
1258
|
});
|
|
1241
|
-
} catch (
|
|
1259
|
+
} catch (u) {
|
|
1242
1260
|
console.error(
|
|
1243
1261
|
`<custom-code-component> error during import from ${e}@${n}`
|
|
1244
|
-
), delete this.dataset.cccReady, this.dataset.cccError = "import-failure", this.dispatchEvent(new ErrorEvent("error",
|
|
1262
|
+
), delete this.dataset.cccReady, this.dataset.cccError = "import-failure", this.dispatchEvent(new ErrorEvent("error", u)), console.error(u);
|
|
1245
1263
|
return;
|
|
1246
1264
|
}
|
|
1247
1265
|
try {
|
|
@@ -1255,23 +1273,17 @@ class Te extends HTMLElement {
|
|
|
1255
1273
|
}
|
|
1256
1274
|
})
|
|
1257
1275
|
), this.dataset.cccReady = "true", delete this.dataset.cccError;
|
|
1258
|
-
} catch (
|
|
1276
|
+
} catch (u) {
|
|
1259
1277
|
console.info(
|
|
1260
1278
|
`<custom-code-component> uncaught error during mount from ${e}@${n}`
|
|
1261
|
-
), console.error(
|
|
1279
|
+
), console.error(u), this.dispatchEvent(new ErrorEvent("error", u)), this.dataset.cccError = "mount-error", delete this.dataset.cccReady;
|
|
1262
1280
|
}
|
|
1263
1281
|
try {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
id: this.getAttribute("path"),
|
|
1267
|
-
subtype: "interactive"
|
|
1268
|
-
},
|
|
1269
|
-
this.shadowRoot
|
|
1270
|
-
);
|
|
1271
|
-
} catch (f) {
|
|
1282
|
+
this.tracking.init();
|
|
1283
|
+
} catch (u) {
|
|
1272
1284
|
console.info(
|
|
1273
1285
|
`Error initialising tracking on <custom-code-component> ${e}@${n}`
|
|
1274
|
-
), console.error(
|
|
1286
|
+
), console.error(u);
|
|
1275
1287
|
}
|
|
1276
1288
|
}
|
|
1277
1289
|
}
|
|
@@ -1286,13 +1298,13 @@ class Te extends HTMLElement {
|
|
|
1286
1298
|
this.channel.port1.postMessage(e);
|
|
1287
1299
|
}
|
|
1288
1300
|
}
|
|
1289
|
-
const
|
|
1290
|
-
customElements && !customElements.get("custom-code-component") &&
|
|
1291
|
-
class
|
|
1301
|
+
const _e = () => customElements.define("custom-code-component", Ne);
|
|
1302
|
+
customElements && !customElements.get("custom-code-component") && _e();
|
|
1303
|
+
class D extends Error {
|
|
1292
1304
|
constructor(...e) {
|
|
1293
|
-
super(...e), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
1305
|
+
super(...e), Error.captureStackTrace && Error.captureStackTrace(this, D), this.name = "CCCImportError";
|
|
1294
1306
|
}
|
|
1295
1307
|
}
|
|
1296
1308
|
export {
|
|
1297
|
-
|
|
1309
|
+
_e as init
|
|
1298
1310
|
};
|