@streamlayer/react-ui 1.5.1 → 1.6.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.
@@ -5,6 +5,7 @@ export type StreamLayerSDKAdvertisementProps = {
5
5
  isMobileScreen?: boolean;
6
6
  persistent?: boolean;
7
7
  skipTypeCheck?: boolean;
8
+ notification?: boolean;
8
9
  sidebar?: 'left' | 'right';
9
10
  banner?: 'top' | 'bottom';
10
11
  layoutMode?: 'cover' | 'side-by-side';
@@ -1,27 +1,27 @@
1
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")({
2
+ import { styled as v } from "@linaria/react";
3
+ import { useStore as p } from "@nanostores/react";
4
+ import { useAnalyticsListener as A } from "../../../hooks/analytics.js";
5
+ import { useEffect as y, useRef as g, useMemo as S } from "react";
6
+ import { eventBus as u } from "@streamlayer/sdk-web-interfaces";
7
+ import { FeatureType as b, PromotionType as h } from "@streamlayer/sdk-web-types";
8
+ import { useAppApp as L } from "../useApp.js";
9
+ import { AdvertisementUI as E } from "../../../ui/advertisement/index.js";
10
+ const I = /* @__PURE__ */ v("div")({
11
11
  name: "AdvertisementUIWrap",
12
12
  class: "aa6pjif",
13
13
  propsAsIs: !1
14
- }), I = (t) => {
14
+ }), T = (t) => {
15
15
  const e = t.target;
16
16
  if (e instanceof HTMLAnchorElement && e.target === "_blank") {
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", {
17
+ const r = e.getAttribute("data-promo-id") || "", i = e.getAttribute("data-promo-type") || h.UNSET;
18
+ e.getAttribute("data-analytics") === "button" && u.emit("advertisement", {
19
19
  action: "buttonSelect",
20
20
  payload: {
21
21
  advertisementId: r,
22
22
  advertisementType: i
23
23
  }
24
- }), e.getAttribute("data-analytics") === "banner" && f.emit("advertisement", {
24
+ }), e.getAttribute("data-analytics") === "banner" && u.emit("advertisement", {
25
25
  action: "bannerSelect",
26
26
  payload: {
27
27
  advertisementId: r,
@@ -29,58 +29,61 @@ const E = /* @__PURE__ */ p("div")({
29
29
  }
30
30
  });
31
31
  }
32
- }, T = ({
32
+ }, N = ({
33
33
  gamification: t,
34
34
  layoutMode: e,
35
35
  skipTypeCheck: r,
36
36
  sidebar: i,
37
37
  banner: n,
38
- isMobileScreen: d,
38
+ notification: d,
39
+ isMobileScreen: f,
39
40
  persistent: a
40
41
  }) => {
41
- const s = y(null), m = u(t.advertisement.$list), o = g(
42
+ const s = g(null), m = p(t.advertisement.$list), o = S(
42
43
  () => t.advertisement.getActiveAdvertisement(a),
43
44
  // fire getActiveNotification when notifications were updated
44
45
  // eslint-disable-next-line react-hooks/exhaustive-deps
45
46
  [m, a]
46
47
  );
47
- v(s, {
48
+ A(s, {
48
49
  enabled: !!o,
49
50
  event: "click",
50
- listener: I
51
+ listener: T
51
52
  });
52
53
  const c = !n && !i;
53
- return o ? /* @__PURE__ */ l(E, {
54
+ return o ? /* @__PURE__ */ l(I, {
54
55
  ref: s,
55
56
  style: {
56
57
  height: c ? "auto" : "100%"
57
58
  },
58
- className: d ? "mobile-view" : "",
59
- children: /* @__PURE__ */ l(L, {
59
+ className: f ? "mobile-view" : "",
60
+ children: /* @__PURE__ */ l(E, {
60
61
  skipTypeCheck: r,
61
62
  sidebar: i,
62
63
  banner: n,
63
64
  advertisement: o,
64
- layoutMode: e
65
+ layoutMode: e,
66
+ isNotification: d
65
67
  })
66
68
  }) : null;
67
- }, W = ({
69
+ }, w = ({
68
70
  sdk: t,
69
71
  sidebar: e,
70
72
  banner: r,
71
73
  skipTypeCheck: i,
72
74
  event: n,
73
75
  layoutMode: d,
74
- isMobileScreen: a,
75
- persistent: s
76
+ isMobileScreen: f,
77
+ persistent: a,
78
+ notification: s
76
79
  }) => {
77
80
  const {
78
81
  deactivate: m
79
- } = h(t);
80
- A(() => {
82
+ } = L(t);
83
+ y(() => {
81
84
  n ? t.createEventSession(n) : m();
82
85
  }, [n, m, t]);
83
- const o = u(t.featuresList.getStore());
86
+ const o = p(t.featuresList.getStore());
84
87
  if (e && r)
85
88
  return /* @__PURE__ */ l("div", {
86
89
  style: {
@@ -90,18 +93,19 @@ const E = /* @__PURE__ */ p("div")({
90
93
  });
91
94
  if (!o)
92
95
  return null;
93
- const c = t.getFeature(S.GAMES);
94
- return c ? /* @__PURE__ */ l(T, {
96
+ const c = t.getFeature(b.GAMES);
97
+ return c ? /* @__PURE__ */ l(N, {
95
98
  gamification: c,
96
99
  sidebar: e,
97
100
  banner: r,
98
101
  layoutMode: d,
99
- isMobileScreen: a,
100
- persistent: s,
102
+ isMobileScreen: f,
103
+ persistent: a,
104
+ notification: s,
101
105
  skipTypeCheck: i
102
106
  }) : null;
103
107
  };
104
108
  export {
105
- E as AdvertisementUIWrap,
106
- W as StreamLayerSDKAdvertisement
109
+ I as AdvertisementUIWrap,
110
+ w as StreamLayerSDKAdvertisement
107
111
  };