@streamlayer/react-ui 1.31.0 → 1.31.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,72 +1,87 @@
1
- import { jsxs as T, jsx as P } from "react/jsx-runtime";
1
+ import { jsx as u, jsxs as $ } from "react/jsx-runtime";
2
2
  import { cx as V } from "@linaria/core";
3
- import { styled as x } from "@linaria/react";
4
- import { useAnalyticsListener as F } from "../../../hooks/analytics.js";
5
- import { useHideTransition as M } from "../../../hooks/showIn.js";
6
- import { forwardRef as O, useEffect as B, useRef as j } from "react";
7
- import { useStore as u } from "@streamlayer/react-polyfills";
8
- import { eventBus as E } from "@streamlayer/sdk-web-interfaces";
9
- import { PromotionType as q, FeatureType as D } from "@streamlayer/sdk-web-types";
10
- import { useAdvertisementBackground as H } from "../../../ui/theme/utils.js";
11
- import { AdvertisementUI as K } from "./AdvertisementUI.js";
12
- const N = /* @__PURE__ */ x("div")({
3
+ import { styled as j } from "@linaria/react";
4
+ import { StreamLayerSDKBannerProvider as q } from "../../app/Banner/index.js";
5
+ import { useAnalyticsListener as H } from "../../../hooks/analytics.js";
6
+ import { useHideTransition as Q } from "../../../hooks/showIn.js";
7
+ import { forwardRef as G, useEffect as _, useRef as z } from "react";
8
+ import { useStore as d } from "@streamlayer/react-polyfills";
9
+ import { eventBus as x } from "@streamlayer/sdk-web-interfaces";
10
+ import { QuestionPosition as C, AdUnit as J, PromotionType as X, FeatureType as Y } from "@streamlayer/sdk-web-types";
11
+ import { useAdvertisementBackground as Z } from "../../../ui/theme/utils.js";
12
+ import { AdvertisementUI as ee } from "./AdvertisementUI.js";
13
+ const D = /* @__PURE__ */ j("div")({
13
14
  name: "AdvertisementUIWrap",
14
15
  class: "a17b2u9w",
15
16
  propsAsIs: !1
16
- }), R = (t) => {
17
+ }), te = (t) => {
17
18
  const r = t.target;
18
19
  if (r instanceof HTMLAnchorElement && r.target === "_blank") {
19
- const o = r.getAttribute("data-promo-id") || "", a = r.getAttribute("data-promo-type") || q.UNSET;
20
- r.getAttribute("data-a") === "button" && E.emit("advertisement", {
20
+ const n = r.getAttribute("data-promo-id") || "", a = r.getAttribute("data-promo-type") || X.UNSET;
21
+ r.getAttribute("data-a") === "button" && x.emit("advertisement", {
21
22
  action: "buttonSelect",
22
23
  payload: {
23
- id: o,
24
+ id: n,
24
25
  type: a
25
26
  }
26
- }), r.getAttribute("data-a") === "banner" && E.emit("advertisement", {
27
+ }), r.getAttribute("data-a") === "banner" && x.emit("advertisement", {
27
28
  action: "bannerSelect",
28
29
  payload: {
29
- id: o,
30
+ id: n,
30
31
  type: a
31
32
  }
32
33
  });
33
34
  }
34
- }, G = O(({
35
+ }, re = G(({
35
36
  gamification: t,
36
37
  skipAutoClose: r,
37
- containerId: o,
38
+ containerId: n,
38
39
  muted: a,
39
- notification: n,
40
- sidebar: s,
40
+ notification: m,
41
+ sidebar: l,
41
42
  banner: i,
42
- persistent: m,
43
- controlVideo: l
44
- }, d) => {
45
- var p, f, g, v, A, b, S, y, U, I;
46
- const e = u(t.advertisement.$store), {
47
- finished: c
48
- } = M();
49
- F(d, {
43
+ persistent: c,
44
+ controlVideo: p
45
+ }, s) => {
46
+ var g, A, S, b, U, y, I, L, P, h, W, k, w, E, T, B;
47
+ const e = d(t.advertisement.$store), o = d(t.openedQuestion.$store), f = d(t.openedQuestion.$extendedStore), {
48
+ finished: v
49
+ } = Q();
50
+ H(s, {
50
51
  enabled: !!e.data,
51
52
  event: "click",
52
- listener: R
53
- }), B(() => {
54
- var L;
55
- c && ((L = e.close) == null || L.call(e));
56
- }, [c]);
57
- const k = !i && !s, W = ((g = (f = (p = e.data) == null ? void 0 : p.question) == null ? void 0 : f.backgroundImage) == null ? void 0 : g.landscapeUrl) || ((A = (v = e.data) == null ? void 0 : v.promotion) == null ? void 0 : A.backgroundImageLandscapeUrl), h = ((y = (S = (b = e.data) == null ? void 0 : b.question) == null ? void 0 : S.backgroundImage) == null ? void 0 : y.portraitUrl) || ((I = (U = e.data) == null ? void 0 : U.promotion) == null ? void 0 : I.backgroundImagePortraitUrl), w = H({
58
- containerId: o,
59
- landscapeUrl: W,
60
- portraitUrl: h
61
- });
62
- return e.data === void 0 || !m && e.isViewed ? null : /* @__PURE__ */ T(N, {
63
- ref: d,
53
+ listener: te
54
+ }), _(() => {
55
+ var O;
56
+ v && ((O = e.close) == null || O.call(e));
57
+ }, [v]);
58
+ const F = !i && !l, M = ((S = (A = (g = e.data) == null ? void 0 : g.question) == null ? void 0 : A.backgroundImage) == null ? void 0 : S.landscapeUrl) || ((U = (b = e.data) == null ? void 0 : b.promotion) == null ? void 0 : U.backgroundImageLandscapeUrl), R = ((L = (I = (y = e.data) == null ? void 0 : y.question) == null ? void 0 : I.backgroundImage) == null ? void 0 : L.portraitUrl) || ((h = (P = e.data) == null ? void 0 : P.promotion) == null ? void 0 : h.backgroundImagePortraitUrl), K = Z({
59
+ containerId: n,
60
+ landscapeUrl: M,
61
+ portraitUrl: R
62
+ }), N = ((k = (W = f == null ? void 0 : f.data) == null ? void 0 : W.appearance) == null ? void 0 : k.position) === C.LBAR;
63
+ return i && e.data === void 0 && ((w = o == null ? void 0 : o.attributes) == null ? void 0 : w.adUnit) === J.STANDART && N && ((B = (T = (E = o == null ? void 0 : o.attributes) == null ? void 0 : E.adPromotion) == null ? void 0 : T.banner) != null && B.imageUrl) ? /* @__PURE__ */ u(D, {
64
+ ref: s,
65
+ style: {
66
+ height: "100%"
67
+ },
68
+ className: V("SL-AdvertisementUIWrap", "SL-AdvertisementWebOs", "SL-AdvertisementUIWrap--lower-third"),
69
+ children: /* @__PURE__ */ u(q, {
70
+ cardId: o.id,
71
+ promotion: {
72
+ ...o.attributes.adPromotion,
73
+ adUnit: o.attributes.adUnit
74
+ },
75
+ direction: i
76
+ })
77
+ }) : e.data === void 0 || !c && e.isViewed ? null : /* @__PURE__ */ $(D, {
78
+ ref: s,
64
79
  style: {
65
- height: k ? "auto" : "100%"
80
+ height: F ? "auto" : "100%"
66
81
  },
67
82
  className: V("SL-AdvertisementUIWrap", "SL-AdvertisementWebOs", "SL-AdvertisementUIWrap--lower-third"),
68
- children: [!n && w, /* @__PURE__ */ P(K, {
69
- sidebar: s,
83
+ children: [!m && K, /* @__PURE__ */ u(ee, {
84
+ sidebar: l,
70
85
  banner: i,
71
86
  advertisement: e.data,
72
87
  advertisementPaused: !!e.isPaused,
@@ -79,40 +94,40 @@ const N = /* @__PURE__ */ x("div")({
79
94
  fireEvent: e.fireEvent,
80
95
  markAsViewed: t.advertisement.markAsViewed,
81
96
  open: t.advertisement.open,
82
- isNotification: n,
97
+ isNotification: m,
83
98
  skipAutoClose: r,
84
- controlVideo: l,
99
+ controlVideo: p,
85
100
  muted: a
86
101
  })]
87
102
  });
88
- }), re = ({
103
+ }), ge = ({
89
104
  sdk: t,
90
105
  sidebar: r,
91
- muted: o,
106
+ muted: n,
92
107
  banner: a,
93
- skipAutoClose: n,
94
- persistent: s,
108
+ skipAutoClose: m,
109
+ persistent: l,
95
110
  notification: i
96
111
  }) => {
97
112
  const {
98
- containerId: m
99
- } = u(t.options), l = u(t.featuresList.getStore()), d = j(null);
100
- if (!l)
113
+ containerId: c
114
+ } = d(t.options), p = d(t.featuresList.getStore()), s = z(null);
115
+ if (!p)
101
116
  return null;
102
- const e = t.getFeature(D.GAMES);
103
- return e != null && e.advertisement ? /* @__PURE__ */ P(G, {
104
- ref: d,
117
+ const e = t.getFeature(Y.GAMES);
118
+ return e != null && e.advertisement ? /* @__PURE__ */ u(re, {
119
+ ref: s,
105
120
  gamification: e,
106
121
  sidebar: r,
107
122
  banner: a,
108
- persistent: s,
109
- skipAutoClose: n,
110
- muted: o,
123
+ persistent: l,
124
+ skipAutoClose: m,
125
+ muted: n,
111
126
  notification: i,
112
- containerId: m,
127
+ containerId: c,
113
128
  controlVideo: t.controlVideoPlayer
114
129
  }) : null;
115
130
  };
116
131
  export {
117
- re as StreamLayerSDKAdvertisementWebOS
132
+ ge as StreamLayerSDKAdvertisementWebOS
118
133
  };
@@ -1,29 +1,32 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { styled as I } from "@linaria/react";
3
- import { Question as b } from "../../app/Features/Gamification/Question.js";
4
- import { useHideTransition as h } from "../../../hooks/showIn.js";
5
- import { useState as q, useMemo as w, useEffect as d } from "react";
6
- import { useStore as l } from "@streamlayer/react-polyfills";
7
- import { eventBus as C } from "@streamlayer/sdk-web-interfaces";
8
- import { FeatureType as x, AdUnit as E } from "@streamlayer/sdk-web-types";
9
- import { InAppNotification as O } from "../../../ui/gamification/question/inapp/notification/AdNotification/index.js";
10
- import { ShowIn as Q } from "../../../ui/show-in/index.js";
11
- const j = () => Q, D = /* @__PURE__ */ I(j())({
2
+ import { styled as N } from "@linaria/react";
3
+ import { Question as O } from "../../app/Features/Gamification/Question.js";
4
+ import { useHideTransition as R } from "../../../hooks/showIn.js";
5
+ import { useState as g, useMemo as C, useEffect as l } from "react";
6
+ import { useStore as A } from "@streamlayer/react-polyfills";
7
+ import { eventBus as D } from "@streamlayer/sdk-web-interfaces";
8
+ import { NotificationType as Q } from "@streamlayer/sdk-web-notifications";
9
+ import { FeatureType as b, QuestionType as h, AdUnit as S } from "@streamlayer/sdk-web-types";
10
+ import { InAppNotification as w } from "../../../ui/gamification/question/inapp/notification/AdNotification/index.js";
11
+ import { InAppPredictionResult as U } from "../../../ui/gamification/question/inapp/prediction-result/index.js";
12
+ import { InAppPredictionResultAd as x } from "../../../ui/gamification/question/inapp/prediction-result-ad/index.js";
13
+ import { ShowIn as L } from "../../../ui/show-in/index.js";
14
+ const P = () => L, j = /* @__PURE__ */ N(P())({
12
15
  name: "OpenedContainer",
13
16
  class: "osyjgip",
14
17
  propsAsIs: !0
15
- }), W = ({
16
- sdk: e,
17
- notification: r
18
+ }), Z = ({
19
+ sdk: o,
20
+ notification: i
18
21
  }) => {
19
- var s, a, p, u, m, f, c;
20
- const A = l(e.featuresList.getStore()), {
21
- hiding: S,
22
- onAnimationEnd: y,
23
- finished: i
24
- } = h(), [T] = q(e.getNotificationsStore()), g = l(T), t = w(() => e.getActiveNotification(), [e, g]);
25
- d(() => {
26
- t && C.emit("notification", {
22
+ var a, s, p, u, c, m, f, d;
23
+ const T = A(o.featuresList.getStore()), {
24
+ hiding: y,
25
+ onAnimationEnd: I,
26
+ finished: r
27
+ } = R(), [q] = g(o.getNotificationsStore()), E = A(q), t = C(() => o.getActiveNotification(), [o, E]);
28
+ l(() => {
29
+ t && D.emit("notification", {
27
30
  action: "rendered",
28
31
  payload: {
29
32
  questionId: t.data.questionId,
@@ -31,26 +34,35 @@ const j = () => Q, D = /* @__PURE__ */ I(j())({
31
34
  }
32
35
  });
33
36
  }, [t]);
34
- const o = e.getFeature(x.GAMES);
35
- return d(() => {
36
- i && (o == null || o.closeQuestion());
37
- }, [i, o]), !A || !o ? null : r && t && ((s = t.data.inApp) == null ? void 0 : s.adUnit) === E.STANDART ? /* @__PURE__ */ n(O, {
37
+ const e = o.getFeature(b.GAMES);
38
+ return l(() => {
39
+ r && (e == null || e.closeQuestion());
40
+ }, [r, e]), !T || !e ? null : i && t && t.type === Q.QUESTION_RESOLVED && t.data.questionType === h.PREDICTION && t.data.question ? ((a = t.data.inApp) == null ? void 0 : a.adUnit) === S.STANDART ? /* @__PURE__ */ n(x, {
41
+ action: t.action,
42
+ close: t.close,
43
+ ...t.data.question,
44
+ inApp: t.data.inApp
45
+ }) : /* @__PURE__ */ n(U, {
46
+ action: t.action,
47
+ close: t.close,
48
+ ...t.data.question
49
+ }) : i && t && ((s = t.data.inApp) == null ? void 0 : s.adUnit) === S.STANDART ? /* @__PURE__ */ n(w, {
38
50
  ...t.data,
39
51
  action: t.action,
40
52
  close: t.close,
41
- color: ((u = (p = (a = t == null ? void 0 : t.data) == null ? void 0 : a.inApp) == null ? void 0 : p.notification) == null ? void 0 : u.indicatorColor) || ((c = (f = (m = t == null ? void 0 : t.data) == null ? void 0 : m.inApp) == null ? void 0 : f.appearance) == null ? void 0 : c.primaryColor) || "",
53
+ color: ((c = (u = (p = t == null ? void 0 : t.data) == null ? void 0 : p.inApp) == null ? void 0 : u.notification) == null ? void 0 : c.indicatorColor) || ((d = (f = (m = t == null ? void 0 : t.data) == null ? void 0 : m.inApp) == null ? void 0 : f.appearance) == null ? void 0 : d.primaryColor) || "",
42
54
  webos: !0
43
- }) : r ? null : /* @__PURE__ */ n(D, {
44
- hiding: S,
45
- onAnimationEnd: y,
46
- children: /* @__PURE__ */ n(b, {
47
- sdk: e,
48
- gamification: o,
55
+ }) : i ? null : /* @__PURE__ */ n(j, {
56
+ hiding: y,
57
+ onAnimationEnd: I,
58
+ children: /* @__PURE__ */ n(O, {
59
+ sdk: o,
60
+ gamification: e,
49
61
  className: "webos",
50
62
  webos: !0
51
63
  })
52
64
  });
53
65
  };
54
66
  export {
55
- W as StreamLayerSDKQuestionWebOS
67
+ Z as StreamLayerSDKQuestionWebOS
56
68
  };