@streamlayer/react 1.21.4 → 1.22.2
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/lib/app/masters.d.ts +2 -5
- package/lib/app/pause-ad.d.ts +1 -10
- package/lib/app/useStreamLayerApp.d.ts +1 -23
- package/lib/cjs/Question.js +1 -0
- package/lib/cjs/advertisement.js +40 -40
- package/lib/cjs/analytics.js +1 -0
- package/lib/cjs/auth.js +1 -1
- package/lib/cjs/bet-pack.js +1 -1
- package/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/hooks-B0Qttldg.js +1 -0
- package/lib/cjs/index-DSi8Qgfs.js +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index10.js +1 -0
- package/lib/cjs/index11.js +4 -0
- package/lib/cjs/index12.js +1 -0
- package/lib/cjs/index13.js +1 -0
- package/lib/cjs/index14.js +1 -0
- package/lib/cjs/index15.js +1 -0
- package/lib/cjs/index16.js +5 -0
- package/lib/cjs/index2.js +1 -5
- package/lib/cjs/index3.js +1 -0
- package/lib/cjs/index4.js +5 -0
- package/lib/cjs/index5.js +1 -0
- package/lib/cjs/index6.js +1 -0
- package/lib/cjs/index7.js +5 -0
- package/lib/cjs/index8.js +1 -0
- package/lib/cjs/index9.js +1 -0
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +6 -6
- package/lib/cjs/notification.js +1 -1
- package/lib/cjs/pause-ad.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/sl-types.js +15 -0
- package/lib/cjs/storage.js +1 -0
- package/lib/cjs/theme.js +17 -0
- package/lib/cjs/useStreamLayerApp.js +1 -1
- package/lib/cjs/useStreamLayerApp2.js +9 -9
- package/lib/cjs/utils.js +47 -0
- package/lib/cjs/vast-client.min.js +1 -0
- package/lib/classic/app/masters.d.ts +2 -5
- package/lib/classic/app/pause-ad.d.ts +1 -10
- package/lib/classic/app/useStreamLayerApp.d.ts +1 -23
- package/lib/classic/cjs/Question.js +1 -0
- package/lib/classic/cjs/advertisement.js +40 -40
- package/lib/classic/cjs/analytics.js +1 -0
- package/lib/classic/cjs/auth.js +1 -1
- package/lib/classic/cjs/bet-pack.js +4 -4
- package/lib/classic/cjs/gamification-feature.js +1 -1
- package/lib/classic/cjs/hooks-B0Qttldg.js +1 -0
- package/lib/classic/cjs/index-DSi8Qgfs.js +1 -0
- package/lib/classic/cjs/index.js +1 -1
- package/lib/classic/cjs/index10.js +1 -0
- package/lib/classic/cjs/index11.js +1 -0
- package/lib/classic/cjs/index12.js +1 -0
- package/lib/classic/cjs/index13.js +4 -0
- package/lib/classic/cjs/index2.js +5 -0
- package/lib/classic/cjs/index3.js +1 -0
- package/lib/classic/cjs/index4.js +1 -0
- package/lib/classic/cjs/index5.js +1 -0
- package/lib/classic/cjs/index6.js +5 -0
- package/lib/classic/cjs/index7.js +1 -0
- package/lib/classic/cjs/index8.js +1 -0
- package/lib/classic/cjs/index9.js +1 -0
- package/lib/classic/cjs/insight.js +1 -1
- package/lib/classic/cjs/notification.js +1 -1
- package/lib/classic/cjs/notification2.js +1 -0
- package/lib/classic/cjs/pause-ad.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/sl-types.js +15 -0
- package/lib/classic/cjs/useStreamLayerApp.js +1 -1
- package/lib/classic/cjs/useStreamLayerApp2.js +9 -9
- package/lib/classic/cjs/utils.js +47 -0
- package/lib/classic/cjs/vast-client.min.js +1 -0
- package/lib/classic/es/Question.js +392 -0
- package/lib/classic/es/advertisement.js +10375 -10374
- package/lib/classic/es/analytics.js +28 -0
- package/lib/classic/es/auth.js +4 -4
- package/lib/classic/es/bet-pack.js +56 -51
- package/lib/classic/es/gamification-feature.js +1 -1
- package/lib/classic/es/hooks-B0Qttldg.js +98 -0
- package/lib/classic/es/index-DSi8Qgfs.js +65 -0
- package/lib/classic/es/index.js +14 -15
- package/lib/classic/es/index10.js +87 -0
- package/lib/classic/es/index11.js +2361 -0
- package/lib/classic/es/index12.js +183 -0
- package/lib/classic/es/index13.js +835 -0
- package/lib/classic/es/index2.js +2621 -0
- package/lib/classic/es/index3.js +64 -0
- package/lib/classic/es/index4.js +19 -0
- package/lib/classic/es/index5.js +285 -0
- package/lib/classic/es/{index-l-eyvmpL.js → index6.js} +937 -937
- package/lib/classic/es/index7.js +7 -0
- package/lib/classic/es/index8.js +11 -0
- package/lib/classic/es/index9.js +319 -0
- package/lib/classic/es/insight.js +31 -32
- package/lib/classic/es/notification.js +7 -1006
- package/lib/classic/es/notification2.js +1117 -0
- package/lib/classic/es/pause-ad.js +139 -138
- package/lib/classic/es/points.js +39 -38
- package/lib/classic/es/sl-types.js +258 -0
- package/lib/classic/es/useStreamLayerApp.js +1 -2
- package/lib/classic/es/useStreamLayerApp2.js +2400 -2283
- package/lib/classic/es/utils.js +76 -0
- package/lib/{es/vast-client.min-B0NUra1B.js → classic/es/vast-client.min.js} +338 -338
- package/lib/classic/index.d.ts +5 -13
- package/lib/classic/masters.d.ts +1 -1
- package/lib/dist/cjs/index.js +1 -1
- package/lib/dist/cjs/masters.js +30 -30
- package/lib/dist/es/index.js +2 -2
- package/lib/dist/es/masters.js +5813 -6063
- package/lib/dist/index.d.ts +1332 -0
- package/lib/dist/style.css +1 -1
- package/lib/es/Question.js +136 -0
- package/lib/es/advertisement.js +10375 -10374
- package/lib/es/analytics.js +28 -0
- package/lib/es/auth.js +4 -4
- package/lib/es/bet-pack.js +7 -6
- package/lib/es/gamification-feature.js +1 -1
- package/lib/es/hooks-B0Qttldg.js +98 -0
- package/lib/es/index-DSi8Qgfs.js +65 -0
- package/lib/es/index.js +13 -14
- package/lib/es/index10.js +267 -0
- package/lib/es/index11.js +835 -0
- package/lib/es/index12.js +183 -0
- package/lib/es/index13.js +319 -0
- package/lib/es/index14.js +87 -0
- package/lib/es/index15.js +2355 -0
- package/lib/es/index16.js +1254 -0
- package/lib/es/index2.js +1349 -3363
- package/lib/es/index3.js +64 -0
- package/lib/es/index4.js +3418 -0
- package/lib/es/index5.js +19 -0
- package/lib/es/index6.js +285 -0
- package/lib/es/{index-l-eyvmpL.js → index7.js} +937 -937
- package/lib/es/index8.js +7 -0
- package/lib/es/index9.js +11 -0
- package/lib/es/insight.js +31 -32
- package/lib/es/masters.js +6 -5
- package/lib/es/masters2.js +189 -176
- package/lib/es/notification.js +124 -119
- package/lib/es/pause-ad.js +140 -139
- package/lib/es/points.js +40 -38
- package/lib/es/sl-types.js +277 -0
- package/lib/es/storage.js +113 -0
- package/lib/es/theme.js +47 -0
- package/lib/es/useStreamLayerApp.js +1 -2
- package/lib/es/useStreamLayerApp2.js +2399 -2282
- package/lib/es/utils.js +76 -0
- package/lib/{classic/es/vast-client.min-B0NUra1B.js → es/vast-client.min.js} +338 -338
- package/lib/index.d.ts +5 -13
- package/lib/masters.d.ts +1 -1
- package/lib/style.css +1 -1
- package/package.json +13 -48
- package/lib/app/event.d.ts +0 -6
- package/lib/app/provider.d.ts +0 -49
- package/lib/cjs/index-l-eyvmpL.js +0 -5
- package/lib/cjs/provider.js +0 -84
- package/lib/cjs/vast-client.min-B0NUra1B.js +0 -1
- package/lib/classic/app/event.d.ts +0 -6
- package/lib/classic/app/provider.d.ts +0 -49
- package/lib/classic/cjs/index-l-eyvmpL.js +0 -5
- package/lib/classic/cjs/provider.js +0 -68
- package/lib/classic/cjs/vast-client.min-B0NUra1B.js +0 -1
- package/lib/classic/es/provider.js +0 -7617
- package/lib/dist/cjs/gamification-feature2.js +0 -1
- package/lib/dist/es/gamification-feature2.js +0 -285
- package/lib/es/provider.js +0 -7693
|
@@ -1,210 +1,210 @@
|
|
|
1
1
|
function N() {
|
|
2
|
-
let
|
|
3
|
-
return { id:
|
|
2
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3
|
+
return { id: i.id || null, adId: i.adId || null, sequence: i.sequence || null, apiFramework: i.apiFramework || null, universalAdIds: [], creativeExtensions: [] };
|
|
4
4
|
}
|
|
5
5
|
const G = ["ADCATEGORIES", "ADCOUNT", "ADPLAYHEAD", "ADSERVINGID", "ADTYPE", "APIFRAMEWORKS", "APPBUNDLE", "ASSETURI", "BLOCKEDADCATEGORIES", "BREAKMAXADLENGTH", "BREAKMAXADS", "BREAKMAXDURATION", "BREAKMINADLENGTH", "BREAKMINDURATION", "BREAKPOSITION", "CLICKPOS", "CLICKTYPE", "CLIENTUA", "CONTENTID", "CONTENTPLAYHEAD", "CONTENTURI", "DEVICEIP", "DEVICEUA", "DOMAIN", "EXTENSIONS", "GDPRCONSENT", "IFA", "IFATYPE", "INVENTORYSTATE", "LATLONG", "LIMITADTRACKING", "MEDIAMIME", "MEDIAPLAYHEAD", "OMIDPARTNER", "PAGEURL", "PLACEMENTTYPE", "PLAYERCAPABILITIES", "PLAYERSIZE", "PLAYERSTATE", "PODSEQUENCE", "REGULATIONS", "SERVERSIDE", "SERVERUA", "TRANSACTIONID", "UNIVERSALADID", "VASTVERSIONS", "VERIFICATIONVENDORS"];
|
|
6
|
-
function w(
|
|
6
|
+
function w(i) {
|
|
7
7
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8
|
-
const r = [],
|
|
8
|
+
const r = [], a = M(i);
|
|
9
9
|
!e.ERRORCODE || t.isCustomCode || /^[0-9]{3}$/.test(e.ERRORCODE) || (e.ERRORCODE = 900), e.CACHEBUSTING = q(Math.round(1e8 * Math.random())), e.TIMESTAMP = (/* @__PURE__ */ new Date()).toISOString(), e.RANDOM = e.random = e.CACHEBUSTING;
|
|
10
|
-
for (const
|
|
11
|
-
for (const
|
|
12
|
-
const o = s
|
|
10
|
+
for (const s in e) e[s] = j(e[s]);
|
|
11
|
+
for (const s in a) {
|
|
12
|
+
const o = a[s];
|
|
13
13
|
typeof o == "string" && r.push(B(o, e));
|
|
14
14
|
}
|
|
15
15
|
return r;
|
|
16
16
|
}
|
|
17
|
-
function B(
|
|
18
|
-
const t = (
|
|
19
|
-
if (!t) return
|
|
20
|
-
let r = t.filter((
|
|
21
|
-
return r.length === 0 ?
|
|
17
|
+
function B(i, e) {
|
|
18
|
+
const t = (i = L(i, e)).match(/[^[\]]+(?=])/g);
|
|
19
|
+
if (!t) return i;
|
|
20
|
+
let r = t.filter((a) => G.indexOf(a) > -1);
|
|
21
|
+
return r.length === 0 ? i : (r = r.reduce((a, s) => (a[s] = -1, a), {}), L(i, r));
|
|
22
22
|
}
|
|
23
|
-
function L(
|
|
24
|
-
let t =
|
|
23
|
+
function L(i, e) {
|
|
24
|
+
let t = i;
|
|
25
25
|
for (const r in e) {
|
|
26
|
-
const
|
|
27
|
-
t = t.replace(new RegExp("(?:\\[|%%)(".concat(r, ")(?:\\]|%%)"), "g"),
|
|
26
|
+
const a = e[r];
|
|
27
|
+
t = t.replace(new RegExp("(?:\\[|%%)(".concat(r, ")(?:\\]|%%)"), "g"), a);
|
|
28
28
|
}
|
|
29
29
|
return t;
|
|
30
30
|
}
|
|
31
|
-
function M(
|
|
32
|
-
return Array.isArray(
|
|
31
|
+
function M(i) {
|
|
32
|
+
return Array.isArray(i) ? i.map((e) => e && e.hasOwnProperty("url") ? e.url : e) : i;
|
|
33
33
|
}
|
|
34
|
-
function C(
|
|
35
|
-
return /^(https?:\/\/|\/\/)/.test(
|
|
34
|
+
function C(i) {
|
|
35
|
+
return /^(https?:\/\/|\/\/)/.test(i);
|
|
36
36
|
}
|
|
37
|
-
function U(
|
|
38
|
-
for (let t = 0; t < e.length; t++) if (W(e[t],
|
|
37
|
+
function U(i, e) {
|
|
38
|
+
for (let t = 0; t < e.length; t++) if (W(e[t], i)) return !0;
|
|
39
39
|
return !1;
|
|
40
40
|
}
|
|
41
|
-
function W(
|
|
42
|
-
if (
|
|
43
|
-
const t = Object.getOwnPropertyNames(
|
|
44
|
-
return t.length === r.length &&
|
|
41
|
+
function W(i, e) {
|
|
42
|
+
if (i && e) {
|
|
43
|
+
const t = Object.getOwnPropertyNames(i), r = Object.getOwnPropertyNames(e);
|
|
44
|
+
return t.length === r.length && i.id === e.id && i.url === e.url;
|
|
45
45
|
}
|
|
46
46
|
return !1;
|
|
47
47
|
}
|
|
48
|
-
function j(
|
|
49
|
-
return encodeURIComponent(
|
|
48
|
+
function j(i) {
|
|
49
|
+
return encodeURIComponent(i).replace(/[!'()*]/g, (e) => "%".concat(e.charCodeAt(0).toString(16)));
|
|
50
50
|
}
|
|
51
|
-
function q(
|
|
51
|
+
function q(i) {
|
|
52
52
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
53
|
-
return
|
|
53
|
+
return i.toString().padStart(e, "0");
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
w(
|
|
55
|
+
const f = { track: function(i, e, t) {
|
|
56
|
+
w(i, e, t).forEach((r) => {
|
|
57
57
|
typeof window < "u" && window !== null && (new Image().src = r);
|
|
58
58
|
});
|
|
59
|
-
}, resolveURLTemplates: w, extractURLsFromTemplates: M, filterUrlTemplates: function(
|
|
60
|
-
return
|
|
59
|
+
}, resolveURLTemplates: w, extractURLsFromTemplates: M, filterUrlTemplates: function(i) {
|
|
60
|
+
return i.reduce((e, t) => {
|
|
61
61
|
const r = t.url || t;
|
|
62
62
|
return C(r) ? e.validUrls.push(r) : e.invalidUrls.push(r), e;
|
|
63
63
|
}, { validUrls: [], invalidUrls: [] });
|
|
64
|
-
}, containsTemplateObject: U, isTemplateObjectEqual: W, encodeURIComponentRFC3986: j, replaceUrlMacros: B, isNumeric: function(
|
|
65
|
-
return !isNaN(parseFloat(
|
|
66
|
-
}, flatten: function
|
|
67
|
-
return e.reduce((t, r) => t.concat(Array.isArray(r) ?
|
|
64
|
+
}, containsTemplateObject: U, isTemplateObjectEqual: W, encodeURIComponentRFC3986: j, replaceUrlMacros: B, isNumeric: function(i) {
|
|
65
|
+
return !isNaN(parseFloat(i)) && isFinite(i);
|
|
66
|
+
}, flatten: function i(e) {
|
|
67
|
+
return e.reduce((t, r) => t.concat(Array.isArray(r) ? i(r) : r), []);
|
|
68
68
|
}, joinArrayOfUniqueTemplateObjs: function() {
|
|
69
|
-
let
|
|
70
|
-
const t = Array.isArray(
|
|
71
|
-
return t.concat(r).reduce((
|
|
72
|
-
}, isValidTimeValue: function(
|
|
73
|
-
return Number.isFinite(
|
|
69
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
70
|
+
const t = Array.isArray(i) ? i : [], r = Array.isArray(e) ? e : [];
|
|
71
|
+
return t.concat(r).reduce((a, s) => (U(s, a) || a.push(s), a), []);
|
|
72
|
+
}, isValidTimeValue: function(i) {
|
|
73
|
+
return Number.isFinite(i) && i >= -2;
|
|
74
74
|
}, addLeadingZeros: q, isValidUrl: C, isBrowserEnvironment: function() {
|
|
75
75
|
return typeof window < "u";
|
|
76
|
-
}, formatMacrosValues: function(
|
|
77
|
-
return typeof
|
|
76
|
+
}, formatMacrosValues: function(i) {
|
|
77
|
+
return typeof i != "object" ? i : JSON.stringify(i);
|
|
78
78
|
} };
|
|
79
|
-
function I(
|
|
80
|
-
return ["true", "TRUE", "True", "1"].includes(
|
|
79
|
+
function I(i) {
|
|
80
|
+
return ["true", "TRUE", "True", "1"].includes(i);
|
|
81
81
|
}
|
|
82
|
-
function Y(
|
|
83
|
-
if (
|
|
84
|
-
if (
|
|
85
|
-
const e =
|
|
82
|
+
function Y(i) {
|
|
83
|
+
if (i == null) return -1;
|
|
84
|
+
if (f.isNumeric(i)) return parseInt(i);
|
|
85
|
+
const e = i.split(":");
|
|
86
86
|
if (e.length !== 3) return -1;
|
|
87
87
|
const t = e[2].split(".");
|
|
88
88
|
let r = parseInt(t[0]);
|
|
89
89
|
t.length === 2 && (r += parseFloat("0.".concat(t[1])));
|
|
90
|
-
const
|
|
91
|
-
return isNaN(
|
|
90
|
+
const a = parseInt(60 * e[1]), s = parseInt(60 * e[0] * 60);
|
|
91
|
+
return isNaN(s) || isNaN(a) || isNaN(r) || a > 3600 || r > 60 ? -1 : s + a + r;
|
|
92
92
|
}
|
|
93
|
-
const l = { childByName: function(
|
|
94
|
-
return Array.from(
|
|
95
|
-
}, childrenByName: function(
|
|
96
|
-
return Array.from(
|
|
97
|
-
}, resolveVastAdTagURI: function(
|
|
98
|
-
if (!e) return
|
|
99
|
-
if (
|
|
93
|
+
const l = { childByName: function(i, e) {
|
|
94
|
+
return Array.from(i.childNodes).find((t) => t.nodeName === e);
|
|
95
|
+
}, childrenByName: function(i, e) {
|
|
96
|
+
return Array.from(i.childNodes).filter((t) => t.nodeName === e);
|
|
97
|
+
}, resolveVastAdTagURI: function(i, e) {
|
|
98
|
+
if (!e) return i;
|
|
99
|
+
if (i.startsWith("//")) {
|
|
100
100
|
const { protocol: t } = location;
|
|
101
|
-
return "".concat(t).concat(
|
|
101
|
+
return "".concat(t).concat(i);
|
|
102
102
|
}
|
|
103
|
-
if (!
|
|
103
|
+
if (!i.includes("://")) {
|
|
104
104
|
const t = e.slice(0, e.lastIndexOf("/"));
|
|
105
|
-
return "".concat(t, "/").concat(
|
|
106
|
-
}
|
|
107
|
-
return
|
|
108
|
-
}, parseBoolean: I, parseNodeText: function(
|
|
109
|
-
return
|
|
110
|
-
}, copyNodeAttribute: function(
|
|
111
|
-
const r = e.getAttribute(
|
|
112
|
-
r && t.setAttribute(
|
|
113
|
-
}, parseAttributes: function(
|
|
114
|
-
return Array.from(
|
|
105
|
+
return "".concat(t, "/").concat(i);
|
|
106
|
+
}
|
|
107
|
+
return i;
|
|
108
|
+
}, parseBoolean: I, parseNodeText: function(i) {
|
|
109
|
+
return i && (i.textContent || i.text || "").trim();
|
|
110
|
+
}, copyNodeAttribute: function(i, e, t) {
|
|
111
|
+
const r = e.getAttribute(i);
|
|
112
|
+
r && t.setAttribute(i, r);
|
|
113
|
+
}, parseAttributes: function(i) {
|
|
114
|
+
return Array.from(i.attributes).reduce((e, t) => (e[t.nodeName] = t.nodeValue, e), {});
|
|
115
115
|
}, parseDuration: Y, getStandAloneAds: function() {
|
|
116
|
-
return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).filter((
|
|
116
|
+
return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).filter((i) => !parseInt(i.sequence, 10));
|
|
117
117
|
}, getSortedAdPods: function() {
|
|
118
|
-
return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).filter((
|
|
119
|
-
}, assignAttributes: function(
|
|
120
|
-
|
|
121
|
-
let { nodeName: r, nodeValue:
|
|
122
|
-
if (r &&
|
|
123
|
-
let
|
|
124
|
-
typeof e[r] == "boolean" && (
|
|
118
|
+
return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).filter((i) => parseInt(i.sequence, 10)).sort((i, e) => i.sequence - e.sequence);
|
|
119
|
+
}, assignAttributes: function(i, e) {
|
|
120
|
+
i && Array.from(i).forEach((t) => {
|
|
121
|
+
let { nodeName: r, nodeValue: a } = t;
|
|
122
|
+
if (r && a && e.hasOwnProperty(r)) {
|
|
123
|
+
let s = a;
|
|
124
|
+
typeof e[r] == "boolean" && (s = I(s)), e[r] = s;
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
}, mergeWrapperAdData: function(
|
|
127
|
+
}, mergeWrapperAdData: function(i, e) {
|
|
128
128
|
var t;
|
|
129
|
-
|
|
130
|
-
const r = (e.creatives || []).filter((n) => n && n.type === "companion"),
|
|
129
|
+
i.errorURLTemplates = e.errorURLTemplates.concat(i.errorURLTemplates), i.impressionURLTemplates = e.impressionURLTemplates.concat(i.impressionURLTemplates), i.extensions = e.extensions.concat(i.extensions), e.viewableImpression.length > 0 && (i.viewableImpression = [...i.viewableImpression, ...e.viewableImpression]), i.followAdditionalWrappers = e.followAdditionalWrappers, i.allowMultipleAds = e.allowMultipleAds, i.fallbackOnNoAd = e.fallbackOnNoAd;
|
|
130
|
+
const r = (e.creatives || []).filter((n) => n && n.type === "companion"), a = r.reduce((n, c) => ((c.variations || []).forEach((u) => {
|
|
131
131
|
(u.companionClickTrackingURLTemplates || []).forEach((d) => {
|
|
132
|
-
|
|
132
|
+
f.containsTemplateObject(d, n) || n.push(d);
|
|
133
133
|
});
|
|
134
134
|
}), n), []);
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
135
|
+
i.creatives = r.concat(i.creatives);
|
|
136
|
+
const s = e.videoClickTrackingURLTemplates && e.videoClickTrackingURLTemplates.length, o = e.videoCustomClickURLTemplates && e.videoCustomClickURLTemplates.length;
|
|
137
|
+
if (i.creatives.forEach((n) => {
|
|
138
138
|
if (e.trackingEvents && e.trackingEvents[n.type]) for (const c in e.trackingEvents[n.type]) {
|
|
139
139
|
const u = e.trackingEvents[n.type][c];
|
|
140
140
|
Array.isArray(n.trackingEvents[c]) || (n.trackingEvents[c] = []), n.trackingEvents[c] = n.trackingEvents[c].concat(u);
|
|
141
141
|
}
|
|
142
|
-
n.type === "linear" && (
|
|
143
|
-
c.companionClickTrackingURLTemplates =
|
|
142
|
+
n.type === "linear" && (s && (n.videoClickTrackingURLTemplates = n.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)), o && (n.videoCustomClickURLTemplates = n.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)), !e.videoClickThroughURLTemplate || n.videoClickThroughURLTemplate !== null && n.videoClickThroughURLTemplate !== void 0 || (n.videoClickThroughURLTemplate = e.videoClickThroughURLTemplate)), n.type === "companion" && a.length && (n.variations || []).forEach((c) => {
|
|
143
|
+
c.companionClickTrackingURLTemplates = f.joinArrayOfUniqueTemplateObjs(c.companionClickTrackingURLTemplates, a);
|
|
144
144
|
});
|
|
145
|
-
}), e.adVerifications && (
|
|
145
|
+
}), e.adVerifications && (i.adVerifications = i.adVerifications.concat(e.adVerifications)), e.blockedAdCategories && (i.blockedAdCategories = i.blockedAdCategories.concat(e.blockedAdCategories)), (t = e.creatives) !== null && t !== void 0 && t.length) {
|
|
146
146
|
const n = e.creatives.filter((c) => {
|
|
147
147
|
var u;
|
|
148
148
|
return ((u = c.icons) === null || u === void 0 ? void 0 : u.length) && !c.mediaFiles.length;
|
|
149
149
|
});
|
|
150
|
-
n.length && (
|
|
150
|
+
n.length && (i.creatives = i.creatives.concat(n));
|
|
151
151
|
}
|
|
152
152
|
} };
|
|
153
|
-
function Q(
|
|
153
|
+
function Q(i, e) {
|
|
154
154
|
const t = function() {
|
|
155
155
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
156
|
-
const { id:
|
|
157
|
-
return { id:
|
|
156
|
+
const { id: a, adId: s, sequence: o, apiFramework: n } = N(r);
|
|
157
|
+
return { id: a, adId: s, sequence: o, apiFramework: n, type: "companion", required: null, variations: [] };
|
|
158
158
|
}(e);
|
|
159
|
-
return t.required =
|
|
160
|
-
const
|
|
159
|
+
return t.required = i.getAttribute("required") || null, t.variations = l.childrenByName(i, "Companion").map((r) => {
|
|
160
|
+
const a = function() {
|
|
161
161
|
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
162
162
|
return { id: n.id || null, adType: "companionAd", width: n.width || 0, height: n.height || 0, assetWidth: n.assetWidth || null, assetHeight: n.assetHeight || null, expandedWidth: n.expandedWidth || null, expandedHeight: n.expandedHeight || null, apiFramework: n.apiFramework || null, adSlotId: n.adSlotId || null, pxratio: n.pxratio || "1", renderingMode: n.renderingMode || "default", staticResources: [], htmlResources: [], iframeResources: [], adParameters: null, altText: null, companionClickThroughURLTemplate: null, companionClickTrackingURLTemplates: [], trackingEvents: {} };
|
|
163
163
|
}(l.parseAttributes(r));
|
|
164
|
-
|
|
164
|
+
a.htmlResources = l.childrenByName(r, "HTMLResource").reduce((n, c) => {
|
|
165
165
|
const u = l.parseNodeText(c);
|
|
166
166
|
return u ? n.concat(u) : n;
|
|
167
|
-
}, []),
|
|
167
|
+
}, []), a.iframeResources = l.childrenByName(r, "IFrameResource").reduce((n, c) => {
|
|
168
168
|
const u = l.parseNodeText(c);
|
|
169
169
|
return u ? n.concat(u) : n;
|
|
170
|
-
}, []),
|
|
170
|
+
}, []), a.staticResources = l.childrenByName(r, "StaticResource").reduce((n, c) => {
|
|
171
171
|
const u = l.parseNodeText(c);
|
|
172
172
|
return u ? n.concat({ url: u, creativeType: c.getAttribute("creativeType") || null }) : n;
|
|
173
|
-
}, []),
|
|
174
|
-
const
|
|
175
|
-
|
|
173
|
+
}, []), a.altText = l.parseNodeText(l.childByName(r, "AltText")) || null;
|
|
174
|
+
const s = l.childByName(r, "TrackingEvents");
|
|
175
|
+
s && l.childrenByName(s, "Tracking").forEach((n) => {
|
|
176
176
|
const c = n.getAttribute("event"), u = l.parseNodeText(n);
|
|
177
|
-
c && u && (Array.isArray(
|
|
178
|
-
}),
|
|
177
|
+
c && u && (Array.isArray(a.trackingEvents[c]) || (a.trackingEvents[c] = []), a.trackingEvents[c].push(u));
|
|
178
|
+
}), a.companionClickTrackingURLTemplates = l.childrenByName(r, "CompanionClickTracking").map((n) => ({ id: n.getAttribute("id") || null, url: l.parseNodeText(n) })), a.companionClickThroughURLTemplate = l.parseNodeText(l.childByName(r, "CompanionClickThrough")) || null;
|
|
179
179
|
const o = l.childByName(r, "AdParameters");
|
|
180
|
-
return o && (
|
|
180
|
+
return o && (a.adParameters = { value: l.parseNodeText(o), xmlEncoded: o.getAttribute("xmlEncoded") || null }), a;
|
|
181
181
|
}), t;
|
|
182
182
|
}
|
|
183
|
-
function X(
|
|
183
|
+
function X(i, e) {
|
|
184
184
|
let t;
|
|
185
185
|
const r = function() {
|
|
186
186
|
let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
187
187
|
const { id: u, adId: d, sequence: g, apiFramework: m } = N(c);
|
|
188
188
|
return { id: u, adId: d, sequence: g, apiFramework: m, type: "linear", duration: 0, skipDelay: null, mediaFiles: [], mezzanine: null, interactiveCreativeFile: null, closedCaptionFiles: [], videoClickThroughURLTemplate: null, videoClickTrackingURLTemplates: [], videoCustomClickURLTemplates: [], adParameters: null, icons: [], trackingEvents: {} };
|
|
189
189
|
}(e);
|
|
190
|
-
r.duration = l.parseDuration(l.parseNodeText(l.childByName(
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
193
|
-
else if (
|
|
194
|
-
const c = parseInt(
|
|
190
|
+
r.duration = l.parseDuration(l.parseNodeText(l.childByName(i, "Duration")));
|
|
191
|
+
const a = i.getAttribute("skipoffset");
|
|
192
|
+
if (a == null) r.skipDelay = null;
|
|
193
|
+
else if (a.charAt(a.length - 1) === "%" && r.duration !== -1) {
|
|
194
|
+
const c = parseInt(a, 10);
|
|
195
195
|
r.skipDelay = r.duration * (c / 100);
|
|
196
|
-
} else r.skipDelay = l.parseDuration(
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
const c = l.childByName(
|
|
200
|
-
r.videoClickThroughURLTemplate = c ? { id: c.getAttribute("id") || null, url: l.parseNodeText(c) } : null, l.childrenByName(
|
|
196
|
+
} else r.skipDelay = l.parseDuration(a);
|
|
197
|
+
const s = l.childByName(i, "VideoClicks");
|
|
198
|
+
if (s) {
|
|
199
|
+
const c = l.childByName(s, "ClickThrough");
|
|
200
|
+
r.videoClickThroughURLTemplate = c ? { id: c.getAttribute("id") || null, url: l.parseNodeText(c) } : null, l.childrenByName(s, "ClickTracking").forEach((u) => {
|
|
201
201
|
r.videoClickTrackingURLTemplates.push({ id: u.getAttribute("id") || null, url: l.parseNodeText(u) });
|
|
202
|
-
}), l.childrenByName(
|
|
202
|
+
}), l.childrenByName(s, "CustomClick").forEach((u) => {
|
|
203
203
|
r.videoCustomClickURLTemplates.push({ id: u.getAttribute("id") || null, url: l.parseNodeText(u) });
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
const o = l.childByName(
|
|
207
|
-
o && (r.adParameters = { value: l.parseNodeText(o), xmlEncoded: o.getAttribute("xmlEncoded") || null }), l.childrenByName(
|
|
206
|
+
const o = l.childByName(i, "AdParameters");
|
|
207
|
+
o && (r.adParameters = { value: l.parseNodeText(o), xmlEncoded: o.getAttribute("xmlEncoded") || null }), l.childrenByName(i, "TrackingEvents").forEach((c) => {
|
|
208
208
|
l.childrenByName(c, "Tracking").forEach((u) => {
|
|
209
209
|
let d = u.getAttribute("event");
|
|
210
210
|
const g = l.parseNodeText(u);
|
|
@@ -216,7 +216,7 @@ function X(a, e) {
|
|
|
216
216
|
Array.isArray(r.trackingEvents[d]) || (r.trackingEvents[d] = []), r.trackingEvents[d].push(g);
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
|
-
}), l.childrenByName(
|
|
219
|
+
}), l.childrenByName(i, "MediaFiles").forEach((c) => {
|
|
220
220
|
l.childrenByName(c, "MediaFile").forEach((h) => {
|
|
221
221
|
r.mediaFiles.push(function(p) {
|
|
222
222
|
const v = { id: null, fileURL: null, fileSize: 0, deliveryType: "progressive", mimeType: null, mediaType: null, codec: null, bitrate: 0, minBitrate: 0, maxBitrate: 0, width: 0, height: 0, apiFramework: null, scalable: null, maintainAspectRatio: null };
|
|
@@ -255,7 +255,7 @@ function X(a, e) {
|
|
|
255
255
|
h.id = g.getAttribute("id"), h.fileURL = l.parseNodeText(g), h.delivery = m.delivery, h.codec = g.getAttribute("codec"), h.type = m.type, h.width = parseInt(m.width, 10), h.height = parseInt(m.height, 10), h.fileSize = parseInt(g.getAttribute("fileSize"), 10), h.mediaType = g.getAttribute("mediaType") || "2D", r.mezzanine = h;
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
const n = l.childByName(
|
|
258
|
+
const n = l.childByName(i, "Icons");
|
|
259
259
|
return n && l.childrenByName(n, "Icon").forEach((c) => {
|
|
260
260
|
r.icons.push(function(u) {
|
|
261
261
|
const d = { program: null, height: 0, width: 0, xPosition: 0, yPosition: 0, apiFramework: null, offset: null, duration: 0, type: null, staticResource: null, htmlResource: null, iframeResource: null, pxratio: "1", iconClickThroughURLTemplate: null, iconClickTrackingURLTemplates: [], iconViewTrackingURLTemplate: null, iconClickFallbackImages: [], altText: null, hoverText: null };
|
|
@@ -284,125 +284,125 @@ function X(a, e) {
|
|
|
284
284
|
}(c));
|
|
285
285
|
}), r;
|
|
286
286
|
}
|
|
287
|
-
function Z(
|
|
287
|
+
function Z(i, e) {
|
|
288
288
|
const t = function() {
|
|
289
289
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
290
|
-
const { id:
|
|
291
|
-
return { id:
|
|
290
|
+
const { id: a, adId: s, sequence: o, apiFramework: n } = N(r);
|
|
291
|
+
return { id: a, adId: s, sequence: o, apiFramework: n, type: "nonlinear", variations: [], trackingEvents: {} };
|
|
292
292
|
}(e);
|
|
293
|
-
return l.childrenByName(
|
|
294
|
-
let
|
|
293
|
+
return l.childrenByName(i, "TrackingEvents").forEach((r) => {
|
|
294
|
+
let a, s;
|
|
295
295
|
l.childrenByName(r, "Tracking").forEach((o) => {
|
|
296
|
-
|
|
296
|
+
a = o.getAttribute("event"), s = l.parseNodeText(o), a && s && (Array.isArray(t.trackingEvents[a]) || (t.trackingEvents[a] = []), t.trackingEvents[a].push(s));
|
|
297
297
|
});
|
|
298
|
-
}), l.childrenByName(
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
298
|
+
}), l.childrenByName(i, "NonLinear").forEach((r) => {
|
|
299
|
+
const a = { id: null, width: 0, height: 0, expandedWidth: 0, expandedHeight: 0, scalable: !0, maintainAspectRatio: !0, minSuggestedDuration: 0, apiFramework: "static", adType: "nonLinearAd", type: null, staticResource: null, htmlResource: null, iframeResource: null, nonlinearClickThroughURLTemplate: null, nonlinearClickTrackingURLTemplates: [], adParameters: null };
|
|
300
|
+
a.id = r.getAttribute("id") || null, a.width = r.getAttribute("width"), a.height = r.getAttribute("height"), a.expandedWidth = r.getAttribute("expandedWidth"), a.expandedHeight = r.getAttribute("expandedHeight"), a.scalable = l.parseBoolean(r.getAttribute("scalable")), a.maintainAspectRatio = l.parseBoolean(r.getAttribute("maintainAspectRatio")), a.minSuggestedDuration = l.parseDuration(r.getAttribute("minSuggestedDuration")), a.apiFramework = r.getAttribute("apiFramework"), l.childrenByName(r, "HTMLResource").forEach((o) => {
|
|
301
|
+
a.type = o.getAttribute("creativeType") || "text/html", a.htmlResource = l.parseNodeText(o);
|
|
302
302
|
}), l.childrenByName(r, "IFrameResource").forEach((o) => {
|
|
303
|
-
|
|
303
|
+
a.type = o.getAttribute("creativeType") || 0, a.iframeResource = l.parseNodeText(o);
|
|
304
304
|
}), l.childrenByName(r, "StaticResource").forEach((o) => {
|
|
305
|
-
|
|
305
|
+
a.type = o.getAttribute("creativeType") || 0, a.staticResource = l.parseNodeText(o);
|
|
306
306
|
});
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}), t.variations.push(
|
|
307
|
+
const s = l.childByName(r, "AdParameters");
|
|
308
|
+
s && (a.adParameters = { value: l.parseNodeText(s), xmlEncoded: s.getAttribute("xmlEncoded") || null }), a.nonlinearClickThroughURLTemplate = l.parseNodeText(l.childByName(r, "NonLinearClickThrough")), l.childrenByName(r, "NonLinearClickTracking").forEach((o) => {
|
|
309
|
+
a.nonlinearClickTrackingURLTemplates.push({ id: o.getAttribute("id") || null, url: l.parseNodeText(o) });
|
|
310
|
+
}), t.variations.push(a);
|
|
311
311
|
}), t;
|
|
312
312
|
}
|
|
313
|
-
function x(
|
|
313
|
+
function x(i) {
|
|
314
314
|
const e = [];
|
|
315
|
-
return
|
|
315
|
+
return i.forEach((t) => {
|
|
316
316
|
const r = K(t);
|
|
317
317
|
r && e.push(r);
|
|
318
318
|
}), e;
|
|
319
319
|
}
|
|
320
|
-
function K(
|
|
321
|
-
if (
|
|
322
|
-
const e = { name: null, value: null, attributes: {}, children: [] }, t =
|
|
323
|
-
if (e.name =
|
|
324
|
-
for (const
|
|
325
|
-
const o = t[
|
|
320
|
+
function K(i) {
|
|
321
|
+
if (i.nodeName === "#comment") return null;
|
|
322
|
+
const e = { name: null, value: null, attributes: {}, children: [] }, t = i.attributes, r = i.childNodes;
|
|
323
|
+
if (e.name = i.nodeName, i.attributes) {
|
|
324
|
+
for (const s in t) if (t.hasOwnProperty(s)) {
|
|
325
|
+
const o = t[s];
|
|
326
326
|
o.nodeName && o.nodeValue && (e.attributes[o.nodeName] = o.nodeValue);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
for (const
|
|
330
|
-
const o = K(r[
|
|
329
|
+
for (const s in r) if (r.hasOwnProperty(s)) {
|
|
330
|
+
const o = K(r[s]);
|
|
331
331
|
o && e.children.push(o);
|
|
332
332
|
}
|
|
333
333
|
if (e.children.length === 0 || e.children.length === 1 && ["#cdata-section", "#text"].indexOf(e.children[0].name) >= 0) {
|
|
334
|
-
const
|
|
335
|
-
|
|
334
|
+
const s = l.parseNodeText(i);
|
|
335
|
+
s !== "" && (e.value = s), e.children = [];
|
|
336
336
|
}
|
|
337
|
-
return (
|
|
338
|
-
var
|
|
337
|
+
return (a = e).value === null && Object.keys(a.attributes).length === 0 && a.children.length === 0 ? null : e;
|
|
338
|
+
var a;
|
|
339
339
|
}
|
|
340
|
-
function J(
|
|
341
|
-
return
|
|
340
|
+
function J(i) {
|
|
341
|
+
return i.getAttribute("AdID") || i.getAttribute("adID") || i.getAttribute("adId") || null;
|
|
342
342
|
}
|
|
343
343
|
const y = { Wrapper: { subElements: ["VASTAdTagURI", "Impression"] }, BlockedAdCategories: { attributes: ["authority"] }, InLine: { subElements: ["AdSystem", "AdTitle", "Impression", "AdServingId", "Creatives"] }, Category: { attributes: ["authority"] }, Pricing: { attributes: ["model", "currency"] }, Verification: { oneOfinLineResources: ["JavaScriptResource", "ExecutableResource"], attributes: ["vendor"] }, UniversalAdId: { attributes: ["idRegistry"] }, JavaScriptResource: { attributes: ["apiFramework", "browserOptional"] }, ExecutableResource: { attributes: ["apiFramework", "type"] }, Tracking: { attributes: ["event"] }, Creatives: { subElements: ["Creative"] }, Creative: { subElements: ["UniversalAdId"] }, Linear: { subElements: ["MediaFiles", "Duration"] }, MediaFiles: { subElements: ["MediaFile"] }, MediaFile: { attributes: ["delivery", "type", "width", "height"] }, Mezzanine: { attributes: ["delivery", "type", "width", "height"] }, NonLinear: { oneOfinLineResources: ["StaticResource", "IFrameResource", "HTMLResource"], attributes: ["width", "height"] }, Companion: { oneOfinLineResources: ["StaticResource", "IFrameResource", "HTMLResource"], attributes: ["width", "height"] }, StaticResource: { attributes: ["creativeType"] }, Icons: { subElements: ["Icon"] }, Icon: { oneOfinLineResources: ["StaticResource", "IFrameResource", "HTMLResource"] } };
|
|
344
|
-
function S(
|
|
345
|
-
if (!y[
|
|
346
|
-
const t = y[
|
|
347
|
-
t.length > 0 && k({ name:
|
|
344
|
+
function S(i, e) {
|
|
345
|
+
if (!y[i.nodeName] || !y[i.nodeName].attributes) return;
|
|
346
|
+
const t = y[i.nodeName].attributes.filter((r) => !i.getAttribute(r));
|
|
347
|
+
t.length > 0 && k({ name: i.nodeName, parentName: i.parentNode.nodeName, attributes: t }, e);
|
|
348
348
|
}
|
|
349
|
-
function V(
|
|
350
|
-
const r = y[
|
|
351
|
-
if (!(!r ||
|
|
349
|
+
function V(i, e, t) {
|
|
350
|
+
const r = y[i.nodeName], a = !t && i.nodeName !== "Wrapper";
|
|
351
|
+
if (!(!r || a)) {
|
|
352
352
|
if (r.subElements) {
|
|
353
|
-
const
|
|
354
|
-
|
|
353
|
+
const s = r.subElements.filter((o) => !l.childByName(i, o));
|
|
354
|
+
s.length > 0 && k({ name: i.nodeName, parentName: i.parentNode.nodeName, subElements: s }, e);
|
|
355
355
|
}
|
|
356
|
-
!t || !r.oneOfinLineResources || r.oneOfinLineResources.some((
|
|
356
|
+
!t || !r.oneOfinLineResources || r.oneOfinLineResources.some((s) => l.childByName(i, s)) || k({ name: i.nodeName, parentName: i.parentNode.nodeName, oneOfResources: r.oneOfinLineResources }, e);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
function D(
|
|
360
|
-
return
|
|
359
|
+
function D(i) {
|
|
360
|
+
return i.children && i.children.length !== 0;
|
|
361
361
|
}
|
|
362
|
-
function k(
|
|
363
|
-
let { name: t, parentName: r, attributes:
|
|
364
|
-
n +=
|
|
362
|
+
function k(i, e) {
|
|
363
|
+
let { name: t, parentName: r, attributes: a, subElements: s, oneOfResources: o } = i, n = "Element '".concat(t, "'");
|
|
364
|
+
n += a ? " missing required attribute(s) '".concat(a.join(", "), "' ") : s ? " missing required sub element(s) '".concat(s.join(", "), "' ") : o ? " must provide one of the following '".concat(o.join(", "), "' ") : " is empty", e("VAST-warning", { message: n, parentElement: r, specVersion: 4.1 });
|
|
365
365
|
}
|
|
366
|
-
const $ = { verifyRequiredValues: function
|
|
366
|
+
const $ = { verifyRequiredValues: function i(e, t, r) {
|
|
367
367
|
if (e && e.nodeName) if (e.nodeName === "InLine" && (r = !0), S(e, t), D(e)) {
|
|
368
368
|
V(e, t, r);
|
|
369
|
-
for (let
|
|
369
|
+
for (let a = 0; a < e.children.length; a++) i(e.children[a], t, r);
|
|
370
370
|
} else l.parseNodeText(e).length === 0 && k({ name: e.nodeName, parentName: e.parentNode.nodeName }, t);
|
|
371
371
|
}, hasSubElements: D, emitMissingValueWarning: k, verifyRequiredAttributes: S, verifyRequiredSubElements: V };
|
|
372
|
-
function ee(
|
|
372
|
+
function ee(i, e) {
|
|
373
373
|
let { allowMultipleAds: t, followAdditionalWrappers: r } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
374
|
-
const
|
|
375
|
-
const o =
|
|
374
|
+
const a = Array.from(i.childNodes).filter((s) => {
|
|
375
|
+
const o = s.nodeName.toLowerCase();
|
|
376
376
|
return o === "inline" || r !== !1 && o === "wrapper";
|
|
377
377
|
});
|
|
378
|
-
for (const
|
|
379
|
-
if (l.copyNodeAttribute("id",
|
|
380
|
-
if (
|
|
381
|
-
const o =
|
|
382
|
-
e("VAST-warning", { message: "<".concat(
|
|
378
|
+
for (const s of a) {
|
|
379
|
+
if (l.copyNodeAttribute("id", i, s), l.copyNodeAttribute("sequence", i, s), l.copyNodeAttribute("adType", i, s), s.nodeName === "Wrapper") return { ad: re(s, e), type: "WRAPPER" };
|
|
380
|
+
if (s.nodeName === "InLine") return { ad: te(s, e, { allowMultipleAds: t }), type: "INLINE" };
|
|
381
|
+
const o = s.nodeName.toLowerCase();
|
|
382
|
+
e("VAST-warning", { message: "<".concat(s.nodeName, o === "inline" ? "> must be written <InLine>" : "> must be written <Wrapper>"), wrongNode: s });
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
function te(
|
|
385
|
+
function te(i, e) {
|
|
386
386
|
let { allowMultipleAds: t } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
387
|
-
return t === !1 &&
|
|
387
|
+
return t === !1 && i.getAttribute("sequence") ? null : H(i, e);
|
|
388
388
|
}
|
|
389
|
-
function H(
|
|
389
|
+
function H(i, e) {
|
|
390
390
|
let t = [];
|
|
391
|
-
e && $.verifyRequiredValues(
|
|
392
|
-
const r = Array.from(
|
|
393
|
-
let
|
|
394
|
-
return { id:
|
|
395
|
-
}(l.parseAttributes(
|
|
396
|
-
return r.forEach((
|
|
397
|
-
switch (
|
|
391
|
+
e && $.verifyRequiredValues(i, e);
|
|
392
|
+
const r = Array.from(i.childNodes), a = function() {
|
|
393
|
+
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
394
|
+
return { id: s.id || null, sequence: s.sequence || null, adType: s.adType || null, adServingId: null, categories: [], expires: null, viewableImpression: [], system: null, title: null, description: null, advertiser: null, pricing: null, survey: null, errorURLTemplates: [], impressionURLTemplates: [], creatives: [], extensions: [], adVerifications: [], blockedAdCategories: [], followAdditionalWrappers: !0, allowMultipleAds: !1, fallbackOnNoAd: null };
|
|
395
|
+
}(l.parseAttributes(i));
|
|
396
|
+
return r.forEach((s) => {
|
|
397
|
+
switch (s.nodeName) {
|
|
398
398
|
case "Error":
|
|
399
|
-
|
|
399
|
+
a.errorURLTemplates.push(l.parseNodeText(s));
|
|
400
400
|
break;
|
|
401
401
|
case "Impression":
|
|
402
|
-
|
|
402
|
+
a.impressionURLTemplates.push({ id: s.getAttribute("id") || null, url: l.parseNodeText(s) });
|
|
403
403
|
break;
|
|
404
404
|
case "Creatives":
|
|
405
|
-
|
|
405
|
+
a.creatives = function(o) {
|
|
406
406
|
const n = [];
|
|
407
407
|
return o.forEach((c) => {
|
|
408
408
|
const u = { id: c.getAttribute("id") || null, adId: J(c), sequence: c.getAttribute("sequence") || null, apiFramework: c.getAttribute("apiFramework") || null }, d = [];
|
|
@@ -429,65 +429,65 @@ function H(a, e) {
|
|
|
429
429
|
v && (d && (v.universalAdIds = d), g && (v.creativeExtensions = g), n.push(v));
|
|
430
430
|
}
|
|
431
431
|
}), n;
|
|
432
|
-
}(l.childrenByName(
|
|
432
|
+
}(l.childrenByName(s, "Creative"));
|
|
433
433
|
break;
|
|
434
434
|
case "Extensions": {
|
|
435
|
-
const o = l.childrenByName(
|
|
436
|
-
|
|
435
|
+
const o = l.childrenByName(s, "Extension");
|
|
436
|
+
a.extensions = x(o), a.adVerifications.length || (t = function(n) {
|
|
437
437
|
let c = null, u = [];
|
|
438
438
|
return n.some((d) => c = l.childByName(d, "AdVerifications")), c && (u = O(l.childrenByName(c, "Verification"))), u;
|
|
439
439
|
}(o));
|
|
440
440
|
break;
|
|
441
441
|
}
|
|
442
442
|
case "AdVerifications":
|
|
443
|
-
|
|
443
|
+
a.adVerifications = O(l.childrenByName(s, "Verification"));
|
|
444
444
|
break;
|
|
445
445
|
case "AdSystem":
|
|
446
|
-
|
|
446
|
+
a.system = { value: l.parseNodeText(s), version: s.getAttribute("version") || null };
|
|
447
447
|
break;
|
|
448
448
|
case "AdTitle":
|
|
449
|
-
|
|
449
|
+
a.title = l.parseNodeText(s);
|
|
450
450
|
break;
|
|
451
451
|
case "AdServingId":
|
|
452
|
-
|
|
452
|
+
a.adServingId = l.parseNodeText(s);
|
|
453
453
|
break;
|
|
454
454
|
case "Category":
|
|
455
|
-
|
|
455
|
+
a.categories.push({ authority: s.getAttribute("authority") || null, value: l.parseNodeText(s) });
|
|
456
456
|
break;
|
|
457
457
|
case "Expires":
|
|
458
|
-
|
|
458
|
+
a.expires = parseInt(l.parseNodeText(s), 10);
|
|
459
459
|
break;
|
|
460
460
|
case "ViewableImpression":
|
|
461
|
-
|
|
461
|
+
a.viewableImpression.push(function(o) {
|
|
462
462
|
const n = (c, u) => {
|
|
463
463
|
const d = l.parseNodeText(u);
|
|
464
464
|
return d && c.push(d), c;
|
|
465
465
|
};
|
|
466
466
|
return { id: o.getAttribute("id") || null, viewable: l.childrenByName(o, "Viewable").reduce(n, []), notViewable: l.childrenByName(o, "NotViewable").reduce(n, []), viewUndetermined: l.childrenByName(o, "ViewUndetermined").reduce(n, []) };
|
|
467
|
-
}(
|
|
467
|
+
}(s));
|
|
468
468
|
break;
|
|
469
469
|
case "Description":
|
|
470
|
-
|
|
470
|
+
a.description = l.parseNodeText(s);
|
|
471
471
|
break;
|
|
472
472
|
case "Advertiser":
|
|
473
|
-
|
|
473
|
+
a.advertiser = { id: s.getAttribute("id") || null, value: l.parseNodeText(s) };
|
|
474
474
|
break;
|
|
475
475
|
case "Pricing":
|
|
476
|
-
|
|
476
|
+
a.pricing = { value: l.parseNodeText(s), model: s.getAttribute("model") || null, currency: s.getAttribute("currency") || null };
|
|
477
477
|
break;
|
|
478
478
|
case "Survey":
|
|
479
|
-
|
|
479
|
+
a.survey = { value: l.parseNodeText(s), type: s.getAttribute("type") || null };
|
|
480
480
|
break;
|
|
481
481
|
case "BlockedAdCategories":
|
|
482
|
-
|
|
482
|
+
a.blockedAdCategories.push({ authority: s.getAttribute("authority") || null, value: l.parseNodeText(s) });
|
|
483
483
|
}
|
|
484
|
-
}), t.length && (
|
|
484
|
+
}), t.length && (a.adVerifications = a.adVerifications.concat(t)), a;
|
|
485
485
|
}
|
|
486
|
-
function re(
|
|
487
|
-
const t = H(
|
|
488
|
-
t.followAdditionalWrappers = !r || l.parseBoolean(r), t.allowMultipleAds = !!
|
|
489
|
-
let o = l.childByName(
|
|
490
|
-
if (o ? t.nextWrapperURL = l.parseNodeText(o) : (o = l.childByName(
|
|
486
|
+
function re(i, e) {
|
|
487
|
+
const t = H(i, e), r = i.getAttribute("followAdditionalWrappers"), a = i.getAttribute("allowMultipleAds"), s = i.getAttribute("fallbackOnNoAd");
|
|
488
|
+
t.followAdditionalWrappers = !r || l.parseBoolean(r), t.allowMultipleAds = !!a && l.parseBoolean(a), t.fallbackOnNoAd = s ? l.parseBoolean(s) : null;
|
|
489
|
+
let o = l.childByName(i, "VASTAdTagURI");
|
|
490
|
+
if (o ? t.nextWrapperURL = l.parseNodeText(o) : (o = l.childByName(i, "VASTAdTagURL"), o && (t.nextWrapperURL = l.parseNodeText(l.childByName(o, "URL")))), t.creatives.forEach((n) => {
|
|
491
491
|
if (["linear", "nonlinear"].includes(n.type)) {
|
|
492
492
|
if (n.trackingEvents) {
|
|
493
493
|
t.trackingEvents || (t.trackingEvents = {}), t.trackingEvents[n.type] || (t.trackingEvents[n.type] = {});
|
|
@@ -506,11 +506,11 @@ function re(a, e) {
|
|
|
506
506
|
}
|
|
507
507
|
}), t.nextWrapperURL) return t;
|
|
508
508
|
}
|
|
509
|
-
function O(
|
|
509
|
+
function O(i) {
|
|
510
510
|
const e = [];
|
|
511
|
-
return
|
|
512
|
-
const r = { resource: null, vendor: null, browserOptional: !1, apiFramework: null, type: null, parameters: null, trackingEvents: {} },
|
|
513
|
-
l.assignAttributes(t.attributes, r),
|
|
511
|
+
return i.forEach((t) => {
|
|
512
|
+
const r = { resource: null, vendor: null, browserOptional: !1, apiFramework: null, type: null, parameters: null, trackingEvents: {} }, a = Array.from(t.childNodes);
|
|
513
|
+
l.assignAttributes(t.attributes, r), a.forEach((o) => {
|
|
514
514
|
let { nodeName: n, textContent: c, attributes: u } = o;
|
|
515
515
|
switch (n) {
|
|
516
516
|
case "JavaScriptResource":
|
|
@@ -521,8 +521,8 @@ function O(a) {
|
|
|
521
521
|
r.parameters = c.trim();
|
|
522
522
|
}
|
|
523
523
|
});
|
|
524
|
-
const
|
|
525
|
-
|
|
524
|
+
const s = l.childByName(t, "TrackingEvents");
|
|
525
|
+
s && l.childrenByName(s, "Tracking").forEach((o) => {
|
|
526
526
|
const n = o.getAttribute("event"), c = l.parseNodeText(o);
|
|
527
527
|
n && c && (Array.isArray(r.trackingEvents[n]) || (r.trackingEvents[n] = []), r.trackingEvents[n].push(c));
|
|
528
528
|
}), e.push(r);
|
|
@@ -538,10 +538,10 @@ class _ {
|
|
|
538
538
|
return this._handlers.push({ event: e, handler: t }), this;
|
|
539
539
|
}
|
|
540
540
|
once(e, t) {
|
|
541
|
-
return this.on(e, function(r,
|
|
541
|
+
return this.on(e, function(r, a, s) {
|
|
542
542
|
const o = { fired: !1, wrapFn: void 0 };
|
|
543
543
|
function n() {
|
|
544
|
-
o.fired || (r.off(
|
|
544
|
+
o.fired || (r.off(a, o.wrapFn), o.fired = !0, s.bind(r)(...arguments));
|
|
545
545
|
}
|
|
546
546
|
return o.wrapFn = n, n;
|
|
547
547
|
}(this, e, t));
|
|
@@ -550,11 +550,11 @@ class _ {
|
|
|
550
550
|
return this._handlers = this._handlers.filter((r) => r.event !== e || r.handler !== t), this;
|
|
551
551
|
}
|
|
552
552
|
emit(e) {
|
|
553
|
-
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0),
|
|
554
|
-
let
|
|
553
|
+
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++) r[a - 1] = arguments[a];
|
|
554
|
+
let s = !1;
|
|
555
555
|
return this._handlers.forEach((o) => {
|
|
556
|
-
o.event === "*" && (
|
|
557
|
-
}),
|
|
556
|
+
o.event === "*" && (s = !0, o.handler(e, ...r)), o.event === e && (s = !0, o.handler(...r));
|
|
557
|
+
}), s;
|
|
558
558
|
}
|
|
559
559
|
removeAllListeners(e) {
|
|
560
560
|
return e ? (this._handlers = this._handlers.filter((t) => t.event !== e), this) : (this._handlers = [], this);
|
|
@@ -570,17 +570,17 @@ class _ {
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
let F = 0, E = 0;
|
|
573
|
-
const z = (
|
|
574
|
-
!
|
|
575
|
-
},
|
|
576
|
-
class
|
|
573
|
+
const z = (i, e) => {
|
|
574
|
+
!i || !e || i <= 0 || e <= 0 || (E = (E * F + 8 * i / e) / ++F);
|
|
575
|
+
}, ie = { ERRORCODE: 900, extensions: [] }, P = "VAST response version not supported";
|
|
576
|
+
class ae extends _ {
|
|
577
577
|
constructor() {
|
|
578
578
|
let { fetcher: e } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
579
579
|
super(), this.maxWrapperDepth = null, this.rootErrorURLTemplates = [], this.errorURLTemplates = [], this.remainingAds = [], this.parsingOptions = {}, this.fetcher = e || null, this.keepFailedAdPod = !1;
|
|
580
580
|
}
|
|
581
581
|
trackVastError(e, t) {
|
|
582
|
-
for (var r = arguments.length,
|
|
583
|
-
this.emit("VAST-error", Object.assign({},
|
|
582
|
+
for (var r = arguments.length, a = new Array(r > 2 ? r - 2 : 0), s = 2; s < r; s++) a[s - 2] = arguments[s];
|
|
583
|
+
this.emit("VAST-error", Object.assign({}, ie, t, ...a)), f.track(e, t);
|
|
584
584
|
}
|
|
585
585
|
getErrorURLTemplates() {
|
|
586
586
|
return this.rootErrorURLTemplates.concat(this.errorURLTemplates);
|
|
@@ -606,16 +606,16 @@ class se extends _ {
|
|
|
606
606
|
}
|
|
607
607
|
buildVASTResponse(e) {
|
|
608
608
|
const t = function(r) {
|
|
609
|
-
let { ads:
|
|
610
|
-
return { ads:
|
|
609
|
+
let { ads: a, errorURLTemplates: s, version: o } = r;
|
|
610
|
+
return { ads: a || [], errorURLTemplates: s || [], version: o || null };
|
|
611
611
|
}({ ads: e, errorURLTemplates: this.getErrorURLTemplates(), version: this.vastVersion });
|
|
612
612
|
return this.completeWrapperResolving(t), t;
|
|
613
613
|
}
|
|
614
614
|
parseVastXml(e, t) {
|
|
615
|
-
let { isRootVAST: r = !1, url:
|
|
615
|
+
let { isRootVAST: r = !1, url: a = null, wrapperDepth: s = 0, allowMultipleAds: o, followAdditionalWrappers: n } = t;
|
|
616
616
|
if (!e || !e.documentElement || e.documentElement.nodeName !== "VAST") {
|
|
617
617
|
var c;
|
|
618
|
-
this.emit("VAST-ad-parsed", { type: "ERROR", url:
|
|
618
|
+
this.emit("VAST-ad-parsed", { type: "ERROR", url: a, wrapperDepth: s });
|
|
619
619
|
const m = (e == null || (c = e.documentElement) === null || c === void 0 ? void 0 : c.nodeName) === "VideoAdServingTemplate";
|
|
620
620
|
throw new Error(m ? P : "Invalid VAST XMLDocument");
|
|
621
621
|
}
|
|
@@ -630,70 +630,70 @@ class se extends _ {
|
|
|
630
630
|
if (this.vastVersion && parseFloat(this.vastVersion) < 3) o = !0;
|
|
631
631
|
else if (o === !1 && u.length > 1) break;
|
|
632
632
|
const p = ee(h, this.emit.bind(this), { allowMultipleAds: o, followAdditionalWrappers: n });
|
|
633
|
-
p.ad ? (u.push(p.ad), this.emit("VAST-ad-parsed", { type: p.type, url:
|
|
633
|
+
p.ad ? (u.push(p.ad), this.emit("VAST-ad-parsed", { type: p.type, url: a, wrapperDepth: s, adIndex: u.length - 1, vastVersion: g })) : this.trackVastError(this.getErrorURLTemplates(), { ERRORCODE: 101 });
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
return u;
|
|
637
637
|
}
|
|
638
638
|
parse(e) {
|
|
639
|
-
let { url: t = null, resolveAll: r = !0, wrapperSequence:
|
|
639
|
+
let { url: t = null, resolveAll: r = !0, wrapperSequence: a = null, previousUrl: s = null, wrapperDepth: o = 0, isRootVAST: n = !1, followAdditionalWrappers: c, allowMultipleAds: u } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, d = [];
|
|
640
640
|
this.vastVersion && parseFloat(this.vastVersion) < 3 && n && (u = !0);
|
|
641
641
|
try {
|
|
642
642
|
d = this.parseVastXml(e, { isRootVAST: n, url: t, wrapperDepth: o, allowMultipleAds: u, followAdditionalWrappers: c });
|
|
643
643
|
} catch (g) {
|
|
644
644
|
return Promise.reject(g);
|
|
645
645
|
}
|
|
646
|
-
if (d.length === 1 &&
|
|
646
|
+
if (d.length === 1 && a != null && (d[0].sequence = a), r === !1) {
|
|
647
647
|
const g = l.getSortedAdPods(d), m = l.getStandAloneAds(d);
|
|
648
648
|
g.length ? d = g : m.length && (d = [m.shift()]), this.remainingAds = m;
|
|
649
649
|
}
|
|
650
|
-
return this.resolveAds(d, { wrapperDepth: o, previousUrl:
|
|
650
|
+
return this.resolveAds(d, { wrapperDepth: o, previousUrl: s, url: t });
|
|
651
651
|
}
|
|
652
652
|
resolveAds() {
|
|
653
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], { wrapperDepth: t, previousUrl: r, url:
|
|
654
|
-
const
|
|
655
|
-
return r =
|
|
653
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], { wrapperDepth: t, previousUrl: r, url: a } = arguments.length > 1 ? arguments[1] : void 0;
|
|
654
|
+
const s = [];
|
|
655
|
+
return r = a, e.forEach((o) => {
|
|
656
656
|
const n = this.resolveWrappers(o, t, r);
|
|
657
|
-
|
|
658
|
-
}), Promise.all(
|
|
657
|
+
s.push(n);
|
|
658
|
+
}), Promise.all(s).then((o) => f.flatten(o));
|
|
659
659
|
}
|
|
660
660
|
resolveWrappers(e, t, r) {
|
|
661
|
-
const
|
|
662
|
-
return new Promise((
|
|
661
|
+
const a = { ...e };
|
|
662
|
+
return new Promise((s) => {
|
|
663
663
|
var o;
|
|
664
|
-
if (t++, !
|
|
665
|
-
if (!this.fetcher) return
|
|
666
|
-
if (t >= this.maxWrapperDepth) return
|
|
667
|
-
|
|
668
|
-
const n = (o = this.parsingOptions.allowMultipleAds) !== null && o !== void 0 ? o :
|
|
669
|
-
this.fetcher.fetchVAST({ url:
|
|
670
|
-
if (delete
|
|
664
|
+
if (t++, !a.nextWrapperURL) return delete a.nextWrapperURL, s(a);
|
|
665
|
+
if (!this.fetcher) return a.VASTAdTagURI = a.nextWrapperURL, delete a.nextWrapperURL, s(a);
|
|
666
|
+
if (t >= this.maxWrapperDepth) return a.errorCode = 302, delete a.nextWrapperURL, s(a);
|
|
667
|
+
a.nextWrapperURL = l.resolveVastAdTagURI(a.nextWrapperURL, r);
|
|
668
|
+
const n = (o = this.parsingOptions.allowMultipleAds) !== null && o !== void 0 ? o : a.allowMultipleAds, c = a.sequence;
|
|
669
|
+
this.fetcher.fetchVAST({ url: a.nextWrapperURL, emitter: this.emit.bind(this), maxWrapperDepth: this.maxWrapperDepth }).then((u) => this.parse(u, { url: a.nextWrapperURL, previousUrl: r, wrapperSequence: c, wrapperDepth: t, followAdditionalWrappers: a.followAdditionalWrappers, allowMultipleAds: n }).then((d) => {
|
|
670
|
+
if (delete a.nextWrapperURL, d.length === 0) return a.creatives = [], s(a);
|
|
671
671
|
d.forEach((g) => {
|
|
672
|
-
g && l.mergeWrapperAdData(g,
|
|
673
|
-
}),
|
|
672
|
+
g && l.mergeWrapperAdData(g, a);
|
|
673
|
+
}), s(d);
|
|
674
674
|
})).catch((u) => {
|
|
675
|
-
|
|
675
|
+
a.errorCode = u.message === P ? 102 : 301, a.errorMessage = u.message, s(a);
|
|
676
676
|
});
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
679
|
completeWrapperResolving(e) {
|
|
680
680
|
if (e.ads.length === 0) this.trackVastError(e.errorURLTemplates, { ERRORCODE: 303 });
|
|
681
681
|
else for (let t = e.ads.length - 1; t >= 0; t--) {
|
|
682
|
-
const r = e.ads[t],
|
|
682
|
+
const r = e.ads[t], a = !r.creatives.some((s) => {
|
|
683
683
|
var o, n;
|
|
684
|
-
return ((o =
|
|
684
|
+
return ((o = s.mediaFiles) === null || o === void 0 ? void 0 : o.length) > 0 || ((n = s.variations) === null || n === void 0 ? void 0 : n.length) > 0;
|
|
685
685
|
});
|
|
686
|
-
!r.errorCode && !
|
|
686
|
+
!r.errorCode && !a || r.VASTAdTagURI || (this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates), { ERRORCODE: r.errorCode || 303 }, { ERRORMESSAGE: r.errorMessage || "" }, { extensions: r.extensions }, { system: r.system }), this.keepFailedAdPod && r.sequence ? r.hasFailed = !0 : e.ads.splice(t, 1));
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
let
|
|
691
|
-
const
|
|
692
|
-
return this.data[
|
|
693
|
-
}, setItem(
|
|
694
|
-
this.data[
|
|
695
|
-
}, removeItem(
|
|
696
|
-
delete this.data[
|
|
690
|
+
let T = null;
|
|
691
|
+
const se = { data: {}, length: 0, getItem(i) {
|
|
692
|
+
return this.data[i];
|
|
693
|
+
}, setItem(i, e) {
|
|
694
|
+
this.data[i] = e, this.length = Object.keys(this.data).length;
|
|
695
|
+
}, removeItem(i) {
|
|
696
|
+
delete this.data[i], this.length = Object.keys(this.data).length;
|
|
697
697
|
}, clear() {
|
|
698
698
|
this.data = {}, this.length = 0;
|
|
699
699
|
} };
|
|
@@ -702,13 +702,13 @@ class ne {
|
|
|
702
702
|
this.storage = this.initStorage();
|
|
703
703
|
}
|
|
704
704
|
initStorage() {
|
|
705
|
-
if (
|
|
705
|
+
if (T) return T;
|
|
706
706
|
try {
|
|
707
|
-
|
|
707
|
+
T = typeof window < "u" && window !== null ? window.localStorage || window.sessionStorage : null;
|
|
708
708
|
} catch {
|
|
709
|
-
|
|
709
|
+
T = null;
|
|
710
710
|
}
|
|
711
|
-
return
|
|
711
|
+
return T && !this.isStorageDisabled(T) || (T = se, T.clear()), T;
|
|
712
712
|
}
|
|
713
713
|
isStorageDisabled(e) {
|
|
714
714
|
const t = "__VASTStorage__";
|
|
@@ -732,20 +732,20 @@ class ne {
|
|
|
732
732
|
return this.storage.clear();
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
const b = 12e4, oe = { get: async function(
|
|
735
|
+
const b = 12e4, oe = { get: async function(i, e) {
|
|
736
736
|
try {
|
|
737
737
|
const t = new AbortController(), r = setTimeout(() => {
|
|
738
738
|
throw t.abort(), new Error("URLHandler: Request timed out after ".concat(e.timeout || b, " ms (408)"));
|
|
739
|
-
}, e.timeout || b),
|
|
739
|
+
}, e.timeout || b), a = await fetch(i, { ...e, signal: t.signal, credentials: e.withCredentials ? "include" : "omit" }).finally(() => {
|
|
740
740
|
clearTimeout(r);
|
|
741
|
-
}),
|
|
742
|
-
return
|
|
743
|
-
}(
|
|
744
|
-
return
|
|
741
|
+
}), s = function(o) {
|
|
742
|
+
return f.isBrowserEnvironment() && window.location.protocol === "https:" && o.url.includes("http://") ? "URLHandler: Cannot go from HTTPS to HTTP." : o.status === 200 && o.ok ? null : "URLHandler: ".concat(o.statusText, " (").concat(o.status, ")");
|
|
743
|
+
}(a);
|
|
744
|
+
return s ? { error: new Error(s), statusCode: a.status } : async function(o) {
|
|
745
745
|
const n = await o.text();
|
|
746
746
|
let c;
|
|
747
|
-
return c =
|
|
748
|
-
}(
|
|
747
|
+
return c = f.isBrowserEnvironment() ? new DOMParser() : new (await import("./index7.js").then((u) => u.i)).DOMParser(), { xml: c.parseFromString(n, "text/xml"), details: { byteLength: n.length, statusCode: o.status, rawXml: n } };
|
|
748
|
+
}(a);
|
|
749
749
|
} catch (t) {
|
|
750
750
|
return { error: t, statusCode: t.name === "AbortError" ? 408 : null };
|
|
751
751
|
}
|
|
@@ -772,20 +772,20 @@ class le {
|
|
|
772
772
|
}
|
|
773
773
|
async fetchVAST(e) {
|
|
774
774
|
var t;
|
|
775
|
-
let { url: r, maxWrapperDepth:
|
|
775
|
+
let { url: r, maxWrapperDepth: a, emitter: s, wrapperDepth: o = 0, previousUrl: n = null, wrapperAd: c = null } = e;
|
|
776
776
|
const u = Date.now();
|
|
777
777
|
this.URLTemplateFilters.forEach((m) => {
|
|
778
778
|
r = m(r);
|
|
779
|
-
}),
|
|
779
|
+
}), s("VAST-resolving", { url: r, previousUrl: n, wrapperDepth: o, maxWrapperDepth: a, timeout: this.fetchingOptions.timeout, wrapperAd: c });
|
|
780
780
|
const d = await this.urlHandler.get(r, this.fetchingOptions), g = Math.round(Date.now() - u);
|
|
781
|
-
if (
|
|
781
|
+
if (s("VAST-resolved", { url: r, previousUrl: n, wrapperDepth: o, error: (d == null ? void 0 : d.error) || null, duration: g, statusCode: (d == null ? void 0 : d.statusCode) || null, ...d == null ? void 0 : d.details }), z(d == null || (t = d.details) === null || t === void 0 ? void 0 : t.byteLength, g), d.error) throw new Error(d.error);
|
|
782
782
|
return d.xml;
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
class ce {
|
|
786
786
|
constructor() {
|
|
787
787
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : new ne();
|
|
788
|
-
this.cappingFreeLunch = e, this.cappingMinimumTimeInterval = t, this.fetcher = new le(), this.vastParser = new
|
|
788
|
+
this.cappingFreeLunch = e, this.cappingMinimumTimeInterval = t, this.fetcher = new le(), this.vastParser = new ae({ fetcher: this.fetcher }), this.storage = r, this.lastSuccessfulAd === void 0 && (this.lastSuccessfulAd = 0), this.totalCalls === void 0 && (this.totalCalls = 0), this.totalCallsTimeout === void 0 && (this.totalCallsTimeout = 0);
|
|
789
789
|
}
|
|
790
790
|
addURLTemplateFilter(e) {
|
|
791
791
|
this.fetcher.addURLTemplateFilter(e);
|
|
@@ -833,28 +833,28 @@ class ce {
|
|
|
833
833
|
get(e) {
|
|
834
834
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
835
835
|
const r = Date.now();
|
|
836
|
-
return t.hasOwnProperty("resolveAll") || (t.resolveAll = !1), this.totalCallsTimeout < r ? (this.totalCalls = 1, this.totalCallsTimeout = r + 36e5) : this.totalCalls++, new Promise((
|
|
837
|
-
if (this.cappingFreeLunch >= this.totalCalls) return
|
|
836
|
+
return t.hasOwnProperty("resolveAll") || (t.resolveAll = !1), this.totalCallsTimeout < r ? (this.totalCalls = 1, this.totalCallsTimeout = r + 36e5) : this.totalCalls++, new Promise((a, s) => {
|
|
837
|
+
if (this.cappingFreeLunch >= this.totalCalls) return s(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls, "/").concat(this.cappingFreeLunch)));
|
|
838
838
|
const o = r - this.lastSuccessfulAd;
|
|
839
839
|
if (o < 0) this.lastSuccessfulAd = 0;
|
|
840
|
-
else if (o < this.cappingMinimumTimeInterval) return
|
|
840
|
+
else if (o < this.cappingMinimumTimeInterval) return s(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval, ")ms minimum interval reached")));
|
|
841
841
|
this.vastParser.initParsingStatus(t), this.fetcher.setOptions(t), this.vastParser.rootURL = e, this.fetcher.fetchVAST({ url: e, emitter: this.vastParser.emit.bind(this.vastParser), maxWrapperDepth: this.vastParser.maxWrapperDepth }).then((n) => (t.previousUrl = e, t.isRootVAST = !0, t.url = e, this.vastParser.parse(n, t).then((c) => {
|
|
842
842
|
const u = this.vastParser.buildVASTResponse(c);
|
|
843
|
-
|
|
844
|
-
}))).catch((n) =>
|
|
843
|
+
a(u);
|
|
844
|
+
}))).catch((n) => s(n));
|
|
845
845
|
});
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
848
|
class ue extends _ {
|
|
849
849
|
constructor(e, t, r) {
|
|
850
|
-
var
|
|
851
|
-
let
|
|
852
|
-
super(), this.ad = t, this.creative = r, this.variation =
|
|
850
|
+
var a;
|
|
851
|
+
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, o = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
|
|
852
|
+
super(), this.ad = t, this.creative = r, this.variation = s, this.muted = o, this.impressed = !1, this.skippable = !1, this.trackingEvents = {}, this.trackedProgressEvents = [], this.lastPercentage = 0, this._alreadyTriggeredQuartiles = {}, this.emitAlwaysEvents = ["creativeView", "start", "firstQuartile", "midpoint", "thirdQuartile", "complete", "resume", "pause", "rewind", "skip", "closeLinear", "close"];
|
|
853
853
|
for (const n in this.creative.trackingEvents) {
|
|
854
854
|
const c = this.creative.trackingEvents[n];
|
|
855
855
|
this.trackingEvents[n] = c.slice(0);
|
|
856
856
|
}
|
|
857
|
-
this.viewableImpressionTrackers = ((
|
|
857
|
+
this.viewableImpressionTrackers = ((a = this.ad.viewableImpression) === null || a === void 0 ? void 0 : a.reduce((n, c) => (n.notViewable.push(...c.notViewable), n.viewUndetermined.push(...c.viewUndetermined), n.viewable.push(...c.viewable), n), { notViewable: [], viewUndetermined: [], viewable: [] })) || {}, Object.entries(this.viewableImpressionTrackers).forEach((n) => {
|
|
858
858
|
let [c, u] = n;
|
|
859
859
|
u.length && (this.trackingEvents[c] = u);
|
|
860
860
|
}), function(n) {
|
|
@@ -878,20 +878,20 @@ class ue extends _ {
|
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
setDuration(e) {
|
|
881
|
-
|
|
881
|
+
f.isValidTimeValue(e) ? (this.assetDuration = e, this.quartiles = { firstQuartile: Math.round(25 * this.assetDuration) / 100, midpoint: Math.round(50 * this.assetDuration) / 100, thirdQuartile: Math.round(75 * this.assetDuration) / 100 }) : this.emit("TRACKER-error", { message: "the duration provided is not valid. duration: ".concat(e) });
|
|
882
882
|
}
|
|
883
883
|
setProgress(e) {
|
|
884
884
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
|
|
885
|
-
if (!
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
const
|
|
885
|
+
if (!f.isValidTimeValue(e) || typeof t != "object") return void this.emit("TRACKER-error", { message: "One given setProgress parameter has the wrong type. progress: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
886
|
+
const a = this.skipDelay || -1;
|
|
887
|
+
if (a === -1 || this.skippable || (a > e ? this.emit("skip-countdown", a - e) : (this.skippable = !0, this.emit("skip-countdown", 0))), this.assetDuration > 0) {
|
|
888
|
+
const s = Math.round(e / this.assetDuration * 100), o = [];
|
|
889
889
|
if (e > 0) {
|
|
890
890
|
o.push("start");
|
|
891
|
-
for (let n = this.lastPercentage; n <
|
|
891
|
+
for (let n = this.lastPercentage; n < s; n++) o.push("progress-".concat(n + 1, "%"));
|
|
892
892
|
o.push("progress-".concat(e));
|
|
893
893
|
for (const n in this.quartiles) this.isQuartileReached(n, this.quartiles[n], e) && (o.push(n), this._alreadyTriggeredQuartiles[n] = !0);
|
|
894
|
-
this.lastPercentage =
|
|
894
|
+
this.lastPercentage = s;
|
|
895
895
|
}
|
|
896
896
|
o.forEach((n) => {
|
|
897
897
|
this.track(n, { macros: t, once: r });
|
|
@@ -900,27 +900,27 @@ class ue extends _ {
|
|
|
900
900
|
this.progress = e;
|
|
901
901
|
}
|
|
902
902
|
isQuartileReached(e, t, r) {
|
|
903
|
-
let
|
|
904
|
-
return t <= r && !this._alreadyTriggeredQuartiles[e] && (
|
|
903
|
+
let a = !1;
|
|
904
|
+
return t <= r && !this._alreadyTriggeredQuartiles[e] && (a = !0), a;
|
|
905
905
|
}
|
|
906
906
|
setMuted(e) {
|
|
907
907
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
908
|
-
typeof e == "boolean" && typeof t == "object" ? (this.muted !== e && this.track(e ? "mute" : "unmute", { macros: t }), this.muted = e) : this.emit("TRACKER-error", { message: "One given setMuted parameter has the wrong type. muted: ".concat(e, ", macros: ").concat(
|
|
908
|
+
typeof e == "boolean" && typeof t == "object" ? (this.muted !== e && this.track(e ? "mute" : "unmute", { macros: t }), this.muted = e) : this.emit("TRACKER-error", { message: "One given setMuted parameter has the wrong type. muted: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
909
909
|
}
|
|
910
910
|
setPaused(e) {
|
|
911
911
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
912
|
-
typeof e == "boolean" && typeof t == "object" ? (this.paused !== e && this.track(e ? "pause" : "resume", { macros: t }), this.paused = e) : this.emit("TRACKER-error", { message: "One given setPaused parameter has the wrong type. paused: ".concat(e, ", macros: ").concat(
|
|
912
|
+
typeof e == "boolean" && typeof t == "object" ? (this.paused !== e && this.track(e ? "pause" : "resume", { macros: t }), this.paused = e) : this.emit("TRACKER-error", { message: "One given setPaused parameter has the wrong type. paused: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
913
913
|
}
|
|
914
914
|
setFullscreen(e) {
|
|
915
915
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
916
|
-
typeof e == "boolean" && typeof t == "object" ? (this.fullscreen !== e && this.track(e ? "fullscreen" : "exitFullscreen", { macros: t }), this.fullscreen = e) : this.emit("TRACKER-error", { message: "One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e, ", macros: ").concat(
|
|
916
|
+
typeof e == "boolean" && typeof t == "object" ? (this.fullscreen !== e && this.track(e ? "fullscreen" : "exitFullscreen", { macros: t }), this.fullscreen = e) : this.emit("TRACKER-error", { message: "One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
917
917
|
}
|
|
918
918
|
setExpand(e) {
|
|
919
919
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
920
|
-
typeof e == "boolean" && typeof t == "object" ? (this.expanded !== e && (this.track(e ? "expand" : "collapse", { macros: t }), this.track(e ? "playerExpand" : "playerCollapse", { macros: t })), this.expanded = e) : this.emit("TRACKER-error", { message: "One given setExpand parameter has the wrong type. expanded: ".concat(e, ", macros: ").concat(
|
|
920
|
+
typeof e == "boolean" && typeof t == "object" ? (this.expanded !== e && (this.track(e ? "expand" : "collapse", { macros: t }), this.track(e ? "playerExpand" : "playerCollapse", { macros: t })), this.expanded = e) : this.emit("TRACKER-error", { message: "One given setExpand parameter has the wrong type. expanded: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
921
921
|
}
|
|
922
922
|
setSkipDelay(e) {
|
|
923
|
-
|
|
923
|
+
f.isValidTimeValue(e) ? this.skipDelay = e : this.emit("TRACKER-error", { message: "setSkipDelay parameter does not have a valid value. duration: ".concat(e) });
|
|
924
924
|
}
|
|
925
925
|
trackImpression() {
|
|
926
926
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -940,7 +940,7 @@ class ue extends _ {
|
|
|
940
940
|
}
|
|
941
941
|
error() {
|
|
942
942
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
943
|
-
typeof e == "object" && typeof t == "boolean" ? this.trackURLs(this.ad.errorURLTemplates, e, { isCustomCode: t }) : this.emit("TRACKER-error", { message: "One given error parameter has the wrong type. macros: ".concat(
|
|
943
|
+
typeof e == "object" && typeof t == "boolean" ? this.trackURLs(this.ad.errorURLTemplates, e, { isCustomCode: t }) : this.emit("TRACKER-error", { message: "One given error parameter has the wrong type. macros: ".concat(f.formatMacrosValues(e), ", isCustomCode: ").concat(t) });
|
|
944
944
|
}
|
|
945
945
|
errorWithCode(e) {
|
|
946
946
|
let t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
@@ -976,20 +976,20 @@ class ue extends _ {
|
|
|
976
976
|
}
|
|
977
977
|
verificationNotExecuted(e) {
|
|
978
978
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
979
|
-
if (typeof e != "string" || typeof t != "object") return void this.emit("TRACKER-error", { message: "One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e, ", macros: ").concat(
|
|
979
|
+
if (typeof e != "string" || typeof t != "object") return void this.emit("TRACKER-error", { message: "One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
980
980
|
if (!this.ad || !this.ad.adVerifications || !this.ad.adVerifications.length) throw new Error("No adVerifications provided");
|
|
981
981
|
if (!e) throw new Error("No vendor provided, unable to find associated verificationNotExecuted");
|
|
982
|
-
const r = this.ad.adVerifications.find((
|
|
982
|
+
const r = this.ad.adVerifications.find((s) => s.vendor === e);
|
|
983
983
|
if (!r) throw new Error("No associated verification element found for vendor: ".concat(e));
|
|
984
|
-
const
|
|
985
|
-
if (
|
|
986
|
-
const
|
|
987
|
-
this.trackURLs(
|
|
984
|
+
const a = r.trackingEvents;
|
|
985
|
+
if (a && a.verificationNotExecuted) {
|
|
986
|
+
const s = a.verificationNotExecuted;
|
|
987
|
+
this.trackURLs(s, t), this.emit("verificationNotExecuted", { trackingURLTemplates: s });
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
overlayViewDuration(e) {
|
|
991
991
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
992
|
-
typeof e == "string" && typeof t == "object" ? (t.ADPLAYHEAD = e, this.track("overlayViewDuration", { macros: t })) : this.emit("TRACKER-error", { message: "One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e, ", macros: ").concat(
|
|
992
|
+
typeof e == "string" && typeof t == "object" ? (t.ADPLAYHEAD = e, this.track("overlayViewDuration", { macros: t })) : this.emit("TRACKER-error", { message: "One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
993
993
|
}
|
|
994
994
|
close() {
|
|
995
995
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -1005,28 +1005,28 @@ class ue extends _ {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
click() {
|
|
1007
1007
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1008
|
-
if (e !== null && typeof e != "string" || typeof t != "object") return void this.emit("TRACKER-error", { message: "One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e, ", macros: ").concat(
|
|
1008
|
+
if (e !== null && typeof e != "string" || typeof t != "object") return void this.emit("TRACKER-error", { message: "One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e, ", macros: ").concat(f.formatMacrosValues(t)) });
|
|
1009
1009
|
this.clickTrackingURLTemplates && this.clickTrackingURLTemplates.length && this.trackURLs(this.clickTrackingURLTemplates, t);
|
|
1010
|
-
const r = this.clickThroughURLTemplate || e,
|
|
1010
|
+
const r = this.clickThroughURLTemplate || e, a = { ...t };
|
|
1011
1011
|
if (r) {
|
|
1012
|
-
this.progress && (
|
|
1013
|
-
const
|
|
1014
|
-
this.emit("clickthrough",
|
|
1012
|
+
this.progress && (a.ADPLAYHEAD = this.progressFormatted());
|
|
1013
|
+
const s = f.resolveURLTemplates([r], a)[0];
|
|
1014
|
+
this.emit("clickthrough", s);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
trackProgressEvents(e, t, r) {
|
|
1018
|
-
const
|
|
1019
|
-
Object.entries(this.trackingEvents).filter((
|
|
1020
|
-
let [o] =
|
|
1018
|
+
const a = parseFloat(e.split("-")[1]);
|
|
1019
|
+
Object.entries(this.trackingEvents).filter((s) => {
|
|
1020
|
+
let [o] = s;
|
|
1021
1021
|
return o.startsWith("progress-");
|
|
1022
|
-
}).map((
|
|
1023
|
-
let [o, n] =
|
|
1022
|
+
}).map((s) => {
|
|
1023
|
+
let [o, n] = s;
|
|
1024
1024
|
return { name: o, time: parseFloat(o.split("-")[1]), urls: n };
|
|
1025
|
-
}).filter((
|
|
1026
|
-
let { time: o } =
|
|
1027
|
-
return o <=
|
|
1028
|
-
}).forEach((
|
|
1029
|
-
let { name: o, urls: n } =
|
|
1025
|
+
}).filter((s) => {
|
|
1026
|
+
let { time: o } = s;
|
|
1027
|
+
return o <= a && o > this.progress;
|
|
1028
|
+
}).forEach((s) => {
|
|
1029
|
+
let { name: o, urls: n } = s;
|
|
1030
1030
|
!r && this.trackedProgressEvents.includes(o) || (this.emit(o, { trackingURLTemplates: n }), this.trackURLs(n, t), r ? delete this.trackingEvents[o] : this.trackedProgressEvents.push(o));
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
@@ -1034,27 +1034,27 @@ class ue extends _ {
|
|
|
1034
1034
|
let { macros: t = {}, once: r = !1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1035
1035
|
if (typeof t != "object") return void this.emit("TRACKER-error", { message: "track given macros has the wrong type. macros: ".concat(t) });
|
|
1036
1036
|
e === "closeLinear" && !this.trackingEvents[e] && this.trackingEvents.close && (e = "close"), e.startsWith("progress-") && !e.endsWith("%") && this.trackProgressEvents(e, t, r);
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1037
|
+
const a = this.trackingEvents[e], s = this.emitAlwaysEvents.indexOf(e) > -1;
|
|
1038
|
+
a ? (this.emit(e, { trackingURLTemplates: a }), this.trackURLs(a, t)) : s && this.emit(e, null), r && (delete this.trackingEvents[e], s && this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e), 1));
|
|
1039
1039
|
}
|
|
1040
1040
|
trackURLs(e) {
|
|
1041
1041
|
var t;
|
|
1042
|
-
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
1043
|
-
const { validUrls:
|
|
1042
|
+
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1043
|
+
const { validUrls: s, invalidUrls: o } = f.filterUrlTemplates(e);
|
|
1044
1044
|
o.length && this.emit("TRACKER-error", { message: "Provided urls are malformed. url: ".concat(o) });
|
|
1045
1045
|
const n = { ...r };
|
|
1046
|
-
this.linear && (this.creative && this.creative.mediaFiles && this.creative.mediaFiles[0] && this.creative.mediaFiles[0].fileURL && (n.ASSETURI = this.creative.mediaFiles[0].fileURL), this.progress && (n.ADPLAYHEAD = this.progressFormatted())), (t = this.creative) !== null && t !== void 0 && (t = t.universalAdIds) !== null && t !== void 0 && t.length && (n.UNIVERSALADID = this.creative.universalAdIds.map((c) => c.idRegistry.concat(" ", c.value)).join(",")), this.ad && (this.ad.sequence && (n.PODSEQUENCE = this.ad.sequence), this.ad.adType && (n.ADTYPE = this.ad.adType), this.ad.adServingId && (n.ADSERVINGID = this.ad.adServingId), this.ad.categories && this.ad.categories.length && (n.ADCATEGORIES = this.ad.categories.map((c) => c.value).join(",")), this.ad.blockedAdCategories && this.ad.blockedAdCategories.length && (n.BLOCKEDADCATEGORIES = this.ad.blockedAdCategories.map((c) => c.value).join(","))),
|
|
1046
|
+
this.linear && (this.creative && this.creative.mediaFiles && this.creative.mediaFiles[0] && this.creative.mediaFiles[0].fileURL && (n.ASSETURI = this.creative.mediaFiles[0].fileURL), this.progress && (n.ADPLAYHEAD = this.progressFormatted())), (t = this.creative) !== null && t !== void 0 && (t = t.universalAdIds) !== null && t !== void 0 && t.length && (n.UNIVERSALADID = this.creative.universalAdIds.map((c) => c.idRegistry.concat(" ", c.value)).join(",")), this.ad && (this.ad.sequence && (n.PODSEQUENCE = this.ad.sequence), this.ad.adType && (n.ADTYPE = this.ad.adType), this.ad.adServingId && (n.ADSERVINGID = this.ad.adServingId), this.ad.categories && this.ad.categories.length && (n.ADCATEGORIES = this.ad.categories.map((c) => c.value).join(",")), this.ad.blockedAdCategories && this.ad.blockedAdCategories.length && (n.BLOCKEDADCATEGORIES = this.ad.blockedAdCategories.map((c) => c.value).join(","))), f.track(s, n, a);
|
|
1047
1047
|
}
|
|
1048
1048
|
convertToTimecode(e) {
|
|
1049
|
-
if (!
|
|
1050
|
-
const t = 1e3 * e, r = Math.floor(t / 36e5),
|
|
1051
|
-
return "".concat(
|
|
1049
|
+
if (!f.isValidTimeValue(e)) return "";
|
|
1050
|
+
const t = 1e3 * e, r = Math.floor(t / 36e5), a = Math.floor(t / 6e4 % 60), s = Math.floor(t / 1e3 % 60), o = Math.floor(t % 1e3);
|
|
1051
|
+
return "".concat(f.addLeadingZeros(r, 2), ":").concat(f.addLeadingZeros(a, 2), ":").concat(f.addLeadingZeros(s, 2), ".").concat(f.addLeadingZeros(o, 3));
|
|
1052
1052
|
}
|
|
1053
1053
|
progressFormatted() {
|
|
1054
1054
|
return this.convertToTimecode(this.progress);
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
1057
|
export {
|
|
1058
|
-
ce as
|
|
1059
|
-
ue as
|
|
1058
|
+
ce as _,
|
|
1059
|
+
ue as z
|
|
1060
1060
|
};
|