@stream-io/video-react-native-sdk 0.0.1-alpha.148 → 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,15 @@
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
+
5
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)
6
15
 
7
16
 
@@ -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,+CAMe;AAEf,SAAwB,kBAAkB,CACxC,YAA6B;IAa7B,SAAS,YAAY;QAKnB,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAY;YACjC,GAAG,YAAY;YACf,kBAAkB,EAAE,KAAK;SAC1B,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;QAE3D,M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QAAQ,CAAC,CACzB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,SAAS,aAAa,CACpB,QAA8C;QAE9C,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACpC;QAED,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAClE,IAAA,iBAAS,EACP,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EACpE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,SAAS,gBAAgB;QACvB,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACpC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,OAAO;QACL,QAAQ;QACR,aAAa;QACb,gBAAgB;KACjB,CAAC;AACJ,CAAC;AA5GD,qCA4GC"}
1
+ {"version":3,"file":"createStoreContext.js","sourceRoot":"","sources":["../../../../src/contexts/StreamVideoContext/createStoreContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAMe;AAEf;;;;;;GAMG;AACH,SAAwB,kBAAkB,CACxC,YAAuB;IAWvB,SAAS,YAAY;QAKnB,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAY,YAAY,CAAC,CAAC;QAEjD,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,GAAG,EA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QAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;MAAA,EAAE,YAAY,CAAC,QAAQ,CAAC,CACzB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,SAAS,aAAa,CACpB,QAA8C;QAE9C,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACpC;QAED,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAClE,IAAA,iBAAS,EACP,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EACpE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,SAAS,gBAAgB;QACvB,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACpC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,OAAO;QACL,QAAQ;QACR,aAAa;QACb,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAvGD,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"}
package/package.json CHANGED
@@ -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.148"
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