@streamlayer/react-ui 1.4.0 → 1.5.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.
|
@@ -1,103 +1,107 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { styled as
|
|
3
|
-
import { useStore as
|
|
4
|
-
import { useAnalyticsListener as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { eventBus as
|
|
7
|
-
import { FeatureType as
|
|
8
|
-
import { useAppApp as
|
|
9
|
-
import { AdvertisementUI as
|
|
10
|
-
const
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { styled as p } from "@linaria/react";
|
|
3
|
+
import { useStore as u } from "@nanostores/react";
|
|
4
|
+
import { useAnalyticsListener as v } from "../../../hooks/analytics.js";
|
|
5
|
+
import { useEffect as A, useRef as y, useMemo as g } from "react";
|
|
6
|
+
import { eventBus as f } from "@streamlayer/sdk-web-interfaces";
|
|
7
|
+
import { FeatureType as S, PromotionType as b } from "@streamlayer/sdk-web-types";
|
|
8
|
+
import { useAppApp as h } from "../useApp.js";
|
|
9
|
+
import { AdvertisementUI as L } from "../../../ui/advertisement/index.js";
|
|
10
|
+
const E = /* @__PURE__ */ p("div")({
|
|
11
11
|
name: "AdvertisementUIWrap",
|
|
12
12
|
class: "aa6pjif",
|
|
13
13
|
propsAsIs: !1
|
|
14
|
-
}),
|
|
14
|
+
}), I = (t) => {
|
|
15
15
|
const e = t.target;
|
|
16
16
|
if (e instanceof HTMLAnchorElement && e.target === "_blank") {
|
|
17
|
-
const
|
|
18
|
-
e.getAttribute("data-analytics") === "button" &&
|
|
17
|
+
const r = e.getAttribute("data-promo-id") || "", i = e.getAttribute("data-promo-type") || b.UNSET;
|
|
18
|
+
e.getAttribute("data-analytics") === "button" && f.emit("advertisement", {
|
|
19
19
|
action: "buttonSelect",
|
|
20
20
|
payload: {
|
|
21
|
-
advertisementId:
|
|
22
|
-
advertisementType:
|
|
21
|
+
advertisementId: r,
|
|
22
|
+
advertisementType: i
|
|
23
23
|
}
|
|
24
|
-
}), e.getAttribute("data-analytics") === "banner" &&
|
|
24
|
+
}), e.getAttribute("data-analytics") === "banner" && f.emit("advertisement", {
|
|
25
25
|
action: "bannerSelect",
|
|
26
26
|
payload: {
|
|
27
|
-
advertisementId:
|
|
28
|
-
advertisementType:
|
|
27
|
+
advertisementId: r,
|
|
28
|
+
advertisementType: i
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
},
|
|
32
|
+
}, T = ({
|
|
33
33
|
gamification: t,
|
|
34
34
|
layoutMode: e,
|
|
35
|
+
skipTypeCheck: r,
|
|
35
36
|
sidebar: i,
|
|
36
|
-
banner:
|
|
37
|
-
isMobileScreen:
|
|
38
|
-
persistent:
|
|
37
|
+
banner: n,
|
|
38
|
+
isMobileScreen: d,
|
|
39
|
+
persistent: a
|
|
39
40
|
}) => {
|
|
40
|
-
const
|
|
41
|
-
() => t.advertisement.getActiveAdvertisement(
|
|
41
|
+
const s = y(null), m = u(t.advertisement.$list), o = g(
|
|
42
|
+
() => t.advertisement.getActiveAdvertisement(a),
|
|
42
43
|
// fire getActiveNotification when notifications were updated
|
|
43
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
-
[
|
|
45
|
+
[m, a]
|
|
45
46
|
);
|
|
46
|
-
|
|
47
|
-
enabled: !!
|
|
47
|
+
v(s, {
|
|
48
|
+
enabled: !!o,
|
|
48
49
|
event: "click",
|
|
49
|
-
listener:
|
|
50
|
+
listener: I
|
|
50
51
|
});
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
ref:
|
|
52
|
+
const c = !n && !i;
|
|
53
|
+
return o ? /* @__PURE__ */ l(E, {
|
|
54
|
+
ref: s,
|
|
54
55
|
style: {
|
|
55
|
-
height:
|
|
56
|
+
height: c ? "auto" : "100%"
|
|
56
57
|
},
|
|
57
|
-
className:
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
className: d ? "mobile-view" : "",
|
|
59
|
+
children: /* @__PURE__ */ l(L, {
|
|
60
|
+
skipTypeCheck: r,
|
|
59
61
|
sidebar: i,
|
|
60
|
-
banner:
|
|
61
|
-
advertisement:
|
|
62
|
+
banner: n,
|
|
63
|
+
advertisement: o,
|
|
62
64
|
layoutMode: e
|
|
63
65
|
})
|
|
64
66
|
}) : null;
|
|
65
|
-
},
|
|
67
|
+
}, W = ({
|
|
66
68
|
sdk: t,
|
|
67
69
|
sidebar: e,
|
|
68
|
-
banner:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
banner: r,
|
|
71
|
+
skipTypeCheck: i,
|
|
72
|
+
event: n,
|
|
73
|
+
layoutMode: d,
|
|
74
|
+
isMobileScreen: a,
|
|
75
|
+
persistent: s
|
|
73
76
|
}) => {
|
|
74
77
|
const {
|
|
75
|
-
deactivate:
|
|
76
|
-
} =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
const
|
|
81
|
-
if (e &&
|
|
82
|
-
return /* @__PURE__ */
|
|
78
|
+
deactivate: m
|
|
79
|
+
} = h(t);
|
|
80
|
+
A(() => {
|
|
81
|
+
n ? t.createEventSession(n) : m();
|
|
82
|
+
}, [n, m, t]);
|
|
83
|
+
const o = u(t.featuresList.getStore());
|
|
84
|
+
if (e && r)
|
|
85
|
+
return /* @__PURE__ */ l("div", {
|
|
83
86
|
style: {
|
|
84
87
|
color: "red"
|
|
85
88
|
},
|
|
86
89
|
children: "define either sidebar or banner, not both."
|
|
87
90
|
});
|
|
88
|
-
if (!
|
|
91
|
+
if (!o)
|
|
89
92
|
return null;
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
gamification:
|
|
93
|
+
const c = t.getFeature(S.GAMES);
|
|
94
|
+
return c ? /* @__PURE__ */ l(T, {
|
|
95
|
+
gamification: c,
|
|
93
96
|
sidebar: e,
|
|
94
|
-
banner:
|
|
95
|
-
layoutMode:
|
|
96
|
-
isMobileScreen:
|
|
97
|
-
persistent:
|
|
97
|
+
banner: r,
|
|
98
|
+
layoutMode: d,
|
|
99
|
+
isMobileScreen: a,
|
|
100
|
+
persistent: s,
|
|
101
|
+
skipTypeCheck: i
|
|
98
102
|
}) : null;
|
|
99
103
|
};
|
|
100
104
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
E as AdvertisementUIWrap,
|
|
106
|
+
W as StreamLayerSDKAdvertisement
|
|
103
107
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useStore as n } from "@nanostores/react";
|
|
3
|
-
import { PromotionType as
|
|
4
|
-
import { Banner as
|
|
5
|
-
import { Overlay as
|
|
6
|
-
import { Sidebar as
|
|
3
|
+
import { PromotionType as d } from "@streamlayer/sdk-web-types";
|
|
4
|
+
import { Banner as u } from "./banner/index.js";
|
|
5
|
+
import { Overlay as t } from "./overlay/index.js";
|
|
6
|
+
import { Sidebar as s } from "./sidebar/index.js";
|
|
7
7
|
import { OverlayContainer as f } from "./overlay/styles.js";
|
|
8
|
-
const y = (r) => (r == null ? void 0 : r.type) ===
|
|
8
|
+
const y = (r) => (r == null ? void 0 : r.type) === d.INGAME_IAB11_LBAR || (r == null ? void 0 : r.type) === d.INGAME_IAB21_LBAR, I = (r) => (r == null ? void 0 : r.type) === d.INGAME_IAB11 || (r == null ? void 0 : r.type) === d.INGAME_IAB21, E = ({ advertisement: r, skipTypeCheck: c, layoutMode: A = "side-by-side", sidebar: e, banner: a }) => {
|
|
9
9
|
const l = n(r.data);
|
|
10
|
-
return !l.data && l.loading ? null : l.error ? /* @__PURE__ */
|
|
10
|
+
return !l.data && l.loading ? null : l.error ? /* @__PURE__ */ o("div", { children: [
|
|
11
11
|
"error ",
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
] }) : l.data ? !
|
|
12
|
+
/* @__PURE__ */ i("button", { onClick: r.close, children: "close" })
|
|
13
|
+
] }) : l.data ? !e && !a && (c || I(l.data)) ? /* @__PURE__ */ i(f, { className: "PromoOverlayContainer", children: /* @__PURE__ */ i(t, { promotionId: r.id, promotion: l.data, onClose: r.close }) }) : e && (c || y(l.data)) ? /* @__PURE__ */ i(s, { className: "PromoSidebarContainer", direction: e, hiding: r.hiding, children: /* @__PURE__ */ i(t, { promotionId: r.id, promotion: l.data, onClose: r.close }) }) : a ? /* @__PURE__ */ i(u, { promotionId: r.id, hiding: r.hiding, promotion: l.data, direction: a }) : null : /* @__PURE__ */ o("div", { children: [
|
|
14
14
|
"empty promo ",
|
|
15
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ i("button", { onClick: r.close, children: "close" })
|
|
16
16
|
] });
|
|
17
17
|
};
|
|
18
18
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
"react-virtualized-auto-sizer": "^1.0.24",
|
|
55
55
|
"react-window": "^1.8.10",
|
|
56
56
|
"react-window-infinite-loader": "^1.0.9",
|
|
57
|
-
"@streamlayer/
|
|
58
|
-
"@streamlayer/sdk-web
|
|
59
|
-
"@streamlayer/
|
|
60
|
-
"@streamlayer/sdk-web-anonymous-auth": "^1.0.
|
|
61
|
-
"@streamlayer/sdk-web-api": "^1.3.
|
|
62
|
-
"@streamlayer/sdk-web-
|
|
63
|
-
"@streamlayer/sdk-web-
|
|
64
|
-
"@streamlayer/sdk-web-interfaces": "^1.1.
|
|
65
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
66
|
-
"@streamlayer/sdk-web-notifications": "^1.1.
|
|
67
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
68
|
-
"@streamlayer/sdk-web-types": "^1.3.
|
|
57
|
+
"@streamlayer/feature-gamification": "^1.4.1",
|
|
58
|
+
"@streamlayer/sdk-web": "^1.2.1",
|
|
59
|
+
"@streamlayer/sdk-web-analytics": "^1.2.1",
|
|
60
|
+
"@streamlayer/sdk-web-anonymous-auth": "^1.0.10",
|
|
61
|
+
"@streamlayer/sdk-web-api": "^1.3.1",
|
|
62
|
+
"@streamlayer/sdk-web-core": "^1.2.1",
|
|
63
|
+
"@streamlayer/sdk-web-features": "^1.0.10",
|
|
64
|
+
"@streamlayer/sdk-web-interfaces": "^1.1.5",
|
|
65
|
+
"@streamlayer/sdk-web-logger": "^1.0.10",
|
|
66
|
+
"@streamlayer/sdk-web-notifications": "^1.1.5",
|
|
67
|
+
"@streamlayer/sdk-web-storage": "^1.0.10",
|
|
68
|
+
"@streamlayer/sdk-web-types": "^1.3.1"
|
|
69
69
|
},
|
|
70
70
|
"nx": {
|
|
71
71
|
"implicitDependencies": [
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
"@linaria/core": "^6.2.0",
|
|
82
82
|
"@linaria/react": "^6.2.1",
|
|
83
83
|
"@nanostores/react": "^0.7.2",
|
|
84
|
-
"@storybook/addon-docs": "^8.3.
|
|
85
|
-
"@storybook/addon-viewport": "^8.3.
|
|
86
|
-
"@storybook/blocks": "^8.3.
|
|
84
|
+
"@storybook/addon-docs": "^8.3.4",
|
|
85
|
+
"@storybook/addon-viewport": "^8.3.4",
|
|
86
|
+
"@storybook/blocks": "^8.3.4",
|
|
87
87
|
"@storybook/jest": "^0.2.3",
|
|
88
|
-
"@storybook/react": "^8.3.
|
|
88
|
+
"@storybook/react": "^8.3.4",
|
|
89
89
|
"@storybook/testing-library": "^0.2.2",
|
|
90
90
|
"@types/react-infinite-scroller": "^1.2.5",
|
|
91
91
|
"@types/react-window": "^1.8.8",
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
102
102
|
"screenfull": "^6.0.2",
|
|
103
103
|
"tslib": "^2.7.0",
|
|
104
|
-
"vite": "5.4.
|
|
104
|
+
"vite": "5.4.8",
|
|
105
105
|
"vite-plugin-node-polyfills": "^0.22.0",
|
|
106
106
|
"vite-plugin-svgr": "^4.2.0",
|
|
107
107
|
"vite-svg-loader": "^5.1.0",
|
|
108
108
|
"vite-tsconfig-paths": "^5.0.1",
|
|
109
|
-
"@streamlayer/react": "^1.
|
|
109
|
+
"@streamlayer/react": "^1.3.0"
|
|
110
110
|
}
|
|
111
111
|
}
|