@streamlayer/react-ui 1.32.4 → 1.33.2

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 (67) hide show
  1. package/lib/app/app/Advertisement/index.js +14 -15
  2. package/lib/app/app/Features/Gamification/Leaderboard.js +46 -36
  3. package/lib/app/app/Features/Gamification/Question.js +42 -42
  4. package/lib/app/app/Features/Gamification/QuestionAdvertisement.js +19 -25
  5. package/lib/app/app/Features/Gamification/index.js +29 -28
  6. package/lib/app/app/Notifications/Onboarding/index.js +45 -42
  7. package/lib/app/app/story/index.js +24 -24
  8. package/lib/app/app/story/insight/index.js +14 -15
  9. package/lib/app/app/story/insight/video.js +3 -3
  10. package/lib/app/app/story/promotion/content.js +5 -5
  11. package/lib/app/app/story/promotion/index.d.ts +1 -0
  12. package/lib/app/app/story/promotion/index.js +24 -25
  13. package/lib/app/app/story/promotion/video.d.ts +0 -1
  14. package/lib/app/app/story/promotion/video.js +41 -43
  15. package/lib/app/app/story/promotion-notification/index.js +15 -16
  16. package/lib/app/app/story/promotion-notification/video.d.ts +0 -1
  17. package/lib/app/app/story/promotion-notification/video.js +22 -30
  18. package/lib/app/app/story/settings/index.js +6 -6
  19. package/lib/app/app/story/settings/login.js +1 -1
  20. package/lib/app/app/story/video.js +28 -28
  21. package/lib/app/login/demo.js +19 -18
  22. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.d.ts +0 -1
  23. package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.js +17 -17
  24. package/lib/app/masters/Notifications/Onboarding/index.js +42 -39
  25. package/lib/app/masters/masters.d.ts +1 -0
  26. package/lib/app/masters/masters.js +34 -32
  27. package/lib/app/masters/provider.d.ts +4 -0
  28. package/lib/app/masters/provider.js +23 -0
  29. package/lib/app/masters/story/components.js +48 -52
  30. package/lib/app/masters/story/index.js +16 -15
  31. package/lib/app/tgl/index.d.ts +1 -0
  32. package/lib/app/tgl/index.js +19 -20
  33. package/lib/app/tgl/video.d.ts +0 -1
  34. package/lib/app/tgl/video.js +40 -42
  35. package/lib/app/webos/ExposedPauseAd/PauseAd.js +68 -68
  36. package/lib/app/webos/story.js +26 -26
  37. package/lib/app/webos/ui/Sidebar/styles.js +82 -888
  38. package/lib/assets/style.css +1 -1
  39. package/lib/core/app.d.ts +7 -0
  40. package/lib/core/app.js +14 -0
  41. package/lib/core/event.d.ts +6 -0
  42. package/lib/core/event.js +5 -0
  43. package/lib/core/hooks.d.ts +16 -0
  44. package/lib/core/hooks.js +8 -0
  45. package/lib/core/provider.d.ts +49 -0
  46. package/lib/core/provider.js +9 -0
  47. package/lib/hooks-B0Qttldg.js +99 -0
  48. package/lib/index.d.ts +0 -1
  49. package/lib/index.js +2 -4
  50. package/lib/ui/advertisement/banner/index.d.ts +2 -2
  51. package/lib/ui/advertisement/notification/lower-third/index.js +34 -30
  52. package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMPlayer.js +100 -33212
  53. package/lib/ui/advertisement/overlay/externalAd/vast-player/useGAMStatic.js +13 -13
  54. package/lib/ui/advertisement/overlay/externalAd/vast-player/useVastAds.js +63 -204
  55. package/lib/ui/gamification/leaderboard/static.d.ts +1 -1
  56. package/lib/ui/gamification/question/inapp/notification/AdNotification/NotificationMedia/index.d.ts +1 -1
  57. package/lib/ui/gamification/question/inapp/notification/AdNotification/NotificationMedia/index.js +1 -1
  58. package/lib/ui/icons/index.d.ts +198 -66
  59. package/lib/ui/video-player/index.js +26 -23
  60. package/lib/useStreamLayerApp.d.ts +23 -0
  61. package/lib/useStreamLayerApp.js +167 -0
  62. package/lib/utils/debug/index.js +8 -8
  63. package/package.json +42 -35
  64. package/lib/index-l-eyvmpL.js +0 -3758
  65. package/lib/utils/createDemo.d.ts +0 -12
  66. package/lib/utils/createDemo.js +0 -49
  67. package/lib/vast-client.min-B0NUra1B.js +0 -1060
@@ -0,0 +1,7 @@
1
+ export declare const StreamLayerSDKReact: React.FC<{
2
+ event?: string;
3
+ topNavigation?: boolean;
4
+ withSidebarNotification?: boolean;
5
+ muted?: boolean;
6
+ theme?: string;
7
+ }>;
@@ -0,0 +1,14 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { App as l } from "../app/app/index.js";
3
+ import { useContext as o } from "react";
4
+ import { StreamLayerThemeProvider as f } from "../ui/theme/index.js";
5
+ import { S as n, a as h, b as y, c as s } from "../hooks-B0Qttldg.js";
6
+ const b = ({ event: p, topNavigation: S, theme: c, muted: u, withSidebarNotification: d = !0 }) => {
7
+ const { sdk: t, status: i } = o(n), e = h(), m = y(), { event: a } = o(n);
8
+ if (i === s.UNSET)
9
+ throw new Error("Wrap app in `StreamLayerProvider`");
10
+ return i === s.CONNECTED ? /* @__PURE__ */ r("div", { className: "StreamLayerSDK", children: "wait" }) : t === null ? /* @__PURE__ */ r("div", { className: "StreamLayerSDK", children: "sdk not initialized" }) : !e.app && !e.appNotification && !e.appSidebar || !e.app && !e.appSidebar && e.appNotification && !d ? null : /* @__PURE__ */ r("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ r(f, { customTheme: c ?? m.theme, themeMode: m.themeMode, children: /* @__PURE__ */ r(l, { sdk: t, muted: u, event: (a == null ? void 0 : a.current) || p, topNavigation: S }) }) });
11
+ };
12
+ export {
13
+ b as StreamLayerSDKReact
14
+ };
@@ -0,0 +1,6 @@
1
+ export type StreamLayerSDKEventProps = {
2
+ event?: string;
3
+ };
4
+ export declare const StreamLayerSDKEvent: React.FC<StreamLayerSDKEventProps & {
5
+ internal?: boolean;
6
+ }>;
@@ -0,0 +1,5 @@
1
+ import "react";
2
+ import { e as a } from "../hooks-B0Qttldg.js";
3
+ export {
4
+ a as StreamLayerSDKEvent
5
+ };
@@ -0,0 +1,16 @@
1
+ import { StreamLayerOptions, StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
2
+ export declare const useStreamLayer: () => StreamLayerSDK | null;
3
+ export declare const useStreamLayerEvent: () => import('react').MutableRefObject<string> | undefined;
4
+ export declare const useStreamLayerTheme: () => Pick<StreamLayerOptions, "theme" | "themeMode">;
5
+ export declare const useStreamLayerUI: () => {
6
+ promotionExternalAd?: boolean;
7
+ promotionSidebar?: boolean;
8
+ promotionOverlay?: boolean;
9
+ promotionNotification?: boolean;
10
+ promotionBanner?: boolean;
11
+ app?: boolean;
12
+ appNotification?: boolean;
13
+ appSidebar?: boolean;
14
+ appBanner?: boolean;
15
+ onboardingNotification?: boolean;
16
+ };
@@ -0,0 +1,8 @@
1
+ import "react";
2
+ import { u as s, f as m, b as t, a as u } from "../hooks-B0Qttldg.js";
3
+ export {
4
+ s as useStreamLayer,
5
+ m as useStreamLayerEvent,
6
+ t as useStreamLayerTheme,
7
+ u as useStreamLayerUI
8
+ };
@@ -0,0 +1,49 @@
1
+ import { DeepLinkCallback } from '@streamlayer/sdk-web-core';
2
+ import { StreamLayerSDK, StreamLayerPlugin } from '@streamlayer/sdk-web-interfaces';
3
+ export type { DeepLinkCallback } from '@streamlayer/sdk-web-core';
4
+ export type ContentActivateParams = {
5
+ stage: 'activate' | 'deactivate';
6
+ id: string;
7
+ isViewed?: boolean;
8
+ hasNotification?: boolean;
9
+ type: 'advertisement' | 'insight' | 'poll' | 'trivia' | 'prediction' | 'tweet' | 'question';
10
+ };
11
+ export type VideoPlayerData = {
12
+ muted?: boolean;
13
+ play?: boolean;
14
+ };
15
+ export type VideoPlayerCallback = (videoPlayerData: VideoPlayerData) => void;
16
+ export type OnContentActivateCallback = (renderData: ContentActivateParams) => void;
17
+ export declare enum StreamLayerStatus {
18
+ UNSET = 0,
19
+ CONNECTED = 1,
20
+ READY = 2
21
+ }
22
+ export declare const StreamLayerContext: import('react').Context<{
23
+ status: StreamLayerStatus;
24
+ sdk: StreamLayerSDK | null;
25
+ event?: React.MutableRefObject<string>;
26
+ }>;
27
+ export type StreamLayerProps = {
28
+ sdkKey: string;
29
+ plugins?: Set<StreamLayerPlugin>;
30
+ event?: string;
31
+ production?: boolean;
32
+ autoEnable?: boolean;
33
+ onDeepLinkHandled?: DeepLinkCallback;
34
+ videoPlayerController?: VideoPlayerCallback;
35
+ onContentActivate?: OnContentActivateCallback;
36
+ theme?: string;
37
+ withAdNotification?: boolean;
38
+ withAd?: boolean;
39
+ hideFriends?: boolean;
40
+ friendsTab?: 'enabled' | 'disabled' | 'activatedGame';
41
+ themeMode?: 'light' | 'dark';
42
+ containerId?: string;
43
+ };
44
+ export declare const StreamLayerProvider: React.FC<StreamLayerProps & {
45
+ children: React.ReactNode;
46
+ skipOnboarding?: boolean;
47
+ betPack?: boolean;
48
+ webOS?: boolean;
49
+ }>;
@@ -0,0 +1,9 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "../useStreamLayerApp.js";
4
+ import { S as o, d as S, c as i } from "../hooks-B0Qttldg.js";
5
+ export {
6
+ o as StreamLayerContext,
7
+ S as StreamLayerProvider,
8
+ i as StreamLayerStatus
9
+ };
@@ -0,0 +1,99 @@
1
+ import { useEffect as n, createContext as A, useRef as D, useMemo as R, useContext as m, useState as v } from "react";
2
+ import { jsxs as I, jsx as M } from "react/jsx-runtime";
3
+ import { useStreamLayerApp as g } from "./useStreamLayerApp.js";
4
+ const j = ({
5
+ event: e,
6
+ internal: o
7
+ }) => {
8
+ const s = B(), r = G();
9
+ return n(() => (s && (e && (s.createEventSession(e, o), r && (r.current = e)), !e && (r != null && r.current) && (s.createEventSession("", o), r.current = "")), () => {
10
+ s && s.disableApp();
11
+ }), [e, o, r, s]), null;
12
+ };
13
+ var Y = /* @__PURE__ */ ((e) => (e[e.UNSET = 0] = "UNSET", e[e.CONNECTED = 1] = "CONNECTED", e[e.READY = 2] = "READY", e))(Y || {});
14
+ const w = {
15
+ status: 0,
16
+ sdk: null
17
+ }, c = A(w), q = ({
18
+ sdkKey: e,
19
+ theme: o,
20
+ themeMode: s,
21
+ plugins: r,
22
+ children: f,
23
+ event: E,
24
+ production: x = !0,
25
+ autoEnable: K = !0,
26
+ withAdNotification: N,
27
+ withAd: C = !0,
28
+ betPack: a = !1,
29
+ hideFriends: T,
30
+ skipOnboarding: p,
31
+ friendsTab: S = "enabled",
32
+ onDeepLinkHandled: u,
33
+ videoPlayerController: i,
34
+ onContentActivate: U,
35
+ containerId: h,
36
+ webOS: b
37
+ }) => {
38
+ const t = g({
39
+ sdkKey: e,
40
+ plugins: r,
41
+ production: x,
42
+ autoEnable: K,
43
+ onDeepLinkHandled: u,
44
+ videoPlayerController: i,
45
+ onContentActivate: U,
46
+ hideFriends: T,
47
+ skipOnboarding: p,
48
+ withAdNotification: N,
49
+ withAd: C,
50
+ friendsTab: S,
51
+ betPack: a,
52
+ webOS: b
53
+ }), l = D(""), y = R(() => t ? { sdk: t, status: 2, event: l } : { status: 1, sdk: null, event: l }, [t]);
54
+ return n(() => {
55
+ t && (t.options.setKey("friendsTab", S), t.options.setKey("theme", o), t.options.setKey("themeMode", s), t.options.setKey("skipOnboarding", p), t.options.setKey("betPack", a), t.options.setKey("containerId", h));
56
+ }, [t, S, o, s, p, a, h]), n(() => () => {
57
+ u && (t == null || t.removeDeepLinkHandler(u)), i && (t == null || t.removeVideoPlayerController(i));
58
+ }, [t]), n(() => {
59
+ localStorage.getItem("SL_DEBUG") && console.log("StreamLayerProvider mounted with props:", {
60
+ sdkKey: !!e,
61
+ onDeepLinkHandled: !!u,
62
+ videoPlayerController: !!i
63
+ });
64
+ }, [e, u, i]), /* @__PURE__ */ I(c.Provider, { value: y, children: [
65
+ E !== void 0 && /* @__PURE__ */ M(j, { event: E }),
66
+ f
67
+ ] });
68
+ }, B = () => {
69
+ const { sdk: e } = m(c);
70
+ return e;
71
+ }, G = () => {
72
+ const { event: e } = m(c);
73
+ return e;
74
+ }, z = () => {
75
+ const { sdk: e } = m(c), [o, s] = v({});
76
+ return n(() => {
77
+ var r;
78
+ return e != null && e.options ? (r = e == null ? void 0 : e.options) == null ? void 0 : r.subscribe((f) => {
79
+ s({ theme: f.theme, themeMode: f.themeMode });
80
+ }) : () => {
81
+ };
82
+ }, [e == null ? void 0 : e.options]), o;
83
+ }, F = () => {
84
+ const { sdk: e } = m(c), [o, s] = v({});
85
+ return n(() => e != null && e.uiState ? e == null ? void 0 : e.uiState.subscribe((r) => {
86
+ s({ ...r });
87
+ }) : () => {
88
+ }, [e == null ? void 0 : e.uiState]), o;
89
+ };
90
+ export {
91
+ c as S,
92
+ F as a,
93
+ z as b,
94
+ Y as c,
95
+ q as d,
96
+ j as e,
97
+ G as f,
98
+ B as u
99
+ };
package/lib/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export { App } from './app/app';
2
- export { StreamLayerThemeProvider } from './ui/theme';
package/lib/index.js CHANGED
@@ -1,6 +1,4 @@
1
- import { App as o } from "./app/app/index.js";
2
- import { StreamLayerThemeProvider as p } from "./ui/theme/index.js";
1
+ import { App as r } from "./app/app/index.js";
3
2
  export {
4
- o as App,
5
- p as StreamLayerThemeProvider
3
+ r as App
6
4
  };
@@ -1,7 +1,7 @@
1
1
  import { Advertisement } from '@streamlayer/feature-gamification';
2
- import { PromotionOptions } from '@streamlayer/sdk-web-types';
2
+ import { Promotion } from '@streamlayer/sdk-web-types';
3
3
  export declare const Banner: React.FC<{
4
- promotion: PromotionOptions;
4
+ promotion: Promotion;
5
5
  promotionId: string;
6
6
  direction?: 'top' | 'bottom';
7
7
  hiding?: boolean;
@@ -1,53 +1,57 @@
1
- import { jsx as i, jsxs as e, Fragment as m } from "react/jsx-runtime";
2
- import { withFocusable as O } from "../../../../app/webos/useTvButton.js";
3
- import { NotificationPromotionImagePosition as N, NotificationEnabled as t, NotificationSponsorLogoMode as _, CtaIconMode as I } from "@streamlayer/sdk-web-types";
4
- import { MediaImgBottom as C, MediaImgMiddle as f, NotificationContainer as L, NotificationContent as A, Body as S, Title as E, Text as P, Footer as x, Logo as D, Vector as F, CtaIcon as a, OpenButton as h, DismissButton as k } from "./styles.js";
5
- const R = {
6
- [N.BOTTOM]: C,
7
- [N.MIDDLE]: f
8
- }, w = ({ src: r, imagePosition: n }) => {
9
- const l = R[n] || C;
10
- return /* @__PURE__ */ i(l, { children: /* @__PURE__ */ i("img", { src: r, alt: "" }) });
11
- }, y = O(k), j = O(h), q = ({ notification: r, open: n, close: l, webos: s }) => {
1
+ import { jsx as i, jsxs as e, Fragment as I } from "react/jsx-runtime";
2
+ import { withFocusable as C } from "../../../../app/webos/useTvButton.js";
3
+ import { NotificationPromotionImagePosition as n, NotificationEnabled as t, NotificationSponsorLogoMode as E, CtaIconMode as O } from "@streamlayer/sdk-web-types";
4
+ import { MediaImgBottom as l, MediaImgMiddle as L, NotificationContainer as _, NotificationContent as f, Body as S, Title as A, Text as D, Footer as F, Logo as P, Vector as x, CtaIcon as a, OpenButton as T, DismissButton as R } from "./styles.js";
5
+ const k = {
6
+ [n.UNSET]: l,
7
+ [n.FIT]: l,
8
+ [n.CENTERED]: l,
9
+ [n.SOLID]: l,
10
+ [n.BOTTOM]: l,
11
+ [n.MIDDLE]: L
12
+ }, w = ({ src: r, imagePosition: s }) => {
13
+ const c = k[s];
14
+ return /* @__PURE__ */ i(c, { children: /* @__PURE__ */ i("img", { src: r, alt: "" }) });
15
+ }, y = C(R), j = C(T), V = ({ notification: r, open: s, close: c, webos: d }) => {
12
16
  if (!r || !r.promotion || r.enabled !== t.NOTIFICATION_ENABLED)
13
17
  return null;
14
- const { title: c, body: d, image: T, promotion: p } = r, { sponsorLogo: g, sponsorLogoMode: M, imagePosition: b, ctaButton: o } = p;
18
+ const { title: m, body: N, image: h, promotion: p } = r, { sponsorLogo: g, sponsorLogoMode: M, imagePosition: b, ctaButton: o } = p;
15
19
  return /* @__PURE__ */ e(
16
- L,
20
+ _,
17
21
  {
18
- "data-webos": s,
22
+ "data-webos": d,
19
23
  className: "SL_Lower_Third_Notification",
20
- onClick: s ? void 0 : n,
24
+ onClick: d ? void 0 : s,
21
25
  children: [
22
- /* @__PURE__ */ e(A, { children: [
23
- /* @__PURE__ */ i(w, { src: T, imagePosition: b }),
26
+ /* @__PURE__ */ e(f, { children: [
27
+ /* @__PURE__ */ i(w, { src: h, imagePosition: b }),
24
28
  /* @__PURE__ */ e(S, { children: [
25
- c && /* @__PURE__ */ i(E, { children: c }),
26
- d && /* @__PURE__ */ i(P, { children: d })
29
+ m && /* @__PURE__ */ i(A, { children: m }),
30
+ N && /* @__PURE__ */ i(D, { children: N })
27
31
  ] })
28
32
  ] }),
29
- /* @__PURE__ */ e(x, { children: [
30
- M !== _.NOTIFICATION_SPONSOR_LOGO_NONE && /* @__PURE__ */ e(m, { children: [
31
- /* @__PURE__ */ i(D, { children: /* @__PURE__ */ i("img", { src: g, alt: c }) }),
32
- /* @__PURE__ */ i(F, {})
33
+ /* @__PURE__ */ e(F, { children: [
34
+ M !== E.NOTIFICATION_SPONSOR_LOGO_NONE && /* @__PURE__ */ e(I, { children: [
35
+ /* @__PURE__ */ i(P, { children: /* @__PURE__ */ i("img", { src: g, alt: m }) }),
36
+ /* @__PURE__ */ i(x, {})
33
37
  ] }),
34
- s ? /* @__PURE__ */ e(m, { children: [
35
- /* @__PURE__ */ i(y, { webos: !0, onClick: l, children: "Dismiss" }),
38
+ d ? /* @__PURE__ */ e(I, { children: [
39
+ /* @__PURE__ */ i(y, { webos: !0, onClick: c, children: "Dismiss" }),
36
40
  /* @__PURE__ */ e(
37
41
  j,
38
42
  {
39
43
  webos: !0,
40
44
  autoFocus: !0,
41
45
  style: { color: o == null ? void 0 : o.textColor, backgroundColor: o == null ? void 0 : o.color },
42
- onClick: n,
46
+ onClick: s,
43
47
  children: [
44
- (o == null ? void 0 : o.ctaIcon) && (o == null ? void 0 : o.ctaIconMode) === I.CTA_ICON_TRANSPARENT && /* @__PURE__ */ i(a, { src: o == null ? void 0 : o.ctaIcon, alt: "cta-icon" }),
48
+ (o == null ? void 0 : o.ctaIcon) && (o == null ? void 0 : o.ctaIconMode) === O.CTA_ICON_TRANSPARENT && /* @__PURE__ */ i(a, { src: o == null ? void 0 : o.ctaIcon, alt: "cta-icon" }),
45
49
  (o == null ? void 0 : o.label) || "Open"
46
50
  ]
47
51
  }
48
52
  )
49
- ] }) : /* @__PURE__ */ e(h, { name: "promo-button", style: { color: o == null ? void 0 : o.textColor, backgroundColor: o == null ? void 0 : o.color }, children: [
50
- (o == null ? void 0 : o.ctaIcon) && (o == null ? void 0 : o.ctaIconMode) === I.CTA_ICON_TRANSPARENT && /* @__PURE__ */ i(a, { src: o == null ? void 0 : o.ctaIcon, alt: "cta-icon" }),
53
+ ] }) : /* @__PURE__ */ e(T, { name: "promo-button", style: { color: o == null ? void 0 : o.textColor, backgroundColor: o == null ? void 0 : o.color }, children: [
54
+ (o == null ? void 0 : o.ctaIcon) && (o == null ? void 0 : o.ctaIconMode) === O.CTA_ICON_TRANSPARENT && /* @__PURE__ */ i(a, { src: o == null ? void 0 : o.ctaIcon, alt: "cta-icon" }),
51
55
  (o == null ? void 0 : o.label) || "Open"
52
56
  ] })
53
57
  ] })
@@ -56,6 +60,6 @@ const R = {
56
60
  );
57
61
  };
58
62
  export {
59
- q as LowerThirdNotification,
63
+ V as LowerThirdNotification,
60
64
  w as NotificationMedia
61
65
  };