@streamlayer/react-ui 1.9.0 → 1.10.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.
Files changed (78) hide show
  1. package/lib/app/app/Advertisement/index.d.ts +1 -0
  2. package/lib/app/app/Advertisement/index.js +78 -67
  3. package/lib/app/app/Features/Gamification/Question.d.ts +1 -0
  4. package/lib/app/app/Features/Gamification/Question.js +43 -41
  5. package/lib/app/app/Features/Gamification/Tabs.js +23 -22
  6. package/lib/app/app/Features/Gamification/index.js +1 -1
  7. package/lib/app/app/Insight/index.d.ts +2 -0
  8. package/lib/app/app/Insight/index.js +28 -24
  9. package/lib/app/app/Navigation/SDKPillNode.d.ts +1 -0
  10. package/lib/app/app/Navigation/SDKPillNode.js +9 -0
  11. package/lib/app/app/Notifications/index.js +125 -113
  12. package/lib/app/app/Points/index.js +16 -16
  13. package/lib/app/app/index.d.ts +1 -0
  14. package/lib/app/app/index.js +84 -86
  15. package/lib/app/app/story/insight/index.d.ts +1 -0
  16. package/lib/app/app/story/insight/index.js +29 -26
  17. package/lib/app/app/story/insight/video.d.ts +1 -0
  18. package/lib/app/app/story/insight/video.js +13 -13
  19. package/lib/app/app/story/promotion/content.d.ts +3 -1
  20. package/lib/app/app/story/promotion/content.js +13 -10
  21. package/lib/app/app/story/promotion/index.d.ts +1 -0
  22. package/lib/app/app/story/promotion/index.js +34 -30
  23. package/lib/app/app/story/promotion/video.d.ts +1 -0
  24. package/lib/app/app/story/promotion/video.js +34 -31
  25. package/lib/app/app/styles.js +44 -0
  26. package/lib/app/app/useApp.d.ts +0 -14
  27. package/lib/app/app/useApp.js +14 -44
  28. package/lib/app/masters/Features/Gamification/Leaderboard.d.ts +1 -1
  29. package/lib/app/masters/Features/Gamification/Tabs.d.ts +2 -2
  30. package/lib/app/masters/Features/Gamification/Tabs.js +2 -2
  31. package/lib/app/masters/Features/Gamification/index.d.ts +2 -2
  32. package/lib/app/masters/Features/Gamification/index.js +1 -1
  33. package/lib/app/masters/Features/index.d.ts +2 -2
  34. package/lib/app/masters/Navigation/MastersNavigation/index.d.ts +1 -1
  35. package/lib/app/masters/Notifications/Onboarding/index.d.ts +1 -1
  36. package/lib/app/masters/Notifications/Onboarding/index.js +4 -4
  37. package/lib/app/masters/Notifications/index.d.ts +2 -2
  38. package/lib/app/masters/Notifications/index.js +1 -1
  39. package/lib/app/masters/masters.js +23 -23
  40. package/lib/app/masters/styles.d.ts +20 -0
  41. package/lib/app/{styles.js → masters/styles.js} +15 -15
  42. package/lib/app/masters/useSdkResponsive.d.ts +15 -0
  43. package/lib/app/masters/useSdkResponsive.js +45 -0
  44. package/lib/app/masters/useSdkScroll.d.ts +12 -0
  45. package/lib/app/masters/useSdkScroll.js +50 -0
  46. package/lib/app/useSdkResponsive.d.ts +1 -0
  47. package/lib/app/useSdkResponsive.js +27 -29
  48. package/lib/app/useSdkScroll.js +25 -24
  49. package/lib/assets/style.css +1 -1
  50. package/lib/ui/advertisement/banner/index.js +14 -11
  51. package/lib/ui/advertisement/index.d.ts +3 -0
  52. package/lib/ui/advertisement/index.js +31 -10
  53. package/lib/ui/advertisement/notification/index.d.ts +1 -0
  54. package/lib/ui/advertisement/notification/index.js +30 -27
  55. package/lib/ui/advertisement/notification/lower-third/index.d.ts +9 -0
  56. package/lib/ui/advertisement/notification/lower-third/index.js +37 -0
  57. package/lib/ui/advertisement/notification/lower-third/styles.d.ts +16 -0
  58. package/lib/ui/advertisement/notification/lower-third/styles.js +64 -0
  59. package/lib/ui/advertisement/overlay/index.d.ts +2 -0
  60. package/lib/ui/advertisement/overlay/index.js +58 -43
  61. package/lib/ui/advertisement/overlay/styles.d.ts +0 -2
  62. package/lib/ui/advertisement/overlay/styles.js +41 -52
  63. package/lib/ui/close-btn/index.d.ts +7 -0
  64. package/lib/ui/close-btn/index.js +47 -0
  65. package/lib/ui/gamification/detail/header/index.d.ts +2 -1
  66. package/lib/ui/gamification/detail/header/index.js +16 -15
  67. package/lib/ui/gamification/vote/styles.js +1 -1
  68. package/lib/ui/questions/insight/index.js +21 -20
  69. package/lib/ui/theme/masters-theme.js +36 -13
  70. package/lib/ui/theme/theme.js +22 -21
  71. package/lib/ui/timer/index.d.ts +3 -1
  72. package/lib/ui/timer/index.js +54 -32
  73. package/lib/ui/video-player/index.d.ts +2 -0
  74. package/lib/ui/video-player/index.js +62 -51
  75. package/lib/ui/video-player/styles.d.ts +1 -0
  76. package/lib/ui/video-player/styles.js +7 -6
  77. package/package.json +15 -15
  78. /package/lib/app/{styles.d.ts → app/styles.d.ts} +0 -0
@@ -0,0 +1,47 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { styled as s } from "@linaria/react";
3
+ import { useState as p, useEffect as f, useCallback as l } from "react";
4
+ import { CloseTimerAuto as a } from "@streamlayer/sdk-web-types";
5
+ import { SvgIcon as I } from "../icons/index.js";
6
+ import { SimpleTimer as u } from "../timer/index.js";
7
+ const v = /* @__PURE__ */ s("div")({
8
+ name: "CloseIconWrap",
9
+ class: "c3v6bv6",
10
+ propsAsIs: !1
11
+ }), T = /* @__PURE__ */ s("div")({
12
+ name: "TimerWrap",
13
+ class: "teuhmro",
14
+ propsAsIs: !1
15
+ }), g = () => I, x = /* @__PURE__ */ s(g())({
16
+ name: "Icon",
17
+ class: "i17rfxv5",
18
+ propsAsIs: !0
19
+ }), S = ({
20
+ close: r,
21
+ className: t,
22
+ duration: o = 0,
23
+ autoClose: m
24
+ }) => {
25
+ const [c, n] = p(o === 0);
26
+ f(() => {
27
+ n(!o);
28
+ }, [o]);
29
+ const i = l(() => {
30
+ m === a.ENABLED ? r == null || r() : n(!0);
31
+ }, [m, r]);
32
+ return c ? /* @__PURE__ */ e(v, {
33
+ onClick: r,
34
+ className: t,
35
+ children: /* @__PURE__ */ e(x, {
36
+ name: "icon-cross"
37
+ })
38
+ }) : /* @__PURE__ */ e(T, {
39
+ children: /* @__PURE__ */ e(u, {
40
+ duration: o,
41
+ onTimerExpired: i
42
+ })
43
+ });
44
+ };
45
+ export {
46
+ S as CloseButton
47
+ };
@@ -1,8 +1,9 @@
1
- import { QuestionType } from '@streamlayer/sdk-web-types';
1
+ import { CloseTimer, QuestionType } from '@streamlayer/sdk-web-types';
2
2
  interface VoteHeaderProps {
3
3
  type?: QuestionType;
4
4
  close: () => void;
5
5
  label?: string;
6
+ closeTimer?: CloseTimer;
6
7
  }
7
8
  export declare const VoteHeader: React.FC<VoteHeaderProps>;
8
9
  export {};
@@ -1,24 +1,25 @@
1
- import { jsxs as r, jsx as n } from "react/jsx-runtime";
2
- import { QuestionType as i } from "@streamlayer/sdk-web-types";
3
- import { QuestionTypeData as m } from "../../constants.js";
4
- import { Container as t, QuestionTypeWrap as a, QuestionTypeIcon as s, QuestionTypeTitle as p, CloseIconWrap as d, CloseIcon as I } from "./styles.js";
5
- const T = ({ type: e, close: c, label: l }) => {
6
- const o = e ? m[e] : { label: l, iconName: void 0 };
7
- return /* @__PURE__ */ r(t, { children: [
8
- /* @__PURE__ */ r(a, { children: [
9
- (o == null ? void 0 : o.iconName) && /* @__PURE__ */ n(
10
- s,
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { QuestionType as e } from "@streamlayer/sdk-web-types";
3
+ import { CloseButton as c } from "../../../close-btn/index.js";
4
+ import { QuestionTypeData as p } from "../../constants.js";
5
+ import { Container as s, QuestionTypeWrap as l, QuestionTypeIcon as m, QuestionTypeTitle as u, CloseIconWrap as C, CloseIcon as f } from "./styles.js";
6
+ const b = ({ type: r, closeTimer: n, close: i, label: d }) => {
7
+ const o = r ? p[r] : { label: d, iconName: void 0 };
8
+ return /* @__PURE__ */ a(s, { children: [
9
+ /* @__PURE__ */ a(l, { children: [
10
+ (o == null ? void 0 : o.iconName) && /* @__PURE__ */ t(
11
+ m,
11
12
  {
12
- "data-type-trivia": e === i.TRIVIA,
13
- "data-type-poll": e === i.POLL,
13
+ "data-type-trivia": r === e.TRIVIA,
14
+ "data-type-poll": r === e.POLL,
14
15
  name: o.iconName
15
16
  }
16
17
  ),
17
- (o == null ? void 0 : o.label) && /* @__PURE__ */ n(p, { children: o.label })
18
+ (o == null ? void 0 : o.label) && /* @__PURE__ */ t(u, { children: o.label })
18
19
  ] }),
19
- /* @__PURE__ */ n(d, { onClick: c, children: /* @__PURE__ */ n(I, { name: "icon-cross" }) })
20
+ n != null && n.seconds ? /* @__PURE__ */ t(c, { close: i, autoClose: n.auto, duration: n.seconds }) : /* @__PURE__ */ t(C, { onClick: i, children: /* @__PURE__ */ t(f, { name: "icon-cross" }) })
20
21
  ] });
21
22
  };
22
23
  export {
23
- T as VoteHeader
24
+ b as VoteHeader
24
25
  };
@@ -1,5 +1,5 @@
1
1
  import { styled as s } from "@linaria/react";
2
- import { SDKScrollContainer as o } from "../../../app/styles.js";
2
+ import { SDKScrollContainer as o } from "../../../app/app/styles.js";
3
3
  import { ShowIn as n } from "../../show-in/index.js";
4
4
  const l = /* @__PURE__ */ s("div")({
5
5
  name: "Container",
@@ -1,30 +1,31 @@
1
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import { QuestionImages as I } from "@streamlayer/sdk-web-types";
3
- import { VideoPlayer as e } from "../../video-player/index.js";
4
- import { Container as v, ImageContainer as C, Image as b, Content as x, Title as D, Description as T } from "./styles.js";
5
- const M = ({
6
- instantView: r,
1
+ import { jsxs as g, jsx as d } from "react/jsx-runtime";
2
+ import { AutoPlayVideo as e, QuestionImages as I } from "@streamlayer/sdk-web-types";
3
+ import { VideoPlayer as v } from "../../video-player/index.js";
4
+ import { Container as C, ImageContainer as D, Image as P, Content as b, Title as x, Description as B } from "./styles.js";
5
+ const N = ({
6
+ instantView: o,
7
7
  isDetail: l,
8
- notification: d,
9
- controlVideo: p
8
+ notification: r,
9
+ controlVideo: y
10
10
  }) => {
11
- const m = r == null ? void 0 : r.heading, h = r == null ? void 0 : r.body, g = m || h, u = d == null ? void 0 : d.title, y = d == null ? void 0 : d.body;
12
- return /* @__PURE__ */ c(v, { children: [
13
- (r == null ? void 0 : r.video) && /* @__PURE__ */ o(
14
- e,
11
+ const m = o == null ? void 0 : o.heading, h = o == null ? void 0 : o.body, u = m || h, c = r == null ? void 0 : r.title, p = r == null ? void 0 : r.body;
12
+ return /* @__PURE__ */ g(C, { children: [
13
+ (o == null ? void 0 : o.video) && /* @__PURE__ */ d(
14
+ v,
15
15
  {
16
- source: r.video.url,
17
- poster: r.video.thumbnailUrl,
18
- controlVideo: p
16
+ source: o.video.url,
17
+ poster: o.video.thumbnailUrl,
18
+ controlVideo: y,
19
+ autoPlay: o.autoPlayVideo === e.ENABLED
19
20
  }
20
21
  ),
21
- (r == null ? void 0 : r.image) && !(r != null && r.video) && /* @__PURE__ */ o(C, { "data-rounded": r.imageMode === I.ROUNDED, children: /* @__PURE__ */ o(b, { src: r == null ? void 0 : r.image }) }),
22
- /* @__PURE__ */ c(x, { children: [
23
- /* @__PURE__ */ o(D, { children: l && g ? m : u }),
24
- /* @__PURE__ */ o(T, { children: l && g ? h : y })
22
+ (o == null ? void 0 : o.image) && !(o != null && o.video) && /* @__PURE__ */ d(D, { "data-rounded": o.imageMode === I.ROUNDED, children: /* @__PURE__ */ d(P, { src: o == null ? void 0 : o.image }) }),
23
+ /* @__PURE__ */ g(b, { children: [
24
+ /* @__PURE__ */ d(x, { children: l && u ? m : c }),
25
+ /* @__PURE__ */ d(B, { children: l && u ? h : p })
25
26
  ] })
26
27
  ] });
27
28
  };
28
29
  export {
29
- M as InsightContent
30
+ N as InsightContent
30
31
  };
@@ -1,5 +1,6 @@
1
- import { breakpoints as R } from "./breakpoints.js";
2
- const a = {
1
+ import { breakpoints as i } from "./breakpoints.js";
2
+ import { FONT as t } from "./constants.js";
3
+ const E = {
3
4
  BG_TRANSPARENT: "rgba(0,0,0, .8)",
4
5
  BLUE_QUESTION_ACTION_BTN: "#1589ee",
5
6
  WHITE: "#FFFFFF",
@@ -13,6 +14,7 @@ const a = {
13
14
  UNSUCCESS: "#DF2F3B",
14
15
  SECONDARY_RED1: "#DF2F3B",
15
16
  NEUTRALS_WHITE: "#FFFFFF",
17
+ NEUTRALS_WHITE1: "#FFFFFF",
16
18
  NEUTRALS_GRAY1: "#F7F7F7",
17
19
  NEUTRALS_GRAY2: "#F2F2F1",
18
20
  NEUTRALS_GRAY3: "#E8E8E8",
@@ -22,20 +24,29 @@ const a = {
22
24
  NEUTRALS_GRAY7: "#6B6F73",
23
25
  NEUTRALS_GRAY9: "#25282A"
24
26
  }, e = {
27
+ ...t,
25
28
  REGULAR: "'Benton Sans', BentonSans, Arial, Helvetica, sans-serif",
26
29
  SERIF: "'Tiempos', 'Tiempos Text', Times New Roman, serif",
27
30
  COLOR: "#fff",
28
31
  WEIGHT_DEFAULT: "500"
29
- }, n = Object.entries(a).reduce((t, [o, A]) => `
30
- ${t}
31
- --color-${o.toLowerCase().replaceAll("_", "-")}: ${A};
32
- `, ""), E = `
33
- ${n}
32
+ }, R = Object.entries(E).reduce((n, [a, o]) => `
33
+ ${n}
34
+ --color-${a.toLowerCase().replaceAll("_", "-")}: ${o};
35
+ `, ""), s = `
36
+ ${R}
34
37
  --font-family: ${e.REGULAR};
35
38
  --font-regular: ${e.REGULAR};
36
39
  --font-color: ${e.COLOR};
37
40
  --font-serif: ${e.SERIF};
38
41
  --font-weight-default: ${e.WEIGHT_DEFAULT};
42
+ --font-weight-default1: ${e.WEIGHT_DEFAULT1};
43
+ --font-weight-default2: ${e.WEIGHT_DEFAULT2};
44
+ --font-weight-default3: ${e.WEIGHT_DEFAULT3};
45
+ --font-size-default: ${t.SIZE_DEFAULT};
46
+ --font-size-secondary: ${t.SIZE_DEFAULT1};
47
+ --font-size-small: ${t.SIZE_DEFAULT2};
48
+ --line-height-default: ${t.LINE_HEIGHT};
49
+ --margin-title-default: ${t.MARGIN_TITLE_DEFAULT};
39
50
 
40
51
  --header-offset: 0px;
41
52
  --header-height: 68px;
@@ -47,18 +58,30 @@ const a = {
47
58
  --pill-offset: 0px;
48
59
  --max-width: 600px;
49
60
  --max-notifications-width: 400px;
61
+ --header-padding: 12px 12px 12px 16px;
62
+ --margin-web-link-btn: 0px;
63
+ --padding-web-link-btn: 11px 16px;
64
+ --insight-content-padding: 0px;
65
+ --close-icon-size: 12px;
66
+ --close-icon-stroke-width: 1.5;
67
+ --padding-title-default: 0px;
68
+ --insight-image-display: inline;
69
+ --web-link-align-items: center;
70
+ --web-link-column-gap: 10px;
50
71
 
51
- ${R.down("xl")`
72
+ --insight-image-ratio: 16/9;
73
+
74
+ ${i.down("xl")`
52
75
  --header-offset: 56px;
53
76
  --watch-live-header: 46px;
54
77
  `}
55
78
 
56
- ${R.intermediate("xl", "lg")`
79
+ ${i.intermediate("xl", "lg")`
57
80
  --header-offset: 76px;
58
81
  `}
59
- `, i = "m1ojpy2l";
82
+ `, r = "m1ojpy2l";
60
83
  export {
61
- a as MASTERS_COLORS,
62
- i as mastersTheme,
63
- E as mastersThemeStr
84
+ E as MASTERS_COLORS,
85
+ r as mastersTheme,
86
+ s as mastersThemeStr
64
87
  };
@@ -1,4 +1,4 @@
1
- import { jsx as t, jsxs as i } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as t } from "react/jsx-runtime";
2
2
  import { breakpoints as d } from "./breakpoints.js";
3
3
  import { colors as p, colorsAdvertisement as s, FONT as e } from "./constants.js";
4
4
  const l = `
@@ -13,8 +13,8 @@ const l = `
13
13
  --font-weight-default2: ${e.WEIGHT_DEFAULT2};
14
14
  --font-weight-default3: ${e.WEIGHT_DEFAULT3};
15
15
  --font-size-default: ${e.SIZE_DEFAULT};
16
- --font-size-default1: ${e.SIZE_DEFAULT1};
17
- --font-size-default2: ${e.SIZE_DEFAULT2};
16
+ --font-size-secondary: ${e.SIZE_DEFAULT1};
17
+ --font-size-small: ${e.SIZE_DEFAULT2};
18
18
  --line-height-default: ${e.LINE_HEIGHT};
19
19
  --margin-title-default: ${e.MARGIN_TITLE_DEFAULT};
20
20
 
@@ -22,18 +22,12 @@ const l = `
22
22
  --header-height: 68px;
23
23
  --watch-live-header: 0px;
24
24
  --animation-duration: 0.5s;
25
- --promo-animation-duration: 0.5s;
26
- --promo-animation-function: ease-in;
27
25
  --animation-function: ease;
28
26
  --container-padding: 16px;
29
27
  --border-radius: 8px;
30
28
  --pill-offset: 0px;
31
29
  --max-width: 600px;
32
30
  --max-notifications-width: 400px;
33
- --promo-header-line-height: 18.5px;
34
- --row-gap-default: 12px;
35
- --row-gap-default1: 12px;
36
- --row-gap-default2: 16px;
37
31
  --header-padding: 12px 12px 12px 16px;
38
32
  --margin-web-link-btn: 0px;
39
33
  --padding-web-link-btn: 11px 16px;
@@ -45,6 +39,13 @@ const l = `
45
39
  --web-link-align-items: center;
46
40
  --web-link-column-gap: 10px;
47
41
 
42
+ --row-gap-default: 12px;
43
+ --row-gap-default1: 12px;
44
+ --row-gap-default2: 16px;
45
+ --promo-header-line-height: 18.5px;
46
+ --promo-animation-duration: 0.5s;
47
+ --promo-animation-function: ease-in;
48
+
48
49
  ${d.down("xl")`
49
50
  --header-offset: 0px;
50
51
  --watch-live-header: 46px;
@@ -86,23 +87,23 @@ const l = `
86
87
  --adv-sponsor-logo-size: 28px;
87
88
  --adv-sponsor-font-size: 12px;
88
89
  }
89
- `, m = "StreamLayerCSSReset", g = "ttkj0ah", c = () => /* @__PURE__ */ t("table", {
90
- children: /* @__PURE__ */ i("table", {
91
- children: [/* @__PURE__ */ t("thead", {
92
- children: /* @__PURE__ */ i("tr", {
93
- children: [/* @__PURE__ */ t("th", {
90
+ `, m = "StreamLayerCSSReset", c = "ttkj0ah", g = () => /* @__PURE__ */ i("table", {
91
+ children: /* @__PURE__ */ t("table", {
92
+ children: [/* @__PURE__ */ i("thead", {
93
+ children: /* @__PURE__ */ t("tr", {
94
+ children: [/* @__PURE__ */ i("th", {
94
95
  children: "name"
95
- }), /* @__PURE__ */ t("th", {
96
+ }), /* @__PURE__ */ i("th", {
96
97
  children: "value"
97
98
  })]
98
99
  })
99
- }), /* @__PURE__ */ t("tbody", {
100
+ }), /* @__PURE__ */ i("tbody", {
100
101
  children: l.split(";").map((n) => {
101
102
  const a = n.trim(), [o, r] = a.split(":");
102
- return /* @__PURE__ */ i("tr", {
103
- children: [/* @__PURE__ */ t("td", {
103
+ return /* @__PURE__ */ t("tr", {
104
+ children: [/* @__PURE__ */ i("td", {
104
105
  children: o
105
- }), /* @__PURE__ */ t("td", {
106
+ }), /* @__PURE__ */ i("td", {
106
107
  children: r
107
108
  })]
108
109
  }, a);
@@ -111,8 +112,8 @@ const l = `
111
112
  })
112
113
  });
113
114
  export {
114
- c as ThemeVariables,
115
+ g as ThemeVariables,
115
116
  m as resetCss,
116
- g as theme,
117
+ c as theme,
117
118
  l as themeStr
118
119
  };
@@ -4,6 +4,8 @@ interface TimerProps {
4
4
  duration?: number;
5
5
  onTimerExpired?: () => void;
6
6
  }
7
- export declare const RemainingTime: import('@linaria/react').StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
+ export declare const SimpleTimer: React.FC<TimerProps & {
8
+ className?: string;
9
+ }>;
8
10
  export declare const Timer: React.FC<TimerProps>;
9
11
  export {};
@@ -1,45 +1,67 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { styled as M } from "@linaria/react";
3
- import { useState as c, useEffect as _, useCallback as n } from "react";
4
- import { CountdownCircleTimer as h } from "react-countdown-circle-timer";
5
- import { TIMER_COLORS as p, TIMER_GREEN as E, TIMER_RED as S, TIMER_GRAY as g } from "../theme/constants.js";
6
- const k = [10, 10, 1, 0], O = /* @__PURE__ */ M("div")({
7
- name: "RemainingTime",
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { styled as T } from "@linaria/react";
3
+ import { useState as m, useEffect as d, useCallback as a } from "react";
4
+ import { CountdownCircleTimer as f } from "react-countdown-circle-timer";
5
+ import { TIMER_COLORS as g, TIMER_GREEN as M, TIMER_RED as S, TIMER_GRAY as _ } from "../theme/constants.js";
6
+ const k = [10, 10, 1, 0], u = /* @__PURE__ */ T("div")({
7
+ name: "RemainingTimeCircle",
8
8
  class: "r165427",
9
9
  propsAsIs: !1
10
- }), u = E, l = S, m = g, L = ({
11
- isPlaying: i = !0,
12
- duration: t = 30,
13
- onTimerExpired: s
10
+ }), E = /* @__PURE__ */ T("div")({
11
+ name: "RemainingTime",
12
+ class: "r17garf3",
13
+ propsAsIs: !1
14
+ }), O = M, l = S, R = _, G = ({
15
+ className: o,
16
+ duration: e = 30,
17
+ onTimerExpired: r,
18
+ isPlaying: n = !0
19
+ }) => /* @__PURE__ */ s(f, {
20
+ isPlaying: n,
21
+ strokeWidth: 0,
22
+ duration: e,
23
+ colors: l,
24
+ size: 24,
25
+ onComplete: r,
26
+ children: ({
27
+ remainingTime: i
28
+ }) => /* @__PURE__ */ s(E, {
29
+ className: o,
30
+ children: e === 0 ? 0 : i
31
+ })
32
+ }), L = ({
33
+ isPlaying: o = !0,
34
+ duration: e = 30,
35
+ onTimerExpired: r
14
36
  }) => {
15
- const [R, o] = c(t > 10 ? u : l), [f, a] = c(2);
16
- _(() => {
17
- t === 0 && (a(0), o(m));
37
+ const [n, t] = m(e > 10 ? O : l), [i, C] = m(2);
38
+ d(() => {
39
+ e === 0 && (C(0), t(R));
40
+ }, [e]);
41
+ const p = ({
42
+ remainingTime: c
43
+ }) => /* @__PURE__ */ s(u, {
44
+ children: e === 0 ? 0 : c
45
+ }), h = a(() => {
46
+ r == null || r(), t(R);
47
+ }, [r, t]), I = a((c) => {
48
+ c === 10 && t(l);
18
49
  }, [t]);
19
- const C = ({
20
- remainingTime: e
21
- }) => /* @__PURE__ */ r(O, {
22
- children: t === 0 ? 0 : e
23
- }), T = n(() => {
24
- s == null || s(), o(m);
25
- }, [s, o]), I = n((e) => {
26
- e === 10 && o(l);
27
- }, [o]);
28
- return /* @__PURE__ */ r(h, {
29
- isPlaying: i,
30
- duration: t,
31
- colors: p,
50
+ return /* @__PURE__ */ s(f, {
51
+ isPlaying: o,
52
+ duration: e,
53
+ colors: g,
32
54
  colorsTime: k,
33
55
  size: 32,
34
- strokeWidth: f,
56
+ strokeWidth: i,
35
57
  trailStrokeWidth: 2,
36
- trailColor: R,
37
- onComplete: T,
58
+ trailColor: n,
59
+ onComplete: h,
38
60
  onUpdate: I,
39
- children: C
61
+ children: p
40
62
  });
41
63
  };
42
64
  export {
43
- O as RemainingTime,
65
+ G as SimpleTimer,
44
66
  L as Timer
45
67
  };
@@ -7,6 +7,8 @@ export type VideoPlayerProps = {
7
7
  controlVideo?: (props: ControlVideoProps) => void;
8
8
  aspectRatio?: string;
9
9
  onPlay?: () => void;
10
+ autoPlay?: boolean;
11
+ hideControls?: boolean;
10
12
  };
11
13
  export declare const pauseAllVideos: () => void;
12
14
  /**
@@ -1,85 +1,96 @@
1
- import { jsxs as E, jsx as i } from "react/jsx-runtime";
2
- import { cx as S } from "@linaria/core";
3
- import { useRef as T, useState as d, useCallback as h, useEffect as y } from "react";
4
- import { eventBus as L } from "@streamlayer/sdk-web-interfaces";
5
- import { SvgIcon as P } from "../icons/index.js";
6
- import { Container as j, ToggleIconPause as k, Player as H, Poster as M, Control as A } from "./styles.js";
7
- const B = (s, a) => {
8
- for (const t of s)
9
- t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (a.unobserve(t.target), t.target.pause());
10
- }, I = new IntersectionObserver(B, { threshold: 0.5 }), p = /* @__PURE__ */ new Set(), F = (s) => {
11
- I.observe(s), p.add(s);
12
- }, u = (s) => {
13
- I.unobserve(s), p.delete(s);
14
- }, N = () => {
15
- for (const s of p)
16
- s instanceof HTMLVideoElement && !s.paused && (s.pause(), u(s));
17
- }, Q = ({ poster: s, source: a, aspectRatio: t, controlVideo: r, onPlay: c }) => {
18
- const e = T(null), [f, l] = d(!1), [b, g] = d(!0), O = h(() => {
1
+ import { jsxs as H, jsx as o } from "react/jsx-runtime";
2
+ import { cx as L } from "@linaria/core";
3
+ import { useRef as S, useState as d, useCallback as y, useEffect as P } from "react";
4
+ import { eventBus as C } from "@streamlayer/sdk-web-interfaces";
5
+ import { SvgIcon as h } from "../icons/index.js";
6
+ import { Container as M, ToggleIconPause as j, HideControls as k, Player as A, Poster as B, Control as F } from "./styles.js";
7
+ const N = (s) => {
8
+ for (const n of s)
9
+ n.isIntersecting ? n.target instanceof HTMLVideoElement && n.target.autoplay && n.target.play() : n.target instanceof HTMLVideoElement && !n.target.paused && n.target.pause();
10
+ }, E = new IntersectionObserver(N, { threshold: 0.5 }), m = /* @__PURE__ */ new Set(), q = (s) => {
11
+ E.observe(s), m.add(s);
12
+ }, z = (s) => {
13
+ E.unobserve(s), m.delete(s);
14
+ }, D = () => {
15
+ for (const s of m)
16
+ s instanceof HTMLVideoElement && !s.paused && s.pause();
17
+ }, X = ({
18
+ poster: s,
19
+ source: n,
20
+ aspectRatio: p,
21
+ controlVideo: r,
22
+ onPlay: i,
23
+ autoPlay: I,
24
+ hideControls: u
25
+ }) => {
26
+ const e = S(null), [c, l] = d(!1), [g, f] = d(!0), O = y(() => {
19
27
  r == null || r({ muted: !0 });
20
- }, [r]), o = h(() => {
28
+ }, [r]), a = y(() => {
21
29
  r == null || r({ muted: !1 });
22
- }, [r]), w = (n) => {
23
- n.stopPropagation();
30
+ }, [r]), T = (t) => {
31
+ t.stopPropagation();
24
32
  const v = e == null ? void 0 : e.current;
25
33
  if (v) {
26
- if (f)
27
- v.pause(), e.current && u(e.current);
34
+ if (c)
35
+ v.pause();
28
36
  else {
29
- const m = e == null ? void 0 : e.current;
30
- if (!m)
37
+ const b = e == null ? void 0 : e.current;
38
+ if (!b)
31
39
  return;
32
- N(), F(m), m.play().catch((C) => console.log(C)), g(!1);
40
+ D(), b.play().catch((x) => console.log(x)), f(!1);
33
41
  }
34
- L.emit("interactions", {
42
+ C.emit("interactions", {
35
43
  action: "tap",
36
44
  payload: {}
37
45
  });
38
46
  }
39
- }, x = () => {
40
- var n;
41
- e.current && u(e.current), (n = e == null ? void 0 : e.current) == null || n.load(), g(!0);
47
+ }, w = () => {
48
+ var t;
49
+ (t = e == null ? void 0 : e.current) == null || t.load(), f(!0);
42
50
  };
43
- return y(() => {
44
- e.current && u(e.current);
45
- }, []), y(() => {
46
- const n = e == null ? void 0 : e.current;
51
+ return P(() => {
52
+ const t = e == null ? void 0 : e.current;
47
53
  return () => {
48
- n && (n.paused || o(), u(n));
54
+ t && (t.paused || a());
49
55
  };
50
- }, [o]), /* @__PURE__ */ E(
51
- j,
56
+ }, [a]), P(() => {
57
+ const t = e.current;
58
+ return t ? (q(t), () => z(t)) : () => {
59
+ };
60
+ }, []), /* @__PURE__ */ H(
61
+ M,
52
62
  {
53
- onClick: w,
54
- className: S(f && k),
55
- style: t ? { aspectRatio: t } : {},
63
+ onClick: u ? void 0 : T,
64
+ className: L(c && j, u && k),
65
+ style: p ? { aspectRatio: p } : {},
56
66
  children: [
57
- /* @__PURE__ */ i(
58
- H,
67
+ /* @__PURE__ */ o(
68
+ A,
59
69
  {
60
70
  ref: e,
61
- src: a,
71
+ src: n,
72
+ autoPlay: I,
62
73
  onPlay: () => {
63
- O(), l(!0), c == null || c();
74
+ console.log("play"), O(), l(!0), f(!1), i == null || i();
64
75
  },
65
76
  onPause: () => {
66
- o(), l(!1);
77
+ a(), l(!1);
67
78
  },
68
79
  onEnded: () => {
69
- o(), l(!1), x();
80
+ a(), l(!1), w();
70
81
  },
71
- style: { visibility: b ? "hidden" : "visible" },
82
+ style: { visibility: g ? "hidden" : "visible" },
72
83
  controls: !1,
73
84
  playsInline: !0
74
85
  }
75
86
  ),
76
- /* @__PURE__ */ i(M, { src: s, style: { visibility: b ? "visible" : "hidden" } }),
77
- /* @__PURE__ */ i(A, { children: f ? /* @__PURE__ */ i(P, { name: "icon-pause" }) : /* @__PURE__ */ i(P, { name: "icon-play" }) })
87
+ /* @__PURE__ */ o(B, { src: s, style: { visibility: g ? "visible" : "hidden" } }),
88
+ !u && /* @__PURE__ */ o(F, { children: c ? /* @__PURE__ */ o(h, { name: "icon-pause" }) : /* @__PURE__ */ o(h, { name: "icon-play" }) })
78
89
  ]
79
90
  }
80
91
  );
81
92
  };
82
93
  export {
83
- Q as VideoPlayer,
84
- N as pauseAllVideos
94
+ X as VideoPlayer,
95
+ D as pauseAllVideos
85
96
  };
@@ -3,3 +3,4 @@ export declare const Player: import('@linaria/react').StyledComponent<import('re
3
3
  export declare const Poster: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLImageElement> & import('react').ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
4
4
  export declare const Control: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
5
  export declare const ToggleIconPause: import('@linaria/core').LinariaClassName;
6
+ export declare const HideControls: import('@linaria/core').LinariaClassName;
@@ -7,19 +7,20 @@ const e = /* @__PURE__ */ s("div")({
7
7
  name: "Player",
8
8
  class: "p6703cq",
9
9
  propsAsIs: !1
10
- }), l = /* @__PURE__ */ s("img")({
10
+ }), n = /* @__PURE__ */ s("img")({
11
11
  name: "Poster",
12
12
  class: "p12ow7zo",
13
13
  propsAsIs: !1
14
- }), n = /* @__PURE__ */ s("div")({
14
+ }), l = /* @__PURE__ */ s("div")({
15
15
  name: "Control",
16
16
  class: "cdpal9o",
17
17
  propsAsIs: !1
18
- }), r = "t1xke4ml";
18
+ }), t = "t1xke4ml", r = "h1yzxv57";
19
19
  export {
20
20
  e as Container,
21
- n as Control,
21
+ l as Control,
22
+ r as HideControls,
22
23
  a as Player,
23
- l as Poster,
24
- r as ToggleIconPause
24
+ n as Poster,
25
+ t as ToggleIconPause
25
26
  };