@streamlayer/react 1.10.0 → 1.11.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.
Files changed (53) hide show
  1. package/lib/cjs/masters2.js +1 -1
  2. package/lib/cjs/provider.js +60 -52
  3. package/lib/cjs/useStreamLayerApp2.js +1 -1
  4. package/lib/classic/app/advertisement.d.ts +18 -0
  5. package/lib/classic/app/app.d.ts +19 -0
  6. package/lib/classic/app/auth.d.ts +4 -0
  7. package/lib/classic/app/event.d.ts +4 -0
  8. package/lib/classic/app/insight.d.ts +13 -0
  9. package/lib/classic/app/masters.d.ts +28 -0
  10. package/lib/classic/app/notification.d.ts +5 -0
  11. package/lib/classic/app/points.d.ts +3 -0
  12. package/lib/classic/app/provider.d.ts +43 -0
  13. package/lib/classic/app/useStreamLayerApp.d.ts +19 -0
  14. package/lib/classic/cjs/advertisement.js +1 -0
  15. package/lib/classic/cjs/auth.js +1 -0
  16. package/lib/classic/cjs/gamification-feature.js +1 -0
  17. package/lib/classic/cjs/gamification-feature2.js +1 -0
  18. package/lib/classic/cjs/index.js +1 -0
  19. package/lib/classic/cjs/insight.js +1 -0
  20. package/lib/classic/cjs/masters.js +1 -0
  21. package/lib/classic/cjs/masters2.js +9 -0
  22. package/lib/classic/cjs/notification.js +1 -0
  23. package/lib/classic/cjs/points.js +1 -0
  24. package/lib/classic/cjs/provider.js +195 -0
  25. package/lib/classic/cjs/useStreamLayerApp.js +1 -0
  26. package/lib/classic/cjs/useStreamLayerApp2.js +17 -0
  27. package/lib/classic/es/advertisement.js +755 -0
  28. package/lib/classic/es/auth.js +11 -0
  29. package/lib/classic/es/gamification-feature.js +4 -0
  30. package/lib/classic/es/gamification-feature2.js +4 -0
  31. package/lib/classic/es/index.js +16 -0
  32. package/lib/classic/es/insight.js +75 -0
  33. package/lib/classic/es/masters.js +8 -0
  34. package/lib/classic/es/masters2.js +1066 -0
  35. package/lib/classic/es/notification.js +468 -0
  36. package/lib/classic/es/points.js +59 -0
  37. package/lib/classic/es/provider.js +24526 -0
  38. package/lib/classic/es/useStreamLayerApp.js +5 -0
  39. package/lib/classic/es/useStreamLayerApp2.js +18023 -0
  40. package/lib/classic/index.d.ts +14 -0
  41. package/lib/classic/masters.d.ts +5 -0
  42. package/lib/classic/style.css +1 -0
  43. package/lib/dist/cjs/gamification-feature2.js +1 -1
  44. package/lib/dist/cjs/masters.js +56 -48
  45. package/lib/dist/es/gamification-feature2.js +10 -10
  46. package/lib/dist/es/index.js +3 -3
  47. package/lib/dist/es/masters.js +6601 -6554
  48. package/lib/es/index.js +1 -1
  49. package/lib/es/masters2.js +22 -22
  50. package/lib/es/notification.js +18 -18
  51. package/lib/es/provider.js +4727 -4679
  52. package/lib/es/useStreamLayerApp2.js +1 -1
  53. package/package.json +49 -13
@@ -0,0 +1,755 @@
1
+ import { jsx as e, jsxs as v, Fragment as po } from "react/jsx-runtime";
2
+ import { useRef as F, useState as R, useCallback as Mo, useEffect as L } from "react";
3
+ import { e as M, s as n, f as Po, g as mo, i as D, Y as ko, a as uo, L as Lo, u as Oo, j as _o, b as Bo, S as T, h as xo } from "./provider.js";
4
+ import { N, a as vo, b as Ao, C as go, c as ho, P as k, d as S, A as Ro, e as Do, S as qo } from "./useStreamLayerApp2.js";
5
+ const wo = /* @__PURE__ */ n("div")({
6
+ name: "Container",
7
+ class: "c5b6wdg",
8
+ propsAsIs: !1
9
+ }), Vo = "a1rlj479", jo = "s35f1di", Uo = "sj4471g", Fo = "b12050d8", zo = "b1d5ybek", Go = (o) => o === "left" || o === "right" ? jo : Fo, Wo = (o) => o === "left" || o === "right" ? Uo : zo, Ho = (o) => o === "left" ? "avdxyl3" : o === "right" ? "a1bisd08" : o === "top" ? "a1u9y2aj" : "a1qqaks", z = ({
10
+ children: o,
11
+ style: s,
12
+ className: i,
13
+ enabled: t = !0,
14
+ hiding: l,
15
+ direction: r = "left",
16
+ onAnimationEnd: c
17
+ }) => /* @__PURE__ */ e(wo, {
18
+ style: s,
19
+ className: M(i, Vo, Ho(r), t && !l && Go(r), t && l && Wo(r)),
20
+ onAnimationEnd: c,
21
+ children: o
22
+ }), Ko = /* @__PURE__ */ n("a")({
23
+ name: "Link",
24
+ class: "l1sgte8c",
25
+ propsAsIs: !1
26
+ }), Yo = /* @__PURE__ */ n("div")({
27
+ name: "BannerContainer",
28
+ class: "b7yfc72",
29
+ propsAsIs: !1
30
+ }), Jo = () => Ko, Zo = /* @__PURE__ */ n(Jo())({
31
+ name: "BannerLink",
32
+ class: "bejjq94",
33
+ propsAsIs: !0
34
+ }), Qo = ({ promotion: o, promotionId: s, hiding: i, direction: t = "bottom" }) => {
35
+ var l, r;
36
+ if (!((l = o.additionalBanner) != null && l.imageUrl))
37
+ return null;
38
+ let c = (r = o.additionalBanner) == null ? void 0 : r.url;
39
+ return c && c.indexOf("http") !== 0 && (c = `https://${c}`), /* @__PURE__ */ e(z, { direction: t, hiding: i, children: /* @__PURE__ */ e(Yo, { className: "BannerContainer", children: /* @__PURE__ */ e(
40
+ Zo,
41
+ {
42
+ as: c ? "a" : "span",
43
+ className: "BannerLink",
44
+ href: c,
45
+ style: {
46
+ backgroundImage: `url(${o.additionalBanner.imageUrl})`,
47
+ cursor: c ? "pointer" : "default"
48
+ },
49
+ "data-promo-id": s,
50
+ "data-promo-type": o.type,
51
+ "data-analytics": "banner",
52
+ target: "_blank"
53
+ }
54
+ ) }) });
55
+ }, Xo = /* @__PURE__ */ n("div")({
56
+ name: "NotificationContent",
57
+ class: "n18wsqoo",
58
+ propsAsIs: !1
59
+ }), oe = /* @__PURE__ */ n("div")({
60
+ name: "Body",
61
+ class: "b1ia90c2",
62
+ propsAsIs: !1
63
+ }), ee = /* @__PURE__ */ n("div")({
64
+ name: "Title",
65
+ class: "tg2z08v",
66
+ propsAsIs: !1
67
+ }), ne = /* @__PURE__ */ n("div")({
68
+ name: "Text",
69
+ class: "t59zdk1",
70
+ propsAsIs: !1
71
+ }), G = /* @__PURE__ */ n("div")({
72
+ name: "MediaImgBottom",
73
+ class: "m1ab9fq",
74
+ propsAsIs: !1
75
+ }), se = () => G, te = /* @__PURE__ */ n(se())({
76
+ name: "MediaImgMiddle",
77
+ class: "m9fsr0y",
78
+ propsAsIs: !0
79
+ }), ie = /* @__PURE__ */ n("img")({
80
+ name: "CtaIcon",
81
+ class: "cvi9y5q",
82
+ propsAsIs: !1
83
+ }), ae = /* @__PURE__ */ n("button")({
84
+ name: "Button",
85
+ class: "bgl6boa",
86
+ propsAsIs: !1
87
+ }), re = /* @__PURE__ */ n("div")({
88
+ name: "Logo",
89
+ class: "l5mq0z",
90
+ propsAsIs: !1
91
+ }), le = /* @__PURE__ */ n("div")({
92
+ name: "Footer",
93
+ class: "f1mse0ft",
94
+ propsAsIs: !1
95
+ }), de = /* @__PURE__ */ n("div")({
96
+ name: "Vector",
97
+ class: "v1hcloah",
98
+ propsAsIs: !1
99
+ }), ce = /* @__PURE__ */ n("div")({
100
+ name: "NotificationContainer",
101
+ class: "n3n65jf",
102
+ propsAsIs: !1
103
+ }), pe = {
104
+ [N.BOTTOM]: G,
105
+ [N.MIDDLE]: te
106
+ }, me = ({ src: o, imagePosition: s }) => {
107
+ const i = pe[s] || G;
108
+ return /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e("img", { src: o, alt: "" }) });
109
+ }, ue = ({ notification: o, open: s }) => {
110
+ if (!o || !o.promotion || o.enabled !== vo.NOTIFICATION_ENABLED)
111
+ return null;
112
+ const { title: i, body: t, image: l, promotion: r } = o, { sponsorLogo: c, sponsorLogoMode: m, imagePosition: A, ctaButton: a } = r;
113
+ return /* @__PURE__ */ v(ce, { className: "SL_Lower_Third_Notification", onClick: s, children: [
114
+ /* @__PURE__ */ v(Xo, { children: [
115
+ /* @__PURE__ */ e(me, { src: l, imagePosition: A }),
116
+ /* @__PURE__ */ v(oe, { children: [
117
+ i && /* @__PURE__ */ e(ee, { children: i }),
118
+ t && /* @__PURE__ */ e(ne, { children: t })
119
+ ] })
120
+ ] }),
121
+ /* @__PURE__ */ v(le, { children: [
122
+ m !== Ao.NOTIFICATION_SPONSOR_LOGO_NONE && /* @__PURE__ */ v(po, { children: [
123
+ /* @__PURE__ */ e(re, { children: /* @__PURE__ */ e("img", { src: c, alt: i }) }),
124
+ /* @__PURE__ */ e(de, {})
125
+ ] }),
126
+ /* @__PURE__ */ v(ae, { name: "promo-button", style: { color: a == null ? void 0 : a.textColor, backgroundColor: a == null ? void 0 : a.color }, children: [
127
+ (a == null ? void 0 : a.ctaIcon) && (a == null ? void 0 : a.ctaIconMode) === go.CTA_ICON_TRANSPARENT && /* @__PURE__ */ e(ie, { src: a == null ? void 0 : a.ctaIcon, alt: "cta-icon" }),
128
+ (a == null ? void 0 : a.label) || "Open"
129
+ ] })
130
+ ] })
131
+ ] });
132
+ }, ve = /* @__PURE__ */ n("div")({
133
+ name: "NotificationContent",
134
+ class: "n1ku6hz",
135
+ propsAsIs: !1
136
+ }), Ae = /* @__PURE__ */ n("div")({
137
+ name: "NotificationContainer",
138
+ class: "nbxqmol",
139
+ propsAsIs: !1
140
+ }), ge = /* @__PURE__ */ n("div")({
141
+ name: "Body",
142
+ class: "b1gu3eml",
143
+ propsAsIs: !1
144
+ }), he = /* @__PURE__ */ n("div")({
145
+ name: "Title",
146
+ class: "t1u17zva",
147
+ propsAsIs: !1
148
+ }), Ie = /* @__PURE__ */ n("div")({
149
+ name: "Text",
150
+ class: "t10ko1g",
151
+ propsAsIs: !1
152
+ }), q = /* @__PURE__ */ n("div")({
153
+ name: "Media",
154
+ class: "mntc42e",
155
+ propsAsIs: !1
156
+ }), ye = () => q, io = /* @__PURE__ */ n(ye())({
157
+ name: "MediaImgFit",
158
+ class: "ml060eo",
159
+ propsAsIs: !0
160
+ }), be = () => q, Io = /* @__PURE__ */ n(be())({
161
+ name: "MediaImgCentered",
162
+ class: "m1vqlvig",
163
+ propsAsIs: !0
164
+ }), fe = () => Io, Ne = /* @__PURE__ */ n(fe())({
165
+ name: "MediaImgBottom",
166
+ class: "m1e7tvi5",
167
+ propsAsIs: !0
168
+ }), $e = () => q, Ce = /* @__PURE__ */ n($e())({
169
+ name: "MediaImgSolid",
170
+ class: "mqvntt2",
171
+ propsAsIs: !0
172
+ }), Te = () => q, Se = /* @__PURE__ */ n(Te())({
173
+ name: "MediaImgMiddle",
174
+ class: "m12jtj3u",
175
+ propsAsIs: !0
176
+ }), Ee = /* @__PURE__ */ n("img")({
177
+ name: "CtaIcon",
178
+ class: "ckq1frv",
179
+ propsAsIs: !1
180
+ }), Me = /* @__PURE__ */ n("button")({
181
+ name: "Button",
182
+ class: "bis90pl",
183
+ propsAsIs: !1
184
+ }), Pe = () => Po, ke = /* @__PURE__ */ n(Pe())({
185
+ name: "StyledChevronRight",
186
+ class: "s9mjmz3",
187
+ propsAsIs: !0
188
+ }), Le = /* @__PURE__ */ n("div")({
189
+ name: "Logo",
190
+ class: "l1cf50a7",
191
+ propsAsIs: !1
192
+ }), Oe = {
193
+ [N.UNSET]: io,
194
+ [N.FIT]: io,
195
+ [N.CENTERED]: Io,
196
+ [N.BOTTOM]: Ne,
197
+ [N.SOLID]: Ce,
198
+ [N.MIDDLE]: Se
199
+ }, _e = ({ src: o, imagePosition: s }) => {
200
+ const i = Oe[s];
201
+ return /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e("img", { src: o, alt: "" }) });
202
+ }, Be = ({ notification: o, open: s, promotionId: i, hiding: t, direction: l = "left" }) => {
203
+ if (!o || !o.promotion || o.enabled !== vo.NOTIFICATION_ENABLED)
204
+ return null;
205
+ if (o.promotion.mode === ho.LOWER_THIRD)
206
+ return /* @__PURE__ */ e(ue, { notification: o, open: s });
207
+ const { title: r, body: c, image: m, promotion: A } = o, { sponsorLogo: a, sponsorLogoMode: g, imagePosition: u, ctaButton: p } = A;
208
+ return /* @__PURE__ */ e(z, { className: "SL_Rich_Notification", direction: l, hiding: t, children: /* @__PURE__ */ v(Ae, { onClick: s, children: [
209
+ g !== Ao.NOTIFICATION_SPONSOR_LOGO_NONE && /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e("img", { src: a, alt: r }) }),
210
+ /* @__PURE__ */ v(ve, { children: [
211
+ /* @__PURE__ */ e(_e, { src: m, imagePosition: u }),
212
+ /* @__PURE__ */ v(ge, { children: [
213
+ r && /* @__PURE__ */ e(he, { children: r }),
214
+ c && /* @__PURE__ */ e(Ie, { children: c })
215
+ ] }),
216
+ /* @__PURE__ */ v(Me, { name: "promo-button", style: { color: p == null ? void 0 : p.textColor, backgroundColor: p == null ? void 0 : p.color }, children: [
217
+ (p == null ? void 0 : p.ctaIcon) && (p == null ? void 0 : p.ctaIconMode) === go.CTA_ICON_TRANSPARENT && /* @__PURE__ */ e(Ee, { src: p == null ? void 0 : p.ctaIcon, alt: "cta-icon" }),
218
+ (p == null ? void 0 : p.label) || "Open"
219
+ ] }),
220
+ /* @__PURE__ */ e(ke, { name: "chevronRight" })
221
+ ] })
222
+ ] }) });
223
+ }, xe = /* @__PURE__ */ n("div")({
224
+ name: "OverlayContainer",
225
+ class: "okzhq2w",
226
+ propsAsIs: !1
227
+ }), yo = /* @__PURE__ */ n("div")({
228
+ name: "PromoOverlay",
229
+ class: "pmgz5i",
230
+ propsAsIs: !1
231
+ }), bo = /* @__PURE__ */ n("div")({
232
+ name: "Header",
233
+ class: "hyxi3jt",
234
+ propsAsIs: !1
235
+ }), fo = /* @__PURE__ */ n("div")({
236
+ name: "HeaderContent",
237
+ class: "h149e3gp",
238
+ propsAsIs: !1
239
+ }), No = "h10toh7", ao = /* @__PURE__ */ n("img")({
240
+ name: "SponsorLogo",
241
+ class: "s1jyea6t",
242
+ propsAsIs: !1
243
+ }), Re = /* @__PURE__ */ n("div")({
244
+ name: "SponsorName",
245
+ class: "szpfa3h",
246
+ propsAsIs: !1
247
+ }), $o = /* @__PURE__ */ n("div")({
248
+ name: "Media",
249
+ class: "m1crmu01",
250
+ propsAsIs: !1
251
+ }), De = /* @__PURE__ */ n("img")({
252
+ name: "PromoImg",
253
+ class: "p1l37r8s",
254
+ propsAsIs: !1
255
+ }), qe = "s1nmch9k", ro = /* @__PURE__ */ n("div")({
256
+ name: "Content",
257
+ class: "c1er0ljd",
258
+ propsAsIs: !1
259
+ }), we = /* @__PURE__ */ n("div")({
260
+ name: "Description",
261
+ class: "dydopmr",
262
+ propsAsIs: !1
263
+ }), Ve = /* @__PURE__ */ n("div")({
264
+ name: "Sponsor",
265
+ class: "s1w6nt04",
266
+ propsAsIs: !1
267
+ }), je = /* @__PURE__ */ n("div")({
268
+ name: "SponsorText",
269
+ class: "s1evcmtq",
270
+ propsAsIs: !1
271
+ }), Co = /* @__PURE__ */ n("div")({
272
+ name: "ADLogo",
273
+ class: "awodx0x",
274
+ propsAsIs: !1
275
+ }), Ue = /* @__PURE__ */ n("span")({
276
+ name: "SponsoredText",
277
+ class: "s1q3n6oi",
278
+ propsAsIs: !1
279
+ }), Fe = /* @__PURE__ */ n("div")({
280
+ name: "ActionBtnWrap",
281
+ class: "a8d4xfk",
282
+ propsAsIs: !1
283
+ }), ze = /* @__PURE__ */ n("a")({
284
+ name: "ActionButton",
285
+ class: "at6oobh",
286
+ propsAsIs: !1
287
+ }), Ge = /* @__PURE__ */ n("div")({
288
+ name: "Title",
289
+ class: "t1gyg7tt",
290
+ propsAsIs: !1
291
+ }), We = "h17rwbtk", He = /* @__PURE__ */ n("div")({
292
+ name: "Container",
293
+ class: "c10m2bce",
294
+ propsAsIs: !1
295
+ }), lo = /* @__PURE__ */ n("div")({
296
+ name: "Item",
297
+ class: "ig23yq5",
298
+ propsAsIs: !1
299
+ }), Ke = /* @__PURE__ */ n("div")({
300
+ name: "Dot",
301
+ class: "d1f6aqua",
302
+ propsAsIs: !1
303
+ }), Ye = ({
304
+ time: o,
305
+ adCount: s,
306
+ adPosition: i
307
+ }) => {
308
+ const t = Math.floor(o / 60), l = o - t * 60;
309
+ return t === 0 && l === 0 && s === i ? null : /* @__PURE__ */ v(He, {
310
+ children: [s > 1 && /* @__PURE__ */ v(po, {
311
+ children: [/* @__PURE__ */ v(lo, {
312
+ children: [i, " of ", s]
313
+ }), /* @__PURE__ */ e(Ke, {})]
314
+ }), /* @__PURE__ */ v(lo, {
315
+ children: [t, ":", l < 10 ? `0${l}` : l]
316
+ })]
317
+ });
318
+ }, Je = (o, s, { onPlay: i, onStop: t, onProgress: l }) => {
319
+ const r = google.ima;
320
+ let c = new r.AdDisplayContainer(o), m = new r.AdsLoader(c), A = new r.AdsRequest(), a;
321
+ m.addEventListener(
322
+ r.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
323
+ (u) => {
324
+ a = u.getAdsManager(o), i && a.addEventListener(r.AdEvent.Type.STARTED, i), t && a.addEventListener(r.AdEvent.Type.COMPLETE, t), l && a.addEventListener(r.AdEvent.Type.AD_PROGRESS, (p) => l(p.getAdData())), a.init(o.clientWidth, o.clientHeight, r.ViewMode.NORMAL), a.start();
325
+ },
326
+ !1
327
+ ), m.addEventListener(
328
+ r.AdErrorEvent.Type.AD_ERROR,
329
+ () => {
330
+ console.log("ad error"), t == null || t();
331
+ },
332
+ !1
333
+ ), A.linearAdSlotWidth = o.clientWidth, A.linearAdSlotHeight = o.clientHeight, A.adTagUrl = s, m.requestAds(A);
334
+ const g = () => {
335
+ a == null || a.destroy(), m == null || m.destroy(), c == null || c.destroy(), c = void 0, m = void 0, A = void 0, a = void 0;
336
+ };
337
+ return () => {
338
+ try {
339
+ c.initialize();
340
+ } catch (u) {
341
+ t == null || t(), console.log("AdsManager could not be started", u);
342
+ }
343
+ return g;
344
+ };
345
+ }, Ze = /* @__PURE__ */ n("div")({
346
+ name: "Container",
347
+ class: "c4q6dw1",
348
+ propsAsIs: !1
349
+ }), Qe = /* @__PURE__ */ n("div")({
350
+ name: "ControlsContainer",
351
+ class: "c1la67r",
352
+ propsAsIs: !1
353
+ }), Xe = "m3guev", on = "m7099mt", en = "mmm6o5s", nn = ({
354
+ promotion: o,
355
+ controlVideo: s,
356
+ promotionId: i,
357
+ onClose: t,
358
+ externalAd: l,
359
+ skipAutoClose: r
360
+ }) => {
361
+ var c;
362
+ const m = F(null), [A, a] = R(!1), [g, u] = R(0), [p, I] = R(0), [$, h] = R(0), y = F(), b = Mo(() => {
363
+ u(0), I(0), h(0), a(!1), s == null || s({
364
+ muted: !1
365
+ });
366
+ }, [s]);
367
+ L(() => {
368
+ if (l != null && l.url && m.current) {
369
+ b();
370
+ const f = Je(m.current, l.url, {
371
+ onPlay: () => {
372
+ D.emit("advertisement", {
373
+ action: "videoPlay",
374
+ payload: {
375
+ id: i,
376
+ type: o.type
377
+ }
378
+ }), s == null || s({
379
+ muted: !0
380
+ }), a(!0);
381
+ },
382
+ onStop: () => {
383
+ t == null || t(), b();
384
+ },
385
+ onProgress: (C) => {
386
+ u(Math.round(C.duration - C.currentTime)), I(C.totalAds), h(C.adPosition);
387
+ }
388
+ })();
389
+ return y.current = f, () => {
390
+ y.current = void 0, f();
391
+ };
392
+ }
393
+ }, [l == null ? void 0 : l.url, s, b, i, o.type, t]);
394
+ const O = ((c = o.sponsor) == null ? void 0 : c.logo) && o.logoMode === k.CENTER;
395
+ return /* @__PURE__ */ v(yo, {
396
+ className: "PromoOverlay",
397
+ children: [/* @__PURE__ */ v(bo, {
398
+ children: [/* @__PURE__ */ e(fo, {
399
+ className: M(!O && No),
400
+ children: /* @__PURE__ */ e(Co, {
401
+ style: {
402
+ transform: "scale(1.5)"
403
+ },
404
+ children: "Ad"
405
+ })
406
+ }), /* @__PURE__ */ v(Qe, {
407
+ children: [/* @__PURE__ */ e(Ye, {
408
+ time: g,
409
+ adCount: p,
410
+ adPosition: $
411
+ }), r && /* @__PURE__ */ e(mo, {
412
+ className: "ClosePromoIcon",
413
+ close: () => {
414
+ var f;
415
+ (f = y.current) == null || f.call(y), t == null || t(), b();
416
+ }
417
+ })]
418
+ })]
419
+ }), /* @__PURE__ */ e($o, {
420
+ className: M(Xe, A && on, !A && en),
421
+ children: /* @__PURE__ */ e(Ze, {
422
+ ref: m
423
+ })
424
+ })]
425
+ });
426
+ }, co = (o) => {
427
+ var s, i, t, l, r, c, m, A, a, g, u, p, I, $, h, y, b, O, f, C, W, H, K, Y, J, Z, Q, X, oo, eo;
428
+ const {
429
+ promotion: d,
430
+ open: no,
431
+ advertisementPaused: To,
432
+ togglePause: E,
433
+ controlVideo: _,
434
+ skipAutoClose: So,
435
+ promotionId: B,
436
+ onClose: Eo,
437
+ markAsViewed: w,
438
+ externalAd: so
439
+ } = o, V = d.type === S.INGAME_IAB11_LBAR || d.type === S.INGAME_IAB11, j = ((s = d.sponsor) == null ? void 0 : s.logo) && d.logoMode === k.CENTER, to = !!((t = (i = d.banner) == null ? void 0 : i.video) != null && t.url), x = d.autoPlayVideo === Ro.ENABLED;
440
+ if (L(() => {
441
+ E == null || E(to || x), no == null || no();
442
+ }, []), L(() => {
443
+ B && d.type && w && w();
444
+ }, [B, d.type, w]), L(() => () => {
445
+ _ == null || _({ muted: !1 });
446
+ }, [_]), so)
447
+ return /* @__PURE__ */ e(nn, { ...o, externalAd: so });
448
+ let P = (l = d.banner) == null ? void 0 : l.url;
449
+ P && P.indexOf("http") !== 0 && (P = `https://${P}`);
450
+ let U = !0;
451
+ return to && (!To || !x ? U = !0 : U = !1), /* @__PURE__ */ v(yo, { className: "PromoOverlay", children: [
452
+ /* @__PURE__ */ v(bo, { children: [
453
+ /* @__PURE__ */ v(fo, { className: M(!j && No), children: [
454
+ ((r = d.sponsor) == null ? void 0 : r.logo) && d.logoMode === k.LEFT && /* @__PURE__ */ e(ao, { className: "PromoSponsorLogo", src: (c = d.sponsor) == null ? void 0 : c.logo, alt: "promo" }),
455
+ /* @__PURE__ */ v(
456
+ Ve,
457
+ {
458
+ style: {
459
+ paddingLeft: (m = d.sponsor) != null && m.logo && d.logoMode === k.LEFT ? "0px" : "8px"
460
+ },
461
+ children: [
462
+ ((A = d.sponsor) == null ? void 0 : A.logo) && d.logoMode === k.LEFT && /* @__PURE__ */ e(Re, { children: (a = d.sponsor) == null ? void 0 : a.name }),
463
+ /* @__PURE__ */ v(je, { className: "SponsorText", children: [
464
+ /* @__PURE__ */ e(Co, { children: "AD" }),
465
+ /* @__PURE__ */ e(Ue, { children: "SPONSORED" })
466
+ ] })
467
+ ]
468
+ }
469
+ )
470
+ ] }),
471
+ /* @__PURE__ */ e(
472
+ mo,
473
+ {
474
+ className: "ClosePromoIcon",
475
+ close: Eo,
476
+ autoClose: (g = d.closeTimer) == null ? void 0 : g.auto,
477
+ duration: So ? 0 : (u = d.closeTimer) == null ? void 0 : u.seconds,
478
+ isPlaying: U
479
+ }
480
+ )
481
+ ] }),
482
+ /* @__PURE__ */ v($o, { children: [
483
+ j && /* @__PURE__ */ e(ao, { className: qe, src: (p = d.sponsor) == null ? void 0 : p.logo, alt: "promo" }),
484
+ /* @__PURE__ */ e(ro, { children: ($ = (I = d.banner) == null ? void 0 : I.video) != null && $.url ? /* @__PURE__ */ e(
485
+ ko,
486
+ {
487
+ source: (y = (h = d.banner) == null ? void 0 : h.video) == null ? void 0 : y.url,
488
+ poster: (O = (b = d.banner) == null ? void 0 : b.video) == null ? void 0 : O.thumbnailUrl,
489
+ aspectRatio: V ? "1/1" : "16/9",
490
+ onPause: () => {
491
+ x && (E == null || E(!0));
492
+ },
493
+ onPlay: () => {
494
+ D.emit("advertisement", {
495
+ action: "videoPlay",
496
+ payload: {
497
+ id: B,
498
+ type: d.type
499
+ }
500
+ }), E == null || E(!1);
501
+ },
502
+ controlVideo: _,
503
+ autoPlay: x
504
+ }
505
+ ) : (f = d.banner) != null && f.imageUrl ? /* @__PURE__ */ e(De, { style: V ? { aspectRatio: "1/1" } : {}, src: (C = d.banner) == null ? void 0 : C.imageUrl, alt: "promo" }) : null }),
506
+ !V && /* @__PURE__ */ v(ro, { children: [
507
+ ((W = d.banner) == null ? void 0 : W.title) && /* @__PURE__ */ e(Ge, { className: M("AdvTitle", j && We), children: (H = d.banner) == null ? void 0 : H.title }),
508
+ ((K = d.banner) == null ? void 0 : K.body) && /* @__PURE__ */ e(we, { className: "AdvDescription", children: (Y = d.banner) == null ? void 0 : Y.body })
509
+ ] })
510
+ ] }),
511
+ d.buttonType !== Do.NO_BUTTON && /* @__PURE__ */ e(Fe, { children: /* @__PURE__ */ e(
512
+ ze,
513
+ {
514
+ href: P,
515
+ style: {
516
+ backgroundColor: ((Z = (J = d.banner) == null ? void 0 : J.ctaButton) == null ? void 0 : Z.color) || "#009dc4",
517
+ color: ((X = (Q = d.banner) == null ? void 0 : Q.ctaButton) == null ? void 0 : X.textColor) || "#fff"
518
+ },
519
+ "data-analytics": "button",
520
+ "data-promo-id": B,
521
+ "data-promo-type": d.type,
522
+ target: "_blank",
523
+ children: (eo = (oo = d.banner) == null ? void 0 : oo.ctaButton) == null ? void 0 : eo.label
524
+ }
525
+ ) })
526
+ ] });
527
+ }, sn = /* @__PURE__ */ n("div")({
528
+ name: "SidebarContainer",
529
+ class: "s1abskp8",
530
+ propsAsIs: !1
531
+ }), tn = ({
532
+ children: o,
533
+ direction: s,
534
+ style: i,
535
+ className: t,
536
+ hiding: l
537
+ }) => /* @__PURE__ */ e(z, {
538
+ direction: s,
539
+ style: i,
540
+ hiding: l,
541
+ className: t,
542
+ children: /* @__PURE__ */ e(sn, {
543
+ children: o
544
+ })
545
+ }), an = (o) => (o == null ? void 0 : o.type) === S.INGAME_IAB11_LBAR || (o == null ? void 0 : o.type) === S.INGAME_IAB21_LBAR, rn = (o) => (o == null ? void 0 : o.type) === S.INGAME_IAB11 || (o == null ? void 0 : o.type) === S.INGAME_IAB21, ln = ({
546
+ advertisement: o,
547
+ close: s,
548
+ skipTypeCheck: i,
549
+ skipAutoClose: t,
550
+ layoutMode: l = "side-by-side",
551
+ sidebar: r,
552
+ isNotification: c,
553
+ banner: m,
554
+ markAsViewed: A,
555
+ open: a,
556
+ externalAd: g,
557
+ controlVideo: u,
558
+ advertisementPaused: p,
559
+ togglePause: I
560
+ }) => o.promotion ? c && o.notification ? /* @__PURE__ */ e(
561
+ Be,
562
+ {
563
+ open: () => a == null ? void 0 : a({ fromNotification: !0 }),
564
+ notification: o.notification,
565
+ promotionId: o.question.id
566
+ }
567
+ ) : !r && !m && (i || rn(o.promotion)) ? /* @__PURE__ */ e(xe, { className: "PromoOverlayContainer", children: /* @__PURE__ */ e(
568
+ co,
569
+ {
570
+ markAsViewed: A,
571
+ promotionId: o.question.id,
572
+ promotion: o.promotion,
573
+ onClose: s,
574
+ open: a,
575
+ skipAutoClose: t,
576
+ externalAd: g,
577
+ controlVideo: u,
578
+ advertisementPaused: p,
579
+ togglePause: I
580
+ }
581
+ ) }) : r && (i || an(o.promotion)) ? /* @__PURE__ */ e(tn, { className: "PromoSidebarContainer", direction: r, hiding: !1, children: /* @__PURE__ */ e(
582
+ co,
583
+ {
584
+ markAsViewed: A,
585
+ promotionId: o.question.id,
586
+ promotion: o.promotion,
587
+ externalAd: g,
588
+ onClose: s,
589
+ open: a,
590
+ controlVideo: u,
591
+ skipAutoClose: t,
592
+ advertisementPaused: p,
593
+ togglePause: I
594
+ }
595
+ ) }) : m ? /* @__PURE__ */ e(
596
+ Qo,
597
+ {
598
+ promotionId: o.question.id,
599
+ hiding: !1,
600
+ promotion: o.promotion,
601
+ direction: m
602
+ }
603
+ ) : null : null, dn = /* @__PURE__ */ n("div")({
604
+ name: "AdvertisementUIWrap",
605
+ class: "aa6pjif",
606
+ propsAsIs: !1
607
+ }), cn = (o) => {
608
+ const s = o.target;
609
+ if (s instanceof HTMLAnchorElement && s.target === "_blank") {
610
+ const i = s.getAttribute("data-promo-id") || "", t = s.getAttribute("data-promo-type") || S.UNSET;
611
+ s.getAttribute("data-analytics") === "button" && D.emit("advertisement", {
612
+ action: "buttonSelect",
613
+ payload: {
614
+ id: i,
615
+ type: t
616
+ }
617
+ }), s.getAttribute("data-analytics") === "banner" && D.emit("advertisement", {
618
+ action: "bannerSelect",
619
+ payload: {
620
+ id: i,
621
+ type: t
622
+ }
623
+ });
624
+ }
625
+ }, pn = ({
626
+ gamification: o,
627
+ layoutMode: s,
628
+ skipAutoClose: i,
629
+ skipTypeCheck: t,
630
+ sidebar: l,
631
+ banner: r,
632
+ notification: c,
633
+ isMobileScreen: m,
634
+ persistent: A,
635
+ externalAd: a,
636
+ controlVideo: g
637
+ }) => {
638
+ var u, p, I;
639
+ const $ = F(null), h = uo(o.advertisement.$store);
640
+ Lo($, {
641
+ enabled: !!h.data,
642
+ event: "click",
643
+ listener: cn
644
+ });
645
+ const y = !r && !l;
646
+ if (h.data === void 0 || !A && h.isViewed)
647
+ return null;
648
+ const b = ((I = (p = (u = h == null ? void 0 : h.data) == null ? void 0 : u.notification) == null ? void 0 : p.promotion) == null ? void 0 : I.mode) === ho.LOWER_THIRD;
649
+ return /* @__PURE__ */ e(dn, {
650
+ ref: $,
651
+ style: {
652
+ height: y ? "auto" : "100%"
653
+ },
654
+ className: M("SL-AdvertisementUIWrap", m && "mobile-view", b && "SL-AdvertisementUIWrap--lower-third"),
655
+ children: /* @__PURE__ */ e(ln, {
656
+ skipTypeCheck: t,
657
+ sidebar: l,
658
+ banner: r,
659
+ advertisement: h.data,
660
+ advertisementPaused: h.isPaused,
661
+ togglePause: h.togglePause,
662
+ close: h.close,
663
+ externalAd: a ? h.externalAd : void 0,
664
+ markAsViewed: o.advertisement.markAsViewed,
665
+ open: o.advertisement.open,
666
+ layoutMode: s,
667
+ isNotification: c,
668
+ skipAutoClose: i,
669
+ controlVideo: g
670
+ })
671
+ });
672
+ }, mn = ({
673
+ sdk: o,
674
+ sidebar: s,
675
+ externalAd: i,
676
+ banner: t,
677
+ skipAutoClose: l,
678
+ skipTypeCheck: r,
679
+ layoutMode: c,
680
+ isMobileScreen: m,
681
+ persistent: A,
682
+ notification: a
683
+ }) => {
684
+ const g = uo(o.featuresList.getStore());
685
+ if (L(() => {
686
+ if (i) {
687
+ const p = document.createElement("script");
688
+ p.async = !0, p.src = "https://imasdk.googleapis.com/js/sdkloader/ima3.js", document.body.appendChild(p);
689
+ }
690
+ }, [i]), s && t)
691
+ return /* @__PURE__ */ e("div", {
692
+ style: {
693
+ color: "red"
694
+ },
695
+ children: "define either sidebar or banner, not both."
696
+ });
697
+ if (t && i)
698
+ return /* @__PURE__ */ e("div", {
699
+ style: {
700
+ color: "red"
701
+ },
702
+ children: "externalAd is not supported with banner"
703
+ });
704
+ if (!g)
705
+ return null;
706
+ const u = o.getFeature(qo.GAMES);
707
+ return u ? /* @__PURE__ */ e(pn, {
708
+ gamification: u,
709
+ sidebar: s,
710
+ banner: t,
711
+ layoutMode: c,
712
+ isMobileScreen: m,
713
+ persistent: A,
714
+ notification: a,
715
+ skipTypeCheck: r,
716
+ skipAutoClose: l,
717
+ externalAd: i,
718
+ controlVideo: o.controlVideoPlayer
719
+ }) : null;
720
+ }, hn = ({
721
+ event: o,
722
+ sidebar: s,
723
+ banner: i,
724
+ isMobileScreen: t,
725
+ skipAutoClose: l,
726
+ persistent: r,
727
+ theme: c,
728
+ notification: m,
729
+ skipTypeCheck: A,
730
+ externalAd: a
731
+ }) => {
732
+ const g = Oo(), u = _o(), p = Bo();
733
+ return g ? a && !u.promotionExternalAd ? o !== void 0 && /* @__PURE__ */ e(T, { event: o }) : !a && u.promotionExternalAd ? o !== void 0 && /* @__PURE__ */ e(T, { event: o }) : s && !u.promotionSidebar ? o !== void 0 && /* @__PURE__ */ e(T, { event: o }) : i && !u.promotionBanner ? o !== void 0 && /* @__PURE__ */ e(T, { event: o }) : m && !u.promotionNotification ? o !== void 0 && /* @__PURE__ */ e(T, { event: o }) : !i && !s && !m && !u.promotionOverlay ? o !== void 0 && /* @__PURE__ */ e(T, { event: o }) : /* @__PURE__ */ v("div", { className: "StreamLayerSDK", children: [
734
+ /* @__PURE__ */ e(xo, { customTheme: c ?? p.theme, themeMode: p.themeMode, children: /* @__PURE__ */ e(
735
+ mn,
736
+ {
737
+ sdk: g,
738
+ sidebar: s,
739
+ banner: i,
740
+ isMobileScreen: t,
741
+ persistent: r,
742
+ notification: m,
743
+ skipTypeCheck: A,
744
+ skipAutoClose: l,
745
+ layoutMode: "side-by-side",
746
+ externalAd: a
747
+ }
748
+ ) }),
749
+ o !== void 0 && /* @__PURE__ */ e(T, { event: o })
750
+ ] }) : null;
751
+ };
752
+ export {
753
+ hn as StreamLayerSDKAdvertisement,
754
+ mn as StreamLayerSDKAdvertisementUI
755
+ };