@streamlayer/react 0.26.3 → 0.27.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.
@@ -0,0 +1,245 @@
1
+ import { jsxs as a, jsx as n, Fragment as x } from "react/jsx-runtime";
2
+ import { s as t, q as p, o as I, Y as w, j as Q, d as k, v as b, e as d, g as y, i as $, k as f, r as _ } from "./index-ad42babc.js";
3
+ import { useStore as r } from "@nanostores/react";
4
+ import { useRef as j, useState as m } from "react";
5
+ import { QuestionType as q } from "@streamlayer/sdk-web-types";
6
+ import "react-countdown-circle-timer";
7
+ import "./es/useStreamLayerApp.js";
8
+ import "@streamlayer/sdk-web";
9
+ import "@streamlayer/sdk-web-interfaces";
10
+ import "@streamlayer/sdk-web-features";
11
+ import "@streamlayer/sdk-web-api";
12
+ import "@streamlayer/sdk-web-storage";
13
+ import "@streamlayer/sdk-web-notifications";
14
+ import "@streamlayer/sl-eslib/interactive/interactive.common_pb";
15
+ import "@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb";
16
+ import "@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb";
17
+ import "@streamlayer/sl-eslib/sports/events/events_connect";
18
+ import "@streamlayer/sl-eslib/sdkSettings/client/client_connect";
19
+ import "@streamlayer/sl-eslib/users/users_connect";
20
+ import "react-auth-code-input";
21
+ import "react-phone-number-input";
22
+ import "@connectrpc/connect";
23
+ import "@connectrpc/connect-web";
24
+ const N = () => p, S = () => p, E = /* @__PURE__ */ t("div")({
25
+ name: "a",
26
+ class: "acysrl1",
27
+ propsAsIs: !1
28
+ }), L = /* @__PURE__ */ t("div")({
29
+ name: "l",
30
+ class: "lo57cjm",
31
+ propsAsIs: !1
32
+ }), U = /* @__PURE__ */ t(N())({
33
+ name: "p",
34
+ class: "p14kwh4y",
35
+ propsAsIs: !0
36
+ }), M = /* @__PURE__ */ t("span")({
37
+ name: "s",
38
+ class: "sxun7sq",
39
+ propsAsIs: !1
40
+ }), O = /* @__PURE__ */ t("button")({
41
+ name: "c",
42
+ class: "c1i8ida8",
43
+ propsAsIs: !1
44
+ }), D = /* @__PURE__ */ t(S())({
45
+ name: "g",
46
+ class: "g1m0xfmw",
47
+ propsAsIs: !0
48
+ }), g = ({ type: s, close: e, label: o }) => {
49
+ const i = s ? I[s] : { label: o, iconName: void 0 };
50
+ return /* @__PURE__ */ a(E, { children: [
51
+ /* @__PURE__ */ a(L, { children: [
52
+ (i == null ? void 0 : i.iconName) && /* @__PURE__ */ n(U, { name: i.iconName }),
53
+ (i == null ? void 0 : i.label) && /* @__PURE__ */ n(M, { children: i.label })
54
+ ] }),
55
+ /* @__PURE__ */ n(O, { onClick: e, children: /* @__PURE__ */ n(D, { name: "icon-cross" }) })
56
+ ] });
57
+ };
58
+ const H = /* @__PURE__ */ t("div")({
59
+ name: "n",
60
+ class: "n1aopxp8",
61
+ propsAsIs: !1
62
+ }), R = ({
63
+ children: s,
64
+ style: e,
65
+ className: o
66
+ }) => /* @__PURE__ */ n(H, {
67
+ style: e,
68
+ className: o,
69
+ children: s
70
+ });
71
+ const F = /* @__PURE__ */ t("div")({
72
+ name: "i",
73
+ class: "i1bwjtdb",
74
+ propsAsIs: !1
75
+ }), T = /* @__PURE__ */ t("video")({
76
+ name: "e",
77
+ class: "enb7moc",
78
+ propsAsIs: !1
79
+ }), B = /* @__PURE__ */ t("img")({
80
+ name: "r",
81
+ class: "r1ws5lyh",
82
+ propsAsIs: !1
83
+ }), C = /* @__PURE__ */ t("div")({
84
+ name: "s",
85
+ class: "soibf55",
86
+ propsAsIs: !1
87
+ }), P = ({ poster: s, source: e }) => {
88
+ const o = j(null), [i, c] = m(!1), [u, v] = m(!0);
89
+ return /* @__PURE__ */ a(F, { onClick: () => {
90
+ const l = o == null ? void 0 : o.current;
91
+ l && c((A) => A ? (l.pause(), !1) : (l.play(), v(!1), !0));
92
+ }, children: [
93
+ /* @__PURE__ */ n(
94
+ T,
95
+ {
96
+ ref: o,
97
+ src: e,
98
+ onEnded: () => {
99
+ var l;
100
+ (l = o == null ? void 0 : o.current) == null || l.load(), c(!1), v(!0);
101
+ },
102
+ style: { visibility: u ? "hidden" : "visible" }
103
+ }
104
+ ),
105
+ /* @__PURE__ */ n(B, { src: s, style: { visibility: u ? "visible" : "hidden" } }),
106
+ /* @__PURE__ */ n(C, { children: !i && /* @__PURE__ */ n(p, { name: "icon-play" }) })
107
+ ] });
108
+ };
109
+ const G = /* @__PURE__ */ t("div")({
110
+ name: "t",
111
+ class: "t18unvw4",
112
+ propsAsIs: !1
113
+ }), J = /* @__PURE__ */ t("div")({
114
+ name: "r",
115
+ class: "rs0uvk8",
116
+ propsAsIs: !1
117
+ }), V = /* @__PURE__ */ t("h3")({
118
+ name: "n",
119
+ class: "n1hem4g7",
120
+ propsAsIs: !1
121
+ }), Y = /* @__PURE__ */ t("div")({
122
+ name: "i",
123
+ class: "i193lbwv",
124
+ propsAsIs: !1
125
+ }), z = /* @__PURE__ */ t("a")({
126
+ name: "a",
127
+ class: "a1dka9qs",
128
+ propsAsIs: !1
129
+ }), K = ({ title: s, instantView: e }) => /* @__PURE__ */ a(G, { children: [
130
+ (e == null ? void 0 : e.video) && /* @__PURE__ */ n(P, { source: e.video.url, poster: e.video.thumbnailUrl }),
131
+ /* @__PURE__ */ a(J, { children: [
132
+ /* @__PURE__ */ n(V, { children: (e == null ? void 0 : e.heading) || s }),
133
+ /* @__PURE__ */ n(Y, { children: e == null ? void 0 : e.body }),
134
+ (e == null ? void 0 : e.webLink) && /* @__PURE__ */ a(z, { href: "webLink", target: "_blank", children: [
135
+ "Explore more of the Masters History",
136
+ /* @__PURE__ */ n(p, { name: "icon-external-link" })
137
+ ] })
138
+ ] })
139
+ ] });
140
+ const W = /* @__PURE__ */ t("div")({
141
+ name: "d",
142
+ class: "dk8r1eq",
143
+ propsAsIs: !1
144
+ }), X = ({
145
+ openedQuestion: s
146
+ }) => {
147
+ var e;
148
+ return ((e = s == null ? void 0 : s.attributes) == null ? void 0 : e.attributes.case) === "insight" ? /* @__PURE__ */ n(K, {
149
+ ...s.attributes.attributes.value
150
+ }) : null;
151
+ }, Z = ({
152
+ extendedQuestion: s,
153
+ vote: e
154
+ }) => {
155
+ const {
156
+ loading: o,
157
+ data: i
158
+ } = s;
159
+ return !o && i ? /* @__PURE__ */ n(w, {
160
+ vote: e,
161
+ openedQuestion: i
162
+ }) : null;
163
+ }, ee = ({
164
+ gamification: s
165
+ }) => {
166
+ var e;
167
+ const o = r(s.openedQuestion.$store), i = r(s.openedQuestion.$extendedStore);
168
+ if (!o)
169
+ return null;
170
+ const c = o.type;
171
+ return /* @__PURE__ */ a(W, {
172
+ children: [/* @__PURE__ */ n(g, {
173
+ close: s.closeQuestion,
174
+ type: ((e = o.attributes) == null ? void 0 : e.type) || q.UNSET
175
+ }), c === "question" && /* @__PURE__ */ n(Z, {
176
+ vote: s.submitAnswer,
177
+ extendedQuestion: i
178
+ }), c !== "question" && /* @__PURE__ */ n(X, {
179
+ openedQuestion: o
180
+ })]
181
+ });
182
+ }, se = ({ leaderboardList: s, openUser: e }) => {
183
+ const { data: o } = r(s.$store);
184
+ return /* @__PURE__ */ n(Q, { fetchMore: s.fetchMore, items: o, openItemDetail: e });
185
+ }, ne = ({ store: s, openQuestion: e }) => {
186
+ const o = r(s);
187
+ return o != null && o.data ? /* @__PURE__ */ n(k, { openQuestion: e, questions: o.data }) : /* @__PURE__ */ n("div", { children: "wait questions..." });
188
+ }, oe = ({ store: s }) => {
189
+ const { data: e } = r(s);
190
+ return e != null && e.summary ? /* @__PURE__ */ n(b, { ...e.summary, ...e.percentage }) : /* @__PURE__ */ n("div", { children: "wait user..." });
191
+ }, te = ({ gamification: s }) => {
192
+ const [e, o] = m(d.HOME);
193
+ return /* @__PURE__ */ a("div", { style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
194
+ /* @__PURE__ */ a(y, { children: [
195
+ /* @__PURE__ */ n($, { activePage: e, toggleActivePage: o }),
196
+ e === d.HOME && /* @__PURE__ */ n(oe, { store: s.userSummary.getStore() })
197
+ ] }),
198
+ e === d.HOME && /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n(ne, { openQuestion: s.openQuestion, store: s.feedList.getStore() }) }),
199
+ e === d.LEADERBOARD && /* @__PURE__ */ n(f, { style: { flex: "1 1 auto", paddingTop: 0, paddingBottom: 0 }, children: /* @__PURE__ */ n(se, { openUser: s.openUser, leaderboardList: s.leaderboardList }) })
200
+ ] });
201
+ };
202
+ const ie = () => R, h = /* @__PURE__ */ t(ie())({
203
+ name: "m",
204
+ class: "m1ph66cs",
205
+ propsAsIs: !0
206
+ }), ae = /* @__PURE__ */ t("div")({
207
+ name: "x",
208
+ class: "xorme7i",
209
+ propsAsIs: !1
210
+ }), Ne = ({
211
+ gamification: s,
212
+ className: e
213
+ }) => {
214
+ const o = r(s.openedQuestion.$store), i = r(s.openedUser);
215
+ return /* @__PURE__ */ a(x, {
216
+ children: [o && /* @__PURE__ */ n(h, {
217
+ className: e,
218
+ children: /* @__PURE__ */ n(ee, {
219
+ gamification: s
220
+ })
221
+ }), i && /* @__PURE__ */ n(h, {
222
+ className: e,
223
+ children: /* @__PURE__ */ a(ae, {
224
+ children: [/* @__PURE__ */ n(g, {
225
+ label: "Friend's Rank",
226
+ close: s.closeUser
227
+ }), /* @__PURE__ */ n(y, {
228
+ children: /* @__PURE__ */ n(b, {
229
+ ...i
230
+ })
231
+ })]
232
+ })
233
+ }), /* @__PURE__ */ n(_, {
234
+ className: e,
235
+ "data-nav": "true",
236
+ children: /* @__PURE__ */ n(te, {
237
+ gamification: s
238
+ })
239
+ })]
240
+ });
241
+ };
242
+ export {
243
+ Ne as GamificationOverlay,
244
+ Ne as default
245
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-e9cf1c5b.cjs"),i=require("@nanostores/react"),d=require("react"),j=require("@streamlayer/sdk-web-types");require("react-countdown-circle-timer");require("./cjs/useStreamLayerApp.js");require("@streamlayer/sdk-web");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-features");require("@streamlayer/sdk-web-api");require("@streamlayer/sdk-web-storage");require("@streamlayer/sdk-web-notifications");require("@streamlayer/sl-eslib/interactive/interactive.common_pb");require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb");require("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb");require("@streamlayer/sl-eslib/sports/events/events_connect");require("@streamlayer/sl-eslib/sdkSettings/client/client_connect");require("@streamlayer/sl-eslib/users/users_connect");require("react-auth-code-input");require("react-phone-number-input");require("@connectrpc/connect");require("@connectrpc/connect-web");const y=()=>t.q,v=()=>t.q,h=t.styled_default("div")({name:"a",class:"acysrl1",propsAsIs:!1}),q=t.styled_default("div")({name:"l",class:"lo57cjm",propsAsIs:!1}),b=t.styled_default(y())({name:"p",class:"p14kwh4y",propsAsIs:!0}),_=t.styled_default("span")({name:"s",class:"sxun7sq",propsAsIs:!1}),g=t.styled_default("button")({name:"c",class:"c1i8ida8",propsAsIs:!1}),A=t.styled_default(v())({name:"g",class:"g1m0xfmw",propsAsIs:!0}),x=({type:n,close:s,label:l})=>{const r=n?t.o[n]:{label:l,iconName:void 0};return e.jsxs(h,{children:[e.jsxs(q,{children:[(r==null?void 0:r.iconName)&&e.jsx(b,{name:r.iconName}),(r==null?void 0:r.label)&&e.jsx(_,{children:r.label})]}),e.jsx(g,{onClick:s,children:e.jsx(A,{name:"icon-cross"})})]})};const I=t.styled_default("div")({name:"n",class:"n1aopxp8",propsAsIs:!1}),S=({children:n,style:s,className:l})=>e.jsx(I,{style:s,className:l,children:n});const w=t.styled_default("div")({name:"i",class:"i1bwjtdb",propsAsIs:!1}),Q=t.styled_default("video")({name:"e",class:"enb7moc",propsAsIs:!1}),k=t.styled_default("img")({name:"r",class:"r1ws5lyh",propsAsIs:!1}),N=t.styled_default("div")({name:"s",class:"soibf55",propsAsIs:!1}),$=({poster:n,source:s})=>{const l=d.useRef(null),[r,o]=d.useState(!1),[u,c]=d.useState(!0);return e.jsxs(w,{onClick:()=>{const a=l==null?void 0:l.current;a&&o(f=>f?(a.pause(),!1):(a.play(),c(!1),!0))},children:[e.jsx(Q,{ref:l,src:s,onEnded:()=>{var a;(a=l==null?void 0:l.current)==null||a.load(),o(!1),c(!0)},style:{visibility:u?"hidden":"visible"}}),e.jsx(k,{src:n,style:{visibility:u?"visible":"hidden"}}),e.jsx(N,{children:!r&&e.jsx(t.q,{name:"icon-play"})})]})};const E=t.styled_default("div")({name:"t",class:"t18unvw4",propsAsIs:!1}),L=t.styled_default("div")({name:"r",class:"rs0uvk8",propsAsIs:!1}),M=t.styled_default("h3")({name:"n",class:"n1hem4g7",propsAsIs:!1}),U=t.styled_default("div")({name:"i",class:"i193lbwv",propsAsIs:!1}),O=t.styled_default("a")({name:"a",class:"a1dka9qs",propsAsIs:!1}),R=({title:n,instantView:s})=>e.jsxs(E,{children:[(s==null?void 0:s.video)&&e.jsx($,{source:s.video.url,poster:s.video.thumbnailUrl}),e.jsxs(L,{children:[e.jsx(M,{children:(s==null?void 0:s.heading)||n}),e.jsx(U,{children:s==null?void 0:s.body}),(s==null?void 0:s.webLink)&&e.jsxs(O,{href:"webLink",target:"_blank",children:["Explore more of the Masters History",e.jsx(t.q,{name:"icon-external-link"})]})]})]});const T=t.styled_default("div")({name:"d",class:"dk8r1eq",propsAsIs:!1}),D=({openedQuestion:n})=>{var s;return((s=n==null?void 0:n.attributes)==null?void 0:s.attributes.case)==="insight"?e.jsx(R,{...n.attributes.attributes.value}):null},H=({extendedQuestion:n,vote:s})=>{const{loading:l,data:r}=n;return!l&&r?e.jsx(t.Y,{vote:s,openedQuestion:r}):null},F=({gamification:n})=>{var s;const l=i.useStore(n.openedQuestion.$store),r=i.useStore(n.openedQuestion.$extendedStore);if(!l)return null;const o=l.type;return e.jsxs(T,{children:[e.jsx(x,{close:n.closeQuestion,type:((s=l.attributes)==null?void 0:s.type)||j.QuestionType.UNSET}),o==="question"&&e.jsx(H,{vote:n.submitAnswer,extendedQuestion:r}),o!=="question"&&e.jsx(D,{openedQuestion:l})]})},P=({leaderboardList:n,openUser:s})=>{const{data:l}=i.useStore(n.$store);return e.jsx(t.j,{fetchMore:n.fetchMore,items:l,openItemDetail:s})},B=({store:n,openQuestion:s})=>{const l=i.useStore(n);return l!=null&&l.data?e.jsx(t.j$1,{openQuestion:s,questions:l.data}):e.jsx("div",{children:"wait questions..."})},C=({store:n})=>{const{data:s}=i.useStore(n);return s!=null&&s.summary?e.jsx(t.v,{...s.summary,...s.percentage}):e.jsx("div",{children:"wait user..."})},G=({gamification:n})=>{const[s,l]=d.useState(t.h.HOME);return e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs(t.e,{children:[e.jsx(t.p$1,{activePage:s,toggleActivePage:l}),s===t.h.HOME&&e.jsx(C,{store:n.userSummary.getStore()})]}),s===t.h.HOME&&e.jsx(t.a$1,{children:e.jsx(B,{openQuestion:n.openQuestion,store:n.feedList.getStore()})}),s===t.h.LEADERBOARD&&e.jsx(t.a$1,{style:{flex:"1 1 auto",paddingTop:0,paddingBottom:0},children:e.jsx(P,{openUser:n.openUser,leaderboardList:n.leaderboardList})})]})};const J=()=>S,p=t.styled_default(J())({name:"m",class:"m1ph66cs",propsAsIs:!0}),V=t.styled_default("div")({name:"x",class:"xorme7i",propsAsIs:!1}),m=({gamification:n,className:s})=>{const l=i.useStore(n.openedQuestion.$store),r=i.useStore(n.openedUser);return e.jsxs(e.Fragment,{children:[l&&e.jsx(p,{className:s,children:e.jsx(F,{gamification:n})}),r&&e.jsx(p,{className:s,children:e.jsxs(V,{children:[e.jsx(x,{label:"Friend's Rank",close:n.closeUser}),e.jsx(t.e,{children:e.jsx(t.v,{...r})})]})}),e.jsx(t.r,{className:s,"data-nav":"true",children:e.jsx(G,{gamification:n})})]})};exports.GamificationOverlay=m;exports.default=m;