@streamlayer/react-ui 1.10.0 → 1.11.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.
@@ -1,14 +1,14 @@
1
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
2
  import { styled as t } from "@linaria/react";
3
3
  import { useEffect as i } from "react";
4
- import { StreamLayerProvider as l, useStreamLayer as p } from "@streamlayer/react";
4
+ import { StreamLayerProvider as l, useStreamLayer as p, StreamLayerSDKEvent as m } from "@streamlayer/react";
5
5
  import { App as c } from "../index.js";
6
- import { StreamLayerThemeProvider as m } from "../../../ui/theme/index.js";
7
- import { useStreamLayerDebug as f } from "../../../utils/debug/index.js";
8
- import { Video as u } from "./video.js";
9
- const s = () => {
6
+ import { StreamLayerThemeProvider as f } from "../../../ui/theme/index.js";
7
+ import { useStreamLayerDebug as u } from "../../../utils/debug/index.js";
8
+ import { Video as y } from "./video.js";
9
+ const a = () => {
10
10
  console.log("deep link handled cb");
11
- }, y = () => {
11
+ }, h = () => {
12
12
  console.log("video player handled cb");
13
13
  }, v = ({
14
14
  event: o
@@ -16,44 +16,47 @@ const s = () => {
16
16
  const e = p();
17
17
  return i(() => {
18
18
  e && e.openFeature(12);
19
- }, [e]), e ? /* @__PURE__ */ r(m, {
20
- children: /* @__PURE__ */ r(c, {
19
+ }, [e, o]), e ? /* @__PURE__ */ s(f, {
20
+ children: [/* @__PURE__ */ r(m, {
21
+ event: o
22
+ }), /* @__PURE__ */ r(c, {
21
23
  sdk: e,
22
24
  event: o,
23
- onDeepLinkHandled: s
24
- })
25
+ onDeepLinkHandled: a
26
+ })]
25
27
  }) : null;
26
- }, h = /* @__PURE__ */ t("div")({
28
+ }, A = /* @__PURE__ */ t("div")({
27
29
  name: "Container",
28
30
  class: "c1a4qh28",
29
31
  propsAsIs: !1
30
- }), k = /* @__PURE__ */ t("div")({
32
+ }), S = /* @__PURE__ */ t("div")({
31
33
  name: "Body",
32
34
  class: "b9h8kuk",
33
35
  propsAsIs: !1
34
- }), A = /* @__PURE__ */ t("div")({
36
+ }), k = /* @__PURE__ */ t("div")({
35
37
  name: "AppContainer",
36
38
  class: "a1wkro2j",
37
39
  propsAsIs: !1
38
- }), D = ({
40
+ }), j = ({
39
41
  sdkKey: o,
40
42
  eventId: e,
41
- production: a
43
+ production: d
42
44
  }) => {
43
- const n = f({
45
+ const n = u({
44
46
  sdkKey: o,
45
47
  eventId: e,
46
- production: a
48
+ production: d
47
49
  });
48
50
  return /* @__PURE__ */ r(l, {
49
51
  sdkKey: n.sdkKey,
50
52
  production: n.env === "production",
51
53
  autoEnable: !0,
52
- onDeepLinkHandled: s,
53
- videoPlayerController: y,
54
- children: /* @__PURE__ */ d(k, {
55
- children: [/* @__PURE__ */ r(u, {}), /* @__PURE__ */ r(h, {
56
- children: /* @__PURE__ */ r(A, {
54
+ onDeepLinkHandled: a,
55
+ videoPlayerController: h,
56
+ withAd: !1,
57
+ children: /* @__PURE__ */ s(S, {
58
+ children: [/* @__PURE__ */ r(y, {}), /* @__PURE__ */ r(A, {
59
+ children: /* @__PURE__ */ r(k, {
57
60
  className: "StreamLayerSDK",
58
61
  children: /* @__PURE__ */ r(v, {
59
62
  event: n.event
@@ -64,5 +67,5 @@ const s = () => {
64
67
  });
65
68
  };
66
69
  export {
67
- D as AppStory
70
+ j as AppStory
68
71
  };
@@ -1,5 +1,7 @@
1
1
  import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
2
+ import { FeatureType } from '@streamlayer/sdk-web-types';
2
3
  export declare const useAppApp: (sdk: StreamLayerSDK) => {
3
4
  sdkReady: boolean;
5
+ activeFeature: FeatureType | undefined;
4
6
  isLogged: boolean;
5
7
  };
@@ -1,15 +1,16 @@
1
- import { useStore as r } from "@nanostores/react";
1
+ import { useStore as o } from "@nanostores/react";
2
2
  import { useEffect as S } from "react";
3
- import { FeatureType as o } from "@streamlayer/sdk-web-types";
3
+ import { FeatureType as s } from "@streamlayer/sdk-web-types";
4
4
  const A = (e) => {
5
- const u = r(e.status), a = r(e.sdkStore.slStreamId), c = r(e.userId()), s = r(e.getActiveFeature()), n = u === "ready" && !!a.data;
5
+ const u = o(e.status), a = o(e.sdkStore.slStreamId), c = o(e.userId()), r = o(e.getActiveFeature()), n = u === "ready" && !!a.data;
6
6
  return S(() => {
7
- const t = e.getFeature(o.GAMES);
8
- t && s !== o.GAMES && (t.closeQuestion(), t.closeUser()), t == null || t.openedQuestionId.subscribe((p) => {
9
- p && s !== o.GAMES && e.openFeature(o.GAMES);
7
+ const t = e.getFeature(s.GAMES);
8
+ t && r !== s.GAMES && (t.closeQuestion(), t.closeUser()), t == null || t.openedQuestionId.subscribe((p) => {
9
+ p && r !== s.GAMES && e.openFeature(s.GAMES);
10
10
  });
11
- }, [s, e]), {
11
+ }, [r, e]), {
12
12
  sdkReady: n,
13
+ activeFeature: r,
13
14
  isLogged: !!c
14
15
  };
15
16
  };
@@ -1,7 +1,9 @@
1
1
  import { StreamLayerSDK } from '@streamlayer/sdk-web-interfaces';
2
2
  export declare const AppContext: import('react').Context<{
3
3
  sdk: StreamLayerSDK | null;
4
+ topNavigation?: boolean;
4
5
  }>;
5
6
  export declare const useAppContext: () => {
6
7
  sdk: StreamLayerSDK | null;
8
+ topNavigation?: boolean;
7
9
  };
@@ -1,8 +1,9 @@
1
- import { createContext as t, useContext as e } from "react";
2
- const o = t({
3
- sdk: null
4
- }), p = () => e(o);
1
+ import { createContext as t, useContext as o } from "react";
2
+ const e = t({
3
+ sdk: null,
4
+ topNavigation: !1
5
+ }), p = () => o(e);
5
6
  export {
6
- o as AppContext,
7
+ e as AppContext,
7
8
  p as useAppContext
8
9
  };
@@ -1,36 +1,36 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as a } from "react";
3
3
  import w from "react-auth-code-input";
4
4
  import P, { isValidPhoneNumber as F, formatPhoneNumberIntl as v } from "react-phone-number-input";
5
5
  import { Timer as D } from "../../ui/timer/index.js";
6
- import { requestLoginCode as I, register as k, login as S } from "../../utils/login.js";
6
+ import { requestLoginCode as I, register as S, login as k } from "../../utils/login.js";
7
7
  import { Panel as q, Form as m, FormTitle as p, FormDescription as d, FormInputContainer as x, FormSubmit as s, Digits as E } from "./styles.js";
8
8
  const z = ({ login: h, anonymousLogin: u, host: c }) => {
9
9
  const [o, g] = a(""), [i, b] = a(""), [l, f] = a(""), y = async (t) => {
10
10
  t.preventDefault();
11
11
  try {
12
- const n = o.replaceAll("+", "");
12
+ const r = o.replaceAll("+", "");
13
13
  try {
14
- await I(c, n);
14
+ await I(c, r);
15
15
  } catch {
16
- await k(c, n);
16
+ await S(c, r);
17
17
  }
18
- b(n);
19
- } catch (n) {
20
- window.alert(n);
18
+ b(r);
19
+ } catch (r) {
20
+ window.alert(r);
21
21
  }
22
22
  }, C = async (t) => {
23
23
  if (t.preventDefault(), i && l)
24
24
  try {
25
- const n = await S(c, i, l);
26
- n && h ? await h(n) : console.log("token", n);
27
- } catch (n) {
28
- window.alert(n);
25
+ const r = await k(c, i, l);
26
+ r && h && await h(r);
27
+ } catch (r) {
28
+ window.alert(r);
29
29
  }
30
30
  };
31
- return /* @__PURE__ */ r(q, { children: [
32
- !i && /* @__PURE__ */ r("div", { children: [
33
- /* @__PURE__ */ r(m, { onSubmit: y, children: [
31
+ return /* @__PURE__ */ n(q, { children: [
32
+ !i && /* @__PURE__ */ n("div", { children: [
33
+ /* @__PURE__ */ n(m, { onSubmit: y, children: [
34
34
  /* @__PURE__ */ e(p, { children: "Enter your phone number" }),
35
35
  /* @__PURE__ */ e(d, { children: "Enter your phone up for number to log in or sign an account." }),
36
36
  /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(P, { value: o, onChange: (t) => g(`${t}`) }) }),
@@ -38,9 +38,9 @@ const z = ({ login: h, anonymousLogin: u, host: c }) => {
38
38
  ] }),
39
39
  u && /* @__PURE__ */ e(s, { style: { display: "block", margin: "auto" }, onClick: u, children: "anonymous login" })
40
40
  ] }),
41
- i && /* @__PURE__ */ r(m, { onSubmit: C, children: [
41
+ i && /* @__PURE__ */ n(m, { onSubmit: C, children: [
42
42
  /* @__PURE__ */ e(p, { children: "Enter Verification Code" }),
43
- /* @__PURE__ */ r(d, { children: [
43
+ /* @__PURE__ */ n(d, { children: [
44
44
  "Please enter the verification code ",
45
45
  /* @__PURE__ */ e("br", {}),
46
46
  "sent to ",
@@ -48,7 +48,7 @@ const z = ({ login: h, anonymousLogin: u, host: c }) => {
48
48
  ] }),
49
49
  /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(w, { autoFocus: !0, allowedCharacters: "numeric", length: 4, onChange: f }) }),
50
50
  /* @__PURE__ */ e(s, { disabled: l.length !== 4, type: "submit", children: "login" }),
51
- /* @__PURE__ */ r(d, { children: [
51
+ /* @__PURE__ */ n(d, { children: [
52
52
  "Didn't get 59 the code? ",
53
53
  /* @__PURE__ */ e("br", {}),
54
54
  "Resend Code in",