@streamlayer/react 1.19.1 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/lib/app/pause-ad.d.ts +38 -0
  2. package/lib/cjs/advertisement.js +38 -42
  3. package/lib/cjs/index-l-eyvmpL.js +5 -0
  4. package/lib/cjs/pause-ad.js +1 -0
  5. package/lib/cjs/provider.js +23 -23
  6. package/lib/cjs/useStreamLayerApp2.js +1 -1
  7. package/lib/cjs/vast-client.min-B0NUra1B.js +1 -0
  8. package/lib/classic/app/pause-ad.d.ts +38 -0
  9. package/lib/classic/cjs/advertisement.js +38 -42
  10. package/lib/classic/cjs/index-l-eyvmpL.js +5 -0
  11. package/lib/classic/cjs/pause-ad.js +1 -0
  12. package/lib/classic/cjs/provider.js +17 -17
  13. package/lib/classic/cjs/useStreamLayerApp2.js +1 -1
  14. package/lib/classic/cjs/vast-client.min-B0NUra1B.js +1 -0
  15. package/lib/classic/es/advertisement.js +10211 -15019
  16. package/lib/classic/es/bet-pack.js +1 -1
  17. package/lib/classic/es/index-l-eyvmpL.js +3758 -0
  18. package/lib/classic/es/index.js +3 -3
  19. package/lib/classic/es/notification.js +1 -1
  20. package/lib/classic/es/pause-ad.js +250 -0
  21. package/lib/classic/es/provider.js +6169 -5724
  22. package/lib/classic/es/useStreamLayerApp2.js +1 -1
  23. package/lib/classic/es/vast-client.min-B0NUra1B.js +1060 -0
  24. package/lib/dist/cjs/masters.js +1 -1
  25. package/lib/dist/es/masters.js +1 -1
  26. package/lib/es/advertisement.js +10211 -15019
  27. package/lib/es/index-l-eyvmpL.js +3758 -0
  28. package/lib/es/index.js +1 -1
  29. package/lib/es/index2.js +1 -1
  30. package/lib/es/masters2.js +1 -1
  31. package/lib/es/notification.js +53 -53
  32. package/lib/es/pause-ad.js +250 -0
  33. package/lib/es/provider.js +5846 -5412
  34. package/lib/es/useStreamLayerApp2.js +1 -1
  35. package/lib/es/vast-client.min-B0NUra1B.js +1060 -0
  36. package/package.json +24 -14
package/lib/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as m, S, a3 as o, h as i, u as s, b as y, _ as L } from "./provider.js";
1
+ import { Q as m, S, a4 as o, h as i, u as s, b as y, $ as L } from "./provider.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import { StreamLayerSDKNotification as p, StreamLayerSDKNotificationUI as u } from "./notification.js";
package/lib/es/index2.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as P, jsxs as F } from "react/jsx-runtime";
2
- import { s as _, B as te, c as ft, f as ht, a as Se, i as gt, j as vt, k as Ee } from "./provider.js";
2
+ import { s as _, B as te, k as ft, l as ht, a as Se, n as gt, c as vt, j as Ee } from "./provider.js";
3
3
  import $, { forwardRef as Ae, useState as W, useRef as D, useEffect as X, useLayoutEffect as wt, createContext as Ve, useMemo as He, useCallback as Re, memo as bt } from "react";
4
4
  import { C as yt, a as St, S as qe } from "./useStreamLayerApp2.js";
5
5
  function _e(t) {
@@ -1,5 +1,5 @@
1
1
  import { jsx as s, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
- import { s as c, l as Y, a as m, A as N, i as V, F as a2, y as l2, n as d2, x as c2, o as p2, f as C2, t as u2, p as m2, z as f2, q as h2, R as j, r as P, k as A, B as X, I as g2, v as v2, w as E2, e as L2, N as w, C as M, D as S2, E as _2, G as T2, H as N2, J as b, K as z, L as J, M as e2, m as F, O as I2, P as b2, S as R2, Q as A2, U as y2 } from "./provider.js";
2
+ import { s as c, i as Y, a as m, A as N, n as V, F as a2, y as l2, o as d2, x as c2, p as p2, l as C2, t as u2, q as m2, z as f2, r as h2, R as j, v as P, j as A, B as X, I as g2, w as v2, C as E2, e as L2, N as w, D as M, E as S2, G as _2, H as T2, J as N2, K as b, L as z, M as J, O as e2, m as F, P as I2, Q as b2, S as R2, U as A2, V as y2 } from "./provider.js";
3
3
  import { useRef as I, useState as _, useEffect as v, createContext as k2, useContext as n2, lazy as w2, useMemo as y, Suspense as x2, forwardRef as D2, useLayoutEffect as F2, useCallback as $, Component as O2 } from "react";
4
4
  import { n as B2 } from "./index2.js";
5
5
  import { Q as V2, S as k } from "./useStreamLayerApp2.js";
@@ -1,7 +1,7 @@
1
- import { s as n, B as A, $ as As, a0 as Is, a1 as _, G, a2 as hs, Y as $s, V as x, X as gs, d as ws, a as ys, e as Ts, N as R, u as bs, b as Cs, _ as fs, h as ks } from "./provider.js";
1
+ import { s as n, B as A, a0 as As, a1 as Is, a2 as _, H as K, a3 as hs, Z as $s, W as x, Y as gs, d as ws, a as ys, e as Ts, N as R, u as bs, b as Cs, $ as fs, h as ks } from "./provider.js";
2
2
  import { jsxs as l, jsx as s } from "react/jsx-runtime";
3
- import { useState as w, useRef as K, useEffect as y, useCallback as Ns, useMemo as qs } from "react";
4
- import { l as v, Q as h, m as X, r as S, S as Ls, A as O } from "./useStreamLayerApp2.js";
3
+ import { useState as w, useRef as G, useEffect as y, useCallback as Ns, useMemo as qs } from "react";
4
+ import { l as v, Q as h, m as H, r as S, S as Ls, A as O } from "./useStreamLayerApp2.js";
5
5
  const b = /* @__PURE__ */ n("div")({
6
6
  name: "Media",
7
7
  class: "m1bcvojl",
@@ -64,7 +64,7 @@ const b = /* @__PURE__ */ n("div")({
64
64
  name: "NotificationContainer",
65
65
  class: "ns1nzpg",
66
66
  propsAsIs: !1
67
- }), H = /* @__PURE__ */ n("div")({
67
+ }), Z = /* @__PURE__ */ n("div")({
68
68
  name: "Body",
69
69
  class: "b1j59nzs",
70
70
  propsAsIs: !1
@@ -76,7 +76,7 @@ const b = /* @__PURE__ */ n("div")({
76
76
  name: "Button",
77
77
  class: "b14ivj5k",
78
78
  propsAsIs: !1
79
- }), Ys = () => A, Ws = /* @__PURE__ */ n(Ys())({
79
+ }), Ws = () => A, Ys = /* @__PURE__ */ n(Ws())({
80
80
  name: "StyledChevronRight",
81
81
  class: "s1atci8n",
82
82
  propsAsIs: !0
@@ -84,22 +84,22 @@ const b = /* @__PURE__ */ n("div")({
84
84
  name: "QuoteWrap",
85
85
  class: "q4w8jgs",
86
86
  propsAsIs: !1
87
- }), Gs = /* @__PURE__ */ n("blockquote")({
87
+ }), Ks = /* @__PURE__ */ n("blockquote")({
88
88
  name: "Quote",
89
89
  class: "qaa0kez",
90
90
  propsAsIs: !1
91
- }), Ks = /* @__PURE__ */ n("div")({
91
+ }), Gs = /* @__PURE__ */ n("div")({
92
92
  name: "Body",
93
93
  class: "b1wvd52w",
94
94
  propsAsIs: !1
95
- }), Xs = /* @__PURE__ */ n("div")({
95
+ }), Hs = /* @__PURE__ */ n("div")({
96
96
  name: "Container",
97
97
  class: "ccvukea",
98
98
  propsAsIs: !1
99
- }), Hs = ({ image: e, tweet: i, account: t, accountVerified: o, body: a, title: p }) => {
99
+ }), Zs = ({ image: e, tweet: i, account: t, accountVerified: o, body: a, title: p }) => {
100
100
  var d;
101
- return /* @__PURE__ */ l(Xs, { children: [
102
- p && /* @__PURE__ */ s(_s, { children: /* @__PURE__ */ s(Gs, { children: p }) }),
101
+ return /* @__PURE__ */ l(Hs, { children: [
102
+ p && /* @__PURE__ */ s(_s, { children: /* @__PURE__ */ s(Ks, { children: p }) }),
103
103
  /* @__PURE__ */ s(
104
104
  As,
105
105
  {
@@ -110,22 +110,22 @@ const b = /* @__PURE__ */ n("div")({
110
110
  createdTweet: i == null ? void 0 : i.date
111
111
  }
112
112
  ),
113
- /* @__PURE__ */ s(Ks, { children: Is(a) })
113
+ /* @__PURE__ */ s(Gs, { children: Is(a) })
114
114
  ] });
115
- }, Js = ({ title: e, questionType: i, questionTypeData: t }) => /* @__PURE__ */ l(H, { children: [
115
+ }, Js = ({ title: e, questionType: i, questionTypeData: t }) => /* @__PURE__ */ l(Z, { children: [
116
116
  /* @__PURE__ */ s(
117
117
  _,
118
118
  {
119
119
  questionTypeData: t,
120
120
  questionType: i,
121
- questionStatus: X.UNSET
121
+ questionStatus: H.UNSET
122
122
  }
123
123
  ),
124
124
  e && /* @__PURE__ */ s(Fs, { children: e })
125
- ] }), Zs = ({ tweet: e }) => e ? /* @__PURE__ */ s(H, { children: /* @__PURE__ */ s(Hs, { ...e, controlVideo: () => {
125
+ ] }), Xs = ({ tweet: e }) => e ? /* @__PURE__ */ s(Z, { children: /* @__PURE__ */ s(Zs, { ...e, controlVideo: () => {
126
126
  } }) }) : null, se = ({ action: e, questionType: i, inApp: t, insight: o, tweet: a }) => {
127
127
  var p;
128
- const d = G[i], r = hs[i];
128
+ const d = K[i], r = hs[i];
129
129
  if (!d || !t || !t.notification)
130
130
  return null;
131
131
  const { title: u, image: m, imageMode: $ } = t.notification;
@@ -135,9 +135,9 @@ const b = /* @__PURE__ */ n("div")({
135
135
  return /* @__PURE__ */ s(Vs, { "data-a": "intr", className: "SL_InApp", onClick: e, children: /* @__PURE__ */ l(zs, { style: I ? {} : { paddingLeft: "1.5rem" }, children: [
136
136
  I && !g && /* @__PURE__ */ s(B, { src: I, imageMode: $, withVideo: !!c }),
137
137
  g && /* @__PURE__ */ s(B, { src: g, fromInsight: !0, withVideo: !!c }),
138
- i === h.TWEET ? /* @__PURE__ */ s(Zs, { tweet: a }) : /* @__PURE__ */ s(Js, { questionTypeData: d, questionType: i, title: u }),
138
+ i === h.TWEET ? /* @__PURE__ */ s(Xs, { tweet: a }) : /* @__PURE__ */ s(Js, { questionTypeData: d, questionType: i, title: u }),
139
139
  /* @__PURE__ */ s(Qs, { name: "inapp-button", children: r || "Open" }),
140
- /* @__PURE__ */ s(Ws, { name: "chevronRight" })
140
+ /* @__PURE__ */ s(Ys, { name: "chevronRight" })
141
141
  ] }) });
142
142
  }, ee = () => ({
143
143
  color: e
@@ -233,7 +233,7 @@ const b = /* @__PURE__ */ n("div")({
233
233
  name: "StyledChevronRight",
234
234
  class: "sx1hq4c",
235
235
  propsAsIs: !0
236
- }), Z = /* @__PURE__ */ n("div")({
236
+ }), X = /* @__PURE__ */ n("div")({
237
237
  name: "NotificationContainer",
238
238
  class: "n1fcriet",
239
239
  propsAsIs: !1
@@ -283,7 +283,7 @@ const b = /* @__PURE__ */ n("div")({
283
283
  name: "LogoImg",
284
284
  class: "ln4a3eh",
285
285
  propsAsIs: !1
286
- }), xe = () => Z, De = /* @__PURE__ */ n(xe())({
286
+ }), xe = () => X, De = /* @__PURE__ */ n(xe())({
287
287
  name: "NotificationInterstitialContainer",
288
288
  class: "no2k63v",
289
289
  propsAsIs: !0
@@ -309,7 +309,7 @@ const b = /* @__PURE__ */ n("div")({
309
309
  {
310
310
  questionTypeData: t,
311
311
  questionType: i,
312
- questionStatus: X.UNSET
312
+ questionStatus: H.UNSET
313
313
  }
314
314
  ),
315
315
  e && /* @__PURE__ */ s(Le, { webos: p, children: e }),
@@ -328,11 +328,11 @@ const b = /* @__PURE__ */ n("div")({
328
328
  webos: d
329
329
  }) => {
330
330
  var r, u, m;
331
- const [$, I] = w(!1), g = K();
331
+ const [$, I] = w(!1), g = G();
332
332
  y(() => (o != null && o.sponsorLogo && (I(!0), g.current = setTimeout(() => {
333
333
  I(!1);
334
334
  }, 5e3)), () => clearTimeout(g.current)), [o == null ? void 0 : o.sponsorLogo]);
335
- const c = G[t];
335
+ const c = K[t];
336
336
  if (!c || !o || !o.notification)
337
337
  return null;
338
338
  const { title: ds, image: ps, imageMode: f, useContentMedia: k } = o.notification, us = t === h.FACTOID ? a == null ? void 0 : a.heading : ds, ms = t === h.FACTOID ? a == null ? void 0 : a.body : "", vs = ps, N = t === h.FACTOID && ((r = a == null ? void 0 : a.video) == null ? void 0 : r.url) && (o == null ? void 0 : o.isVideo) && k === S.ENABLED, q = k === S.ENABLED ? N ? (u = a == null ? void 0 : a.video) == null ? void 0 : u.url : a == null ? void 0 : a.image : "";
@@ -344,7 +344,7 @@ const b = /* @__PURE__ */ n("div")({
344
344
  onClick: () => I(!1)
345
345
  }
346
346
  ) : /* @__PURE__ */ l(
347
- Z,
347
+ X,
348
348
  {
349
349
  "data-a": "intr",
350
350
  className: "SL_InApp",
@@ -400,7 +400,7 @@ const b = /* @__PURE__ */ n("div")({
400
400
  ]
401
401
  }
402
402
  );
403
- }, Ye = /* @__PURE__ */ n("div")({
403
+ }, We = /* @__PURE__ */ n("div")({
404
404
  name: "NotificationContainer",
405
405
  class: "n11jcrxe",
406
406
  propsAsIs: !1
@@ -408,19 +408,19 @@ const b = /* @__PURE__ */ n("div")({
408
408
  name: "Icon",
409
409
  class: "i1vmpt6u",
410
410
  propsAsIs: !1
411
- }), We = /* @__PURE__ */ n("div")({
411
+ }), Ye = /* @__PURE__ */ n("div")({
412
412
  name: "IconContainer",
413
413
  class: "i180665s",
414
414
  propsAsIs: !1
415
- }), _e = () => A, Ge = /* @__PURE__ */ n(_e())({
415
+ }), _e = () => A, Ke = /* @__PURE__ */ n(_e())({
416
416
  name: "TitleIcon",
417
417
  class: "t16zzzei",
418
418
  propsAsIs: !0
419
- }), Ke = () => gs, Xe = /* @__PURE__ */ n(Ke())({
419
+ }), Ge = () => gs, He = /* @__PURE__ */ n(Ge())({
420
420
  name: "Close",
421
421
  class: "c1sur0q2",
422
422
  propsAsIs: !0
423
- }), He = /* @__PURE__ */ n("div")({
423
+ }), Ze = /* @__PURE__ */ n("div")({
424
424
  name: "Body",
425
425
  class: "bai9j52",
426
426
  propsAsIs: !1
@@ -428,7 +428,7 @@ const b = /* @__PURE__ */ n("div")({
428
428
  name: "Title",
429
429
  class: "t1bnt25p",
430
430
  propsAsIs: !1
431
- }), Ze = /* @__PURE__ */ n("div")({
431
+ }), Xe = /* @__PURE__ */ n("div")({
432
432
  name: "Description",
433
433
  class: "dmixjec",
434
434
  propsAsIs: !1
@@ -443,14 +443,14 @@ const b = /* @__PURE__ */ n("div")({
443
443
  }) => {
444
444
  var o, a;
445
445
  return /* @__PURE__ */ l(
446
- Ye,
446
+ We,
447
447
  {
448
448
  "data-a": "intr",
449
449
  onClick: () => {
450
450
  e == null || e(), t && t.markIstantOpen();
451
451
  },
452
452
  children: [
453
- /* @__PURE__ */ l(We, { children: [
453
+ /* @__PURE__ */ l(Ye, { children: [
454
454
  /* @__PURE__ */ s(U, { className: "on-light", src: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png" }),
455
455
  /* @__PURE__ */ s(
456
456
  U,
@@ -460,18 +460,18 @@ const b = /* @__PURE__ */ n("div")({
460
460
  }
461
461
  )
462
462
  ] }),
463
- /* @__PURE__ */ l(He, { children: [
463
+ /* @__PURE__ */ l(Ze, { children: [
464
464
  /* @__PURE__ */ l(Je, { children: [
465
- /* @__PURE__ */ s(Ge, { name: "icon-trophy-solid" }),
465
+ /* @__PURE__ */ s(Ke, { name: "icon-trophy-solid" }),
466
466
  (o = t == null ? void 0 : t.titleCard) == null ? void 0 : o.title
467
467
  ] }),
468
- /* @__PURE__ */ l(Ze, { children: [
468
+ /* @__PURE__ */ l(Xe, { children: [
469
469
  /* @__PURE__ */ s("span", { children: (a = t == null ? void 0 : t.titleCard) == null ? void 0 : a.subtitle }),
470
470
  /* @__PURE__ */ s(sn, { name: "inapp-button", children: "Play Now" })
471
471
  ] })
472
472
  ] }),
473
473
  /* @__PURE__ */ s(
474
- Xe,
474
+ He,
475
475
  {
476
476
  close: (p) => {
477
477
  p == null || p.stopPropagation(), i == null || i();
@@ -727,11 +727,11 @@ const b = /* @__PURE__ */ n("div")({
727
727
  name: "BodyContainer",
728
728
  class: "b1xx7swj",
729
729
  propsAsIs: !1
730
- }), Yn = /* @__PURE__ */ n("div")({
730
+ }), Wn = /* @__PURE__ */ n("div")({
731
731
  name: "Body",
732
732
  class: "b1a21en",
733
733
  propsAsIs: !1
734
- }), Wn = ({
734
+ }), Yn = ({
735
735
  step: e,
736
736
  children: i,
737
737
  state: t = "pending"
@@ -756,7 +756,7 @@ const b = /* @__PURE__ */ n("div")({
756
756
  style: {
757
757
  minWidth: `${o}px`
758
758
  },
759
- children: /* @__PURE__ */ s(Yn, {
759
+ children: /* @__PURE__ */ s(Wn, {
760
760
  children: i
761
761
  }, e)
762
762
  })
@@ -769,25 +769,25 @@ const b = /* @__PURE__ */ n("div")({
769
769
  name: "Line",
770
770
  class: "lgbipw0",
771
771
  propsAsIs: !1
772
- }), Gn = () => M, Kn = /* @__PURE__ */ n(Gn())({
772
+ }), Kn = () => M, Gn = /* @__PURE__ */ n(Kn())({
773
773
  name: "Line1",
774
774
  class: "l1anth16",
775
775
  propsAsIs: !0
776
- }), Xn = () => M, Hn = /* @__PURE__ */ n(Xn())({
776
+ }), Hn = () => M, Zn = /* @__PURE__ */ n(Hn())({
777
777
  name: "Line2",
778
778
  class: "l193yd7v",
779
779
  propsAsIs: !0
780
- }), Jn = () => M, Zn = /* @__PURE__ */ n(Jn())({
780
+ }), Jn = () => M, Xn = /* @__PURE__ */ n(Jn())({
781
781
  name: "Line3",
782
782
  class: "lhbflsp",
783
783
  propsAsIs: !0
784
784
  }), so = () => /* @__PURE__ */ l(_n, {
785
- children: [/* @__PURE__ */ s(Kn, {
786
- children: /* @__PURE__ */ s("div", {})
787
- }), /* @__PURE__ */ s(Hn, {
785
+ children: [/* @__PURE__ */ s(Gn, {
788
786
  children: /* @__PURE__ */ s("div", {})
789
787
  }), /* @__PURE__ */ s(Zn, {
790
788
  children: /* @__PURE__ */ s("div", {})
789
+ }), /* @__PURE__ */ s(Xn, {
790
+ children: /* @__PURE__ */ s("div", {})
791
791
  })]
792
792
  }), eo = /* @__PURE__ */ n("div")({
793
793
  name: "Container",
@@ -867,11 +867,11 @@ const b = /* @__PURE__ */ n("div")({
867
867
  name: "Container",
868
868
  class: "cmox3ot",
869
869
  propsAsIs: !1
870
- }), Y = /* @__PURE__ */ n("div")({
870
+ }), W = /* @__PURE__ */ n("div")({
871
871
  name: "Body",
872
872
  class: "bqq1ix4",
873
873
  propsAsIs: !1
874
- }), W = {
874
+ }), Y = {
875
875
  1: 3e3,
876
876
  2: 4e3,
877
877
  3: 4e3
@@ -879,8 +879,8 @@ const b = /* @__PURE__ */ n("div")({
879
879
  if (y(() => {
880
880
  if (t) {
881
881
  const m = setTimeout(() => {
882
- W[r + 1] && (a || r < 3) ? t(r + 1) : e == null || e();
883
- }, W[r]);
882
+ Y[r + 1] && (a || r < 3) ? t(r + 1) : e == null || e();
883
+ }, Y[r]);
884
884
  return () => {
885
885
  m && clearTimeout(m);
886
886
  };
@@ -888,11 +888,11 @@ const b = /* @__PURE__ */ n("div")({
888
888
  return () => {
889
889
  };
890
890
  }, [t, r, e, a]), r === 1)
891
- return /* @__PURE__ */ s(Q, { children: /* @__PURE__ */ s(Y, { children: /* @__PURE__ */ s(io, {}) }) });
891
+ return /* @__PURE__ */ s(Q, { children: /* @__PURE__ */ s(W, { children: /* @__PURE__ */ s(io, {}) }) });
892
892
  let u = "pending";
893
- return r === 3 && (u = a ? "correct" : "incorrect"), /* @__PURE__ */ s(Q, { "data-a": "intr", onClick: () => i == null ? void 0 : i(), children: /* @__PURE__ */ l(Y, { children: [
893
+ return r === 3 && (u = a ? "correct" : "incorrect"), /* @__PURE__ */ s(Q, { "data-a": "intr", onClick: () => i == null ? void 0 : i(), children: /* @__PURE__ */ l(W, { children: [
894
894
  r !== 1 && /* @__PURE__ */ s(so, {}, r),
895
- /* @__PURE__ */ l(Wn, { state: u, step: r, children: [
895
+ /* @__PURE__ */ l(Yn, { state: u, step: r, children: [
896
896
  r === 2 && /* @__PURE__ */ s(po, { title: d || "unknown", answer: (o == null ? void 0 : o.title) || "unknown" }),
897
897
  r === 3 && a && /* @__PURE__ */ s(vo, { answer: (o == null ? void 0 : o.title) || "unknown" }),
898
898
  r === 3 && !a && /* @__PURE__ */ s(Ao, { title: p || "unknown", answer: (o == null ? void 0 : o.title) || "unknown" })
@@ -941,7 +941,7 @@ const b = /* @__PURE__ */ n("div")({
941
941
  propsAsIs: !1
942
942
  }), bo = ({ sponsorLogo: e, onClick: i }) => /* @__PURE__ */ s(yo, { onClick: i, children: /* @__PURE__ */ s(go, { withoutPadding: !0, children: /* @__PURE__ */ s(ls, { src: e }) }) }), Co = (e) => {
943
943
  var i, t, o, a, p;
944
- const [d, r] = w(!1), u = K();
944
+ const [d, r] = w(!1), u = G();
945
945
  return y(() => {
946
946
  var m;
947
947
  return (m = e == null ? void 0 : e.inApp) != null && m.sponsorLogo && (r(!0), u.current = setTimeout(() => {
@@ -0,0 +1,250 @@
1
+ import { jsx as n, jsxs as I } from "react/jsx-runtime";
2
+ import { c as K, i as V, s as p, e as x, f as F, j as M, a as _, u as j, b as q, h as z } from "./provider.js";
3
+ import { useRef as L, useCallback as C, useState as R, useEffect as b, Component as G } from "react";
4
+ import { c as N } from "./vast-client.min-B0NUra1B.js";
5
+ const H = {}, O = new N(), w = V(H), E = K("ui:gam-static"), U = (r) => new Promise((e, a) => {
6
+ const s = new Image();
7
+ s.onload = () => e(r), s.onerror = () => a(), s.src = r;
8
+ }), D = () => {
9
+ const r = L(0);
10
+ return [C(async (e) => {
11
+ var a, s, c, o, l, t, u, i, f, m, h;
12
+ if ((a = w.get()[e]) != null && a.imageSrc)
13
+ return { success: !0 };
14
+ const v = Date.now();
15
+ r.current = v, w.setKey(e, { url: e });
16
+ try {
17
+ const d = await O.get(e);
18
+ if (E.debug(d, "parsedVAST"), r.current === v && w.get()[e].url) {
19
+ const y = d.ads.find((g) => g.creatives.length > 0);
20
+ if (y) {
21
+ E.debug(y, "validAd");
22
+ const g = y.creatives.find((S) => S.type === "nonlinear");
23
+ if (g) {
24
+ E.debug(g, "nonlinear");
25
+ const S = (c = (s = g.variations) == null ? void 0 : s[0]) == null ? void 0 : c.staticResource, B = (l = (o = g.variations) == null ? void 0 : o[0]) == null ? void 0 : l.nonlinearClickThroughURLTemplate;
26
+ if (S)
27
+ return await U(S), w.setKey(e, { url: e, imageSrc: S, adUrl: B }), { success: !0 };
28
+ }
29
+ const A = y.creatives.find((S) => S.type === "companion");
30
+ E.debug(A, "companion");
31
+ const T = (f = (i = (u = (t = A == null ? void 0 : A.variations) == null ? void 0 : t[0]) == null ? void 0 : u.staticResources) == null ? void 0 : i[0]) == null ? void 0 : f.url, P = (h = (m = A == null ? void 0 : A.variations) == null ? void 0 : m[0]) == null ? void 0 : h.companionClickThroughURLTemplate;
32
+ if (T)
33
+ return await U(T), w.setKey(e, { url: e, imageSrc: T, adUrl: P }), { success: !0 };
34
+ }
35
+ }
36
+ } catch (d) {
37
+ console.error("Error parsing VAST", d);
38
+ }
39
+ return { success: !1 };
40
+ }, []), w];
41
+ }, J = /* @__PURE__ */ p("div")({
42
+ name: "PauseAdOverlay",
43
+ class: "pw9gih8",
44
+ propsAsIs: !1
45
+ }), Q = /* @__PURE__ */ p("div")({
46
+ name: "PauseAdContent",
47
+ class: "p8lpomy",
48
+ propsAsIs: !1
49
+ }), W = /* @__PURE__ */ p("div")({
50
+ name: "PauseAdGradientLeft",
51
+ class: "pv7u167",
52
+ propsAsIs: !1
53
+ }), X = /* @__PURE__ */ p("div")({
54
+ name: "PauseAdGradientRight",
55
+ class: "p1kh2yb0",
56
+ propsAsIs: !1
57
+ }), Y = /* @__PURE__ */ p("div")({
58
+ name: "PauseAdGradientBottom",
59
+ class: "pl8f94x",
60
+ propsAsIs: !1
61
+ }), Z = /* @__PURE__ */ p("div")({
62
+ name: "PauseAdTopLeft",
63
+ class: "p1m6zmrt",
64
+ propsAsIs: !1
65
+ }), $ = /* @__PURE__ */ p("h2")({
66
+ name: "PauseAdTitle",
67
+ class: "pm3vwfa",
68
+ propsAsIs: !1
69
+ }), ee = /* @__PURE__ */ p("p")({
70
+ name: "PauseAdCaption",
71
+ class: "p1tibuhw",
72
+ propsAsIs: !1
73
+ }), re = /* @__PURE__ */ p("div")({
74
+ name: "PauseAdBottomLeft",
75
+ class: "ptqqrqd",
76
+ propsAsIs: !1
77
+ }), se = /* @__PURE__ */ p("button")({
78
+ name: "PauseAdPlayButton",
79
+ class: "p14estxv",
80
+ propsAsIs: !1
81
+ }), te = /* @__PURE__ */ p("div")({
82
+ name: "PauseAdSidebar",
83
+ class: "p1dpvfl1",
84
+ propsAsIs: !1
85
+ }), k = /* @__PURE__ */ p("img")({
86
+ name: "ExternalAdContainer",
87
+ class: "ezfmabr",
88
+ propsAsIs: !1
89
+ }), ne = ({ vastUrl: r }) => {
90
+ var e;
91
+ const [, a] = D(), s = _(a, { keys: [r] });
92
+ return (e = s == null ? void 0 : s[r]) != null && e.imageSrc ? s[r].adUrl ? /* @__PURE__ */ n("a", { href: s[r].adUrl, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ n(k, { src: s[r].imageSrc }) }) : /* @__PURE__ */ n(k, { src: s[r].imageSrc }) : null;
93
+ }, ae = ({ isClosing: r, title: e, caption: a, onPlay: s, onClose: c, vastUrl: o, options: l }) => {
94
+ const t = (l == null ? void 0 : l.showPauseButton) ?? !0, { ref: u, focusSelf: i } = F.useFocusable({
95
+ focusKey: "sl-pause-ad-play",
96
+ onEnterRelease: s,
97
+ isFocusBoundary: !0,
98
+ forceFocus: !0
99
+ });
100
+ return b(() => {
101
+ u.current && i();
102
+ }, [u, i]), b(() => {
103
+ const f = (m) => {
104
+ const h = m.keyCode;
105
+ if (h === 461 || h === 10009 || h === 27) {
106
+ m.preventDefault(), m.stopPropagation(), m.stopImmediatePropagation(), c == null || c();
107
+ return;
108
+ }
109
+ };
110
+ return window.addEventListener("keydown", f, { capture: !0 }), () => window.removeEventListener("keydown", f, { capture: !0 });
111
+ }, [c]), /* @__PURE__ */ n(J, { className: M(r && "pause-ad-closing"), children: /* @__PURE__ */ I(Q, { children: [
112
+ /* @__PURE__ */ n(W, {}),
113
+ /* @__PURE__ */ n(X, {}),
114
+ /* @__PURE__ */ n(Y, {}),
115
+ /* @__PURE__ */ I(Z, { children: [
116
+ /* @__PURE__ */ n($, { children: e }),
117
+ /* @__PURE__ */ n(ee, { children: a })
118
+ ] }),
119
+ t && /* @__PURE__ */ n(re, { children: /* @__PURE__ */ n(
120
+ se,
121
+ {
122
+ ref: u,
123
+ onClick: s,
124
+ onMouseEnter: () => u.current.focus(),
125
+ "aria-label": "Resume playback"
126
+ }
127
+ ) }),
128
+ /* @__PURE__ */ I(te, { children: [
129
+ o && /* @__PURE__ */ n(ne, { vastUrl: o }),
130
+ /* @__PURE__ */ n("span", { children: "ADVERTISEMENT" })
131
+ ] })
132
+ ] }) });
133
+ }, oe = ({
134
+ showPauseAd: r,
135
+ vastUrls: e,
136
+ title: a,
137
+ caption: s,
138
+ onPlay: c,
139
+ onClose: o,
140
+ onRender: l,
141
+ options: t
142
+ }) => {
143
+ const u = (t == null ? void 0 : t.pauseAdDelay) ?? 5e3, [i, f] = R(!1), [m, h] = R(!1), v = L(), d = e == null ? void 0 : e[0].url, y = L(d);
144
+ y.current = d;
145
+ const [g, A] = D();
146
+ return b(() => {
147
+ if (r && d) {
148
+ x.emit("exposedPauseAd", {
149
+ action: "enabled",
150
+ payload: {}
151
+ }), g(d).then((P) => {
152
+ y.current === d && (P == null ? void 0 : P.success) !== !0 && (clearTimeout(v.current), o == null || o());
153
+ }).catch(() => {
154
+ y.current === d && (clearTimeout(v.current), o == null || o());
155
+ });
156
+ const T = () => {
157
+ var P;
158
+ (P = A.get()[y.current]) != null && P.imageSrc ? (clearTimeout(v.current), h(!1), f(!0), x.emit("exposedPauseAd", {
159
+ action: "rendered",
160
+ payload: {}
161
+ })) : v.current = setTimeout(() => {
162
+ T();
163
+ }, 200);
164
+ };
165
+ v.current = setTimeout(() => {
166
+ T();
167
+ }, u);
168
+ } else
169
+ x.emit("exposedPauseAd", {
170
+ action: "disabled",
171
+ payload: {}
172
+ }), h(!0), v.current = setTimeout(() => {
173
+ f(!1);
174
+ }, 400);
175
+ return () => {
176
+ v.current && clearTimeout(v.current);
177
+ };
178
+ }, [A, g, o, u, r, d]), b(() => {
179
+ l == null || l({ rendered: i });
180
+ }, [i, l]), b(() => () => {
181
+ l == null || l({ rendered: !1 });
182
+ }, [l]), i ? /* @__PURE__ */ n(
183
+ ae,
184
+ {
185
+ onClose: o,
186
+ isClosing: m,
187
+ title: a,
188
+ caption: s,
189
+ onPlay: c,
190
+ vastUrl: d,
191
+ options: t
192
+ }
193
+ ) : null;
194
+ }, le = ({
195
+ showPauseAd: r,
196
+ pauseAdVastUrl: e,
197
+ videoPlayerController: a,
198
+ onRenderPauseAd: s,
199
+ onClosePauseAd: c,
200
+ children: o,
201
+ options: l
202
+ }) => {
203
+ const t = j(), u = q(), i = L(), f = C(() => {
204
+ c == null || c();
205
+ }, [c]), m = C(() => {
206
+ t == null || t.controlVideoPlayer({ play: !0 });
207
+ }, [t]);
208
+ return b(() => t ? (a && (i.current = a, t.addVideoPlayerController(i.current)), () => {
209
+ i.current && t.removeVideoPlayerController(i.current);
210
+ }) : () => {
211
+ }, [t, a]), t ? /* @__PURE__ */ n("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ I(
212
+ z,
213
+ {
214
+ style: { position: "relative" },
215
+ customTheme: u.theme,
216
+ themeMode: u.themeMode,
217
+ children: [
218
+ o,
219
+ e && /* @__PURE__ */ n(
220
+ oe,
221
+ {
222
+ showPauseAd: r,
223
+ vastUrls: e,
224
+ onClose: f,
225
+ onRender: s,
226
+ onPlay: m,
227
+ options: l
228
+ }
229
+ )
230
+ ]
231
+ }
232
+ ) }) : o;
233
+ };
234
+ class pe extends G {
235
+ constructor(e) {
236
+ super(e), this.state = { hasError: !1 };
237
+ }
238
+ static getDerivedStateFromError() {
239
+ return { hasError: !0 };
240
+ }
241
+ componentDidCatch(e, a) {
242
+ console.error(e, a.componentStack);
243
+ }
244
+ render() {
245
+ return this.state.hasError ? this.props.children : /* @__PURE__ */ n(le, { ...this.props });
246
+ }
247
+ }
248
+ export {
249
+ pe as StreamLayerPauseAd
250
+ };