@stream-io/video-react-native-sdk 0.0.1-alpha.147 → 0.0.1-alpha.149

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.1-alpha.149](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.148...@stream-io/video-react-native-sdk-0.0.1-alpha.149) (2023-06-12)
6
+
7
+
8
+ ### Features
9
+
10
+ * **react-native:** replace async storage with mmkv in dogfood app ([#630](https://github.com/GetStream/stream-video-js/issues/630)) ([fafcb01](https://github.com/GetStream/stream-video-js/commit/fafcb01c6ac7d71bf3ea8b532a9a6ef638df1fb8))
11
+
12
+
13
+
14
+ ## [0.0.1-alpha.148](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.147...@stream-io/video-react-native-sdk-0.0.1-alpha.148) (2023-06-12)
15
+
16
+
17
+ ### Features
18
+
19
+ * User connect and types ([#627](https://github.com/GetStream/stream-video-js/issues/627)) ([721ef61](https://github.com/GetStream/stream-video-js/commit/721ef611374540ef570a516009c78d58ce4f5360))
20
+
21
+
22
+
5
23
  ## [0.0.1-alpha.147](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.146...@stream-io/video-react-native-sdk-0.0.1-alpha.147) (2023-06-12)
6
24
 
7
25
 
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
- export default function createStoreContext<PassedStoreType extends object>(initialState: PassedStoreType): {
2
+ /**
3
+ * Creates a Atomic store context with a provider and hooks to access the store
4
+ * Atomic means that each value in the store updates state separately using useStoreValue hook
5
+ * Extremely minimalistic implementation of Jotai's store context
6
+ * @param initialState - the initial state of the store
7
+ * @returns - {Provider, useStoreValue, useStoreSetState}
8
+ */
9
+ export default function createStoreContext<StoreType extends object>(initialState: StoreType): {
3
10
  Provider: (props: React.PropsWithChildren<{}>) => JSX.Element;
4
- useStoreValue: <SelectorOutput extends (PassedStoreType & {
5
- isStoreInitialized: boolean;
6
- })[keyof PassedStoreType | "isStoreInitialized"]>(selector: (store: PassedStoreType & {
7
- isStoreInitialized: boolean;
8
- }) => SelectorOutput) => SelectorOutput;
9
- useStoreSetState: () => (partialStateOrFunc: Partial<PassedStoreType & {
10
- isStoreInitialized: boolean;
11
- }> | ((prevState: PassedStoreType & {
12
- isStoreInitialized: boolean;
13
- }) => Partial<PassedStoreType>)) => void;
11
+ useStoreValue: <SelectorOutput extends StoreType[keyof StoreType]>(selector: (store: StoreType) => SelectorOutput) => SelectorOutput;
12
+ useStoreSetState: () => (partialStateOrFunc: Partial<StoreType> | ((prevState: StoreType) => Partial<StoreType>)) => void;
14
13
  };
@@ -24,12 +24,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const react_1 = __importStar(require("react"));
27
+ /**
28
+ * Creates a Atomic store context with a provider and hooks to access the store
29
+ * Atomic means that each value in the store updates state separately using useStoreValue hook
30
+ * Extremely minimalistic implementation of Jotai's store context
31
+ * @param initialState - the initial state of the store
32
+ * @returns - {Provider, useStoreValue, useStoreSetState}
33
+ */
27
34
  function createStoreContext(initialState) {
28
35
  function useStoreData() {
29
- const storeRef = (0, react_1.useRef)({
30
- ...initialState,
31
- isStoreInitialized: false,
32
- });
36
+ const storeRef = (0, react_1.useRef)(initialState);
33
37
  const getSnapshot = (0, react_1.useRef)(() => storeRef.current).current;
34
38
  const subscribersRef = (0, react_1.useRef)([]);
35
39
  const setState = (0, react_1.useRef)((partialStateOrFunc) => {
@@ -1 +1 @@
1
- {"version":3,"file":"createStoreContext.js","sourceRoot":"","sources":["../../../../src/contexts/StreamVideoContext/createStoreContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAM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vGD,qCAuGC"}
@@ -21,10 +21,4 @@ export interface SDKStreamVideoStore {
21
21
  }
22
22
  export declare const StreamVideoStoreProvider: (props: {
23
23
  children?: import("react").ReactNode;
24
- }) => JSX.Element, useStreamVideoStoreValue: <SelectorOutput extends boolean | MediaDeviceInfo | MediaDeviceInfo[] | undefined>(selector: (store: SDKStreamVideoStore & {
25
- isStoreInitialized: boolean;
26
- }) => SelectorOutput) => SelectorOutput, useStreamVideoStoreSetState: () => (partialStateOrFunc: Partial<SDKStreamVideoStore & {
27
- isStoreInitialized: boolean;
28
- }> | ((prevState: SDKStreamVideoStore & {
29
- isStoreInitialized: boolean;
30
- }) => Partial<SDKStreamVideoStore>)) => void;
24
+ }) => JSX.Element, useStreamVideoStoreValue: <SelectorOutput extends boolean | MediaDeviceInfo | MediaDeviceInfo[] | undefined>(selector: (store: SDKStreamVideoStore) => SelectorOutput) => SelectorOutput, useStreamVideoStoreSetState: () => (partialStateOrFunc: Partial<SDKStreamVideoStore> | ((prevState: SDKStreamVideoStore) => Partial<SDKStreamVideoStore>)) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contexts/StreamVideoContext/index.tsx"],"names":[],"mappings":";;;;;;;AAAA,8EAAsD;AAwBzC,KAIT,IAAA,4BAAkB,EAAsB;IAC1C,yBAAyB,EAAE,KAAK;IAChC,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,EAAE;IAChB,kBAAkB,EAAE,SAAS;IAC7B,kBAAkB,EAAE,SAAS;CAC9B,CAAC,EAXU,gCAAwB,gBACnB,gCAAwB,qBACrB,mCAA2B,uBAS5C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contexts/StreamVideoContext/index.ts"],"names":[],"mappings":";;;;;;;AAAA,8EAAsD;AAwBzC,KAIT,IAAA,4BAAkB,EAAsB;IAC1C,yBAAyB,EAAE,KAAK;IAChC,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,EAAE;IAChB,kBAAkB,EAAE,SAAS;IAC7B,kBAAkB,EAAE,SAAS;CAC9B,CAAC,EAXU,gCAAwB,gBACnB,gCAAwB,qBACrB,mCAA2B,uBAS5C"}
@@ -30,4 +30,4 @@ export type StreamVideoClientInit = {
30
30
  *
31
31
  * @category Client State
32
32
  */
33
- export declare const useCreateStreamVideoClient: ({ apiKey, tokenOrProvider, user, options, isAnonymous, }: StreamVideoClientInit) => StreamVideoClient;
33
+ export declare const useCreateStreamVideoClient: ({ apiKey, tokenOrProvider, user, options, }: StreamVideoClientInit) => StreamVideoClient;
@@ -8,18 +8,11 @@ const react_1 = require("react");
8
8
  *
9
9
  * @category Client State
10
10
  */
11
- const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options, isAnonymous = false, }) => {
11
+ const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options, }) => {
12
12
  const [client] = (0, react_1.useState)(() => new video_client_1.StreamVideoClient(apiKey, options));
13
13
  const disconnectRef = (0, react_1.useRef)(Promise.resolve());
14
14
  (0, react_1.useEffect)(() => {
15
15
  const connectionPromise = disconnectRef.current.then(() => {
16
- if (isAnonymous) {
17
- return client
18
- .connectAnonymousUser(user, tokenOrProvider)
19
- .catch((err) => {
20
- console.error(`Failed to establish connection`, err);
21
- });
22
- }
23
16
  return client.connectUser(user, tokenOrProvider).catch((err) => {
24
17
  console.error(`Failed to establish connection`, err);
25
18
  });
@@ -33,7 +26,7 @@ const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options, is
33
26
  };
34
27
  // we want to re-run this effect only in some special cases
35
28
  // eslint-disable-next-line react-hooks/exhaustive-deps
36
- }, [apiKey, tokenOrProvider, client, isAnonymous, user?.id]);
29
+ }, [apiKey, tokenOrProvider, client, user?.id]);
37
30
  return client;
38
31
  };
39
32
  exports.useCreateStreamVideoClient = useCreateStreamVideoClient;
@@ -1 +1 @@
1
- {"version":3,"file":"useCreateStreamVideoClient.js","sourceRoot":"","sources":["../../../src/hooks/useCreateStreamVideoClient.tsx"],"names":[],"mappings":";;;AAAA,0DAKiC;AACjC,iCAAoD;AA6BpD;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,EACzC,MAAM,EACN,eAAe,EACf,IAAI,EACJ,OAAO,EACP,WAAW,GAAG,KAAK,GACG,EAAE,EAAE;IAC1B,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,gCAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,iBAAiB,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACxD,IAAI,WAAW,EAAE;gBACf,OAAO,MAAM;qBACV,oBAAoB,CAAC,IAAI,EAAE,eAAe,CAAC;qBAC3C,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACb,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;gBACvD,CAAC,CAAC,CAAC;aACN;YACD,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7D,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,OAAO,GAAG,iBAAiB;iBACtC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;iBACnC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,OAAO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AC,GAAG,EAAE,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,2DAA2D;QAC3D,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA5BW,QAAA,0BAA0B,8BA4BrC"}
package/package.json CHANGED
@@ -21,9 +21,9 @@
21
21
  "CHANGELOG.md"
22
22
  ],
23
23
  "dependencies": {
24
- "@stream-io/i18n": "^0.0.2",
25
- "@stream-io/video-client": "^0.0.9",
26
- "@stream-io/video-react-bindings": "^0.0.9"
24
+ "@stream-io/i18n": "^0.0.3",
25
+ "@stream-io/video-client": "^0.0.10",
26
+ "@stream-io/video-react-bindings": "^0.0.10"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@react-native-community/netinfo": ">=9.0.0",
@@ -66,5 +66,5 @@
66
66
  "typedoc-plugin-markdown": "^3.15.3",
67
67
  "typescript": "^4.9.5"
68
68
  },
69
- "version": "0.0.1-alpha.147"
69
+ "version": "0.0.1-alpha.149"
70
70
  }
@@ -6,29 +6,31 @@ import React, {
6
6
  useState,
7
7
  } from 'react';
8
8
 
9
- export default function createStoreContext<PassedStoreType extends object>(
10
- initialState: PassedStoreType,
9
+ /**
10
+ * Creates a Atomic store context with a provider and hooks to access the store
11
+ * Atomic means that each value in the store updates state separately using useStoreValue hook
12
+ * Extremely minimalistic implementation of Jotai's store context
13
+ * @param initialState - the initial state of the store
14
+ * @returns - {Provider, useStoreValue, useStoreSetState}
15
+ */
16
+ export default function createStoreContext<StoreType extends object>(
17
+ initialState: StoreType,
11
18
  ) {
12
19
  type SetStateFuncType = (
13
20
  partialStateOrFunc:
14
21
  | Partial<StoreType>
15
- | ((prevState: StoreType) => Partial<PassedStoreType>),
22
+ | ((prevState: StoreType) => Partial<StoreType>),
16
23
  ) => void;
17
24
 
18
25
  // returns unsubscribe function
19
26
  type SubscribeFunc = (callback: () => void) => () => void;
20
27
 
21
- type StoreType = PassedStoreType & { isStoreInitialized: boolean };
22
-
23
28
  function useStoreData(): {
24
29
  getSnapshot: () => StoreType;
25
30
  setState: SetStateFuncType;
26
31
  subscribe: SubscribeFunc;
27
32
  } {
28
- const storeRef = useRef<StoreType>({
29
- ...initialState,
30
- isStoreInitialized: false,
31
- });
33
+ const storeRef = useRef<StoreType>(initialState);
32
34
 
33
35
  const getSnapshot = useRef(() => storeRef.current).current;
34
36
 
@@ -43,20 +43,12 @@ export const useCreateStreamVideoClient = ({
43
43
  tokenOrProvider,
44
44
  user,
45
45
  options,
46
- isAnonymous = false,
47
46
  }: StreamVideoClientInit) => {
48
47
  const [client] = useState(() => new StreamVideoClient(apiKey, options));
49
48
 
50
49
  const disconnectRef = useRef(Promise.resolve());
51
50
  useEffect(() => {
52
51
  const connectionPromise = disconnectRef.current.then(() => {
53
- if (isAnonymous) {
54
- return client
55
- .connectAnonymousUser(user, tokenOrProvider)
56
- .catch((err) => {
57
- console.error(`Failed to establish connection`, err);
58
- });
59
- }
60
52
  return client.connectUser(user, tokenOrProvider).catch((err) => {
61
53
  console.error(`Failed to establish connection`, err);
62
54
  });
@@ -71,7 +63,7 @@ export const useCreateStreamVideoClient = ({
71
63
  };
72
64
  // we want to re-run this effect only in some special cases
73
65
  // eslint-disable-next-line react-hooks/exhaustive-deps
74
- }, [apiKey, tokenOrProvider, client, isAnonymous, user?.id]);
66
+ }, [apiKey, tokenOrProvider, client, user?.id]);
75
67
 
76
68
  return client;
77
69
  };