@microsoft/live-share-react 1.0.0-preview.8 → 1.0.1-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 -34
  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
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveCanvas.js","sourceRoot":"","sources":["../../src/live-hooks/useLiveCanvas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGH,aAAa,EAIb,UAAU,GACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC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Ac,GAAG,cAAc,CAAC;SAC9C;IACL,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,UAAU,IAAI,mBAAmB,EAAE;YACnC,UAAU,CAAC,wBAAwB,GAAG,GAAuB,EAAE;gBAC3D,OAAO,mBAAmB,CAAC;YAC/B,CAAC,CAAC;SACL;IACL,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC;IAEtC;;OAEG;IACH,OAAO;QACH,aAAa;QACb,UAAU;KACb,CAAC;AACN,CAAC"}
@@ -1,22 +1,22 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { UserMeetingRole } from "@microsoft/live-share";
6
- import { IUseLiveEventResults, OnReceivedLiveEventAction } from "../types";
7
- /**
8
- * React hook for using a Live Share `LiveEvent`.
9
- *
10
- * @remarks
11
- * Use this hook if you want to send transient JSON objects to everyone connected to the Fluid container,
12
- * such as when sending push notifications or reactions.
13
- *
14
- * @template TEvent Optional typing for events sent & received. Default is `object` type.
15
- * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one
16
- * will be created, otherwise it will use the existing one.
17
- * @param allowedRoles Optional. The meeting roles eligible to send events through this object.
18
- * @param onReceivedEvent Optional. Callback method to be called when a new notification is received.
19
- * @returns stateful `latestEvent` & `allEvents` list, `sendEvent` callback, and the `liveEvent` object.
20
- */
21
- export declare function useLiveEvent<TEvent extends object = object>(uniqueKey: string, allowedRoles?: UserMeetingRole[], onReceivedEvent?: OnReceivedLiveEventAction<TEvent>): IUseLiveEventResults<TEvent>;
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { UserMeetingRole } from "@microsoft/live-share";
6
+ import { IUseLiveEventResults, OnReceivedLiveEventAction } from "../types";
7
+ /**
8
+ * React hook for using a Live Share `LiveEvent`.
9
+ *
10
+ * @remarks
11
+ * Use this hook if you want to send transient JSON objects to everyone connected to the Fluid container,
12
+ * such as when sending push notifications or reactions.
13
+ *
14
+ * @template TEvent Optional typing for events sent & received. Default is `object` type.
15
+ * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one
16
+ * will be created, otherwise it will use the existing one.
17
+ * @param allowedRoles Optional. The meeting roles eligible to send events through this object.
18
+ * @param onReceivedEvent Optional. Callback method to be called when a new notification is received.
19
+ * @returns stateful `latestEvent` & `allEvents` list, `sendEvent` callback, and the `liveEvent` object.
20
+ */
21
+ export declare function useLiveEvent<TEvent = any>(uniqueKey: string, allowedRoles?: UserMeetingRole[], onReceivedEvent?: OnReceivedLiveEventAction<TEvent>): IUseLiveEventResults<TEvent>;
22
22
  //# sourceMappingURL=useLiveEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveEvent.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLiveEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,eAAe,EAElB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACH,oBAAoB,EACpB,yBAAyB,EAE5B,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,EACvD,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,eAAe,EAAE,EAChC,eAAe,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,GACpD,oBAAoB,CAAC,MAAM,CAAC,CA+E9B"}
1
+ {"version":3,"file":"useLiveEvent.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLiveEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,eAAe,EAElB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACH,oBAAoB,EACpB,yBAAyB,EAE5B,MAAM,UAAU,CAAC;AAUlB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAG,GAAG,EACrC,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,eAAe,EAAE,EAChC,eAAe,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,GACpD,oBAAoB,CAAC,MAAM,CAAC,CA4F9B"}
@@ -1,86 +1,101 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { LiveEventEvents, LiveEvent, } from "@microsoft/live-share";
6
- import React from "react";
7
- import { useDynamicDDS } from "../shared-hooks";
8
- /**
9
- * React hook for using a Live Share `LiveEvent`.
10
- *
11
- * @remarks
12
- * Use this hook if you want to send transient JSON objects to everyone connected to the Fluid container,
13
- * such as when sending push notifications or reactions.
14
- *
15
- * @template TEvent Optional typing for events sent & received. Default is `object` type.
16
- * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one
17
- * will be created, otherwise it will use the existing one.
18
- * @param allowedRoles Optional. The meeting roles eligible to send events through this object.
19
- * @param onReceivedEvent Optional. Callback method to be called when a new notification is received.
20
- * @returns stateful `latestEvent` & `allEvents` list, `sendEvent` callback, and the `liveEvent` object.
21
- */
22
- export function useLiveEvent(uniqueKey, allowedRoles, onReceivedEvent) {
23
- /**
24
- * Stateful latest event (user facing) and its non-user-facing setter method.
25
- */
26
- const [latestEvent, setLatestReceived] = React.useState();
27
- /**
28
- * Reference for all received/sent events. The current value of this is user-facing. Because
29
- * this is always set at the same time as latestEvent, it is effectively a stateful value.
30
- */
31
- const allEventsRef = React.useRef([]);
32
- /**
33
- * User facing: dynamically load the DDS for the given unique key.
34
- */
35
- const { dds: liveEvent } = useDynamicDDS(uniqueKey, LiveEvent);
36
- /**
37
- * User facing: callback to send event through `LiveEvent`
38
- */
39
- const sendEvent = React.useCallback((event) => {
40
- if ((liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.isInitialized) === undefined) {
41
- console.error(new Error("Cannot call emitEvent when liveEvent is undefined"));
42
- return;
43
- }
44
- if (!liveEvent.isInitialized) {
45
- console.error(new Error("Cannot call emitEvent while liveEvent is not started"));
46
- return;
47
- }
48
- liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.sendEvent(event);
49
- }, [liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.isInitialized]);
50
- /**
51
- * Setup change listeners and start `LiveEvent` if needed
52
- */
53
- React.useEffect(() => {
54
- if ((liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.isInitialized) === undefined)
55
- return;
56
- // Register event listener
57
- const onEventReceived = (event, local) => {
58
- // If developer passed the optional onReceivedEvent callback, we
59
- // call it.
60
- onReceivedEvent === null || onReceivedEvent === void 0 ? void 0 : onReceivedEvent(event, local);
61
- // Set the received event to our local state
62
- const received = {
63
- event: event,
64
- local,
65
- };
66
- allEventsRef.current = [...allEventsRef.current, received];
67
- setLatestReceived(received);
68
- };
69
- liveEvent.on(LiveEventEvents.received, onEventReceived);
70
- if (!liveEvent.isInitialized) {
71
- // Start live event
72
- liveEvent.initialize(allowedRoles);
73
- }
74
- return () => {
75
- // on unmount, remove event listeners
76
- liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.off(LiveEventEvents.received, onEventReceived);
77
- };
78
- }, [liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.isInitialized]);
79
- return {
80
- latestEvent,
81
- allEvents: allEventsRef.current,
82
- sendEvent,
83
- liveEvent,
84
- };
85
- }
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ import { LiveEventEvents, LiveEvent, } from "@microsoft/live-share";
15
+ import React from "react";
16
+ import { useDynamicDDS } from "../shared-hooks";
17
+ import { ActionContainerNotJoinedError, ActionLiveDataObjectInitializedError, ActionLiveDataObjectUndefinedError, } from "../internal";
18
+ import { useFluidObjectsContext } from "../providers";
19
+ /**
20
+ * React hook for using a Live Share `LiveEvent`.
21
+ *
22
+ * @remarks
23
+ * Use this hook if you want to send transient JSON objects to everyone connected to the Fluid container,
24
+ * such as when sending push notifications or reactions.
25
+ *
26
+ * @template TEvent Optional typing for events sent & received. Default is `object` type.
27
+ * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one
28
+ * will be created, otherwise it will use the existing one.
29
+ * @param allowedRoles Optional. The meeting roles eligible to send events through this object.
30
+ * @param onReceivedEvent Optional. Callback method to be called when a new notification is received.
31
+ * @returns stateful `latestEvent` & `allEvents` list, `sendEvent` callback, and the `liveEvent` object.
32
+ */
33
+ export function useLiveEvent(uniqueKey, allowedRoles, onReceivedEvent) {
34
+ /**
35
+ * Stateful latest event (user facing) and its non-user-facing setter method.
36
+ */
37
+ const [latestEvent, setLatestReceived] = React.useState();
38
+ /**
39
+ * Reference for all received/sent events. The current value of this is user-facing. Because
40
+ * this is always set at the same time as latestEvent, it is effectively a stateful value.
41
+ */
42
+ const allEventsRef = React.useRef([]);
43
+ /**
44
+ * User facing: dynamically load the DDS for the given unique key.
45
+ */
46
+ const { dds: liveEvent } = useDynamicDDS(uniqueKey, (LiveEvent));
47
+ const { container } = useFluidObjectsContext();
48
+ /**
49
+ * User facing: callback to send event through `LiveEvent`
50
+ */
51
+ const sendEvent = React.useCallback((event) => __awaiter(this, void 0, void 0, function* () {
52
+ if (!container) {
53
+ throw new ActionContainerNotJoinedError("liveEvent", "sendEvent");
54
+ }
55
+ if (liveEvent === undefined) {
56
+ throw new ActionLiveDataObjectUndefinedError("liveEvent", "sendEvent");
57
+ }
58
+ if (!liveEvent.isInitialized) {
59
+ throw new ActionLiveDataObjectInitializedError("liveEvent", "sendEvent");
60
+ }
61
+ return yield liveEvent.send(event);
62
+ }), [container, liveEvent]);
63
+ /**
64
+ * Setup change listeners and start `LiveEvent` if needed
65
+ */
66
+ React.useEffect(() => {
67
+ if ((liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.isInitialized) === undefined)
68
+ return;
69
+ // Register event listener
70
+ const onEventReceived = (event, local, clientId, timestamp) => {
71
+ // If developer passed the optional onReceivedEvent callback, we
72
+ // call it.
73
+ onReceivedEvent === null || onReceivedEvent === void 0 ? void 0 : onReceivedEvent(event, local);
74
+ // Set the received event to our local state
75
+ const received = {
76
+ value: event,
77
+ local,
78
+ clientId,
79
+ timestamp,
80
+ };
81
+ allEventsRef.current = [...allEventsRef.current, received];
82
+ setLatestReceived(received);
83
+ };
84
+ liveEvent.on(LiveEventEvents.received, onEventReceived);
85
+ if (!liveEvent.isInitialized) {
86
+ // Start live event
87
+ liveEvent.initialize(allowedRoles);
88
+ }
89
+ return () => {
90
+ // on unmount, remove event listeners
91
+ liveEvent === null || liveEvent === void 0 ? void 0 : liveEvent.off(LiveEventEvents.received, onEventReceived);
92
+ };
93
+ }, [liveEvent]);
94
+ return {
95
+ latestEvent,
96
+ allEvents: allEventsRef.current,
97
+ sendEvent,
98
+ liveEvent,
99
+ };
100
+ }
86
101
  //# sourceMappingURL=useLiveEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveEvent.js","sourceRoot":"","sources":["../../src/live-hooks/useLiveEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,eAAe,EAEf,SAAS,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,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KAAK,CAAC,CAAC;YAChC,4CAA4C;YAC5C,MAAM,QAAQ,GAA8B;gBACxC,KAAK,EAAE,KAAK;gBACZ,KAAK;gBACL,QAAQ;gBACR,SAAS;aACZ,CAAC;YACF,YAAY,CAAC,OAAO,GAAG,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC3D,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC,CAAC;QACF,SAAS,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;YAC1B,mBAAmB;YACnB,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;SACtC;QAED,OAAO,GAAG,EAAE;YACR,qCAAqC;YACrC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,CAAC,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC9D,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO;QACH,WAAW;QACX,SAAS,EAAE,YAAY,CAAC,OAAO;QAC/B,SAAS;QACT,SAAS;KACZ,CAAC;AACN,CAAC"}
@@ -1,26 +1,26 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { PresenceState } from "@microsoft/live-share";
6
- import { IUseLivePresenceResults } from "../types";
7
- /**
8
- * React hook for using a Live Share `LivePresence`.
9
- *
10
- * @remarks
11
- * Use this hook if you want to track presence for who is currently using this component, such as
12
- * who is online or who is viewing a specific document. With presence, you can sent along any custom
13
- * user data. This is useful for rendering a list of users, profile pictures, cursor positions, and more.
14
- *
15
- * @template TData Optional typing for the custom user presence data object. Default is `object` type.
16
-
17
- * @param userId Optional. The unique ID for a user. If none is provided, a random UUID will be generated.
18
- * @param initialData Optional. Initial presence data object for the user.
19
- * @param initialPresenceState Optional. Initial status of the user's presence. Default is online.
20
- * @param uniqueKey Optional. The unique key for `LivePresence`. If one does not yet exist, a new one
21
- * will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
22
- * @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
23
- * to update the local user's presence and the `LivePresence` Fluid object.
24
- */
25
- export declare function useLivePresence<TData extends object = object>(userId?: string | undefined, initialData?: TData | undefined, initialPresenceState?: PresenceState, uniqueKey?: string): IUseLivePresenceResults<TData>;
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { PresenceState, UserMeetingRole } from "@microsoft/live-share";
6
+ import { IUseLivePresenceResults } from "../types";
7
+ /**
8
+ * React hook for using a Live Share `LivePresence`.
9
+ *
10
+ * @remarks
11
+ * Use this hook if you want to track presence for who is currently using this component, such as
12
+ * who is online or who is viewing a specific document. With presence, you can sent along any custom
13
+ * user data. This is useful for rendering a list of users, profile pictures, cursor positions, and more.
14
+ *
15
+ * @template TData Optional typing for the custom user presence data object. Default is `object` type.
16
+ * @param uniqueKey The unique key for `LivePresence`. If one does not yet exist, a new one
17
+ * @param userId Optional. The unique ID for a user. If none is provided, a random UUID will be generated.
18
+ * @param initialData Optional. Initial presence data object for the user. Can be value or a function to get the value.
19
+ * @param initialPresenceState Optional. Initial status of the user's presence. Default is online.
20
+ * @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
21
+ * will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
22
+ * @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
23
+ * to update the local user's presence and the `LivePresence` Fluid object.
24
+ */
25
+ export declare function useLivePresence<TData extends object = object>(uniqueKey: string, initialData?: TData | (() => TData) | undefined, initialPresenceState?: PresenceState, allowedRoles?: UserMeetingRole[]): IUseLivePresenceResults<TData>;
26
26
  //# sourceMappingURL=useLivePresence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLivePresence.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLivePresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,aAAa,EAEhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAGnD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EACzD,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,CAAC,EAAE,KAAK,GAAG,SAAS,EAC/B,oBAAoB,GAAE,aAAoC,EAC1D,SAAS,GAAE,MAAyB,GACrC,uBAAuB,CAAC,KAAK,CAAC,CAsFhC"}
1
+ {"version":3,"file":"useLivePresence.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLivePresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,aAAa,EAEb,eAAe,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAA8B,MAAM,UAAU,CAAC;AAS/E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EACzD,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,EAC/C,oBAAoB,GAAE,aAAoC,EAC1D,YAAY,CAAC,EAAE,eAAe,EAAE,GACjC,uBAAuB,CAAC,KAAK,CAAC,CA8FhC"}
@@ -1,93 +1,107 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { PresenceState, LivePresence, } from "@microsoft/live-share";
6
- import React from "react";
7
- import { useDynamicDDS } from "../shared-hooks";
8
- /**
9
- * React hook for using a Live Share `LivePresence`.
10
- *
11
- * @remarks
12
- * Use this hook if you want to track presence for who is currently using this component, such as
13
- * who is online or who is viewing a specific document. With presence, you can sent along any custom
14
- * user data. This is useful for rendering a list of users, profile pictures, cursor positions, and more.
15
- *
16
- * @template TData Optional typing for the custom user presence data object. Default is `object` type.
17
-
18
- * @param userId Optional. The unique ID for a user. If none is provided, a random UUID will be generated.
19
- * @param initialData Optional. Initial presence data object for the user.
20
- * @param initialPresenceState Optional. Initial status of the user's presence. Default is online.
21
- * @param uniqueKey Optional. The unique key for `LivePresence`. If one does not yet exist, a new one
22
- * will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
23
- * @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
24
- * to update the local user's presence and the `LivePresence` Fluid object.
25
- */
26
- export function useLivePresence(userId, initialData, initialPresenceState = PresenceState.online, uniqueKey = ":<dds-default>") {
27
- /**
28
- * Stateful all user presence list and its non-user-facing setter method.
29
- */
30
- const [allUsers, setAllUsers] = React.useState([]);
31
- /**
32
- * User facing: dynamically load the DDS for the given unique key.
33
- */
34
- const { dds: livePresence } = useDynamicDDS(uniqueKey, (LivePresence));
35
- /**
36
- * User facing: list of non-local user's presence objects.
37
- */
38
- const otherUsers = React.useMemo(() => {
39
- return [...allUsers.filter((user) => !user.isLocalUser)];
40
- }, [allUsers]);
41
- /**
42
- * User facing: local user's presence object.
43
- */
44
- const localUser = React.useMemo(() => {
45
- return allUsers.find((user) => user.isLocalUser);
46
- }, [allUsers]);
47
- /**
48
- * User facing: callback to update the local user's presence.
49
- */
50
- const updatePresence = React.useCallback((state, data) => {
51
- if (!livePresence) {
52
- console.error(new Error("Cannot call updatePresence when presence is undefined"));
53
- return;
54
- }
55
- if (!livePresence.isInitialized) {
56
- console.error(new Error("Cannot call updatePresence while presence is not started"));
57
- return;
58
- }
59
- livePresence.updatePresence(state, data);
60
- }, [livePresence]);
61
- /**
62
- * Setup change listeners and start `LivePresence` if needed
63
- */
64
- React.useEffect(() => {
65
- if (livePresence === undefined)
66
- return;
67
- const onPresenceChanged = () => {
68
- const updatedLocalUsers = [];
69
- livePresence === null || livePresence === void 0 ? void 0 : livePresence.forEach((user) => {
70
- updatedLocalUsers.push(user);
71
- });
72
- setAllUsers(updatedLocalUsers);
73
- };
74
- livePresence.on("presenceChanged", onPresenceChanged);
75
- if (!livePresence.isInitialized) {
76
- livePresence.initialize(userId, initialData, initialPresenceState);
77
- }
78
- else {
79
- onPresenceChanged();
80
- }
81
- return () => {
82
- livePresence === null || livePresence === void 0 ? void 0 : livePresence.off("presenceChanged", onPresenceChanged);
83
- };
84
- }, [livePresence]);
85
- return {
86
- localUser,
87
- otherUsers,
88
- allUsers,
89
- livePresence,
90
- updatePresence,
91
- };
92
- }
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ import { PresenceState, LivePresence, } from "@microsoft/live-share";
15
+ import React from "react";
16
+ import { useDynamicDDS } from "../shared-hooks";
17
+ import { useFluidObjectsContext } from "../providers";
18
+ import { ActionContainerNotJoinedError, ActionLiveDataObjectInitializedError, ActionLiveDataObjectUndefinedError, } from "../internal";
19
+ /**
20
+ * React hook for using a Live Share `LivePresence`.
21
+ *
22
+ * @remarks
23
+ * Use this hook if you want to track presence for who is currently using this component, such as
24
+ * who is online or who is viewing a specific document. With presence, you can sent along any custom
25
+ * user data. This is useful for rendering a list of users, profile pictures, cursor positions, and more.
26
+ *
27
+ * @template TData Optional typing for the custom user presence data object. Default is `object` type.
28
+ * @param uniqueKey The unique key for `LivePresence`. If one does not yet exist, a new one
29
+ * @param userId Optional. The unique ID for a user. If none is provided, a random UUID will be generated.
30
+ * @param initialData Optional. Initial presence data object for the user. Can be value or a function to get the value.
31
+ * @param initialPresenceState Optional. Initial status of the user's presence. Default is online.
32
+ * @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
33
+ * will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
34
+ * @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
35
+ * to update the local user's presence and the `LivePresence` Fluid object.
36
+ */
37
+ export function useLivePresence(uniqueKey, initialData, initialPresenceState = PresenceState.online, allowedRoles) {
38
+ /**
39
+ * Stateful all user presence list and its non-user-facing setter method.
40
+ */
41
+ const [allUsers, setAllUsers] = React.useState([]);
42
+ /**
43
+ * User facing: dynamically load the DDS for the given unique key.
44
+ */
45
+ const { dds: livePresence } = useDynamicDDS(uniqueKey, (LivePresence));
46
+ /**
47
+ * User facing: list of non-local user's presence objects.
48
+ */
49
+ const otherUsers = allUsers.filter((user) => !user.isLocalUser);
50
+ /**
51
+ * User facing: local user's presence object.
52
+ */
53
+ const localUser = allUsers.find((user) => user.isLocalUser);
54
+ const { container } = useFluidObjectsContext();
55
+ /**
56
+ * User facing: callback to update the local user's presence.
57
+ */
58
+ const updatePresence = React.useCallback((data, state) => __awaiter(this, void 0, void 0, function* () {
59
+ if (!container) {
60
+ throw new ActionContainerNotJoinedError("livePresence", "updatePresence");
61
+ }
62
+ if (livePresence === undefined) {
63
+ throw new ActionLiveDataObjectUndefinedError("livePresence", "updatePresence");
64
+ }
65
+ if (!livePresence.isInitialized) {
66
+ throw new ActionLiveDataObjectInitializedError("livePresence", "updatePresence");
67
+ }
68
+ return yield livePresence.update(data, state);
69
+ }), [container, livePresence]);
70
+ /**
71
+ * Setup change listeners and start `LivePresence` if needed
72
+ */
73
+ React.useEffect(() => {
74
+ if (livePresence === undefined)
75
+ return;
76
+ const onPresenceChanged = () => {
77
+ const updatedLocalUsers = [];
78
+ livePresence === null || livePresence === void 0 ? void 0 : livePresence.getUsers().forEach((user) => {
79
+ updatedLocalUsers.push(user);
80
+ });
81
+ setAllUsers(updatedLocalUsers);
82
+ };
83
+ livePresence.on("presenceChanged", onPresenceChanged);
84
+ if (!livePresence.isInitialized) {
85
+ livePresence.initialize(isInitialDataCallback(initialData)
86
+ ? initialData()
87
+ : initialData, initialPresenceState, allowedRoles);
88
+ }
89
+ else {
90
+ onPresenceChanged();
91
+ }
92
+ return () => {
93
+ livePresence === null || livePresence === void 0 ? void 0 : livePresence.off("presenceChanged", onPresenceChanged);
94
+ };
95
+ }, [livePresence]);
96
+ return {
97
+ localUser,
98
+ otherUsers,
99
+ allUsers,
100
+ livePresence,
101
+ updatePresence,
102
+ };
103
+ }
104
+ function isInitialDataCallback(value) {
105
+ return typeof value === "function";
106
+ }
93
107
  //# sourceMappingURL=useLivePresence.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLivePresence.js","sourceRoot":"","sources":["../../src/live-hooks/useLivePresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,aAAa,EACb,YAAY,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe,CAC3B,MAA2B,EAC3B,WAA+B,EAC/B,uBAAsC,aAAa,CAAC,MAAM,EAC1D,YAAoB,gBAAgB;IAEpC;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC1C,EAAE,CACL,CAAC;IACF;;OAEG;IACH,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,aAAa,CAAsB,SAAS,EAAE,CAAA,YAAmB,CAAA,CAAC,CAAC;IAEjG;;OA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C,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;YACH,WAAW,CAAC,iBAAiB,CAAC,CAAC;QACnC,CAAC,CAAC;QACF,YAAY,CAAC,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QAEtD,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE;YAC7B,YAAY,CAAC,UAAU,CACnB,qBAAqB,CAAQ,WAAW,CAAC;gBACrC,CAAC,CAAC,WAAW,EAAE;gBACf,CAAC,CAAC,WAAW,EACjB,oBAAoB,EACpB,YAAY,CACf,CAAC;SACL;aAAM;YACH,iBAAiB,EAAE,CAAC;SACvB;QAED,OAAO,GAAG,EAAE;YACR,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QAC5D,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO;QACH,SAAS;QACT,UAAU;QACV,QAAQ;QACR,YAAY;QACZ,cAAc;KACjB,CAAC;AACN,CAAC;AAED,SAAS,qBAAqB,CAAQ,KAAU;IAC5C,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACvC,CAAC"}
@@ -1,20 +1,20 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { UserMeetingRole } from "@microsoft/live-share";
6
- import { SetLiveStateAction } from "../types";
7
- /**
8
- * React hook for using a Live Share `LiveState`.
9
- *
10
- * @remarks
11
- * Use this hook if you want to synchronize app state that will reset when all users leave the session.
12
- *
13
- * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one will be created, otherwise it will use the existing one.
14
- * @param initialState Optional. the initial state value of type TState
15
- * @param initialData Optional. the initial data value of type TData
16
- * @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
17
- * @returns ordered values: first value is the synchronized state value, second is synchronized data value, and third is a setter to change the state/data values.
18
- */
19
- export declare function useLiveState<TState extends string = string, TData extends object = object>(uniqueKey: string, initialState?: TState, initialData?: TData, allowedRoles?: UserMeetingRole[]): [TState | undefined, TData | undefined, SetLiveStateAction<TState, TData>];
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { LiveState, UserMeetingRole } from "@microsoft/live-share";
6
+ import { SetLiveStateAction } from "../types";
7
+ /**
8
+ * React hook for using a Live Share `LiveState`.
9
+ *
10
+ * @remarks
11
+ * Use this hook if you want to synchronize app state that will reset when all users leave the session.
12
+ *
13
+ * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one will be created, otherwise it will use the existing one.
14
+ * @param initialState Optional. the initial state value of type TState
15
+ * @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
16
+ * @returns ordered values: first value is the synchronized state value and the second is a setter to change the state value.
17
+ * The setter returns a void promise, which will throw if the user does not have the required roles to set.
18
+ */
19
+ export declare function useLiveState<TState = any>(uniqueKey: string, initialState: TState, allowedRoles?: UserMeetingRole[]): [TState, SetLiveStateAction<TState>, LiveState<TState> | undefined];
20
20
  //# sourceMappingURL=useLiveState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveState.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLiveState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAa,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAW9C;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CACxB,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,KAAK,SAAS,MAAM,GAAG,MAAM,EAE7B,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,KAAK,EACnB,YAAY,CAAC,EAAE,eAAe,EAAE,GACjC,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAqE5E"}
1
+ {"version":3,"file":"useLiveState.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLiveState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAU9C;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAG,GAAG,EACrC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,eAAe,EAAE,GACjC,CAAC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAqErE"}