@microsoft/live-share-react 1.0.0-preview.9 → 1.0.2-preview.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.
Files changed (220) hide show
  1. package/README.md +99 -35
  2. package/bin/index.d.ts +6 -6
  3. package/bin/index.js +6 -6
  4. package/bin/interfaces/LiveInterfaceExtensions.d.ts +25 -8
  5. package/bin/interfaces/LiveInterfaceExtensions.d.ts.map +1 -1
  6. package/bin/interfaces/LiveInterfaceExtensions.js +5 -5
  7. package/bin/interfaces/index.d.ts +1 -1
  8. package/bin/interfaces/index.js +1 -1
  9. package/bin/internal/errors.d.ts +26 -0
  10. package/bin/internal/errors.d.ts.map +1 -0
  11. package/bin/internal/errors.js +39 -0
  12. package/bin/internal/errors.js.map +1 -0
  13. package/bin/internal/index.d.ts +4 -0
  14. package/bin/internal/index.d.ts.map +1 -0
  15. package/bin/internal/index.js +4 -0
  16. package/bin/internal/index.js.map +1 -0
  17. package/bin/internal/type-guards.d.ts +6 -0
  18. package/bin/internal/type-guards.d.ts.map +1 -0
  19. package/bin/internal/type-guards.js +8 -0
  20. package/bin/internal/type-guards.js.map +1 -0
  21. package/bin/{internal-hooks → internal}/useSharedStateRegistry.d.ts +30 -30
  22. package/bin/internal/useSharedStateRegistry.d.ts.map +1 -0
  23. package/bin/{internal-hooks → internal}/useSharedStateRegistry.js +101 -99
  24. package/bin/internal/useSharedStateRegistry.js.map +1 -0
  25. package/bin/live-hooks/index.d.ts +6 -6
  26. package/bin/live-hooks/index.js +6 -6
  27. package/bin/live-hooks/useLiveCanvas.d.ts +27 -27
  28. package/bin/live-hooks/useLiveCanvas.d.ts.map +1 -1
  29. package/bin/live-hooks/useLiveCanvas.js +158 -166
  30. package/bin/live-hooks/useLiveCanvas.js.map +1 -1
  31. package/bin/live-hooks/useLiveEvent.d.ts +21 -21
  32. package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
  33. package/bin/live-hooks/useLiveEvent.js +100 -85
  34. package/bin/live-hooks/useLiveEvent.js.map +1 -1
  35. package/bin/live-hooks/useLivePresence.d.ts +25 -25
  36. package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
  37. package/bin/live-hooks/useLivePresence.js +106 -92
  38. package/bin/live-hooks/useLivePresence.js.map +1 -1
  39. package/bin/live-hooks/useLiveState.d.ts +19 -19
  40. package/bin/live-hooks/useLiveState.d.ts.map +1 -1
  41. package/bin/live-hooks/useLiveState.js +79 -70
  42. package/bin/live-hooks/useLiveState.js.map +1 -1
  43. package/bin/live-hooks/useLiveTimer.d.ts +7 -7
  44. package/bin/live-hooks/useLiveTimer.d.ts.map +1 -1
  45. package/bin/live-hooks/useLiveTimer.js +150 -131
  46. package/bin/live-hooks/useLiveTimer.js.map +1 -1
  47. package/bin/live-hooks/useMediaSynchronizer.d.ts +22 -22
  48. package/bin/live-hooks/useMediaSynchronizer.d.ts.map +1 -1
  49. package/bin/live-hooks/useMediaSynchronizer.js +206 -161
  50. package/bin/live-hooks/useMediaSynchronizer.js.map +1 -1
  51. package/bin/providers/AzureProvider.d.ts +33 -33
  52. package/bin/providers/AzureProvider.d.ts.map +1 -1
  53. package/bin/providers/AzureProvider.js +101 -101
  54. package/bin/providers/AzureProvider.js.map +1 -1
  55. package/bin/providers/LiveShareProvider.d.ts +62 -41
  56. package/bin/providers/LiveShareProvider.d.ts.map +1 -1
  57. package/bin/providers/LiveShareProvider.js +68 -65
  58. package/bin/providers/LiveShareProvider.js.map +1 -1
  59. package/bin/providers/index.d.ts +2 -2
  60. package/bin/providers/index.js +2 -2
  61. package/bin/shared-hooks/index.d.ts +3 -4
  62. package/bin/shared-hooks/index.d.ts.map +1 -1
  63. package/bin/shared-hooks/index.js +3 -4
  64. package/bin/shared-hooks/index.js.map +1 -1
  65. package/bin/shared-hooks/useDynamicDDS.d.ts +18 -18
  66. package/bin/shared-hooks/useDynamicDDS.d.ts.map +1 -1
  67. package/bin/shared-hooks/useDynamicDDS.js +67 -67
  68. package/bin/shared-hooks/useDynamicDDS.js.map +1 -1
  69. package/bin/shared-hooks/useSharedMap.d.ts +21 -21
  70. package/bin/shared-hooks/useSharedMap.d.ts.map +1 -1
  71. package/bin/shared-hooks/useSharedMap.js +112 -105
  72. package/bin/shared-hooks/useSharedMap.js.map +1 -1
  73. package/bin/shared-hooks/useSharedState.d.ts +20 -20
  74. package/bin/shared-hooks/useSharedState.d.ts.map +1 -1
  75. package/bin/shared-hooks/useSharedState.js +72 -62
  76. package/bin/shared-hooks/useSharedState.js.map +1 -1
  77. package/bin/types/ActionTypes.d.ts +111 -29
  78. package/bin/types/ActionTypes.d.ts.map +1 -1
  79. package/bin/types/ActionTypes.js +5 -5
  80. package/bin/types/PropTypes.d.ts +7 -7
  81. package/bin/types/PropTypes.d.ts.map +1 -1
  82. package/bin/types/PropTypes.js +5 -5
  83. package/bin/types/ResultTypes.d.ts +174 -162
  84. package/bin/types/ResultTypes.d.ts.map +1 -1
  85. package/bin/types/ResultTypes.js +5 -5
  86. package/bin/types/index.d.ts +3 -3
  87. package/bin/types/index.js +3 -3
  88. package/bin/utils/index.d.ts +1 -1
  89. package/bin/utils/index.js +1 -1
  90. package/bin/utils/type-check.d.ts +14 -14
  91. package/bin/utils/type-check.js +53 -53
  92. package/package.json +18 -14
  93. package/src/interfaces/LiveInterfaceExtensions.ts +19 -2
  94. package/src/internal/errors.ts +48 -0
  95. package/src/internal/index.ts +3 -0
  96. package/src/internal/type-guards.ts +9 -0
  97. package/src/{internal-hooks → internal}/useSharedStateRegistry.ts +6 -5
  98. package/src/live-hooks/useLiveCanvas.ts +12 -20
  99. package/src/live-hooks/useLiveEvent.ts +41 -22
  100. package/src/live-hooks/useLivePresence.ts +52 -33
  101. package/src/live-hooks/useLiveState.ts +48 -53
  102. package/src/live-hooks/useLiveTimer.ts +50 -41
  103. package/src/live-hooks/useMediaSynchronizer.ts +108 -41
  104. package/src/providers/AzureProvider.tsx +3 -8
  105. package/src/providers/LiveShareProvider.tsx +46 -16
  106. package/src/shared-hooks/index.ts +0 -1
  107. package/src/shared-hooks/useDynamicDDS.ts +15 -8
  108. package/src/shared-hooks/useSharedMap.ts +48 -22
  109. package/src/shared-hooks/useSharedState.ts +15 -5
  110. package/src/types/ActionTypes.ts +100 -15
  111. package/src/types/ResultTypes.ts +23 -9
  112. package/bin/internal-hooks/index.d.ts +0 -2
  113. package/bin/internal-hooks/index.d.ts.map +0 -1
  114. package/bin/internal-hooks/index.js +0 -2
  115. package/bin/internal-hooks/index.js.map +0 -1
  116. package/bin/internal-hooks/useDynamicDDSRegistry.d.ts +0 -14
  117. package/bin/internal-hooks/useDynamicDDSRegistry.d.ts.map +0 -1
  118. package/bin/internal-hooks/useDynamicDDSRegistry.js +0 -142
  119. package/bin/internal-hooks/useDynamicDDSRegistry.js.map +0 -1
  120. package/bin/internal-hooks/useSharedStateRegistry.d.ts.map +0 -1
  121. package/bin/internal-hooks/useSharedStateRegistry.js.map +0 -1
  122. package/bin/internal-hooks/useStateRef.d.ts +0 -7
  123. package/bin/internal-hooks/useStateRef.d.ts.map +0 -1
  124. package/bin/internal-hooks/useStateRef.js +0 -15
  125. package/bin/internal-hooks/useStateRef.js.map +0 -1
  126. package/bin/live-hooks/useLiveAICompletion.d.ts +0 -29
  127. package/bin/live-hooks/useLiveAICompletion.d.ts.map +0 -1
  128. package/bin/live-hooks/useLiveAICompletion.js +0 -186
  129. package/bin/live-hooks/useLiveAICompletion.js.map +0 -1
  130. package/bin/live-hooks/useLiveCoPilot.d.ts +0 -28
  131. package/bin/live-hooks/useLiveCoPilot.d.ts.map +0 -1
  132. package/bin/live-hooks/useLiveCoPilot.js +0 -178
  133. package/bin/live-hooks/useLiveCoPilot.js.map +0 -1
  134. package/bin/live-share-turbo/AzureTurboClient.d.ts +0 -39
  135. package/bin/live-share-turbo/AzureTurboClient.d.ts.map +0 -1
  136. package/bin/live-share-turbo/AzureTurboClient.js +0 -56
  137. package/bin/live-share-turbo/AzureTurboClient.js.map +0 -1
  138. package/bin/live-share-turbo/LiveShareTurboClient.d.ts +0 -53
  139. package/bin/live-share-turbo/LiveShareTurboClient.d.ts.map +0 -1
  140. package/bin/live-share-turbo/LiveShareTurboClient.js +0 -69
  141. package/bin/live-share-turbo/LiveShareTurboClient.js.map +0 -1
  142. package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts +0 -31
  143. package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts.map +0 -1
  144. package/bin/live-share-turbo/dds-objects/TurboDataObject.js +0 -75
  145. package/bin/live-share-turbo/dds-objects/TurboDataObject.js.map +0 -1
  146. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts +0 -48
  147. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts.map +0 -1
  148. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js +0 -104
  149. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js.map +0 -1
  150. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts +0 -28
  151. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts.map +0 -1
  152. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js +0 -68
  153. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js.map +0 -1
  154. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts +0 -60
  155. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts.map +0 -1
  156. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js +0 -111
  157. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js.map +0 -1
  158. package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts +0 -77
  159. package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts.map +0 -1
  160. package/bin/live-share-turbo/dds-objects/TurboLivePresence.js +0 -137
  161. package/bin/live-share-turbo/dds-objects/TurboLivePresence.js.map +0 -1
  162. package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts +0 -30
  163. package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts.map +0 -1
  164. package/bin/live-share-turbo/dds-objects/TurboLiveState.js +0 -74
  165. package/bin/live-share-turbo/dds-objects/TurboLiveState.js.map +0 -1
  166. package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts +0 -61
  167. package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts.map +0 -1
  168. package/bin/live-share-turbo/dds-objects/TurboSharedMap.js +0 -108
  169. package/bin/live-share-turbo/dds-objects/TurboSharedMap.js.map +0 -1
  170. package/bin/live-share-turbo/dds-objects/index.d.ts +0 -8
  171. package/bin/live-share-turbo/dds-objects/index.d.ts.map +0 -1
  172. package/bin/live-share-turbo/dds-objects/index.js +0 -8
  173. package/bin/live-share-turbo/dds-objects/index.js.map +0 -1
  174. package/bin/live-share-turbo/index.d.ts +0 -5
  175. package/bin/live-share-turbo/index.d.ts.map +0 -1
  176. package/bin/live-share-turbo/index.js +0 -5
  177. package/bin/live-share-turbo/index.js.map +0 -1
  178. package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts +0 -15
  179. package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts.map +0 -1
  180. package/bin/live-share-turbo/interfaces/IFluidTurboClient.js +0 -2
  181. package/bin/live-share-turbo/interfaces/IFluidTurboClient.js.map +0 -1
  182. package/bin/live-share-turbo/interfaces/index.d.ts +0 -3
  183. package/bin/live-share-turbo/interfaces/index.d.ts.map +0 -1
  184. package/bin/live-share-turbo/interfaces/index.js +0 -3
  185. package/bin/live-share-turbo/interfaces/index.js.map +0 -1
  186. package/bin/live-share-turbo/internals/FluidTurboClient.d.ts +0 -39
  187. package/bin/live-share-turbo/internals/FluidTurboClient.d.ts.map +0 -1
  188. package/bin/live-share-turbo/internals/FluidTurboClient.js +0 -121
  189. package/bin/live-share-turbo/internals/FluidTurboClient.js.map +0 -1
  190. package/bin/live-share-turbo/internals/index.d.ts +0 -2
  191. package/bin/live-share-turbo/internals/index.d.ts.map +0 -1
  192. package/bin/live-share-turbo/internals/index.js +0 -2
  193. package/bin/live-share-turbo/internals/index.js.map +0 -1
  194. package/bin/live-share-turbo/internals/types.d.ts +0 -4
  195. package/bin/live-share-turbo/internals/types.d.ts.map +0 -1
  196. package/bin/live-share-turbo/internals/types.js +0 -2
  197. package/bin/live-share-turbo/internals/types.js.map +0 -1
  198. package/bin/providers/FluidContextProvider.d.ts +0 -34
  199. package/bin/providers/FluidContextProvider.d.ts.map +0 -1
  200. package/bin/providers/FluidContextProvider.js +0 -99
  201. package/bin/providers/FluidContextProvider.js.map +0 -1
  202. package/bin/providers/LiveShareContextProvider.d.ts +0 -42
  203. package/bin/providers/LiveShareContextProvider.d.ts.map +0 -1
  204. package/bin/providers/LiveShareContextProvider.js +0 -63
  205. package/bin/providers/LiveShareContextProvider.js.map +0 -1
  206. package/bin/shared-hooks/useLockedTask.d.ts +0 -11
  207. package/bin/shared-hooks/useLockedTask.d.ts.map +0 -1
  208. package/bin/shared-hooks/useLockedTask.js +0 -82
  209. package/bin/shared-hooks/useLockedTask.js.map +0 -1
  210. package/bin/shared-hooks/useTaskManager.d.ts +0 -13
  211. package/bin/shared-hooks/useTaskManager.d.ts.map +0 -1
  212. package/bin/shared-hooks/useTaskManager.js +0 -86
  213. package/bin/shared-hooks/useTaskManager.js.map +0 -1
  214. package/bin/utils/getContainerSchema.d.ts +0 -8
  215. package/bin/utils/getContainerSchema.d.ts.map +0 -1
  216. package/bin/utils/getContainerSchema.js +0 -41
  217. package/bin/utils/getContainerSchema.js.map +0 -1
  218. package/src/internal-hooks/index.ts +0 -1
  219. package/src/shared-hooks/useTaskManager.ts +0 -82
  220. package/tinylicious.log +0 -4
@@ -16,10 +16,12 @@ import { LoadableObjectClass } from "fluid-framework";
16
16
  * @param onFirstInitialize Optional. Callback function for when the DDS is first loaded
17
17
  * @returns the DDS object, which is of type T when loaded and undefined while loading
18
18
  */
19
- export function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFluidLoadable>(
19
+ export function useDynamicDDS<
20
+ T extends IFluidLoadable = FluidObject<any> & IFluidLoadable
21
+ >(
20
22
  uniqueKey: string,
21
23
  loadableObjectClass: LoadableObjectClass<T>,
22
- onFirstInitialize?: (dds: T) => void,
24
+ onFirstInitialize?: (dds: T) => void
23
25
  ): {
24
26
  dds: T | undefined;
25
27
  error: Error | undefined;
@@ -29,10 +31,7 @@ export function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFlu
29
31
  /**
30
32
  * Import container and DDS object register callbacks from AzureProvider.
31
33
  */
32
- const {
33
- container,
34
- clientRef,
35
- } = useFluidObjectsContext();
34
+ const { container, clientRef } = useFluidObjectsContext();
36
35
 
37
36
  /**
38
37
  * Once container is available, this effect will register the setter method so that the DDS loaded
@@ -46,7 +45,11 @@ export function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFlu
46
45
  // Callback method to set the `initialData` into the map when the DDS is first created.
47
46
  const onGetDDS = async () => {
48
47
  try {
49
- const dds = await clientRef.current.getDDS<T>(uniqueKey, loadableObjectClass, onFirstInitialize);
48
+ const dds = await clientRef.current.getDDS<T>(
49
+ uniqueKey,
50
+ loadableObjectClass,
51
+ onFirstInitialize
52
+ );
50
53
  if (mounted) {
51
54
  setDDS(dds);
52
55
  }
@@ -54,7 +57,11 @@ export function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFlu
54
57
  if (error instanceof Error) {
55
58
  setError(error);
56
59
  } else {
57
- setError(new Error("useDynamicDDS: an unknown error occurred while getting the DDS"));
60
+ setError(
61
+ new Error(
62
+ "useDynamicDDS: an unknown error occurred while getting the DDS"
63
+ )
64
+ );
58
65
  }
59
66
  }
60
67
  };
@@ -8,6 +8,11 @@ import { isEntries, isJSON, isMap } from "../utils";
8
8
  import { IUseSharedMapResults, SharedMapInitialData } from "../types";
9
9
  import { useDynamicDDS } from "./useDynamicDDS";
10
10
  import { SharedMap } from "fluid-framework";
11
+ import { useFluidObjectsContext } from "../providers";
12
+ import {
13
+ ActionContainerNotJoinedError,
14
+ ActionLiveDataObjectUndefinedError,
15
+ } from "../internal";
11
16
 
12
17
  /**
13
18
  * React hook for using a Fluid `SharedMap`.
@@ -17,14 +22,14 @@ import { SharedMap } from "fluid-framework";
17
22
  * directly is that it integrates nicely with React state and automates repetitive tasks.
18
23
  * If you want to use `SharedMap` this hook creates directly, you can do that as well.
19
24
  *
20
- * @template TData Optional typing for objects stored in the SharedMap. Default is `object` type.
25
+ * @template TData Optional typing for objects stored in the SharedMap. Default is `any` type.
21
26
  * @param uniqueKey the unique key for the `SharedMap`. If one does not yet exist, a new `SharedMap`
22
27
  * will be created, otherwise it will use the existing one.
23
28
  * @param initialData a JS Map, entries array, or JSON object to insert into the `SharedMap` when creating
24
29
  * the DDS for the first time.
25
30
  * @returns stateful `map` entries, `setEntry` callback, `deleteEntry` callback, and the Fluid `sharedMap`.
26
31
  */
27
- export function useSharedMap<TData extends object = object>(
32
+ export function useSharedMap<TData = any>(
28
33
  uniqueKey: string,
29
34
  initialData?: SharedMapInitialData<TData>
30
35
  ): IUseSharedMapResults<TData> {
@@ -35,34 +40,49 @@ export function useSharedMap<TData extends object = object>(
35
40
  getInitialData<TData>(initialData)
36
41
  );
37
42
 
38
- const onFirstInitialize = React.useCallback((newDDS: SharedMap): void => {
39
- /**
40
- * Callback method to set the `initialData` into the map when the `SharedMap` is first created.
41
- * Only should be used as a prop to useDynamicDDS.
42
- */
43
- getInitialData(initialData).forEach((value, key) => {
44
- newDDS.set(key, value);
45
- });
46
- }, [initialData]);
43
+ const onFirstInitialize = React.useCallback(
44
+ (newDDS: SharedMap): void => {
45
+ /**
46
+ * Callback method to set the `initialData` into the map when the `SharedMap` is first created.
47
+ * Only should be used as a prop to useDynamicDDS.
48
+ */
49
+ getInitialData(initialData).forEach((value, key) => {
50
+ newDDS.set(key, value);
51
+ });
52
+ },
53
+ [initialData]
54
+ );
47
55
  /**
48
56
  * User facing: dynamically load the SharedMap DDS for the given unique key.
49
57
  */
50
- const { dds: sharedMap } = useDynamicDDS<SharedMap>(uniqueKey, SharedMap, onFirstInitialize);
58
+ const { dds: sharedMap } = useDynamicDDS<SharedMap>(
59
+ uniqueKey,
60
+ SharedMap,
61
+ onFirstInitialize
62
+ );
63
+
64
+ const { container } = useFluidObjectsContext();
51
65
 
52
66
  /**
53
67
  * User facing: set a value to the Fluid `SharedMap`.
54
68
  */
55
69
  const setEntry = React.useCallback(
56
70
  (key: string, value: TData) => {
57
- if (!sharedMap) {
58
- console.error(
59
- new Error("Cannot call set when sharedMap is undefined")
71
+ if (!container) {
72
+ throw new ActionContainerNotJoinedError(
73
+ "sharedMap",
74
+ "setEntry"
75
+ );
76
+ }
77
+ if (sharedMap === undefined) {
78
+ throw new ActionLiveDataObjectUndefinedError(
79
+ "sharedMap",
80
+ "setEntry"
60
81
  );
61
- return;
62
82
  }
63
83
  sharedMap.set(key, value);
64
84
  },
65
- [sharedMap]
85
+ [container, sharedMap]
66
86
  );
67
87
 
68
88
  /**
@@ -70,15 +90,21 @@ export function useSharedMap<TData extends object = object>(
70
90
  */
71
91
  const deleteEntry = React.useCallback(
72
92
  (key: string) => {
73
- if (!sharedMap) {
74
- console.error(
75
- new Error("Cannot call remove when sharedMap is undefined")
93
+ if (!container) {
94
+ throw new ActionContainerNotJoinedError(
95
+ "sharedMap",
96
+ "deleteEntry"
97
+ );
98
+ }
99
+ if (sharedMap === undefined) {
100
+ throw new ActionLiveDataObjectUndefinedError(
101
+ "sharedMap",
102
+ "deleteEntry"
76
103
  );
77
- return;
78
104
  }
79
105
  sharedMap.delete(key);
80
106
  },
81
- [sharedMap]
107
+ [container, sharedMap]
82
108
  );
83
109
 
84
110
  // Setup change listeners, initial values, etc.
@@ -7,6 +7,7 @@ import React from "react";
7
7
  import { useFluidObjectsContext } from "../providers";
8
8
  import { DisposeSharedStateAction, SetSharedStateAction } from "../types";
9
9
  import { v4 as uuid } from "uuid";
10
+ import { isPrevStateCallback } from "../internal";
10
11
 
11
12
  /**
12
13
  * Inspired by React's `useState` hook, `useSharedState` makes it easy to synchronize state in your app.
@@ -22,7 +23,7 @@ import { v4 as uuid } from "uuid";
22
23
  *
23
24
  * @returns a stateful value, the function to update it, and an optional dispose method to delete it from the `SharedMap`.
24
25
  */
25
- export function useSharedState<S>(
26
+ export function useSharedState<S = any>(
26
27
  uniqueKey: string,
27
28
  initialState: S
28
29
  ): [S, SetSharedStateAction<S>, DisposeSharedStateAction] {
@@ -48,9 +49,14 @@ export function useSharedState<S>(
48
49
  * User facing: callback to change the shared state.
49
50
  */
50
51
  const setSharedState: SetSharedStateAction<S> = React.useCallback(
51
- (updatedState: S) => {
52
- setLocalState(updatedState);
53
- updateSharedState(uniqueKey, updatedState);
52
+ (state: S | ((prevState: S) => S)) => {
53
+ setLocalState((prevState) => {
54
+ const valueToSet = isPrevStateCallback<S>(state)
55
+ ? state(prevState)
56
+ : state;
57
+ updateSharedState(uniqueKey, valueToSet);
58
+ return valueToSet;
59
+ });
54
60
  },
55
61
  [uniqueKey, setLocalState, updateSharedState]
56
62
  );
@@ -79,7 +85,11 @@ export function useSharedState<S>(
79
85
  return () => {
80
86
  unregisterSharedSetStateAction(uniqueKey, componentIdRef.current);
81
87
  };
82
- }, [uniqueKey, registerSharedSetStateAction, unregisterSharedSetStateAction]);
88
+ }, [
89
+ uniqueKey,
90
+ registerSharedSetStateAction,
91
+ unregisterSharedSetStateAction,
92
+ ]);
83
93
 
84
94
  return [localState, setSharedState, disposeSharedState];
85
95
  }
@@ -6,13 +6,27 @@
6
6
  import React from "react";
7
7
  import { IFluidLoadable } from "@fluidframework/core-interfaces";
8
8
  import { LoadableObjectClass } from "fluid-framework";
9
- import { ITimerConfig, PresenceState } from "@microsoft/live-share";
9
+ import { ITimerConfig, ILiveEvent, PresenceState } from "@microsoft/live-share";
10
10
 
11
11
  // React actions
12
- export type SetSharedStateAction<T> = (state: T) => void;
12
+
13
+ /**
14
+ * Callback to set shared state
15
+ */
16
+ export type SetSharedStateAction<TState> = (
17
+ state: TState | ((prevState: TState) => TState)
18
+ ) => void;
19
+ /**
20
+ * Callback to set local state
21
+ */
13
22
  export type SetLocalStateAction = React.Dispatch<React.SetStateAction<any>>;
14
23
 
15
24
  // Fluid actions
25
+
26
+ /**
27
+ * Callback for UnregisterDDSSetStateAction.
28
+ * <T extends IFluidLoadable>(uniqueKey: string, componentId: string, objectClass: LoadableObjectClass<T>, setLocalStateAction: SetLocalStateAction, onDidFirstInitialize?: (dds: T) => void) => void
29
+ */
16
30
  export type RegisterDDSSetStateAction = <T extends IFluidLoadable>(
17
31
  uniqueKey: string,
18
32
  componentId: string,
@@ -21,56 +35,127 @@ export type RegisterDDSSetStateAction = <T extends IFluidLoadable>(
21
35
  onDidFirstInitialize?: (dds: T) => void
22
36
  ) => void;
23
37
 
38
+ /**
39
+ * Callback for UnregisterDDSSetStateAction.
40
+ * (uniqueKey: string, componentId: string) => void
41
+ */
24
42
  export type UnregisterDDSSetStateAction = (
25
43
  uniqueKey: string,
26
44
  componentId: string
27
45
  ) => void;
28
46
 
47
+ /**
48
+ * Callback for RegisterSharedSetStateAction.
49
+ * (uniqueKey: string, componentId: string, setLocalStateAction: SetLocalStateAction) => void
50
+ */
29
51
  export type RegisterSharedSetStateAction = (
30
52
  uniqueKey: string,
31
53
  componentId: string,
32
54
  setLocalStateAction: SetLocalStateAction
33
55
  ) => void;
34
56
 
57
+ /**
58
+ * Callback for UnregisterSharedSetStateAction.
59
+ * (uniqueKey: string, componentId: string) => void
60
+ */
35
61
  export type UnregisterSharedSetStateAction = (
36
62
  uniqueKey: string,
37
63
  componentId: string
38
64
  ) => void;
39
65
 
66
+ /**
67
+ * Callback for UpdateSharedStateAction.
68
+ * (uniqueKey: string, value: any) => void
69
+ */
40
70
  export type UpdateSharedStateAction = (uniqueKey: string, value: any) => void;
41
71
 
72
+ /**
73
+ * Callback for DeleteSharedStateAction.
74
+ * (uniqueKey: string) => void
75
+ */
42
76
  export type DeleteSharedStateAction = (uniqueKey: string) => void;
77
+ /**
78
+ * Callback for DisposeSharedStateAction.
79
+ * () => void
80
+ */
43
81
  export type DisposeSharedStateAction = () => void;
44
82
 
45
83
  // Live Share actions
46
84
 
47
- export type SetLiveStateAction<TState, TData> = (
48
- state: TState,
49
- value?: TData | undefined
50
- ) => void;
85
+ /**
86
+ * Callback for SetLiveStateAction<TState = undefined>.
87
+ * (state: TState) => Promise<void>
88
+ */
89
+ export type SetLiveStateAction<TState = undefined> = (
90
+ state: TState | ((prevState: TState) => TState)
91
+ ) => Promise<void>;
51
92
 
52
- export type SendLiveEventAction<TEvent> = (event: TEvent) => void;
93
+ /**
94
+ * Callback for SendLiveEventAction<TEvent>.
95
+ * (event: TEvent) => Promise<void>
96
+ */
97
+ export type SendLiveEventAction<TEvent> = (
98
+ event: TEvent
99
+ ) => Promise<ILiveEvent<TEvent>>;
53
100
 
101
+ /**
102
+ * Callback for OnReceivedLiveEventAction<TEvent>.
103
+ * (event: TEvent, local: boolean) => void
104
+ */
54
105
  export type OnReceivedLiveEventAction<TEvent> = (
55
106
  event: TEvent,
56
107
  local: boolean
57
108
  ) => void;
58
109
 
110
+ /**
111
+ * Callback for OnUpdateLivePresenceAction<TData extends object = object>.
112
+ * (data?: TData | undefined, state?: PresenceState | undefined) => Promise<void>
113
+ */
59
114
  export type OnUpdateLivePresenceAction<TData extends object = object> = (
60
- state?: PresenceState | undefined,
61
- data?: TData | undefined
62
- ) => void;
115
+ data?: TData | undefined,
116
+ state?: PresenceState | undefined
117
+ ) => Promise<void>;
63
118
 
64
- export type OnStartTimerAction = (
65
- duration: number
66
- ) => void;
119
+ /**
120
+ * Callback for OnStartTimerAction.
121
+ * (duration: number) => Promise<void>
122
+ */
123
+ export type OnStartTimerAction = (duration: number) => Promise<void>;
67
124
 
68
- export type OnPlayTimerAction = () => void;
125
+ /**
126
+ * Callback for OnPlayTimerAction.
127
+ * () => Promise<void>
128
+ */
129
+ export type OnPlayTimerAction = () => Promise<void>;
69
130
 
70
- export type OnPauseTimerAction = () => void;
131
+ /**
132
+ * Callback for OnPauseTimerAction.
133
+ * () => Promise<void>
134
+ */
135
+ export type OnPauseTimerAction = () => Promise<void>;
71
136
 
137
+ /**
138
+ * Callback for OnTimerTickAction.
139
+ * (milliRemaining: number) => void
140
+ */
72
141
  export type OnTimerTickAction = (milliRemaining: number) => void;
142
+ /**
143
+ * Callback for OnTimerDidStartAction.
144
+ * (timerConfig: ITimerConfig) => void
145
+ */
73
146
  export type OnTimerDidStartAction = (timerConfig: ITimerConfig) => void;
147
+ /**
148
+ * Callback for OnTimerDidPauseAction.
149
+ * (timerConfig: ITimerConfig) => void
150
+ */
74
151
  export type OnTimerDidPauseAction = (timerConfig: ITimerConfig) => void;
152
+ /**
153
+ * Callback for OnTimerDidPlayAction.
154
+ * (timerConfig: ITimerConfig) => void
155
+ */
75
156
  export type OnTimerDidPlayAction = (timerConfig: ITimerConfig) => void;
157
+ /**
158
+ * Callback for OnTimerDidFinishAction.
159
+ * (timerConfig: ITimerConfig) => void
160
+ */
76
161
  export type OnTimerDidFinishAction = (timerConfig: ITimerConfig) => void;
@@ -64,7 +64,7 @@ export interface IUseSharedMapResults<TData> {
64
64
  sharedMap: SharedMap | undefined;
65
65
  }
66
66
 
67
- export interface IUseLiveEventResults<TEvent extends object = object> {
67
+ export interface IUseLiveEventResults<TEvent = any> {
68
68
  /**
69
69
  * The most recent event that has been received in the session.
70
70
  */
@@ -75,6 +75,8 @@ export interface IUseLiveEventResults<TEvent extends object = object> {
75
75
  allEvents: IReceiveLiveEvent<TEvent>[];
76
76
  /**
77
77
  * Callback method to send a new event to users in the session.
78
+ * @param TEvent to send.
79
+ * @returns void promise that will throw when user does not have required roles
78
80
  */
79
81
  sendEvent: SendLiveEventAction<TEvent>;
80
82
  /**
@@ -97,15 +99,19 @@ export interface IUseLiveTimerResults {
97
99
  */
98
100
  liveTimer: LiveTimer | undefined;
99
101
  /**
100
- * Start timer callback.
102
+ * Callback to send event through `LiveTimer`
103
+ * @param duration the duration for the timer in milliseconds
104
+ * @returns void promise that will throw when user does not have required roles
101
105
  */
102
106
  start: OnStartTimerAction;
103
107
  /**
104
- * Play timer callback.
108
+ * Callback to send event through `LiveTimer`
109
+ * @returns void promise that will throw when user does not have required roles
105
110
  */
106
111
  play: OnPlayTimerAction;
107
112
  /**
108
- * Pause timer callback.
113
+ * Callback to send event through `LiveTimer`
114
+ * @returns void promise that will throw when user does not have required roles
109
115
  */
110
116
  pause: OnPauseTimerAction;
111
117
  }
@@ -129,6 +135,9 @@ export interface IUseLivePresenceResults<TData extends object = object> {
129
135
  livePresence: LivePresence<TData> | undefined;
130
136
  /**
131
137
  * Callback method to update the local user's presence.
138
+ * @param data Optional. TData to set for user.
139
+ * @param state Optional. PresenceState to set for user.
140
+ * @returns void promise that will throw when user does not have required roles
132
141
  */
133
142
  updatePresence: OnUpdateLivePresenceAction<TData>;
134
143
  }
@@ -140,23 +149,28 @@ export interface IUseMediaSynchronizerResults {
140
149
  suspended: boolean;
141
150
  /**
142
151
  * Callback to initiate a play action for the group media session.
152
+ * @returns void promise that will throw when user does not have required roles
143
153
  */
144
- play: () => void;
154
+ play: () => Promise<void>;
145
155
  /**
146
156
  * Callback to initiate a pause action for the group media session.
157
+ * @returns void promise that will throw when user does not have required roles
147
158
  */
148
- pause: () => void;
159
+ pause: () => Promise<void>;
149
160
  /**
150
161
  * Callback to initiate a seek action for the group media session.
151
- *
152
162
  * @param time timestamp of the video in seconds to seek to
163
+ * @returns void promise that will throw when user does not have required roles
153
164
  */
154
- seekTo: (time: number) => void;
165
+ seekTo: (time: number) => Promise<void>;
155
166
  /**
156
167
  * Callback to change the track for the group media session.
157
168
  * @param track media metadata object, track src string, or null
169
+ * @returns void promise that will throw when user does not have required roles
158
170
  */
159
- setTrack: (track: Partial<ExtendedMediaMetadata> | string | null) => void;
171
+ setTrack: (
172
+ track: Partial<ExtendedMediaMetadata> | string | null
173
+ ) => Promise<void>;
160
174
  /**
161
175
  * Begin a new suspension. If a wait point is not set, the suspension will only impact the
162
176
  * local user.
@@ -1,2 +0,0 @@
1
- export * from "./useSharedStateRegistry";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./useSharedStateRegistry";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -1,14 +0,0 @@
1
- import { IAzureContainerResults, RegisterDDSSetStateAction, UnregisterDDSSetStateAction } from "../types";
2
- export interface IDynamicDDSRegistry {
3
- registerDDSSetStateAction: RegisterDDSSetStateAction;
4
- unregisterDDSSetStateAction: UnregisterDDSSetStateAction;
5
- }
6
- /**
7
- * Hook used internally to keep track of the DDSSetStateActionMap for each unique key. It gets DDS objects for provided keys where they exist and creates
8
- * them where they do not, providing the DDS objects to components that use them.
9
- *
10
- * @param results IAzureContainerResults response or undefined
11
- * @returns IDynamicDDSRegistry object
12
- */
13
- export declare const useDynamicDDSRegistry: (results: IAzureContainerResults | undefined) => IDynamicDDSRegistry;
14
- //# sourceMappingURL=useDynamicDDSRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDynamicDDSRegistry.d.ts","sourceRoot":"","sources":["../../src/internal-hooks/useDynamicDDSRegistry.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,sBAAsB,EACtB,yBAAyB,EAEzB,2BAA2B,EAC9B,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,mBAAmB;IAChC,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,2BAA2B,EAAE,2BAA2B,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,YACrB,sBAAsB,GAAG,SAAS,KAC5C,mBAyKF,CAAC"}
@@ -1,142 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useCallback, useEffect, useRef } from "react";
11
- /**
12
- * Hook used internally to keep track of the DDSSetStateActionMap for each unique key. It gets DDS objects for provided keys where they exist and creates
13
- * them where they do not, providing the DDS objects to components that use them.
14
- *
15
- * @param results IAzureContainerResults response or undefined
16
- * @returns IDynamicDDSRegistry object
17
- */
18
- export const useDynamicDDSRegistry = (results) => {
19
- const registeredDDSSetStateActionMapRef = useRef(new Map());
20
- // Get the DDS from dynamicObjects for a given key, if known
21
- const getDDS = useCallback((key) => __awaiter(void 0, void 0, void 0, function* () {
22
- const dynamicObjectMap = results === null || results === void 0 ? void 0 : results.container.initialObjects.dynamicObjects;
23
- if (dynamicObjectMap) {
24
- const handleValue = dynamicObjectMap.get(key);
25
- if (handleValue) {
26
- const dds = yield handleValue.get();
27
- return dds;
28
- }
29
- else {
30
- return undefined;
31
- }
32
- }
33
- else {
34
- throw new Error("getDDS should never be called if dynamicObjects is undefined");
35
- }
36
- }), [results]);
37
- // Create a new DDS of type T in dynamicObjects
38
- const createDDS = useCallback((key, objectClass) => __awaiter(void 0, void 0, void 0, function* () {
39
- const dynamicObjectMap = results === null || results === void 0 ? void 0 : results.container.initialObjects.dynamicObjects;
40
- if (dynamicObjectMap) {
41
- // Create a new DDS and set the handle to the DDS
42
- const dds = yield results.container.create(objectClass);
43
- dynamicObjectMap.set(key, dds.handle);
44
- return dds;
45
- }
46
- else {
47
- throw new Error("createDDS: should never be called if dynamicObjectsMap is undefined");
48
- }
49
- }), [results]);
50
- // Callback for hooks (e.g., useSharedMap) to register a new set state action so they
51
- // always have the most recent DDS. If one does not exist, we create it here.
52
- const registerDDSSetStateAction = useCallback((uniqueKey, componentId, objectClass, setLocalStateAction, onDidFirstInitialize) => __awaiter(void 0, void 0, void 0, function* () {
53
- let shouldCreateIfNeeded = false;
54
- let actionsMap = registeredDDSSetStateActionMapRef.current.get(uniqueKey);
55
- if (actionsMap) {
56
- if (!actionsMap.has(componentId)) {
57
- shouldCreateIfNeeded = true;
58
- actionsMap.set(componentId, setLocalStateAction);
59
- }
60
- }
61
- else {
62
- shouldCreateIfNeeded = true;
63
- actionsMap = new Map();
64
- actionsMap.set(componentId, setLocalStateAction);
65
- registeredDDSSetStateActionMapRef.current.set(uniqueKey, actionsMap);
66
- }
67
- try {
68
- // Set initial values, if known
69
- let dds = yield getDDS(uniqueKey);
70
- if (dds) {
71
- setLocalStateAction(dds);
72
- }
73
- else if (shouldCreateIfNeeded) {
74
- // Create a new DDS of type T
75
- dds = yield createDDS(uniqueKey, objectClass);
76
- setLocalStateAction(dds);
77
- onDidFirstInitialize === null || onDidFirstInitialize === void 0 ? void 0 : onDidFirstInitialize(dds);
78
- }
79
- }
80
- catch (error) {
81
- throw error;
82
- }
83
- }), [results]);
84
- // Callback for hooks (e.g., useSharedMap) to unregister their set state actions
85
- const unregisterDDSSetStateAction = useCallback((uniqueKey, componentId) => {
86
- let actionsMap = registeredDDSSetStateActionMapRef.current.get(uniqueKey);
87
- if (actionsMap === null || actionsMap === void 0 ? void 0 : actionsMap.has(componentId)) {
88
- actionsMap.delete(componentId);
89
- }
90
- }, []);
91
- // Initial setup
92
- useEffect(() => {
93
- if (!results)
94
- return;
95
- const { container } = results;
96
- const dynamicObjectMap = container.initialObjects
97
- .dynamicObjects;
98
- // Register value changed listener
99
- const valueChangedListener = (changed, local) => {
100
- if (local)
101
- return;
102
- if (registeredDDSSetStateActionMapRef.current.has(changed.key)) {
103
- const actionMap = registeredDDSSetStateActionMapRef.current.get(changed.key);
104
- // Get the DDS for the changed value, if known
105
- getDDS(changed.key)
106
- .then((dds) => {
107
- // Update each component that has registered an action in actionMap
108
- actionMap === null || actionMap === void 0 ? void 0 : actionMap.forEach((setLocalStateHandler) => {
109
- setLocalStateHandler(dds);
110
- });
111
- })
112
- .catch((error) => console.error(error));
113
- }
114
- };
115
- dynamicObjectMap.on("valueChanged", valueChangedListener);
116
- // Set initial values
117
- dynamicObjectMap.forEach((handleValue, key) => {
118
- const actionMap = registeredDDSSetStateActionMapRef.current.get(key);
119
- if (handleValue) {
120
- handleValue
121
- .get()
122
- .then((dds) => {
123
- // Update each component that has registered an action in actionMap
124
- actionMap === null || actionMap === void 0 ? void 0 : actionMap.forEach((setLocalStateHandler) => {
125
- setLocalStateHandler(dds);
126
- });
127
- })
128
- .catch((error) => {
129
- console.error(error);
130
- });
131
- }
132
- });
133
- return () => {
134
- dynamicObjectMap.off("valueChanged", valueChangedListener);
135
- };
136
- }, [results]);
137
- return {
138
- registerDDSSetStateAction,
139
- unregisterDDSSetStateAction,
140
- };
141
- };
142
- //# sourceMappingURL=useDynamicDDSRegistry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDynamicDDSRegistry.js","sourceRoot":"","sources":["../../src/internal-hooks/useDynamicDDSRegistry.ts"],"names":[],"mappings":";;;;;;;;;AAOA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAavD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,OAA2C,EACxB,EAAE;IACrB,MAAM,iCAAiC,GAAG,MAAM,CAE9C,IAAI,GAAG,EAAE,CAAC,CAAC;IAEb,4DAA4D;IAC5D,MAAM,MAAM,GAAG,WAAW,CACtB,CACI,GAAW,EACW,EAAE;QACxB,MAAM,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,cAAc,CACrD,cAAuC,CAAC;QAC7C,IAAI,gBAAgB,EAA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xC,oBAAoB,CAAC,GAAG,CAAC,CAAC;oBAC9B,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;oBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC,CAAC,CAAC;aACV;QACL,CAAC,CACJ,CAAC;QACF,OAAO,GAAG,EAAE;YACR,gBAAgB,CAAC,GAAG,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC;QAC/D,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO;QACH,yBAAyB;QACzB,2BAA2B;KAC9B,CAAC;AACN,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSharedStateRegistry.d.ts","sourceRoot":"","sources":["../../src/internal-hooks/useSharedStateRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAE5B,8BAA8B,EAC9B,uBAAuB,EAC1B,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,4BAA4B,EAAE,4BAA4B,CAAC;IAC3D;;OAEG;IACH,8BAA8B,EAAE,8BAA8B,CAAC;IAC/D;;OAEG;IACH,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C;;OAEG;IACH,iBAAiB,EAAE,uBAAuB,CAAC;CAC9C;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,YACtB,sBAAsB,GAAG,SAAS,KAC5C,4BAuHF,CAAC"}