@streamlayer/react 0.30.2 → 0.30.3

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.
@@ -171,7 +171,7 @@ declare module "../../sdk-web-interfaces/src/store/single" {
171
171
  export const createComputedStore: <Value, T extends WritableAtom<any> = WritableAtom<any>>(store: T, mutator: (value: StoreValue<T>) => Value) => import("nanostores").ReadableAtom<Value>;
172
172
  }
173
173
  declare module "../../sdk-web-interfaces/src/store/api" {
174
- import type { FetcherStore } from '@nanostores/query';
174
+ import type { FetcherStore, FetcherValue } from '@nanostores/query';
175
175
  import { WritableAtom } from 'nanostores';
176
176
  import { AbstractStore } from "../../sdk-web-interfaces/src/store/abstract";
177
177
  /**
@@ -179,7 +179,7 @@ declare module "../../sdk-web-interfaces/src/store/api" {
179
179
  */
180
180
  export class ApiStore<StoreValue, StoreInstance extends FetcherStore<StoreValue, any> = FetcherStore<StoreValue, any>> extends AbstractStore<StoreInstance> {
181
181
  private readonly atomStore;
182
- constructor(store: StoreInstance, name: string, atomPicker?: (val?: StoreInstance['value']) => string | undefined);
182
+ constructor(store: StoreInstance, name: string, atomPicker?: (val: FetcherValue<StoreValue, unknown>, prevVal?: string) => string | undefined);
183
183
  getAtomStore: () => WritableAtom<string | undefined>;
184
184
  getValue: () => Promise<StoreValue | undefined>;
185
185
  getValues: () => never;
@@ -1492,6 +1492,11 @@ declare module "../../sdk-web/src/index" {
1492
1492
  }
1493
1493
  declare module "app/useStreamLayerApp" {
1494
1494
  import type { StreamLayerSDK, StreamLayerPlugin } from '../../sdk-web-interfaces/src/index.ts';
1495
+ global {
1496
+ interface Window {
1497
+ sl: unknown;
1498
+ }
1499
+ }
1495
1500
  export const useStreamLayerApp: (sdkKey: string, plugins?: Set<StreamLayerPlugin>, production?: boolean, autoEnable?: boolean) => StreamLayerSDK | null;
1496
1501
  }
1497
1502
  declare module "app/provider" {
@@ -2,13 +2,13 @@ import { jsx as c, jsxs as I, Fragment as me } from "react/jsx-runtime";
2
2
  import { d as Ke, S as Mt, a as qt, b as jt, s as Gt } from "./index2.js";
3
3
  import { lazy as Wt, useMemo as Ne, Suspense as Ht, useRef as dt, useState as K, useEffect as he, Component as Yt, createElement as Vt, useCallback as pt, useContext as Qt } from "react";
4
4
  import { FeatureType as Re, QuestionType as q } from "@streamlayer/sdk-web-types";
5
- import { useStore as ee } from "@nanostores/react";
5
+ import { useStore as Z } from "@nanostores/react";
6
6
  import { FeatureStatus as pe } from "@streamlayer/sdk-web-interfaces";
7
7
  import { s as h, i as z, c as Kt } from "./index3.js";
8
8
  import { NotificationType as ye } from "@streamlayer/sdk-web-notifications";
9
9
  import { Player as Xt } from "@lottiefiles/react-lottie-player";
10
10
  const Jt = ({ feature: s, sdk: o, children: l, className: d }) => {
11
- const m = ee(s.status), g = ee(o.sdkStore.slStreamId);
11
+ const m = Z(s.status), g = Z(o.sdkStore.slStreamId);
12
12
  return g != null && g.loading ? /* @__PURE__ */ c("div", { className: d, children: "event is loading..." }) : g != null && g.data ? m !== pe.Ready ? /* @__PURE__ */ c("div", { className: d, children: "wait feature..." }) : l : /* @__PURE__ */ c("div", { className: d, children: "event is forbidden..." });
13
13
  }, Zt = Wt(() => import("./gamification-feature.js")), er = ({
14
14
  sdk: s,
@@ -57,7 +57,7 @@ const Jt = ({ feature: s, sdk: o, children: l, className: d }) => {
57
57
  name: "ButtonIcon",
58
58
  class: "b11des7c",
59
59
  propsAsIs: !0
60
- }), Z = "featuredGroups", cr = (s) => {
60
+ }), ee = "featuredGroups", cr = (s) => {
61
61
  var o;
62
62
  return /* @__PURE__ */ c(Ue, {
63
63
  ...s,
@@ -102,10 +102,10 @@ const Jt = ({ feature: s, sdk: o, children: l, className: d }) => {
102
102
  /* @__PURE__ */ c(
103
103
  cr,
104
104
  {
105
- active: s === Z,
105
+ active: s === ee,
106
106
  disabled: !l,
107
107
  onClick: () => {
108
- o(Z);
108
+ o(ee);
109
109
  }
110
110
  }
111
111
  ),
@@ -2191,7 +2191,7 @@ const Mi = ({
2191
2191
  var f, n, w, v, E, C;
2192
2192
  const {
2193
2193
  data: y
2194
- } = ee(o.$store);
2194
+ } = Z(o.$store);
2195
2195
  return /* @__PURE__ */ c(Qn, {
2196
2196
  hiding: s,
2197
2197
  children: /* @__PURE__ */ c(Nn, {
@@ -2272,7 +2272,7 @@ const Mi = ({
2272
2272
  class: "ctckejh",
2273
2273
  propsAsIs: !0
2274
2274
  }), Zn = ({ sdk: s }) => {
2275
- const o = s.getNotificationsStore(), l = ee(o), d = Ne(() => {
2275
+ const o = s.getNotificationsStore(), l = Z(o), d = Ne(() => {
2276
2276
  if (!(l != null && l.size))
2277
2277
  return null;
2278
2278
  for (const m of l.values())
@@ -2306,14 +2306,14 @@ const Mi = ({
2306
2306
  class: "s1oe3036",
2307
2307
  propsAsIs: !0
2308
2308
  }), is = (s) => {
2309
- const o = dt(""), [l, d] = K(!1), m = ee(s.status), g = ee(s.userId()), f = m === "ready", [n, w] = K(Z), v = pt(
2309
+ const o = dt(""), [l, d] = K(!1), m = Z(s.status), g = Z(s.userId()), f = m === "ready", [n, w] = K(ee), v = pt(
2310
2310
  (y, x) => {
2311
- w(x), x === Z ? (y && s.createEventSession(y), s.openFeature(Re.GAMES)) : s.closeFeature();
2311
+ w(x), x === ee ? (y && s.createEventSession(y), s.openFeature(Re.GAMES)) : s.closeFeature();
2312
2312
  },
2313
2313
  [s]
2314
2314
  );
2315
2315
  he(() => {
2316
- !f && n === Z && (w(ce), s.closeFeature());
2316
+ !f && n === ee && (w(ce), s.closeFeature());
2317
2317
  }, [f, n, s]);
2318
2318
  const E = (y) => {
2319
2319
  o.current = y, s.initializeApp().then(({ enabled: x, err: A }) => {
@@ -2324,7 +2324,7 @@ const Mi = ({
2324
2324
  if (x) {
2325
2325
  s.isUserAuthorized().then((B) => {
2326
2326
  if (B) {
2327
- v(y, Z);
2327
+ v(y, ee);
2328
2328
  return;
2329
2329
  } else
2330
2330
  s.disableApp();
@@ -2337,7 +2337,7 @@ const Mi = ({
2337
2337
  };
2338
2338
  return he(() => {
2339
2339
  if (!g) {
2340
- f && n === Z && (w(ce), s.disableApp());
2340
+ f && (w(ce), s.disableApp());
2341
2341
  return;
2342
2342
  }
2343
2343
  g && o.current && l && s.initializeApp().then(() => {
@@ -2353,7 +2353,7 @@ const Mi = ({
2353
2353
  isLogged: !!g
2354
2354
  };
2355
2355
  }, ns = (s) => {
2356
- const o = ee(s.getActiveFeature()), l = ee(s.streamStore()), [d, m] = K(null);
2356
+ const o = Z(s.getActiveFeature()), l = Z(s.streamStore()), [d, m] = K(null);
2357
2357
  return he(() => {
2358
2358
  const g = s.getFeatures();
2359
2359
  if (o)
@@ -2403,7 +2403,7 @@ const Mi = ({
2403
2403
  children: o && g === xe && o[g]
2404
2404
  }
2405
2405
  ),
2406
- m && g === Z && /* @__PURE__ */ c(ss, { className: Ke, sdk: s }),
2406
+ m && g === ee && /* @__PURE__ */ c(ss, { className: Ke, sdk: s }),
2407
2407
  !v && /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "You are not logged in." })
2408
2408
  ] });
2409
2409
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react",
3
- "version": "0.30.2",
3
+ "version": "0.30.3",
4
4
  "type": "module",
5
5
  "author": "StreamLayer, Inc (https://streamlayer.io)",
6
6
  "maintainers": [
@@ -54,14 +54,14 @@
54
54
  }
55
55
  ],
56
56
  "dependencies": {
57
- "@streamlayer/feature-gamification": "^0.26.2",
58
- "@streamlayer/sdk-web": "^0.28.24",
57
+ "@streamlayer/sdk-web": "^0.28.25",
58
+ "@streamlayer/feature-gamification": "^0.26.3",
59
59
  "@streamlayer/sdk-web-api": "^0.0.1",
60
- "@streamlayer/sdk-web-core": "^0.0.1",
61
- "@streamlayer/sdk-web-features": "^0.10.27",
60
+ "@streamlayer/sdk-web-core": "^0.0.2",
61
+ "@streamlayer/sdk-web-features": "^0.10.28",
62
+ "@streamlayer/sdk-web-interfaces": "^0.0.1",
62
63
  "@streamlayer/sdk-web-logger": "^0.0.4",
63
- "@streamlayer/sdk-web-interfaces": "^0.18.15",
64
- "@streamlayer/sdk-web-notifications": "^0.13.1",
64
+ "@streamlayer/sdk-web-notifications": "^0.13.2",
65
65
  "@streamlayer/sdk-web-storage": "^0.0.4",
66
66
  "@streamlayer/sdk-web-types": "^0.0.1"
67
67
  },
@@ -114,7 +114,7 @@
114
114
  "size-limit": "^11.0.0",
115
115
  "url-loader": "^4.1.1",
116
116
  "vite-plugin-dts": "^3.6.3",
117
- "@streamlayer/react-ui": "^0.67.2"
117
+ "@streamlayer/react-ui": "^0.67.3"
118
118
  },
119
119
  "scripts": {
120
120
  "size-limit": "size-limit"