@streamlayer/react-ui 0.64.1 → 0.65.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,6 +1,6 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import { useStore as i } from "@nanostores/react";
3
- import { UserStatistics as e } from "../../../gamification/user-statistics/index.js";
3
+ import { UserStatistics as s } from "../../../gamification/user-statistics/index.js";
4
4
  import "../../../../utils/common.js";
5
5
  import "../../../gamification/user-statistics/components/rank/index.js";
6
6
  import "../../../gamification/user-statistics/components/rank/styles.js";
@@ -8,11 +8,11 @@ import "@linaria/react";
8
8
  import "../../../gamification/user-statistics/components/statistic/index.js";
9
9
  import "../../../gamification/user-statistics/components/statistic/styles.js";
10
10
  import "../../../gamification/user-statistics/styles.js";
11
- const g = ({ userSummary: o }) => {
12
- var t;
13
- const r = i(o.getStore());
14
- return (t = r.data) != null && t.summary ? /* @__PURE__ */ m(e, { ...r.data.summary, ...r.data.percentage }) : /* @__PURE__ */ m("div", { children: "wait user..." });
11
+ const x = ({ userSummary: e }) => {
12
+ var t, m;
13
+ const r = i(e.getStore());
14
+ return (t = r.data) != null && t.summary ? /* @__PURE__ */ o(s, { ...r.data.summary, successRate: (m = r.data.percentage) == null ? void 0 : m.correct }) : /* @__PURE__ */ o("div", { children: "wait user..." });
15
15
  };
16
16
  export {
17
- g as UserSummary
17
+ x as UserSummary
18
18
  };
@@ -1,10 +1,10 @@
1
- import { jsxs as p, Fragment as d, jsx as r } from "react/jsx-runtime";
2
- import { styled as n } from "@linaria/react";
1
+ import { jsxs as e, Fragment as d, jsx as r } from "react/jsx-runtime";
2
+ import { styled as s } from "@linaria/react";
3
3
  import { useStore as m } from "@nanostores/react";
4
4
  import { SDKWhiteContainer as l, SDKScrollContainer as a } from "../../styles.js";
5
5
  import { VoteHeader as c } from "../../../gamification/detail/header/index.js";
6
- import { UserStatistics as h } from "../../../gamification/user-statistics/index.js";
7
- import { ShowIn as u } from "../../../show-in/index.js";
6
+ import { UserStatistics as u } from "../../../gamification/user-statistics/index.js";
7
+ import { ShowIn as h } from "../../../show-in/index.js";
8
8
  import { Question as f } from "./Question.js";
9
9
  import { Tabs as v } from "./Tabs.js";
10
10
  import "../../../gamification/constants.js";
@@ -58,13 +58,13 @@ import "../../../gamification/question/insight/index.js";
58
58
  import "../../../gamification/question/insight/styles.js";
59
59
  import "../../../gamification/question/list/styles.js";
60
60
  import "./UserSummary.js";
61
- const e = n(u)`
61
+ const n = s(h)`
62
62
  position: absolute;
63
63
  inset: 0;
64
64
  top: var(--header-height);
65
65
  background: var(--color-neutrals-white);
66
66
  z-index: 3;
67
- `, x = n.div`
67
+ `, x = s.div`
68
68
  background: var(--color-transparent-item);
69
69
  width: 100%;
70
70
  height: 100%;
@@ -77,18 +77,21 @@ const e = n(u)`
77
77
  & > div {
78
78
  width: 100%;
79
79
  }
80
- `, jr = ({ gamification: t, className: o }) => {
81
- const s = m(t.openedQuestion.$store), i = m(t.openedUser);
82
- return /* @__PURE__ */ p(d, { children: [
83
- s && /* @__PURE__ */ r(e, { className: o, children: /* @__PURE__ */ r(f, { gamification: t }) }),
84
- i && /* @__PURE__ */ r(e, { className: o, children: /* @__PURE__ */ p(x, { children: [
80
+ `, S = ({ correct: t, incorrect: o }) => {
81
+ const i = t + o;
82
+ return i === 0 ? 0 : Math.round(t / i * 100);
83
+ }, kt = ({ gamification: t, className: o }) => {
84
+ const i = m(t.openedQuestion.$store), p = m(t.openedUser);
85
+ return /* @__PURE__ */ e(d, { children: [
86
+ i && /* @__PURE__ */ r(n, { className: o, children: /* @__PURE__ */ r(f, { gamification: t }) }),
87
+ p && /* @__PURE__ */ r(n, { className: o, children: /* @__PURE__ */ e(x, { children: [
85
88
  /* @__PURE__ */ r(c, { label: "Friend's Rank", close: t.closeUser }),
86
- /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(h, { ...i }) })
89
+ /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(u, { ...p, successRate: S(p) }) })
87
90
  ] }) }),
88
91
  /* @__PURE__ */ r(a, { className: o, "data-nav": "true", children: /* @__PURE__ */ r(v, { gamification: t }) })
89
92
  ] });
90
93
  };
91
94
  export {
92
- jr as GamificationOverlay,
93
- jr as default
95
+ kt as GamificationOverlay,
96
+ kt as default
94
97
  };
@@ -2,8 +2,8 @@ import { jsx as o } from "react/jsx-runtime";
2
2
  import { useStore as c } from "@nanostores/react";
3
3
  import { useMemo as s } from "react";
4
4
  import { NotificationType as r } from "@streamlayer/sdk-web-notifications";
5
- import { Notification as e } from "../../gamification/question/notification/index.js";
6
- import { Container as m } from "./styles.js";
5
+ import { Notification as p } from "../../gamification/question/notification/index.js";
6
+ import { Container as n } from "./styles.js";
7
7
  import "@streamlayer/sdk-web-types";
8
8
  import "../../gamification/constants.js";
9
9
  import "../../gamification/question/notification/insight/index.js";
@@ -17,19 +17,23 @@ import "../../gamification/question/notification/prediction-result/animation-lin
17
17
  import "../../gamification/question/notification/prediction-result/animation-lines/styles.js";
18
18
  import "../../gamification/question/notification/prediction-result/styles.js";
19
19
  import "../../gamification/question/notification/styles.js";
20
+ import "../../gamification/question/notification/tweet/index.js";
21
+ import "../../questions/twitter/account/index.js";
22
+ import "../../questions/twitter/account/styles.js";
23
+ import "../../gamification/question/notification/tweet/styles.js";
20
24
  import "../../show-in/index.js";
21
25
  import "@linaria/core";
22
- const B = ({ sdk: p }) => {
23
- const f = p.getNotificationsStore(), t = c(f), i = s(() => {
26
+ const L = ({ sdk: e }) => {
27
+ const f = e.getNotificationsStore(), t = c(f), i = s(() => {
24
28
  if (!(t != null && t.size))
25
29
  return null;
26
- for (const n of t.values())
27
- if (n.type === r.ONBOARDING)
28
- return n;
30
+ for (const m of t.values())
31
+ if (m.type === r.ONBOARDING)
32
+ return m;
29
33
  return t.values().next().value;
30
34
  }, [t]);
31
- return (i == null ? void 0 : i.type) === r.QUESTION ? /* @__PURE__ */ o(m, { hiding: i.hiding, children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(e, { ...i }) }) }) : (i == null ? void 0 : i.type) === r.QUESTION_RESOLVED ? /* @__PURE__ */ o(m, { hiding: i.hiding, children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(e, { ...i }) }) }) : null;
35
+ return (i == null ? void 0 : i.type) === r.QUESTION ? /* @__PURE__ */ o(n, { hiding: i.hiding, children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(p, { ...i }) }) }) : (i == null ? void 0 : i.type) === r.QUESTION_RESOLVED ? /* @__PURE__ */ o(n, { hiding: i.hiding, children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(p, { ...i }) }) }) : null;
32
36
  };
33
37
  export {
34
- B as SDKNotifications
38
+ L as SDKNotifications
35
39
  };
@@ -32,6 +32,10 @@ import "../gamification/question/notification/prediction-result/animation-lines/
32
32
  import "../gamification/question/notification/prediction-result/animation-lines/styles.js";
33
33
  import "../gamification/question/notification/prediction-result/styles.js";
34
34
  import "../gamification/question/notification/styles.js";
35
+ import "../gamification/question/notification/tweet/index.js";
36
+ import "../questions/twitter/account/index.js";
37
+ import "../questions/twitter/account/styles.js";
38
+ import "../gamification/question/notification/tweet/styles.js";
35
39
  import "./Notifications/styles.js";
36
40
  import "../show-in/index.js";
37
41
  import "../navigation/button/index.js";
@@ -39,7 +43,7 @@ import "../navigation/button/styles.js";
39
43
  const x = ({ sdk: i, className: e }) => {
40
44
  const [, m] = A(i);
41
45
  return /* @__PURE__ */ o(S, { className: e, feature: m, sdk: i });
42
- }, st = ({ sdk: i, overlays: e, children: m }) => {
46
+ }, ft = ({ sdk: i, overlays: e, children: m }) => {
43
47
  const { sdkEnabled: t, sdkReady: l, activeOverlay: r, activateAndLoadOverlay: c, enableSdk: f, disableSdk: u, isLogged: p } = k(i);
44
48
  return /* @__PURE__ */ y(b, { children: [
45
49
  t && /* @__PURE__ */ o(
@@ -73,5 +77,5 @@ const x = ({ sdk: i, className: e }) => {
73
77
  ] });
74
78
  };
75
79
  export {
76
- st as MastersApp
80
+ ft as MastersApp
77
81
  };
@@ -1,9 +1,10 @@
1
- import { jsx as r, jsxs as n } from "react/jsx-runtime";
2
- import { QuestionType as p } from "@streamlayer/sdk-web-types";
3
- import { QuestionTypeData as l } from "../../constants.js";
4
- import { Insight as a } from "./insight/index.js";
5
- import { PredictionResult as d } from "./prediction-result/index.js";
6
- import { Container as f, CloseIconWrap as h, CloseIcon as C, Header as I, TypeIcon as s, TypeName as T, Question as A, AnswerButton as D } from "./styles.js";
1
+ import { jsx as r, jsxs as e, Fragment as a } from "react/jsx-runtime";
2
+ import { QuestionType as i } from "@streamlayer/sdk-web-types";
3
+ import { QuestionTypeData as d } from "../../constants.js";
4
+ import { Insight as f } from "./insight/index.js";
5
+ import { PredictionResult as T } from "./prediction-result/index.js";
6
+ import { Container as h, CloseIconWrap as C, CloseIcon as E, Header as I, TypeIcon as A, TypeName as D, Question as W, AnswerButton as w } from "./styles.js";
7
+ import { Tweet as x } from "./tweet/index.js";
7
8
  import "../../../video-player/index.js";
8
9
  import "react";
9
10
  import "../../../icons/index.js";
@@ -13,22 +14,32 @@ import "./insight/styles.js";
13
14
  import "./prediction-result/animation-lines/index.js";
14
15
  import "./prediction-result/animation-lines/styles.js";
15
16
  import "./prediction-result/styles.js";
16
- const W = ({
17
- close: m,
18
- action: e,
19
- data: { questionType: i, question: o, insight: c }
17
+ import "../../../questions/twitter/account/index.js";
18
+ import "../../../questions/twitter/account/styles.js";
19
+ import "./tweet/styles.js";
20
+ const L = ({
21
+ close: n,
22
+ action: t,
23
+ data: { questionType: o, question: m, insight: c, tweet: l }
20
24
  }) => {
21
- const t = l[i];
22
- return t ? o != null && o.predictionResult ? /* @__PURE__ */ r(d, { close: m, ...o }) : /* @__PURE__ */ n(f, { children: [
23
- /* @__PURE__ */ r(h, { onClick: m, children: /* @__PURE__ */ r(C, { name: "icon-cross" }) }),
24
- /* @__PURE__ */ n(I, { children: [
25
- /* @__PURE__ */ r(s, { name: t.iconName }),
26
- /* @__PURE__ */ r(T, { children: t.label })
25
+ const p = d[o];
26
+ return p ? m != null && m.predictionResult ? /* @__PURE__ */ r(T, { close: n, ...m }) : /* @__PURE__ */ e(h, { children: [
27
+ /* @__PURE__ */ r(C, { onClick: n, children: /* @__PURE__ */ r(E, { name: "icon-cross" }) }),
28
+ o !== i.TWEET && /* @__PURE__ */ e(I, { children: [
29
+ /* @__PURE__ */ r(A, { name: p.iconName }),
30
+ /* @__PURE__ */ r(D, { children: p.label })
27
31
  ] }),
28
- i === p.FACTOID ? /* @__PURE__ */ r(a, { ...c, action: e }) : /* @__PURE__ */ r(A, { children: o == null ? void 0 : o.title }),
29
- i !== p.FACTOID && /* @__PURE__ */ r(D, { onClick: e, children: "Answer" })
32
+ o === i.FACTOID && /* @__PURE__ */ r(f, { ...c, action: t }),
33
+ o === i.TWEET && // ToDo: connect with real Api data
34
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
35
+ // @ts-ignore
36
+ /* @__PURE__ */ r(x, { ...l, action: t }),
37
+ o !== i.FACTOID && o !== i.TWEET && /* @__PURE__ */ e(a, { children: [
38
+ /* @__PURE__ */ r(W, { children: m == null ? void 0 : m.title }),
39
+ /* @__PURE__ */ r(w, { onClick: t, children: "Answer" })
40
+ ] })
30
41
  ] }) : null;
31
42
  };
32
43
  export {
33
- W as Notification
44
+ L as Notification
34
45
  };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { Notification } from '@streamlayer/sdk-web-notifications';
3
+ import { TwitterContentProps } from '../../../../questions/twitter';
4
+ export declare const Tweet: React.FC<TwitterContentProps & {
5
+ action: Notification['action'];
6
+ }>;
@@ -0,0 +1,25 @@
1
+ import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
+ import { Account as m } from "../../../../questions/twitter/account/index.js";
3
+ import { Container as p, QuoteWrap as l, Quote as d, Details as h, Body as s, Image as u, ActionBtn as f } from "./styles.js";
4
+ import "../../../../icons/index.js";
5
+ import "@linaria/react";
6
+ import "react";
7
+ import "../../../../questions/twitter/account/styles.js";
8
+ const Q = ({
9
+ account: i,
10
+ body: n,
11
+ image: o,
12
+ title: c,
13
+ action: t
14
+ }) => /* @__PURE__ */ e(p, { children: [
15
+ /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(d, { children: c }) }),
16
+ /* @__PURE__ */ e(h, { children: [
17
+ /* @__PURE__ */ r(m, { ...i }),
18
+ /* @__PURE__ */ r(s, { children: n }),
19
+ o && /* @__PURE__ */ r(u, { src: o })
20
+ ] }),
21
+ t && /* @__PURE__ */ r(f, { onClick: t, children: "View Tweet" })
22
+ ] });
23
+ export {
24
+ Q as Tweet
25
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const Container: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const ActionBtn: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
4
+ export declare const Body: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const Image: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
6
+ export declare const Details: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
+ export declare const QuoteWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
8
+ export declare const Quote: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLQuoteElement> & import("react").BlockquoteHTMLAttributes<HTMLQuoteElement> & Record<never, unknown>>;
@@ -0,0 +1,68 @@
1
+ import { styled as o } from "@linaria/react";
2
+ const t = o.div`
3
+ box-sizing: border-box;
4
+ background-color: var(--color-neutrals-white);
5
+ border-radius: 8px;
6
+ width: 100%;
7
+ `, e = o.button`
8
+ border: none;
9
+ outline: none;
10
+ background-color: var(--color-primary-green1);
11
+ color: var(--color-white);
12
+ border-radius: 40px;
13
+ display: flex;
14
+ justify-content: center;
15
+ align-items: center;
16
+ font-size: 14px;
17
+ font-weight: 550;
18
+ width: 100%;
19
+ padding: 0px 16px;
20
+ height: 44px;
21
+
22
+ &:hover {
23
+ background-color: var(--color-primary-green2);
24
+ cursor: pointer;
25
+ }
26
+ `, i = o.div`
27
+ color: var(--color-neutrals-gray9);
28
+ font-size: 12px;
29
+ font-weight: var(--font-weight-default);
30
+ line-height: 18px;
31
+ `, n = o.img`
32
+ max-width: 100%;
33
+ border-radius: 8px;
34
+ `, a = o.div`
35
+ display: flex;
36
+ flex-direction: column;
37
+ row-gap: 12px;
38
+ color: var(--color-neutrals-gray9);
39
+ font-weight: var(--font-weight-default);
40
+ margin-bottom: 16px;
41
+ `, l = o.div`
42
+ padding-bottom: 12px;
43
+ border-bottom: 0.7px solid var(--color-neutrals-gray3);
44
+ margin-bottom: 12px;
45
+ `, d = o.blockquote`
46
+ padding: 0px 24px 0px 12px;
47
+ color: var(--color-primary-green2);
48
+ border-left: 2px solid var(--color-primary-green2);
49
+ font-size: 12px;
50
+ font-family: var(--font-serif);
51
+ font-weight: var(--font-weight-default);
52
+ display: -webkit-box;
53
+ -webkit-box-orient: vertical;
54
+ -webkit-line-clamp: 2;
55
+ overflow: hidden;
56
+ word-break: break-word;
57
+ text-overflow: ellipsis;
58
+ max-height: 32px;
59
+ `;
60
+ export {
61
+ e as ActionBtn,
62
+ i as Body,
63
+ t as Container,
64
+ a as Details,
65
+ n as Image,
66
+ d as Quote,
67
+ l as QuoteWrap
68
+ };
@@ -9,6 +9,6 @@ export interface UserStatisticsProps {
9
9
  correct?: number;
10
10
  incorrect?: number;
11
11
  inTop?: number;
12
- average?: number;
12
+ successRate?: number;
13
13
  }
14
14
  export declare const UserStatistics: React.FC<UserStatisticsProps>;
@@ -16,7 +16,7 @@ const m = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXd
16
16
  correct: u,
17
17
  incorrect: x,
18
18
  inTop: i,
19
- average: O
19
+ successRate: O
20
20
  }) => /* @__PURE__ */ N(k, { children: [
21
21
  /* @__PURE__ */ M(E, { children: /* @__PURE__ */ N(Q, { children: [
22
22
  /* @__PURE__ */ N(Y, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.64.1",
3
+ "version": "0.65.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -36,14 +36,14 @@
36
36
  "react-window": "^1.8.9",
37
37
  "@lottiefiles/react-lottie-player": "*",
38
38
  "react-window-infinite-loader": "^1.0.9",
39
- "@streamlayer/feature-gamification": "^0.25.0",
40
- "@streamlayer/sdk-web": "^0.28.21",
41
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.16",
39
+ "@streamlayer/feature-gamification": "^0.26.0",
40
+ "@streamlayer/sdk-web": "^0.28.22",
41
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.17",
42
42
  "@streamlayer/sdk-web-api": "^0.0.1",
43
43
  "@streamlayer/sdk-web-core": "^0.17.8",
44
- "@streamlayer/sdk-web-features": "^0.10.24",
44
+ "@streamlayer/sdk-web-features": "^0.10.25",
45
45
  "@streamlayer/sdk-web-interfaces": "^0.18.15",
46
- "@streamlayer/sdk-web-notifications": "^0.12.1",
46
+ "@streamlayer/sdk-web-notifications": "^0.13.0",
47
47
  "@streamlayer/sdk-web-storage": "^0.0.4",
48
48
  "@streamlayer/sdk-web-types": "^0.20.1"
49
49
  },
@@ -84,6 +84,6 @@
84
84
  "vite-plugin-svgr": "^4.1.0",
85
85
  "vite-svg-loader": "^4.0.0",
86
86
  "vite-tsconfig-paths": "^4.2.1",
87
- "@streamlayer/react": "^0.29.6"
87
+ "@streamlayer/react": "^0.29.8"
88
88
  }
89
89
  }