@streamlayer/react-ui 1.27.3 → 1.28.1
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/webos/ExposedPauseAd/PauseAd.js +47 -45
- package/lib/app/webos/index.js +38 -37
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +2642 -2596
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.d.ts +2 -0
- package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.js +1 -1
- package/lib/{useVastAds-Bu_IhLJ2.js → useVastAds-CakWRNKN.js} +83 -71
- package/package.json +15 -15
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VastAd, VastCreativeLinear, VastResponse } from '@dailymotion/vast-client';
|
|
2
2
|
import { RefObject } from 'react';
|
|
3
|
+
import { PalNonceManager } from '@streamlayer/feature-gamification/externalAd';
|
|
3
4
|
/**
|
|
4
5
|
* Get the first valid creative from an ad
|
|
5
6
|
*/
|
|
@@ -19,6 +20,7 @@ type AdStore = {
|
|
|
19
20
|
ads: AdData[];
|
|
20
21
|
autoplay: boolean;
|
|
21
22
|
muted: boolean;
|
|
23
|
+
nonceManager?: PalNonceManager;
|
|
22
24
|
};
|
|
23
25
|
export declare const useVastAds: (container: RefObject<HTMLDivElement> | null, externalGamUrl?: string) => import('nanostores').PreinitializedWritableAtom<AdStore> & object;
|
|
24
26
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useState as re, useRef as
|
|
2
|
-
import { v4 as
|
|
1
|
+
import { useState as re, useRef as U, useEffect as I } from "react";
|
|
2
|
+
import { v4 as x, validate as ae, v5 as S } from "uuid";
|
|
3
3
|
import { a as ie } from "./index-tnt2CtQe.js";
|
|
4
|
-
function
|
|
4
|
+
function L() {
|
|
5
5
|
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
6
6
|
return { id: a.id || null, adId: a.adId || null, sequence: a.sequence || null, apiFramework: a.apiFramework || null, universalAdIds: [], creativeExtensions: [] };
|
|
7
7
|
}
|
|
8
8
|
const se = ["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"];
|
|
9
|
-
function
|
|
9
|
+
function D(a) {
|
|
10
10
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
11
11
|
const r = [], i = z(a);
|
|
12
12
|
!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;
|
|
@@ -18,12 +18,12 @@ function S(a) {
|
|
|
18
18
|
return r;
|
|
19
19
|
}
|
|
20
20
|
function _(a, e) {
|
|
21
|
-
const t = (a =
|
|
21
|
+
const t = (a = V(a, e)).match(/[^[\]]+(?=])/g);
|
|
22
22
|
if (!t) return a;
|
|
23
23
|
let r = t.filter((i) => se.indexOf(i) > -1);
|
|
24
|
-
return r.length === 0 ? a : (r = r.reduce((i, s) => (i[s] = -1, i), {}),
|
|
24
|
+
return r.length === 0 ? a : (r = r.reduce((i, s) => (i[s] = -1, i), {}), V(a, r));
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function V(a, e) {
|
|
27
27
|
let t = a;
|
|
28
28
|
for (const r in e) {
|
|
29
29
|
const i = e[r];
|
|
@@ -34,10 +34,10 @@ function D(a, e) {
|
|
|
34
34
|
function z(a) {
|
|
35
35
|
return Array.isArray(a) ? a.map((e) => e && e.hasOwnProperty("url") ? e.url : e) : a;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function P(a) {
|
|
38
38
|
return /^(https?:\/\/|\/\/)/.test(a);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function O(a, e) {
|
|
41
41
|
for (let t = 0; t < e.length; t++) if (Y(e[t], a)) return !0;
|
|
42
42
|
return !1;
|
|
43
43
|
}
|
|
@@ -56,30 +56,30 @@ function Q(a) {
|
|
|
56
56
|
return a.toString().padStart(e, "0");
|
|
57
57
|
}
|
|
58
58
|
const f = { track: function(a, e, t) {
|
|
59
|
-
|
|
59
|
+
D(a, e, t).forEach((r) => {
|
|
60
60
|
typeof window < "u" && window !== null && (new Image().src = r);
|
|
61
61
|
});
|
|
62
|
-
}, resolveURLTemplates:
|
|
62
|
+
}, resolveURLTemplates: D, extractURLsFromTemplates: z, filterUrlTemplates: function(a) {
|
|
63
63
|
return a.reduce((e, t) => {
|
|
64
64
|
const r = t.url || t;
|
|
65
|
-
return
|
|
65
|
+
return P(r) ? e.validUrls.push(r) : e.invalidUrls.push(r), e;
|
|
66
66
|
}, { validUrls: [], invalidUrls: [] });
|
|
67
|
-
}, containsTemplateObject:
|
|
67
|
+
}, containsTemplateObject: O, isTemplateObjectEqual: Y, encodeURIComponentRFC3986: G, replaceUrlMacros: _, isNumeric: function(a) {
|
|
68
68
|
return !isNaN(parseFloat(a)) && isFinite(a);
|
|
69
69
|
}, flatten: function a(e) {
|
|
70
70
|
return e.reduce((t, r) => t.concat(Array.isArray(r) ? a(r) : r), []);
|
|
71
71
|
}, joinArrayOfUniqueTemplateObjs: function() {
|
|
72
72
|
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
73
73
|
const t = Array.isArray(a) ? a : [], r = Array.isArray(e) ? e : [];
|
|
74
|
-
return t.concat(r).reduce((i, s) => (
|
|
74
|
+
return t.concat(r).reduce((i, s) => (O(s, i) || i.push(s), i), []);
|
|
75
75
|
}, isValidTimeValue: function(a) {
|
|
76
76
|
return Number.isFinite(a) && a >= -2;
|
|
77
|
-
}, addLeadingZeros: Q, isValidUrl:
|
|
77
|
+
}, addLeadingZeros: Q, isValidUrl: P, isBrowserEnvironment: function() {
|
|
78
78
|
return typeof window < "u";
|
|
79
79
|
}, formatMacrosValues: function(a) {
|
|
80
80
|
return typeof a != "object" ? a : JSON.stringify(a);
|
|
81
81
|
} };
|
|
82
|
-
function
|
|
82
|
+
function F(a) {
|
|
83
83
|
return ["true", "TRUE", "True", "1"].includes(a);
|
|
84
84
|
}
|
|
85
85
|
function ne(a) {
|
|
@@ -108,7 +108,7 @@ const l = { childByName: function(a, e) {
|
|
|
108
108
|
return "".concat(t, "/").concat(a);
|
|
109
109
|
}
|
|
110
110
|
return a;
|
|
111
|
-
}, parseBoolean:
|
|
111
|
+
}, parseBoolean: F, parseNodeText: function(a) {
|
|
112
112
|
return a && (a.textContent || a.text || "").trim();
|
|
113
113
|
}, copyNodeAttribute: function(a, e, t) {
|
|
114
114
|
const r = e.getAttribute(a);
|
|
@@ -124,7 +124,7 @@ const l = { childByName: function(a, e) {
|
|
|
124
124
|
let { nodeName: r, nodeValue: i } = t;
|
|
125
125
|
if (r && i && e.hasOwnProperty(r)) {
|
|
126
126
|
let s = i;
|
|
127
|
-
typeof e[r] == "boolean" && (s =
|
|
127
|
+
typeof e[r] == "boolean" && (s = F(s)), e[r] = s;
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}, mergeWrapperAdData: function(a, e) {
|
|
@@ -156,7 +156,7 @@ const l = { childByName: function(a, e) {
|
|
|
156
156
|
function oe(a, e) {
|
|
157
157
|
const t = function() {
|
|
158
158
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
159
|
-
const { id: i, adId: s, sequence: o, apiFramework: n } =
|
|
159
|
+
const { id: i, adId: s, sequence: o, apiFramework: n } = L(r);
|
|
160
160
|
return { id: i, adId: s, sequence: o, apiFramework: n, type: "companion", required: null, variations: [] };
|
|
161
161
|
}(e);
|
|
162
162
|
return t.required = a.getAttribute("required") || null, t.variations = l.childrenByName(a, "Companion").map((r) => {
|
|
@@ -187,7 +187,7 @@ function le(a, e) {
|
|
|
187
187
|
let t;
|
|
188
188
|
const r = function() {
|
|
189
189
|
let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
190
|
-
const { id: u, adId: d, sequence: v, apiFramework: m } =
|
|
190
|
+
const { id: u, adId: d, sequence: v, apiFramework: m } = L(c);
|
|
191
191
|
return { id: u, adId: d, sequence: v, apiFramework: m, type: "linear", duration: 0, skipDelay: null, mediaFiles: [], mezzanine: null, interactiveCreativeFile: null, closedCaptionFiles: [], videoClickThroughURLTemplate: null, videoClickTrackingURLTemplates: [], videoCustomClickURLTemplates: [], adParameters: null, icons: [], trackingEvents: {} };
|
|
192
192
|
}(e);
|
|
193
193
|
r.duration = l.parseDuration(l.parseNodeText(l.childByName(a, "Duration")));
|
|
@@ -290,7 +290,7 @@ function le(a, e) {
|
|
|
290
290
|
function ce(a, e) {
|
|
291
291
|
const t = function() {
|
|
292
292
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
293
|
-
const { id: i, adId: s, sequence: o, apiFramework: n } =
|
|
293
|
+
const { id: i, adId: s, sequence: o, apiFramework: n } = L(r);
|
|
294
294
|
return { id: i, adId: s, sequence: o, apiFramework: n, type: "nonlinear", variations: [], trackingEvents: {} };
|
|
295
295
|
}(e);
|
|
296
296
|
return l.childrenByName(a, "TrackingEvents").forEach((r) => {
|
|
@@ -313,7 +313,7 @@ function ce(a, e) {
|
|
|
313
313
|
}), t.variations.push(i);
|
|
314
314
|
}), t;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function B(a) {
|
|
317
317
|
const e = [];
|
|
318
318
|
return a.forEach((t) => {
|
|
319
319
|
const r = X(t);
|
|
@@ -343,35 +343,35 @@ function X(a) {
|
|
|
343
343
|
function ue(a) {
|
|
344
344
|
return a.getAttribute("AdID") || a.getAttribute("adID") || a.getAttribute("adId") || null;
|
|
345
345
|
}
|
|
346
|
-
const
|
|
347
|
-
function
|
|
348
|
-
if (!
|
|
349
|
-
const t =
|
|
350
|
-
t.length > 0 &&
|
|
346
|
+
const E = { 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"] } };
|
|
347
|
+
function M(a, e) {
|
|
348
|
+
if (!E[a.nodeName] || !E[a.nodeName].attributes) return;
|
|
349
|
+
const t = E[a.nodeName].attributes.filter((r) => !a.getAttribute(r));
|
|
350
|
+
t.length > 0 && y({ name: a.nodeName, parentName: a.parentNode.nodeName, attributes: t }, e);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
const r =
|
|
352
|
+
function W(a, e, t) {
|
|
353
|
+
const r = E[a.nodeName], i = !t && a.nodeName !== "Wrapper";
|
|
354
354
|
if (!(!r || i)) {
|
|
355
355
|
if (r.subElements) {
|
|
356
356
|
const s = r.subElements.filter((o) => !l.childByName(a, o));
|
|
357
|
-
s.length > 0 &&
|
|
357
|
+
s.length > 0 && y({ name: a.nodeName, parentName: a.parentNode.nodeName, subElements: s }, e);
|
|
358
358
|
}
|
|
359
|
-
!t || !r.oneOfinLineResources || r.oneOfinLineResources.some((s) => l.childByName(a, s)) ||
|
|
359
|
+
!t || !r.oneOfinLineResources || r.oneOfinLineResources.some((s) => l.childByName(a, s)) || y({ name: a.nodeName, parentName: a.parentNode.nodeName, oneOfResources: r.oneOfinLineResources }, e);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function K(a) {
|
|
363
363
|
return a.children && a.children.length !== 0;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function y(a, e) {
|
|
366
366
|
let { name: t, parentName: r, attributes: i, subElements: s, oneOfResources: o } = a, n = "Element '".concat(t, "'");
|
|
367
367
|
n += i ? " missing required attribute(s) '".concat(i.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 });
|
|
368
368
|
}
|
|
369
369
|
const de = { verifyRequiredValues: function a(e, t, r) {
|
|
370
|
-
if (e && e.nodeName) if (e.nodeName === "InLine" && (r = !0),
|
|
371
|
-
|
|
370
|
+
if (e && e.nodeName) if (e.nodeName === "InLine" && (r = !0), M(e, t), K(e)) {
|
|
371
|
+
W(e, t, r);
|
|
372
372
|
for (let i = 0; i < e.children.length; i++) a(e.children[i], t, r);
|
|
373
|
-
} else l.parseNodeText(e).length === 0 &&
|
|
374
|
-
}, hasSubElements:
|
|
373
|
+
} else l.parseNodeText(e).length === 0 && y({ name: e.nodeName, parentName: e.parentNode.nodeName }, t);
|
|
374
|
+
}, hasSubElements: K, emitMissingValueWarning: y, verifyRequiredAttributes: M, verifyRequiredSubElements: W };
|
|
375
375
|
function he(a, e) {
|
|
376
376
|
let { allowMultipleAds: t, followAdditionalWrappers: r } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
377
377
|
const i = Array.from(a.childNodes).filter((s) => {
|
|
@@ -415,7 +415,7 @@ function Z(a, e) {
|
|
|
415
415
|
d.push(p);
|
|
416
416
|
});
|
|
417
417
|
const m = l.childByName(c, "CreativeExtensions");
|
|
418
|
-
m && (v =
|
|
418
|
+
m && (v = B(l.childrenByName(m, "CreativeExtension")));
|
|
419
419
|
for (const h in c.childNodes) {
|
|
420
420
|
const p = c.childNodes[h];
|
|
421
421
|
let g;
|
|
@@ -436,14 +436,14 @@ function Z(a, e) {
|
|
|
436
436
|
break;
|
|
437
437
|
case "Extensions": {
|
|
438
438
|
const o = l.childrenByName(s, "Extension");
|
|
439
|
-
i.extensions =
|
|
439
|
+
i.extensions = B(o), i.adVerifications.length || (t = function(n) {
|
|
440
440
|
let c = null, u = [];
|
|
441
|
-
return n.some((d) => c = l.childByName(d, "AdVerifications")), c && (u =
|
|
441
|
+
return n.some((d) => c = l.childByName(d, "AdVerifications")), c && (u = j(l.childrenByName(c, "Verification"))), u;
|
|
442
442
|
}(o));
|
|
443
443
|
break;
|
|
444
444
|
}
|
|
445
445
|
case "AdVerifications":
|
|
446
|
-
i.adVerifications =
|
|
446
|
+
i.adVerifications = j(l.childrenByName(s, "Verification"));
|
|
447
447
|
break;
|
|
448
448
|
case "AdSystem":
|
|
449
449
|
i.system = { value: l.parseNodeText(s), version: s.getAttribute("version") || null };
|
|
@@ -509,7 +509,7 @@ function pe(a, e) {
|
|
|
509
509
|
}
|
|
510
510
|
}), t.nextWrapperURL) return t;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function j(a) {
|
|
513
513
|
const e = [];
|
|
514
514
|
return a.forEach((t) => {
|
|
515
515
|
const r = { resource: null, vendor: null, browserOptional: !1, apiFramework: null, type: null, parameters: null, trackingEvents: {} }, i = Array.from(t.childNodes);
|
|
@@ -572,10 +572,10 @@ class J {
|
|
|
572
572
|
return this._handlers.map((e) => e.event);
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
let
|
|
575
|
+
let q = 0, N = 0;
|
|
576
576
|
const $ = (a, e) => {
|
|
577
|
-
!a || !e || a <= 0 || e <= 0 || (
|
|
578
|
-
}, ge = { ERRORCODE: 900, extensions: [] },
|
|
577
|
+
!a || !e || a <= 0 || e <= 0 || (N = (N * q + 8 * a / e) / ++q);
|
|
578
|
+
}, ge = { ERRORCODE: 900, extensions: [] }, H = "VAST response version not supported";
|
|
579
579
|
class ve extends J {
|
|
580
580
|
constructor() {
|
|
581
581
|
let { fetcher: e } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -589,7 +589,7 @@ class ve extends J {
|
|
|
589
589
|
return this.rootErrorURLTemplates.concat(this.errorURLTemplates);
|
|
590
590
|
}
|
|
591
591
|
getEstimatedBitrate() {
|
|
592
|
-
return
|
|
592
|
+
return N;
|
|
593
593
|
}
|
|
594
594
|
initParsingStatus() {
|
|
595
595
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -620,7 +620,7 @@ class ve extends J {
|
|
|
620
620
|
var c;
|
|
621
621
|
this.emit("VAST-ad-parsed", { type: "ERROR", url: i, wrapperDepth: s });
|
|
622
622
|
const m = (e == null || (c = e.documentElement) === null || c === void 0 ? void 0 : c.nodeName) === "VideoAdServingTemplate";
|
|
623
|
-
throw new Error(m ?
|
|
623
|
+
throw new Error(m ? H : "Invalid VAST XMLDocument");
|
|
624
624
|
}
|
|
625
625
|
const u = [], d = e.documentElement.childNodes, v = e.documentElement.getAttribute("version");
|
|
626
626
|
r && v && (this.vastVersion = v);
|
|
@@ -675,7 +675,7 @@ class ve extends J {
|
|
|
675
675
|
v && l.mergeWrapperAdData(v, i);
|
|
676
676
|
}), s(d);
|
|
677
677
|
})).catch((u) => {
|
|
678
|
-
i.errorCode = u.message ===
|
|
678
|
+
i.errorCode = u.message === H ? 102 : 301, i.errorMessage = u.message, s(i);
|
|
679
679
|
});
|
|
680
680
|
});
|
|
681
681
|
}
|
|
@@ -735,11 +735,11 @@ class Te {
|
|
|
735
735
|
return this.storage.clear();
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
const
|
|
738
|
+
const w = 12e4, Ae = { get: async function(a, e) {
|
|
739
739
|
try {
|
|
740
740
|
const t = new AbortController(), r = setTimeout(() => {
|
|
741
|
-
throw t.abort(), new Error("URLHandler: Request timed out after ".concat(e.timeout ||
|
|
742
|
-
}, e.timeout ||
|
|
741
|
+
throw t.abort(), new Error("URLHandler: Request timed out after ".concat(e.timeout || w, " ms (408)"));
|
|
742
|
+
}, e.timeout || w), i = await fetch(a, { ...e, signal: t.signal, credentials: e.withCredentials ? "include" : "omit" }).finally(() => {
|
|
743
743
|
clearTimeout(r);
|
|
744
744
|
}), s = function(o) {
|
|
745
745
|
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, ")");
|
|
@@ -759,7 +759,7 @@ class Re {
|
|
|
759
759
|
}
|
|
760
760
|
setOptions() {
|
|
761
761
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
762
|
-
this.urlHandler = e.urlHandler || e.urlhandler || Ae, this.fetchingOptions = { timeout: e.timeout ||
|
|
762
|
+
this.urlHandler = e.urlHandler || e.urlhandler || Ae, this.fetchingOptions = { timeout: e.timeout || w, withCredentials: !!e.withCredentials };
|
|
763
763
|
}
|
|
764
764
|
addURLTemplateFilter(e) {
|
|
765
765
|
typeof e == "function" && this.URLTemplateFilters.push(e);
|
|
@@ -1117,7 +1117,7 @@ function Ee(a) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
return r;
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function C(a) {
|
|
1121
1121
|
const e = {
|
|
1122
1122
|
attributes: {},
|
|
1123
1123
|
children: {},
|
|
@@ -1134,7 +1134,7 @@ function L(a) {
|
|
|
1134
1134
|
if (r)
|
|
1135
1135
|
for (const i in r) {
|
|
1136
1136
|
const s = r[i];
|
|
1137
|
-
s.nodeName && s.nodeName.substring(0, 1) !== "#" && (e.children[s.nodeName] =
|
|
1137
|
+
s.nodeName && s.nodeName.substring(0, 1) !== "#" && (e.children[s.nodeName] = C(s));
|
|
1138
1138
|
}
|
|
1139
1139
|
return e;
|
|
1140
1140
|
}
|
|
@@ -1158,7 +1158,7 @@ class be {
|
|
|
1158
1158
|
break;
|
|
1159
1159
|
case "Extensions":
|
|
1160
1160
|
this.extensions = ee(r, "Extension").map(
|
|
1161
|
-
(i) =>
|
|
1161
|
+
(i) => C(i)
|
|
1162
1162
|
);
|
|
1163
1163
|
break;
|
|
1164
1164
|
}
|
|
@@ -1194,7 +1194,7 @@ class Ne {
|
|
|
1194
1194
|
break;
|
|
1195
1195
|
case "Extensions":
|
|
1196
1196
|
this.extensions = ee(r, "Extension").map(
|
|
1197
|
-
(i) =>
|
|
1197
|
+
(i) => C(i)
|
|
1198
1198
|
);
|
|
1199
1199
|
break;
|
|
1200
1200
|
}
|
|
@@ -1208,10 +1208,14 @@ const we = (a, e) => {
|
|
|
1208
1208
|
return async () => {
|
|
1209
1209
|
try {
|
|
1210
1210
|
const o = new URL(e), n = new t.NonceRequest();
|
|
1211
|
-
let c = localStorage.getItem("sl-device-id") ||
|
|
1212
|
-
u || (u =
|
|
1211
|
+
let c = localStorage.getItem("sl-device-id") || x(), u = sessionStorage.getItem("sl-ad-session-id");
|
|
1212
|
+
u || (u = x(), sessionStorage.setItem("sl-ad-session-id", u)), ae(c) || (c = S(`https://${c}`, S.URL)), o.searchParams.get("url") || o.searchParams.set("url", "https://streamlayer.io"), o.searchParams.get("description_url") || o.searchParams.set("description_url", "https://streamlayer.io"), n.adWillAutoPlay = o.searchParams.get("vpa") === "auto", n.adWillPlayMuted = o.searchParams.get("vpmute") === "1", n.continuousPlayback = !0, n.descriptionUrl = o.searchParams.get("description_url"), n.iconsSupported = !0, n.sessionId = c, n.supportedApiFrameworks = "2,7,9", n.videoHeight = a.clientHeight, n.videoWidth = a.clientWidth;
|
|
1213
1213
|
const d = await i.loadNonceManager(n);
|
|
1214
|
-
return o.searchParams.get("is_lat") === "[placeholder]" && o.searchParams.set("is_lat", "1"), o.searchParams.get("rdid") === "[placeholder]" && o.searchParams.set("rdid", c), o.searchParams.get("correlator") === "[placeholder]" && o.searchParams.set("correlator", u), o.searchParams.set("wta", "1"), o.searchParams.set("givn", d.getNonce()),
|
|
1214
|
+
return o.searchParams.get("is_lat") === "[placeholder]" && o.searchParams.set("is_lat", "1"), o.searchParams.get("rdid") === "[placeholder]" && o.searchParams.set("rdid", c), o.searchParams.get("correlator") === "[placeholder]" && o.searchParams.set("correlator", u), o.searchParams.set("wta", "1"), o.searchParams.set("givn", d.getNonce()), {
|
|
1215
|
+
url: o,
|
|
1216
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1217
|
+
manager: d
|
|
1218
|
+
};
|
|
1215
1219
|
} catch (o) {
|
|
1216
1220
|
console.log("AdsManager could not be started", o);
|
|
1217
1221
|
return;
|
|
@@ -1221,27 +1225,34 @@ const we = (a, e) => {
|
|
|
1221
1225
|
var t;
|
|
1222
1226
|
const e = a == null ? void 0 : a.mediaFiles;
|
|
1223
1227
|
return e != null && e.length && ((t = e.find((r) => r.fileURL)) == null ? void 0 : t.fileURL) || "";
|
|
1224
|
-
},
|
|
1228
|
+
}, k = ie({
|
|
1225
1229
|
ads: [],
|
|
1226
1230
|
autoplay: !0,
|
|
1227
|
-
muted: !1
|
|
1231
|
+
muted: !1,
|
|
1232
|
+
nonceManager: void 0
|
|
1228
1233
|
}), Ve = (a, e) => {
|
|
1229
|
-
const [t, r] = re(), i =
|
|
1230
|
-
return
|
|
1234
|
+
const [t, r] = re(), i = U(Date.now()), s = U(Date.now());
|
|
1235
|
+
return I(() => {
|
|
1231
1236
|
if (!e || !(a != null && a.current))
|
|
1232
1237
|
return;
|
|
1233
1238
|
const o = we(a.current, e), n = Date.now();
|
|
1234
|
-
i.current = n,
|
|
1235
|
-
|
|
1239
|
+
i.current = n, k.set({
|
|
1240
|
+
...k.get(),
|
|
1241
|
+
nonceManager: void 0
|
|
1242
|
+
}), o().then((c) => {
|
|
1243
|
+
i.current === n && c && (r(c.url), k.set({
|
|
1244
|
+
...k.get(),
|
|
1245
|
+
nonceManager: c.manager
|
|
1246
|
+
}));
|
|
1236
1247
|
}).catch((c) => {
|
|
1237
1248
|
console.error(c);
|
|
1238
1249
|
});
|
|
1239
|
-
}, [a, e]),
|
|
1250
|
+
}, [a, e]), I(() => {
|
|
1240
1251
|
const o = async (n, c) => {
|
|
1241
1252
|
let u = [];
|
|
1242
1253
|
if (n.searchParams.get("output") === "vmap") {
|
|
1243
1254
|
const h = await fetch(n.toString()), p = new DOMParser(), g = await h.text(), T = p.parseFromString(g, "text/xml");
|
|
1244
|
-
u = new Ne(T).adBreaks.map((
|
|
1255
|
+
u = new Ne(T).adBreaks.map((b) => b.adSource.adTagURI.uri);
|
|
1245
1256
|
} else
|
|
1246
1257
|
u = [n.toString()];
|
|
1247
1258
|
const d = await Promise.all(
|
|
@@ -1250,18 +1261,19 @@ const we = (a, e) => {
|
|
|
1250
1261
|
const T = g.ads.find((te) => te.creatives.length > 0);
|
|
1251
1262
|
if (!T)
|
|
1252
1263
|
return;
|
|
1253
|
-
const A = Ce(T),
|
|
1264
|
+
const A = Ce(T), b = Ue(A);
|
|
1254
1265
|
return {
|
|
1255
1266
|
creative: A,
|
|
1256
1267
|
order: p,
|
|
1257
|
-
mediaFileUrl:
|
|
1268
|
+
mediaFileUrl: b,
|
|
1258
1269
|
ad: T,
|
|
1259
1270
|
raw: g
|
|
1260
1271
|
};
|
|
1261
1272
|
}
|
|
1262
1273
|
}))
|
|
1263
1274
|
), v = n.searchParams.get("vpa") !== "click", m = n.searchParams.get("vpmute") === "1";
|
|
1264
|
-
|
|
1275
|
+
k.set({
|
|
1276
|
+
...k.get(),
|
|
1265
1277
|
ads: d.filter((h) => !!h),
|
|
1266
1278
|
autoplay: v,
|
|
1267
1279
|
muted: m
|
|
@@ -1274,7 +1286,7 @@ const we = (a, e) => {
|
|
|
1274
1286
|
return () => {
|
|
1275
1287
|
s.current = 0;
|
|
1276
1288
|
};
|
|
1277
|
-
}, [t]),
|
|
1289
|
+
}, [t]), k;
|
|
1278
1290
|
};
|
|
1279
1291
|
export {
|
|
1280
1292
|
Ue as a,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -80,19 +80,19 @@
|
|
|
80
80
|
"@noriginmedia/norigin-spatial-navigation": "^2.3.0",
|
|
81
81
|
"react-window-infinite-loader": "^1.0.9",
|
|
82
82
|
"uuid": "^11.1.0",
|
|
83
|
-
"@streamlayer/feature-gamification": "^1.
|
|
84
|
-
"@streamlayer/react-polyfills": "^0.1.
|
|
85
|
-
"@streamlayer/sdk-web": "^1.14.
|
|
86
|
-
"@streamlayer/sdk-web-
|
|
87
|
-
"@streamlayer/sdk-web-
|
|
88
|
-
"@streamlayer/sdk-web-api": "^1.12.
|
|
89
|
-
"@streamlayer/sdk-web-core": "^1.15.
|
|
90
|
-
"@streamlayer/sdk-web-features": "^1.0.
|
|
91
|
-
"@streamlayer/sdk-web-interfaces": "^1.7.
|
|
92
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
93
|
-
"@streamlayer/sdk-web-notifications": "^1.3.
|
|
94
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
95
|
-
"@streamlayer/sdk-web-types": "^1.14.
|
|
83
|
+
"@streamlayer/feature-gamification": "^1.21.1",
|
|
84
|
+
"@streamlayer/react-polyfills": "^0.1.32",
|
|
85
|
+
"@streamlayer/sdk-web": "^1.14.5",
|
|
86
|
+
"@streamlayer/sdk-web-anonymous-auth": "^1.1.51",
|
|
87
|
+
"@streamlayer/sdk-web-analytics": "^1.11.5",
|
|
88
|
+
"@streamlayer/sdk-web-api": "^1.12.5",
|
|
89
|
+
"@streamlayer/sdk-web-core": "^1.15.5",
|
|
90
|
+
"@streamlayer/sdk-web-features": "^1.0.72",
|
|
91
|
+
"@streamlayer/sdk-web-interfaces": "^1.7.5",
|
|
92
|
+
"@streamlayer/sdk-web-logger": "^1.0.72",
|
|
93
|
+
"@streamlayer/sdk-web-notifications": "^1.3.34",
|
|
94
|
+
"@streamlayer/sdk-web-storage": "^1.0.72",
|
|
95
|
+
"@streamlayer/sdk-web-types": "^1.14.5"
|
|
96
96
|
},
|
|
97
97
|
"nx": {
|
|
98
98
|
"implicitDependencies": [
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"vite-plugin-svgr": "^4.2.0",
|
|
134
134
|
"vite-svg-loader": "^5.1.0",
|
|
135
135
|
"vite-tsconfig-paths": "^5.0.1",
|
|
136
|
-
"@streamlayer/react": "^1.18.
|
|
136
|
+
"@streamlayer/react": "^1.18.5"
|
|
137
137
|
},
|
|
138
138
|
"dependencies": {
|
|
139
139
|
"@dailymotion/vast-client": "^6.2.0",
|