@streamlayer/react-ui 1.22.1 → 1.22.3

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 (45) hide show
  1. package/lib/app/app/Notifications/index.js +64 -60
  2. package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/index.d.ts +3 -2
  3. package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/index.js +10 -12
  4. package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/styles.d.ts +5 -1
  5. package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/styles.js +1 -1
  6. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.d.ts +1 -1
  7. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.js +20 -28
  8. package/lib/app/masters/BetPack/BetPackContent/EndScreen/styles.d.ts +5 -17
  9. package/lib/app/masters/BetPack/BetPackContent/EndScreen/styles.js +10 -56
  10. package/lib/app/masters/BetPack/BetPackContent/LoaderScreen/index.d.ts +3 -1
  11. package/lib/app/masters/BetPack/BetPackContent/LoaderScreen/index.js +9 -6
  12. package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/index.js +4 -8
  13. package/lib/app/masters/BetPack/BetPackContent/StartScreen/index.d.ts +2 -3
  14. package/lib/app/masters/BetPack/BetPackContent/StartScreen/index.js +18 -24
  15. package/lib/app/masters/BetPack/BetPackContent/StartScreen/styles.d.ts +1 -6
  16. package/lib/app/masters/BetPack/BetPackContent/StartScreen/styles.js +14 -40
  17. package/lib/app/masters/BetPack/BetPackContent/constants.js +1 -1
  18. package/lib/app/masters/BetPack/BetPackContent/index.d.ts +1 -3
  19. package/lib/app/masters/BetPack/BetPackContent/index.js +106 -106
  20. package/lib/app/masters/BetPack/BetPackContent/styles.d.ts +9 -1
  21. package/lib/app/masters/BetPack/BetPackContent/styles.js +48 -10
  22. package/lib/app/masters/BetPack/BetPackOverlay/index.js +2 -3
  23. package/lib/app/masters/BetPack/index.d.ts +2 -2
  24. package/lib/app/masters/BetPack/index.js +60 -88
  25. package/lib/app/masters/BetPack/styles.d.ts +0 -1
  26. package/lib/app/masters/BetPack/styles.js +7 -12
  27. package/lib/app/masters/Features/Gamification/Tabs.js +1 -1
  28. package/lib/app/masters/masters.js +58 -67
  29. package/lib/app/masters/useSdkResponsive.d.ts +0 -2
  30. package/lib/app/masters/useSdkResponsive.js +0 -2
  31. package/lib/assets/style.css +1 -1
  32. package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +1 -1
  33. package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.js +1 -1
  34. package/lib/ui/gamification/question/inapp/prediction-result/frames/content.js +18 -16
  35. package/lib/ui/gamification/user-statistics/index.js +27 -25
  36. package/lib/ui/gamification/vote/index.js +1 -1
  37. package/lib/ui/theme/masters-theme.js +23 -92
  38. package/lib/ui/theme/theme.js +5 -5
  39. package/lib/{useVastAds-Dt_tRbpd.js → useVastAds-Bu_IhLJ2.js} +2 -2
  40. package/lib/utils/decorators/masters.js +49 -11
  41. package/package.json +15 -15
  42. package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/useDynamicParentFont.d.ts +0 -4
  43. package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/useDynamicParentFont.js +0 -33
  44. package/lib/app/masters/useOrientation.d.ts +0 -3
  45. package/lib/app/masters/useOrientation.js +0 -12
@@ -1,51 +1,25 @@
1
1
  import { styled as s } from "@linaria/react";
2
- import { ScreenTitle as t, ScreenDescription as r, ScreenButton as n } from "../../styles.js";
3
- import { SvgIcon as e } from "../../../../../ui/icons/index.js";
4
- const I = /* @__PURE__ */ s("div")({
5
- name: "ScreenWrap",
6
- class: "s991vvm",
2
+ import { SvgIcon as t } from "../../../../../ui/icons/index.js";
3
+ const n = /* @__PURE__ */ s("span")({
4
+ name: "NextButton",
5
+ class: "n991vvm",
7
6
  propsAsIs: !1
8
- }), A = /* @__PURE__ */ s("div")({
9
- name: "Main",
10
- class: "mnbj36g",
11
- propsAsIs: !1
12
- }), o = () => e, u = /* @__PURE__ */ s(o())({
7
+ }), o = () => t, a = /* @__PURE__ */ s(o())({
13
8
  name: "IconArrowRight",
14
- class: "izrvgt",
15
- propsAsIs: !0
16
- }), c = () => e, f = /* @__PURE__ */ s(c())({
17
- name: "SponsorIcon",
18
- class: "swqs2ju",
9
+ class: "inbj36g",
19
10
  propsAsIs: !0
20
- }), v = /* @__PURE__ */ s("div")({
11
+ }), c = /* @__PURE__ */ s("div")({
21
12
  name: "StartScreenSponsor",
22
- class: "s1oq8jlq",
13
+ class: "szrvgt",
23
14
  propsAsIs: !1
24
- }), p = () => t, g = /* @__PURE__ */ s(p())({
25
- name: "StartScreenTitle",
26
- class: "se4nn9a",
27
- propsAsIs: !0
28
- }), a = () => r, x = /* @__PURE__ */ s(a())({
29
- name: "StartScreenDescription",
30
- class: "sofug8s",
31
- propsAsIs: !0
32
- }), S = () => n, d = /* @__PURE__ */ s(S())({
33
- name: "StartScreenButton",
34
- class: "s18s0pjp",
35
- propsAsIs: !0
36
- }), _ = /* @__PURE__ */ s("div")({
15
+ }), p = /* @__PURE__ */ s("div")({
37
16
  name: "StartScreenNote",
38
- class: "s1pgosw8",
17
+ class: "swqs2ju",
39
18
  propsAsIs: !1
40
19
  });
41
20
  export {
42
- u as IconArrowRight,
43
- A as Main,
44
- I as ScreenWrap,
45
- f as SponsorIcon,
46
- d as StartScreenButton,
47
- x as StartScreenDescription,
48
- _ as StartScreenNote,
49
- v as StartScreenSponsor,
50
- g as StartScreenTitle
21
+ a as IconArrowRight,
22
+ n as NextButton,
23
+ p as StartScreenNote,
24
+ c as StartScreenSponsor
51
25
  };
@@ -5,7 +5,7 @@ const n = {
5
5
  infinite: !1,
6
6
  arrows: !1,
7
7
  centerMode: !0,
8
- centerPadding: "19px",
8
+ centerPadding: "18px",
9
9
  speed: 500,
10
10
  rows: 1,
11
11
  slidesToShow: 1,
@@ -2,10 +2,8 @@ import { Gamification } from '@streamlayer/feature-gamification';
2
2
  import { BetPackEventCb } from '../';
3
3
  export declare const BetPackContent: React.FC<{
4
4
  gamification: Gamification;
5
- height?: number;
6
5
  swipeable?: boolean;
7
6
  autoplay?: boolean;
8
- centerPadding?: string;
9
- changeHeightOnInit: () => void;
7
+ overlay?: boolean;
10
8
  onEvent: BetPackEventCb;
11
9
  }>;
@@ -1,115 +1,86 @@
1
- import { jsx as a, jsxs as R } from "react/jsx-runtime";
2
- import { ConnectError as T, Code as N } from "@connectrpc/connect";
3
- import { cx as A } from "@linaria/core";
4
- import { useCallback as P, useSyncExternalStore as F, useRef as b, useState as B, useMemo as M, useEffect as S } from "react";
5
- import { EmergencyScreen as v } from "./EmergencyScreen/index.js";
6
- import { EndScreen as V } from "./EndScreen/index.js";
7
- import { LoaderScreen as D } from "./LoaderScreen/index.js";
8
- import { QuestionScreen as H } from "./QuestionScreen/index.js";
9
- import { ScreenContainer as I } from "./ScreenContainer/index.js";
10
- import { StartScreen as L } from "./StartScreen/index.js";
11
- import { settings as x } from "./constants.js";
12
- import { Carousel as w, desktopDots as K } from "./styles.js";
13
- function z(t, o, c) {
14
- let l = new Set(o).add(void 0);
15
- return t.listen((n, s, p) => {
16
- l.has(p) && c(n, s, p);
1
+ import { jsx as u, jsxs as O } from "react/jsx-runtime";
2
+ import { ConnectError as P, Code as Q } from "@connectrpc/connect";
3
+ import { useCallback as k, useSyncExternalStore as j, useRef as p, useState as R, useMemo as T, useEffect as y } from "react";
4
+ import { EmergencyScreen as b } from "./EmergencyScreen/index.js";
5
+ import { EndScreen as v } from "./EndScreen/index.js";
6
+ import { LoaderScreen as w } from "./LoaderScreen/index.js";
7
+ import { QuestionScreen as F } from "./QuestionScreen/index.js";
8
+ import { ScreenContainer as H } from "./ScreenContainer/index.js";
9
+ import { StartScreen as A } from "./StartScreen/index.js";
10
+ import { settings as B } from "./constants.js";
11
+ import { Carousel as N } from "./styles.js";
12
+ function V(t, s, c) {
13
+ let o = new Set(s).add(void 0);
14
+ return t.listen((n, a, r) => {
15
+ o.has(r) && c(n, a, r);
17
16
  });
18
17
  }
19
- function G(t, o = {}) {
20
- let c = P(
21
- (n) => o.keys ? z(t, o.keys, n) : t.listen(n),
22
- [o.keys, t]
23
- ), l = t.get.bind(t);
24
- return F(c, l, l);
18
+ function D(t, s = {}) {
19
+ let c = k(
20
+ (n) => s.keys ? V(t, s.keys, n) : t.listen(n),
21
+ [s.keys, t]
22
+ ), o = t.get.bind(t);
23
+ return j(c, o, o);
25
24
  }
26
- const re = ({ gamification: t, autoplay: o, swipeable: c, changeHeightOnInit: l, height: n, onEvent: s, centerPadding: p }) => {
27
- const i = b(), d = b(null), [C, O] = B(!1), { data: r, error: f, loading: y } = G(t.betPack.getStore()), { listOfQuestions: m, countQuestionsAvailable: Q } = M(() => {
28
- const e = r ? Object.values(r) : [];
25
+ const I = ({ data: t, gamification: s, onEvent: c, swipeable: o, overlay: n, autoplay: a }) => {
26
+ const r = p(), l = p(null), i = p(null), [d, S] = R(0), { listOfQuestions: m, countQuestionsAvailable: g } = T(() => {
27
+ const e = t ? Object.values(t) : [];
29
28
  return {
30
29
  listOfQuestions: e,
31
- countQuestionsAvailable: e.filter(({ marketClosed: u }) => !u).length
30
+ countQuestionsAvailable: e.filter(({ marketClosed: f }) => !f).length
32
31
  };
33
- }, [r]);
34
- S(() => {
35
- !f && !y && r !== void 0 && !C && s({
36
- type: "slBetPackReady",
37
- payload: {
38
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
- // @ts-expect-error
40
- next: () => {
41
- var e;
42
- return (e = d.current) == null ? void 0 : e.slickNext();
43
- },
44
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
45
- // @ts-expect-error
46
- prev: () => {
47
- var e;
48
- return (e = d.current) == null ? void 0 : e.slickPrev();
49
- },
50
- current: 0,
51
- canNext: !0,
52
- canPrev: !1
53
- }
54
- });
55
- }, [r, f, y, s]);
56
- const h = P(
57
- async (e, u) => {
32
+ }, [t]), x = k(
33
+ async (e, f) => {
58
34
  try {
59
- O(!0), await t.betPackVote(e, u), s({
35
+ await s.betPackVote(e, f), c({
60
36
  type: "slVoted",
61
37
  payload: {
62
38
  questionId: e,
63
- answerId: u
39
+ answerId: f
64
40
  }
65
41
  });
66
42
  } finally {
67
- i.current && clearTimeout(i.current), o && (i.current = setTimeout(() => {
68
- var k;
69
- (k = d.current) == null || k.slickNext();
43
+ r.current && clearTimeout(r.current), a && (r.current = setTimeout(() => {
44
+ var h;
45
+ (h = l.current) == null || h.slickNext();
70
46
  }, 2e3));
71
47
  }
72
48
  },
73
- [t, s, o]
49
+ [s, c, a]
74
50
  );
75
- if (S(() => () => {
76
- i.current && clearTimeout(i.current);
77
- }, []), y)
78
- return /* @__PURE__ */ a(D, {});
79
- if (!f && (r == null || !Object.keys(r).length))
80
- return /* @__PURE__ */ a(
81
- v,
82
- {
83
- actionFn: () => s({ type: "slHardRefresh" }),
84
- description: `It looks like we couldn't
85
- load the questions.`,
86
- isMobile: c,
87
- height: n
88
- }
89
- );
90
- if (f)
91
- return /* @__PURE__ */ a(
92
- v,
93
- {
94
- actionFn: () => s({ type: "slHardRefresh" }),
95
- description: f instanceof T && f.code !== N.InvalidArgument ? `The event ID was not
96
- specified or is invalid.` : `The server is unable to
97
- handle this request.`,
98
- isMobile: c,
99
- height: n
100
- }
101
- );
102
- const j = (e) => {
103
- var u;
104
- if (s({
51
+ y(() => (c({
52
+ type: "slBetPackReady",
53
+ payload: {
54
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
55
+ // @ts-expect-error
56
+ next: () => {
57
+ var e;
58
+ return (e = l.current) == null ? void 0 : e.slickNext();
59
+ },
60
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61
+ // @ts-expect-error
62
+ prev: () => {
63
+ var e;
64
+ return (e = l.current) == null ? void 0 : e.slickPrev();
65
+ },
66
+ current: 0,
67
+ canNext: !0,
68
+ canPrev: !1
69
+ }
70
+ }), () => {
71
+ r.current && clearTimeout(r.current);
72
+ }), [c]);
73
+ const C = (e) => {
74
+ var f;
75
+ if (c({
105
76
  type: "slBetPackChangeCard",
106
77
  payload: {
107
78
  current: e,
108
- canNext: e < Object.keys(r).length + 1,
79
+ canNext: e < Object.keys(t).length + 1,
109
80
  canPrev: e >= 1
110
81
  }
111
- }), e !== 0 && e !== Object.keys(r).length + 1 && ((u = m[e - 1]) != null && u.id)) {
112
- t.openQuestion(m[e - 1].id, {
82
+ }), e !== 0 && e !== Object.keys(t).length + 1 && ((f = m[e - 1]) != null && f.id)) {
83
+ s.openQuestion(m[e - 1].id, {
113
84
  openedFrom: "bet-pack",
114
85
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
115
86
  // @ts-expect-error
@@ -124,29 +95,58 @@ handle this request.`,
124
95
  });
125
96
  return;
126
97
  }
127
- t.closeQuestion();
128
- }, g = (e) => e ? /* @__PURE__ */ a(I, { height: n, children: /* @__PURE__ */ a(H, { question: e, vote: h }) }, e.id) : null;
129
- return /* @__PURE__ */ R(
130
- w,
98
+ s.closeQuestion();
99
+ };
100
+ return y(() => {
101
+ n && i.current && S(i.current.clientHeight);
102
+ }, [n]), /* @__PURE__ */ O(
103
+ N,
131
104
  {
132
- ...x,
133
- swipe: c,
134
- onInit: l,
135
- centerPadding: p || x.centerPadding,
136
- afterChange: j,
105
+ ...B,
106
+ swipe: o,
107
+ afterChange: C,
137
108
  beforeChange: () => {
138
- i.current && clearTimeout(i.current);
109
+ r.current && clearTimeout(r.current);
139
110
  },
140
- ref: d,
141
- className: A(!c && K),
111
+ ref: l,
142
112
  children: [
143
- /* @__PURE__ */ a(L, { height: n, sliderRef: d, countQuestionsAvailable: Q }),
144
- Object.values(r).map(g),
145
- /* @__PURE__ */ a(V, { onEvent: s, height: n })
113
+ /* @__PURE__ */ u(A, { ref: i, sliderRef: l, countQuestionsAvailable: g }),
114
+ m.map((e) => e ? /* @__PURE__ */ u(H, { height: d, children: /* @__PURE__ */ u(F, { question: e, vote: x }) }, e.id) : null),
115
+ /* @__PURE__ */ u(v, { height: d, onEvent: c })
146
116
  ]
147
117
  }
148
118
  );
119
+ }, _ = ({ gamification: t, autoplay: s, overlay: c, swipeable: o, onEvent: n }) => {
120
+ const a = D(t.betPack.getStore()), { error: r, loading: l, data: i } = a;
121
+ return l || !Object.hasOwn(a, "data") ? /* @__PURE__ */ u(w, {}) : r ? /* @__PURE__ */ u(
122
+ b,
123
+ {
124
+ onEvent: n,
125
+ actionFn: () => n({ type: "slHardRefresh" }),
126
+ description: r instanceof P && r.code !== Q.InvalidArgument ? `The event ID was not
127
+ specified or is invalid.` : `The server is unable to
128
+ handle this request.`
129
+ }
130
+ ) : !i || !i.timestamp || !i.data || !Object.keys(i.data).length ? /* @__PURE__ */ u(
131
+ b,
132
+ {
133
+ onEvent: n,
134
+ actionFn: () => n({ type: "slHardRefresh" }),
135
+ description: `It looks like we couldn't
136
+ load the questions.`
137
+ }
138
+ ) : /* @__PURE__ */ u(
139
+ I,
140
+ {
141
+ data: i.data,
142
+ gamification: t,
143
+ onEvent: n,
144
+ swipeable: o,
145
+ autoplay: s,
146
+ overlay: c
147
+ }
148
+ );
149
149
  };
150
150
  export {
151
- re as BetPackContent
151
+ _ as BetPackContent
152
152
  };
@@ -1,4 +1,12 @@
1
1
  export declare const Carousel: any;
2
- export declare const desktopDots: import('@linaria/core').LinariaClassName;
3
2
  export declare const Dot: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
3
  export declare const Dots: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const ScreenWrap: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const SponsorIcon: React.FC<{
6
+ style?: React.CSSProperties;
7
+ className?: string;
8
+ }>;
9
+ export declare const ScreenTextBlock: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
10
+ export declare const ScreenTitle: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
11
+ export declare const ScreenDescription: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
12
+ export declare const ScreenButton: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLButtonElement> & import('react').ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
@@ -1,21 +1,59 @@
1
+ import { jsx as n } from "react/jsx-runtime";
1
2
  import { styled as s } from "@linaria/react";
2
- import o from "react-slick";
3
- const t = () => o, p = /* @__PURE__ */ s(t())({
3
+ import r from "react-slick";
4
+ import { SvgIcon as c } from "../../../../ui/icons/index.js";
5
+ const t = () => r, S = /* @__PURE__ */ s(t())({
4
6
  name: "Carousel",
5
7
  class: "c1f9jjsn",
6
8
  propsAsIs: !0
7
- }), a = "d25r51y", l = /* @__PURE__ */ s("div")({
9
+ }), d = /* @__PURE__ */ s("div")({
8
10
  name: "Dot",
9
- class: "d1lvrmx8",
11
+ class: "d25r51y",
10
12
  propsAsIs: !1
11
- }), c = /* @__PURE__ */ s("div")({
13
+ }), f = /* @__PURE__ */ s("div")({
12
14
  name: "Dots",
13
- class: "d11xps29",
15
+ class: "d1lvrmx8",
16
+ propsAsIs: !1
17
+ }), v = /* @__PURE__ */ s("div")({
18
+ name: "ScreenWrap",
19
+ class: "s11xps29",
20
+ propsAsIs: !1
21
+ }), p = () => c, a = /* @__PURE__ */ s(p())({
22
+ name: "SponsorIconI",
23
+ class: "s14qstuv",
24
+ propsAsIs: !0
25
+ }), A = ({
26
+ style: o,
27
+ className: e
28
+ }) => /* @__PURE__ */ n(a, {
29
+ className: e,
30
+ style: o,
31
+ name: "icon-masters-logo"
32
+ }), u = /* @__PURE__ */ s("div")({
33
+ name: "ScreenTextBlock",
34
+ class: "s14mdh2e",
35
+ propsAsIs: !1
36
+ }), x = /* @__PURE__ */ s("div")({
37
+ name: "ScreenTitle",
38
+ class: "sqtjig9",
39
+ propsAsIs: !1
40
+ }), D = /* @__PURE__ */ s("div")({
41
+ name: "ScreenDescription",
42
+ class: "ss0mt",
43
+ propsAsIs: !1
44
+ }), j = /* @__PURE__ */ s("button")({
45
+ name: "ScreenButton",
46
+ class: "s10dmski",
14
47
  propsAsIs: !1
15
48
  });
16
49
  export {
17
- p as Carousel,
18
- l as Dot,
19
- c as Dots,
20
- a as desktopDots
50
+ S as Carousel,
51
+ d as Dot,
52
+ f as Dots,
53
+ j as ScreenButton,
54
+ D as ScreenDescription,
55
+ u as ScreenTextBlock,
56
+ x as ScreenTitle,
57
+ v as ScreenWrap,
58
+ A as SponsorIcon
21
59
  };
@@ -1,10 +1,9 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@linaria/core";
3
- import "../../useOrientation.js";
4
3
  import "react";
5
- import { BetPackOverlay as c } from "../index.js";
4
+ import { BetPackOverlay as a } from "../index.js";
6
5
  import "../../../../ui/icons/index.js";
7
6
  import "./styles.js";
8
7
  export {
9
- c as BetPackOverlay
8
+ a as BetPackOverlay
10
9
  };
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
2
3
  import { AllowedMessageType } from './utils';
3
4
  export { BetPackOverlay, type BetPackOverlayProps } from './BetPackOverlay';
@@ -7,8 +8,7 @@ export type BetPackEventCb = (event: {
7
8
  }) => void;
8
9
  export declare const BetPack: React.FC<{
9
10
  sdk: StreamLayerSDK;
10
- heightOffset?: number;
11
11
  onEvent?: BetPackEventCb;
12
12
  swipeable?: boolean;
13
- centerPadding?: string;
13
+ overlay?: boolean;
14
14
  }>;
@@ -1,95 +1,67 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
- import { cx as y } from "@linaria/core";
3
- import R from "lodash.throttle";
4
- import { forwardRef as b, useState as C, useCallback as N, useMemo as A, memo as z, useRef as L, useEffect as O } from "react";
5
- import { useStore as H } from "@streamlayer/react-polyfills";
6
- import { FeatureType as j } from "@streamlayer/sdk-web-types";
7
- import { BetPackContent as G } from "./BetPackContent/index.js";
8
- import { EmergencyScreen as T } from "./BetPackContent/EmergencyScreen/index.js";
9
- import { LoaderScreen as E } from "./BetPackContent/LoaderScreen/index.js";
10
- import { BetPackContainer as M } from "./styles.js";
11
- import { defaultEventHandler as U } from "./utils.js";
12
- import { useOrientation as Y } from "../useOrientation.js";
13
- import { SvgIcon as k } from "../../../ui/icons/index.js";
14
- import { Container as q, Header as D, HeaderTitle as J, CloseButton as K, Main as Q, Footer as V, SlideSwitchButton as p, IconArrowPrev as W, buttonAvailable as B, IconArrowNext as X } from "./BetPackOverlay/styles.js";
15
- const ur = b(
16
- ({ sdk: m, onEvent: o, close: u, isMobile: c }, h) => {
17
- const [i, d] = C(), [r, t] = C(), { orientation: s } = Y(), l = N(
18
- (a) => {
19
- if (a.type === "slBetPackReady") {
20
- const { next: P, prev: x, current: w, canNext: F, canPrev: I } = a.payload || {};
21
- d({ next: P, prev: x }), t((n) => ({
22
- current: n != null && n.current ? n == null ? void 0 : n.current : w,
23
- canPrev: n != null && n.current ? n == null ? void 0 : n.canPrev : I,
24
- canNext: F
25
- }));
26
- }
27
- if (a.type === "slBetPackChangeCard") {
28
- const { current: P, canNext: x, canPrev: w } = a.payload || {};
29
- t({ current: P, canNext: x, canPrev: w });
30
- }
31
- o == null || o(a);
32
- },
33
- [o]
34
- ), g = A(() => c ? s === "landscape" ? "60px" : "18px" : "30px", [c, s]);
35
- return /* @__PURE__ */ f(q, { ref: h, children: [
36
- /* @__PURE__ */ f(D, { children: [
37
- /* @__PURE__ */ f(J, { children: [
38
- /* @__PURE__ */ e(k, { name: "fgIcon" }),
39
- "Featured Groups+",
40
- " "
41
- ] }),
42
- /* @__PURE__ */ e(K, { onClick: u, children: /* @__PURE__ */ e(k, { name: "icon-close-btn-gray" }) })
1
+ import { jsxs as m, jsx as r } from "react/jsx-runtime";
2
+ import { cx as P } from "@linaria/core";
3
+ import { forwardRef as b, useState as B, useCallback as F, memo as H, useMemo as L } from "react";
4
+ import { useStore as k } from "@streamlayer/react-polyfills";
5
+ import { FeatureType as p } from "@streamlayer/sdk-web-types";
6
+ import { BetPackContent as I } from "./BetPackContent/index.js";
7
+ import { EmergencyScreen as M } from "./BetPackContent/EmergencyScreen/index.js";
8
+ import { LoaderScreen as x } from "./BetPackContent/LoaderScreen/index.js";
9
+ import { BetPackContainer as R } from "./styles.js";
10
+ import { defaultEventHandler as j } from "./utils.js";
11
+ import { SvgIcon as y } from "../../../ui/icons/index.js";
12
+ import { Container as G, Header as T, HeaderTitle as z, CloseButton as O, Main as U, Footer as Y, SlideSwitchButton as C, IconArrowPrev as q, buttonAvailable as g, IconArrowNext as D } from "./BetPackOverlay/styles.js";
13
+ const er = b(({ sdk: n, onEvent: i, close: t }, a) => {
14
+ const [e, d] = B(), [o, h] = B(), N = F(
15
+ (l) => {
16
+ if (l.type === "slBetPackReady") {
17
+ const { next: s, prev: u, current: f, canNext: w, canPrev: A } = l.payload || {};
18
+ d({ next: s, prev: u }), h((c) => ({
19
+ current: c != null && c.current ? c == null ? void 0 : c.current : f,
20
+ canPrev: c != null && c.current ? c == null ? void 0 : c.canPrev : A,
21
+ canNext: w
22
+ }));
23
+ }
24
+ if (l.type === "slBetPackChangeCard") {
25
+ const { current: s, canNext: u, canPrev: f } = l.payload || {};
26
+ h({ current: s, canNext: u, canPrev: f });
27
+ }
28
+ i == null || i(l);
29
+ },
30
+ [i]
31
+ );
32
+ return /* @__PURE__ */ m(G, { ref: a, children: [
33
+ /* @__PURE__ */ m(T, { children: [
34
+ /* @__PURE__ */ m(z, { children: [
35
+ /* @__PURE__ */ r(y, { name: "fgIcon" }),
36
+ "Featured Groups+"
43
37
  ] }),
44
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(
45
- Z,
46
- {
47
- sdk: m,
48
- onEvent: l,
49
- swipeable: !!c,
50
- centerPadding: g,
51
- heightOffset: c ? 0 : 48
52
- }
53
- ) }),
54
- !c && /* @__PURE__ */ f(V, { children: [
55
- /* @__PURE__ */ e(p, { onClick: i == null ? void 0 : i.prev, disabled: !(r != null && r.canPrev), children: /* @__PURE__ */ e(W, { name: "iconArrowPrev", className: y((r == null ? void 0 : r.canPrev) && B) }) }),
56
- /* @__PURE__ */ e(p, { onClick: i == null ? void 0 : i.next, disabled: !(r != null && r.canNext), children: /* @__PURE__ */ e(X, { name: "iconArrowPrev", className: y((r == null ? void 0 : r.canNext) && B) }) })
57
- ] })
58
- ] });
38
+ /* @__PURE__ */ r(O, { onClick: t, children: /* @__PURE__ */ r(y, { name: "icon-close-btn-gray" }) })
39
+ ] }),
40
+ /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r(K, { sdk: n, onEvent: N, overlay: !0 }) }),
41
+ /* @__PURE__ */ m(Y, { children: [
42
+ /* @__PURE__ */ r(C, { onClick: e == null ? void 0 : e.prev, disabled: !(o != null && o.canPrev), children: /* @__PURE__ */ r(q, { name: "iconArrowPrev", className: P((o == null ? void 0 : o.canPrev) && g) }) }),
43
+ /* @__PURE__ */ r(C, { onClick: e == null ? void 0 : e.next, disabled: !(o != null && o.canNext), children: /* @__PURE__ */ r(D, { name: "iconArrowPrev", className: P((o == null ? void 0 : o.canNext) && g) }) })
44
+ ] })
45
+ ] });
46
+ }), J = ({ user: n, gamification: i, overlay: t, swipeable: a, onEvent: e }) => n.data ? i ? /* @__PURE__ */ r(I, { overlay: t, gamification: i, onEvent: e, swipeable: a }) : /* @__PURE__ */ r(x, {}) : n.error && !n.loading ? /* @__PURE__ */ r(
47
+ M,
48
+ {
49
+ onEvent: e,
50
+ actionFn: () => e({ type: "slHardRefresh" }),
51
+ description: `You are not authorized to
52
+ view this resource.`
59
53
  }
60
- ), Z = z(({ sdk: m, swipeable: o = !0, heightOffset: u = 65, onEvent: c = U, centerPadding: h }) => {
61
- const i = H(m.featuresList.getStore()), d = A(() => m.getFeature(j.GAMES), [i]), r = H(m.getUserStore()), t = L(null), [s, l] = C(), g = N(() => {
62
- t.current && l(t.current.clientHeight);
63
- }, []);
64
- return O(() => {
65
- const a = R(() => {
66
- t.current && l(t.current.clientHeight);
67
- }, 200);
68
- return window.addEventListener("resize", a), () => {
69
- window.removeEventListener("resize", a);
70
- };
71
- }, []), r.data ? d ? /* @__PURE__ */ e(M, { ref: t, className: y("betPack", o && "isMobile"), children: /* @__PURE__ */ e(
72
- G,
54
+ ) : /* @__PURE__ */ r(x, {}), K = H(({ sdk: n, swipeable: i = !0, onEvent: t = j, overlay: a }) => {
55
+ const e = k(n.featuresList.getStore()), d = L(() => n.getFeature(p.GAMES), [e]), o = k(n.getUserStore());
56
+ return /* @__PURE__ */ r(
57
+ R,
73
58
  {
74
- gamification: d,
75
- onEvent: c,
76
- swipeable: o,
77
- centerPadding: h,
78
- changeHeightOnInit: g,
79
- height: s ? s - u : void 0
59
+ className: P("SL-BetPack", a && "SL-BetPack--overlay", !a && "SL-BetPack--standalone"),
60
+ children: /* @__PURE__ */ r(J, { overlay: a, user: o, gamification: d, onEvent: t, swipeable: i })
80
61
  }
81
- ) }) : /* @__PURE__ */ e("div", { children: "no gamification" }) : r.error && !r.loading ? /* @__PURE__ */ e(
82
- T,
83
- {
84
- actionFn: () => c({ type: "slHardRefresh" }),
85
- description: `You are not authorized to
86
- view this resource.`,
87
- isMobile: o,
88
- height: s ? s - u : void 0
89
- }
90
- ) : /* @__PURE__ */ e(E, {});
62
+ );
91
63
  });
92
64
  export {
93
- Z as BetPack,
94
- ur as BetPackOverlay
65
+ K as BetPack,
66
+ er as BetPackOverlay
95
67
  };
@@ -1,4 +1,3 @@
1
- export declare const ScreenButton: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLButtonElement> & import('react').ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
2
1
  export declare const ScreenTitle: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
2
  export declare const ScreenDescription: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
3
  export declare const BetPackContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;