@streamlayer/react-ui 1.30.0 → 1.31.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/Advertisement/index.js +76 -61
- package/lib/app/webos/Question/index.js +45 -33
- package/lib/assets/style.css +1 -1
- package/package.json +21 -16
|
@@ -1,72 +1,87 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as u, jsxs as $ } from "react/jsx-runtime";
|
|
2
2
|
import { cx as V } from "@linaria/core";
|
|
3
|
-
import { styled as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
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
|
-
}),
|
|
17
|
+
}), te = (t) => {
|
|
17
18
|
const r = t.target;
|
|
18
19
|
if (r instanceof HTMLAnchorElement && r.target === "_blank") {
|
|
19
|
-
const
|
|
20
|
-
r.getAttribute("data-a") === "button" &&
|
|
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:
|
|
24
|
+
id: n,
|
|
24
25
|
type: a
|
|
25
26
|
}
|
|
26
|
-
}), r.getAttribute("data-a") === "banner" &&
|
|
27
|
+
}), r.getAttribute("data-a") === "banner" && x.emit("advertisement", {
|
|
27
28
|
action: "bannerSelect",
|
|
28
29
|
payload: {
|
|
29
|
-
id:
|
|
30
|
+
id: n,
|
|
30
31
|
type: a
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
},
|
|
35
|
+
}, re = G(({
|
|
35
36
|
gamification: t,
|
|
36
37
|
skipAutoClose: r,
|
|
37
|
-
containerId:
|
|
38
|
+
containerId: n,
|
|
38
39
|
muted: a,
|
|
39
|
-
notification:
|
|
40
|
-
sidebar:
|
|
40
|
+
notification: m,
|
|
41
|
+
sidebar: l,
|
|
41
42
|
banner: i,
|
|
42
|
-
persistent:
|
|
43
|
-
controlVideo:
|
|
44
|
-
},
|
|
45
|
-
var
|
|
46
|
-
const e =
|
|
47
|
-
finished:
|
|
48
|
-
} =
|
|
49
|
-
|
|
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:
|
|
53
|
-
}),
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
}, [
|
|
57
|
-
const
|
|
58
|
-
containerId:
|
|
59
|
-
landscapeUrl:
|
|
60
|
-
portraitUrl:
|
|
61
|
-
});
|
|
62
|
-
return e.data === void 0
|
|
63
|
-
ref:
|
|
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:
|
|
80
|
+
height: F ? "auto" : "100%"
|
|
66
81
|
},
|
|
67
82
|
className: V("SL-AdvertisementUIWrap", "SL-AdvertisementWebOs", "SL-AdvertisementUIWrap--lower-third"),
|
|
68
|
-
children: [!
|
|
69
|
-
sidebar:
|
|
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:
|
|
97
|
+
isNotification: m,
|
|
83
98
|
skipAutoClose: r,
|
|
84
|
-
controlVideo:
|
|
99
|
+
controlVideo: p,
|
|
85
100
|
muted: a
|
|
86
101
|
})]
|
|
87
102
|
});
|
|
88
|
-
}),
|
|
103
|
+
}), ge = ({
|
|
89
104
|
sdk: t,
|
|
90
105
|
sidebar: r,
|
|
91
|
-
muted:
|
|
106
|
+
muted: n,
|
|
92
107
|
banner: a,
|
|
93
|
-
skipAutoClose:
|
|
94
|
-
persistent:
|
|
108
|
+
skipAutoClose: m,
|
|
109
|
+
persistent: l,
|
|
95
110
|
notification: i
|
|
96
111
|
}) => {
|
|
97
112
|
const {
|
|
98
|
-
containerId:
|
|
99
|
-
} =
|
|
100
|
-
if (!
|
|
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(
|
|
103
|
-
return e != null && e.advertisement ? /* @__PURE__ */
|
|
104
|
-
ref:
|
|
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:
|
|
109
|
-
skipAutoClose:
|
|
110
|
-
muted:
|
|
123
|
+
persistent: l,
|
|
124
|
+
skipAutoClose: m,
|
|
125
|
+
muted: n,
|
|
111
126
|
notification: i,
|
|
112
|
-
containerId:
|
|
127
|
+
containerId: c,
|
|
113
128
|
controlVideo: t.controlVideoPlayer
|
|
114
129
|
}) : null;
|
|
115
130
|
};
|
|
116
131
|
export {
|
|
117
|
-
|
|
132
|
+
ge as StreamLayerSDKAdvertisementWebOS
|
|
118
133
|
};
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { styled as
|
|
3
|
-
import { Question as
|
|
4
|
-
import { useHideTransition as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { useStore as
|
|
7
|
-
import { eventBus as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
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
|
-
}),
|
|
16
|
-
sdk:
|
|
17
|
-
notification:
|
|
18
|
+
}), Z = ({
|
|
19
|
+
sdk: o,
|
|
20
|
+
notification: i
|
|
18
21
|
}) => {
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
hiding:
|
|
22
|
-
onAnimationEnd:
|
|
23
|
-
finished:
|
|
24
|
-
} =
|
|
25
|
-
|
|
26
|
-
t &&
|
|
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
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
}, [
|
|
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: ((
|
|
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
|
-
}) :
|
|
44
|
-
hiding:
|
|
45
|
-
onAnimationEnd:
|
|
46
|
-
children: /* @__PURE__ */ n(
|
|
47
|
-
sdk:
|
|
48
|
-
gamification:
|
|
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
|
-
|
|
67
|
+
Z as StreamLayerSDKQuestionWebOS
|
|
56
68
|
};
|