@microsoft/live-share-react 1.0.0-preview.11 → 1.0.0-preview.13

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 (215) hide show
  1. package/README.md +3 -3
  2. package/bin/index.d.ts +7 -0
  3. package/bin/index.d.ts.map +1 -0
  4. package/bin/index.js +7 -0
  5. package/bin/index.js.map +1 -0
  6. package/bin/interfaces/LiveInterfaceExtensions.d.ts +9 -0
  7. package/bin/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
  8. package/bin/interfaces/LiveInterfaceExtensions.js +6 -0
  9. package/bin/interfaces/LiveInterfaceExtensions.js.map +1 -0
  10. package/bin/interfaces/index.d.ts +2 -0
  11. package/bin/interfaces/index.d.ts.map +1 -0
  12. package/bin/interfaces/index.js +2 -0
  13. package/bin/interfaces/index.js.map +1 -0
  14. package/bin/internal-hooks/index.d.ts +2 -0
  15. package/bin/internal-hooks/index.d.ts.map +1 -0
  16. package/bin/internal-hooks/index.js +2 -0
  17. package/bin/internal-hooks/index.js.map +1 -0
  18. package/bin/internal-hooks/useDynamicDDSRegistry.d.ts +14 -0
  19. package/bin/internal-hooks/useDynamicDDSRegistry.d.ts.map +1 -0
  20. package/bin/internal-hooks/useDynamicDDSRegistry.js +142 -0
  21. package/bin/internal-hooks/useDynamicDDSRegistry.js.map +1 -0
  22. package/bin/internal-hooks/useSharedStateRegistry.d.ts +31 -0
  23. package/bin/internal-hooks/useSharedStateRegistry.d.ts.map +1 -0
  24. package/bin/internal-hooks/useSharedStateRegistry.js +102 -0
  25. package/bin/internal-hooks/useSharedStateRegistry.js.map +1 -0
  26. package/bin/internal-hooks/useStateRef.d.ts +7 -0
  27. package/bin/internal-hooks/useStateRef.d.ts.map +1 -0
  28. package/bin/internal-hooks/useStateRef.js +15 -0
  29. package/bin/internal-hooks/useStateRef.js.map +1 -0
  30. package/bin/live-hooks/index.d.ts +7 -0
  31. package/bin/live-hooks/index.d.ts.map +1 -0
  32. package/bin/live-hooks/index.js +7 -0
  33. package/bin/live-hooks/index.js.map +1 -0
  34. package/bin/live-hooks/useLiveAICompletion.d.ts +29 -0
  35. package/bin/live-hooks/useLiveAICompletion.d.ts.map +1 -0
  36. package/bin/live-hooks/useLiveAICompletion.js +186 -0
  37. package/bin/live-hooks/useLiveAICompletion.js.map +1 -0
  38. package/bin/live-hooks/useLiveCanvas.d.ts +28 -0
  39. package/bin/live-hooks/useLiveCanvas.d.ts.map +1 -0
  40. package/bin/live-hooks/useLiveCanvas.js +159 -0
  41. package/bin/live-hooks/useLiveCanvas.js.map +1 -0
  42. package/bin/live-hooks/useLiveCoPilot.d.ts +28 -0
  43. package/bin/live-hooks/useLiveCoPilot.d.ts.map +1 -0
  44. package/bin/live-hooks/useLiveCoPilot.js +178 -0
  45. package/bin/live-hooks/useLiveCoPilot.js.map +1 -0
  46. package/bin/live-hooks/useLiveEvent.d.ts +22 -0
  47. package/bin/live-hooks/useLiveEvent.d.ts.map +1 -0
  48. package/bin/live-hooks/useLiveEvent.js +93 -0
  49. package/bin/live-hooks/useLiveEvent.js.map +1 -0
  50. package/bin/live-hooks/useLivePresence.d.ts +26 -0
  51. package/bin/live-hooks/useLivePresence.d.ts.map +1 -0
  52. package/bin/live-hooks/useLivePresence.js +102 -0
  53. package/bin/live-hooks/useLivePresence.js.map +1 -0
  54. package/bin/live-hooks/useLiveState.d.ts +20 -0
  55. package/bin/live-hooks/useLiveState.d.ts.map +1 -0
  56. package/bin/live-hooks/useLiveState.js +73 -0
  57. package/bin/live-hooks/useLiveState.js.map +1 -0
  58. package/bin/live-hooks/useLiveTimer.d.ts +8 -0
  59. package/bin/live-hooks/useLiveTimer.d.ts.map +1 -0
  60. package/bin/live-hooks/useLiveTimer.js +145 -0
  61. package/bin/live-hooks/useLiveTimer.js.map +1 -0
  62. package/bin/live-hooks/useMediaSynchronizer.d.ts +23 -0
  63. package/bin/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
  64. package/bin/live-hooks/useMediaSynchronizer.js +185 -0
  65. package/bin/live-hooks/useMediaSynchronizer.js.map +1 -0
  66. package/bin/live-share-turbo/AzureTurboClient.d.ts +39 -0
  67. package/bin/live-share-turbo/AzureTurboClient.d.ts.map +1 -0
  68. package/bin/live-share-turbo/AzureTurboClient.js +56 -0
  69. package/bin/live-share-turbo/AzureTurboClient.js.map +1 -0
  70. package/bin/live-share-turbo/LiveShareTurboClient.d.ts +53 -0
  71. package/bin/live-share-turbo/LiveShareTurboClient.d.ts.map +1 -0
  72. package/bin/live-share-turbo/LiveShareTurboClient.js +69 -0
  73. package/bin/live-share-turbo/LiveShareTurboClient.js.map +1 -0
  74. package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts +31 -0
  75. package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts.map +1 -0
  76. package/bin/live-share-turbo/dds-objects/TurboDataObject.js +75 -0
  77. package/bin/live-share-turbo/dds-objects/TurboDataObject.js.map +1 -0
  78. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts +48 -0
  79. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts.map +1 -0
  80. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js +104 -0
  81. package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js.map +1 -0
  82. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts +28 -0
  83. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts.map +1 -0
  84. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js +68 -0
  85. package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js.map +1 -0
  86. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts +60 -0
  87. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts.map +1 -0
  88. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js +111 -0
  89. package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js.map +1 -0
  90. package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts +77 -0
  91. package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts.map +1 -0
  92. package/bin/live-share-turbo/dds-objects/TurboLivePresence.js +137 -0
  93. package/bin/live-share-turbo/dds-objects/TurboLivePresence.js.map +1 -0
  94. package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts +30 -0
  95. package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts.map +1 -0
  96. package/bin/live-share-turbo/dds-objects/TurboLiveState.js +74 -0
  97. package/bin/live-share-turbo/dds-objects/TurboLiveState.js.map +1 -0
  98. package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts +61 -0
  99. package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts.map +1 -0
  100. package/bin/live-share-turbo/dds-objects/TurboSharedMap.js +108 -0
  101. package/bin/live-share-turbo/dds-objects/TurboSharedMap.js.map +1 -0
  102. package/bin/live-share-turbo/dds-objects/index.d.ts +8 -0
  103. package/bin/live-share-turbo/dds-objects/index.d.ts.map +1 -0
  104. package/bin/live-share-turbo/dds-objects/index.js +8 -0
  105. package/bin/live-share-turbo/dds-objects/index.js.map +1 -0
  106. package/bin/live-share-turbo/index.d.ts +5 -0
  107. package/bin/live-share-turbo/index.d.ts.map +1 -0
  108. package/bin/live-share-turbo/index.js +5 -0
  109. package/bin/live-share-turbo/index.js.map +1 -0
  110. package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts +15 -0
  111. package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts.map +1 -0
  112. package/bin/live-share-turbo/interfaces/IFluidTurboClient.js +2 -0
  113. package/bin/live-share-turbo/interfaces/IFluidTurboClient.js.map +1 -0
  114. package/bin/live-share-turbo/interfaces/index.d.ts +3 -0
  115. package/bin/live-share-turbo/interfaces/index.d.ts.map +1 -0
  116. package/bin/live-share-turbo/interfaces/index.js +3 -0
  117. package/bin/live-share-turbo/interfaces/index.js.map +1 -0
  118. package/bin/live-share-turbo/internals/FluidTurboClient.d.ts +39 -0
  119. package/bin/live-share-turbo/internals/FluidTurboClient.d.ts.map +1 -0
  120. package/bin/live-share-turbo/internals/FluidTurboClient.js +121 -0
  121. package/bin/live-share-turbo/internals/FluidTurboClient.js.map +1 -0
  122. package/bin/live-share-turbo/internals/index.d.ts +2 -0
  123. package/bin/live-share-turbo/internals/index.d.ts.map +1 -0
  124. package/bin/live-share-turbo/internals/index.js +2 -0
  125. package/bin/live-share-turbo/internals/index.js.map +1 -0
  126. package/bin/live-share-turbo/internals/types.d.ts +4 -0
  127. package/bin/live-share-turbo/internals/types.d.ts.map +1 -0
  128. package/bin/live-share-turbo/internals/types.js +2 -0
  129. package/bin/live-share-turbo/internals/types.js.map +1 -0
  130. package/bin/providers/AzureProvider.d.ts +34 -0
  131. package/bin/providers/AzureProvider.d.ts.map +1 -0
  132. package/bin/providers/AzureProvider.js +102 -0
  133. package/bin/providers/AzureProvider.js.map +1 -0
  134. package/bin/providers/FluidContextProvider.d.ts +34 -0
  135. package/bin/providers/FluidContextProvider.d.ts.map +1 -0
  136. package/bin/providers/FluidContextProvider.js +99 -0
  137. package/bin/providers/FluidContextProvider.js.map +1 -0
  138. package/bin/providers/LiveShareContextProvider.d.ts +42 -0
  139. package/bin/providers/LiveShareContextProvider.d.ts.map +1 -0
  140. package/bin/providers/LiveShareContextProvider.js +63 -0
  141. package/bin/providers/LiveShareContextProvider.js.map +1 -0
  142. package/bin/providers/LiveShareProvider.d.ts +63 -0
  143. package/bin/providers/LiveShareProvider.d.ts.map +1 -0
  144. package/bin/providers/LiveShareProvider.js +69 -0
  145. package/bin/providers/LiveShareProvider.js.map +1 -0
  146. package/bin/providers/index.d.ts +3 -0
  147. package/bin/providers/index.d.ts.map +1 -0
  148. package/bin/providers/index.js +3 -0
  149. package/bin/providers/index.js.map +1 -0
  150. package/bin/shared-hooks/index.d.ts +4 -0
  151. package/bin/shared-hooks/index.d.ts.map +1 -0
  152. package/bin/shared-hooks/index.js +4 -0
  153. package/bin/shared-hooks/index.js.map +1 -0
  154. package/bin/shared-hooks/useDynamicDDS.d.ts +19 -0
  155. package/bin/shared-hooks/useDynamicDDS.d.ts.map +1 -0
  156. package/bin/shared-hooks/useDynamicDDS.js +68 -0
  157. package/bin/shared-hooks/useDynamicDDS.js.map +1 -0
  158. package/bin/shared-hooks/useLockedTask.d.ts +11 -0
  159. package/bin/shared-hooks/useLockedTask.d.ts.map +1 -0
  160. package/bin/shared-hooks/useLockedTask.js +82 -0
  161. package/bin/shared-hooks/useLockedTask.js.map +1 -0
  162. package/bin/shared-hooks/useSharedMap.d.ts +22 -0
  163. package/bin/shared-hooks/useSharedMap.d.ts.map +1 -0
  164. package/bin/shared-hooks/useSharedMap.js +106 -0
  165. package/bin/shared-hooks/useSharedMap.js.map +1 -0
  166. package/bin/shared-hooks/useSharedState.d.ts +21 -0
  167. package/bin/shared-hooks/useSharedState.d.ts.map +1 -0
  168. package/bin/shared-hooks/useSharedState.js +67 -0
  169. package/bin/shared-hooks/useSharedState.js.map +1 -0
  170. package/bin/shared-hooks/useTaskManager.d.ts +13 -0
  171. package/bin/shared-hooks/useTaskManager.d.ts.map +1 -0
  172. package/bin/shared-hooks/useTaskManager.js +86 -0
  173. package/bin/shared-hooks/useTaskManager.js.map +1 -0
  174. package/bin/types/ActionTypes.d.ts +106 -0
  175. package/bin/types/ActionTypes.d.ts.map +1 -0
  176. package/bin/types/ActionTypes.js +6 -0
  177. package/bin/types/ActionTypes.js.map +1 -0
  178. package/bin/types/PropTypes.d.ts +8 -0
  179. package/bin/types/PropTypes.d.ts.map +1 -0
  180. package/bin/types/PropTypes.js +6 -0
  181. package/bin/types/PropTypes.js.map +1 -0
  182. package/bin/types/ResultTypes.d.ts +175 -0
  183. package/bin/types/ResultTypes.d.ts.map +1 -0
  184. package/bin/types/ResultTypes.js +6 -0
  185. package/bin/types/ResultTypes.js.map +1 -0
  186. package/bin/types/index.d.ts +4 -0
  187. package/bin/types/index.d.ts.map +1 -0
  188. package/bin/types/index.js +4 -0
  189. package/bin/types/index.js.map +1 -0
  190. package/bin/utils/getContainerSchema.d.ts +8 -0
  191. package/bin/utils/getContainerSchema.d.ts.map +1 -0
  192. package/bin/utils/getContainerSchema.js +41 -0
  193. package/bin/utils/getContainerSchema.js.map +1 -0
  194. package/bin/utils/index.d.ts +2 -0
  195. package/bin/utils/index.d.ts.map +1 -0
  196. package/bin/utils/index.js +2 -0
  197. package/bin/utils/index.js.map +1 -0
  198. package/bin/utils/type-check.d.ts +15 -0
  199. package/bin/utils/type-check.d.ts.map +1 -0
  200. package/bin/utils/type-check.js +54 -0
  201. package/bin/utils/type-check.js.map +1 -0
  202. package/package.json +13 -13
  203. package/src/internal-hooks/useSharedStateRegistry.ts +6 -5
  204. package/src/live-hooks/useLiveEvent.ts +14 -18
  205. package/src/live-hooks/useLivePresence.ts +13 -7
  206. package/src/live-hooks/useLiveState.ts +8 -6
  207. package/src/live-hooks/useLiveTimer.ts +21 -18
  208. package/src/live-hooks/useMediaSynchronizer.ts +37 -27
  209. package/src/providers/AzureProvider.tsx +2 -7
  210. package/src/providers/LiveShareProvider.tsx +45 -15
  211. package/src/shared-hooks/useDynamicDDS.ts +15 -8
  212. package/src/shared-hooks/useSharedMap.ts +17 -10
  213. package/src/shared-hooks/useSharedState.ts +5 -1
  214. package/src/types/ActionTypes.ts +89 -11
  215. package/src/types/ResultTypes.ts +22 -8
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ export type SharedMapInitialData<T> = Map<string, T> | readonly (readonly [string, T])[] | {
6
+ [key: string]: T;
7
+ } | undefined;
8
+ //# sourceMappingURL=PropTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropTypes.d.ts","sourceRoot":"","sources":["../../src/types/PropTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAC5B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GACd,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GACjC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAA;CAAE,GACpB,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=PropTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropTypes.js","sourceRoot":"","sources":["../../src/types/PropTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,175 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { AzureContainerServices } from "@fluidframework/azure-client";
6
+ import { ITimerConfig, LivePresenceUser, LiveEvent, LivePresence, LiveTimer } from "@microsoft/live-share";
7
+ import { InkingManager, LiveCanvas } from "@microsoft/live-share-canvas";
8
+ import { CoordinationWaitPoint, ExtendedMediaMetadata, MediaPlayerSynchronizer } from "@microsoft/live-share-media";
9
+ import { IFluidContainer, SharedMap } from "fluid-framework";
10
+ import { IReceiveLiveEvent } from "../interfaces";
11
+ import { OnPauseTimerAction, OnPlayTimerAction, OnStartTimerAction, OnUpdateLivePresenceAction, SendLiveEventAction } from "./ActionTypes";
12
+ export interface IAzureContainerResults {
13
+ /**
14
+ * Fluid Container.
15
+ */
16
+ container: IFluidContainer;
17
+ /**
18
+ * Azure container services which has information such as current socket connections.
19
+ */
20
+ services: AzureContainerServices;
21
+ }
22
+ export interface ILiveShareContainerResults extends IAzureContainerResults {
23
+ /**
24
+ * Whether the local user/client initially created the container.
25
+ */
26
+ created: boolean;
27
+ }
28
+ export interface IUseSharedMapResults<TData> {
29
+ /**
30
+ * Stateful map of most recent values from `SharedMap`.
31
+ */
32
+ map: ReadonlyMap<string, TData>;
33
+ /**
34
+ * Callback method to set/replace new entries in the `SharedMap`.
35
+ */
36
+ setEntry: (key: string, value: TData) => void;
37
+ /**
38
+ * Callback method to delete an existing entry in the `SharedMap`.
39
+ */
40
+ deleteEntry: (key: string) => void;
41
+ /**
42
+ * The Fluid `SharedMap` object, should you want to use it directly.
43
+ */
44
+ sharedMap: SharedMap | undefined;
45
+ }
46
+ export interface IUseLiveEventResults<TEvent extends object = object> {
47
+ /**
48
+ * The most recent event that has been received in the session.
49
+ */
50
+ latestEvent: IReceiveLiveEvent<TEvent> | undefined;
51
+ /**
52
+ * All received events since initializing this component, sorted from oldest -> newest.
53
+ */
54
+ allEvents: IReceiveLiveEvent<TEvent>[];
55
+ /**
56
+ * Callback method to send a new event to users in the session.
57
+ * @param TEvent to send.
58
+ * @returns void promise that will throw when user does not have required roles
59
+ */
60
+ sendEvent: SendLiveEventAction<TEvent>;
61
+ /**
62
+ * The `LiveEvent` object, should you want to use it directly.
63
+ */
64
+ liveEvent: LiveEvent | undefined;
65
+ }
66
+ export interface IUseLiveTimerResults {
67
+ /**
68
+ * The current timer configuration.
69
+ */
70
+ timerConfig: ITimerConfig | undefined;
71
+ /**
72
+ * The time remaining in milliseconds.
73
+ */
74
+ milliRemaining: number | undefined;
75
+ /**
76
+ * The `LiveTimer` object, should you want to use it directly.
77
+ */
78
+ liveTimer: LiveTimer | undefined;
79
+ /**
80
+ * Callback to send event through `LiveTimer`
81
+ * @param duration the duration for the timer in milliseconds
82
+ * @returns void promise that will throw when user does not have required roles
83
+ */
84
+ start: OnStartTimerAction;
85
+ /**
86
+ * Callback to send event through `LiveTimer`
87
+ * @returns void promise that will throw when user does not have required roles
88
+ */
89
+ play: OnPlayTimerAction;
90
+ /**
91
+ * Callback to send event through `LiveTimer`
92
+ * @returns void promise that will throw when user does not have required roles
93
+ */
94
+ pause: OnPauseTimerAction;
95
+ }
96
+ export interface IUseLivePresenceResults<TData extends object = object> {
97
+ /**
98
+ * The local user's presence object.
99
+ */
100
+ localUser: LivePresenceUser<TData> | undefined;
101
+ /**
102
+ * List of non-local user's presence objects.
103
+ */
104
+ otherUsers: LivePresenceUser<TData>[];
105
+ /**
106
+ * List of all user's presence objects.
107
+ */
108
+ allUsers: LivePresenceUser<TData>[];
109
+ /**
110
+ * Live Share `LivePresence` object, should you want to use it directly.
111
+ */
112
+ livePresence: LivePresence<TData> | undefined;
113
+ /**
114
+ * Callback method to update the local user's presence.
115
+ * @param data Optional. TData to set for user.
116
+ * @param state Optional. PresenceState to set for user.
117
+ * @returns void promise that will throw when user does not have required roles
118
+ */
119
+ updatePresence: OnUpdateLivePresenceAction<TData>;
120
+ }
121
+ export interface IUseMediaSynchronizerResults {
122
+ /**
123
+ * Stateful boolean on whether the session has an active suspension.
124
+ */
125
+ suspended: boolean;
126
+ /**
127
+ * Callback to initiate a play action for the group media session.
128
+ * @returns void promise that will throw when user does not have required roles
129
+ */
130
+ play: () => Promise<void>;
131
+ /**
132
+ * Callback to initiate a pause action for the group media session.
133
+ * @returns void promise that will throw when user does not have required roles
134
+ */
135
+ pause: () => Promise<void>;
136
+ /**
137
+ * Callback to initiate a seek action for the group media session.
138
+ * @param time timestamp of the video in seconds to seek to
139
+ * @returns void promise that will throw when user does not have required roles
140
+ */
141
+ seekTo: (time: number) => Promise<void>;
142
+ /**
143
+ * Callback to change the track for the group media session.
144
+ * @param track media metadata object, track src string, or null
145
+ * @returns void promise that will throw when user does not have required roles
146
+ */
147
+ setTrack: (track: Partial<ExtendedMediaMetadata> | string | null) => Promise<void>;
148
+ /**
149
+ * Begin a new suspension. If a wait point is not set, the suspension will only impact the
150
+ * local user.
151
+ *
152
+ * @param waitPoint Optional. Point in track to set the suspension at.
153
+ * @see CoordinationWaitPoint
154
+ */
155
+ beginSuspension: (waitPoint?: CoordinationWaitPoint) => void;
156
+ /**
157
+ * End the currently active exception.
158
+ */
159
+ endSuspension: () => void;
160
+ /**
161
+ * Live Share `MediaPlayerSynchronizer` object, should you want to use it directly.
162
+ */
163
+ mediaSynchronizer: MediaPlayerSynchronizer | undefined;
164
+ }
165
+ export interface IUseLiveCanvasResults {
166
+ /**
167
+ * Inking manager for the canvas, which is synchronized by `liveCanvas`. It is set when loaded and undefined while loading.
168
+ */
169
+ inkingManager: InkingManager | undefined;
170
+ /**
171
+ * Live Canvas data object which synchronizes inking & cursors in the session. It is set when loaded and undefined while loading.
172
+ */
173
+ liveCanvas: LiveCanvas | undefined;
174
+ }
175
+ //# sourceMappingURL=ResultTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultTypes.d.ts","sourceRoot":"","sources":["../../src/types/ResultTypes.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=ResultTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultTypes.js","sourceRoot":"","sources":["../../src/types/ResultTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,4 @@
1
+ export * from "./ActionTypes";
2
+ export * from "./ResultTypes";
3
+ export * from "./PropTypes";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./ActionTypes";
2
+ export * from "./ResultTypes";
3
+ export * from "./PropTypes";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { ContainerSchema, LoadableObjectClass } from "fluid-framework";
6
+ export declare function getContainerSchema(additionalDynamicObjectTypes: LoadableObjectClass<any>[] | undefined): ContainerSchema;
7
+ export declare function getLiveShareContainerSchema(additionalDynamicObjectTypes: LoadableObjectClass<any>[] | undefined): ContainerSchema;
8
+ //# sourceMappingURL=getContainerSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getContainerSchema.d.ts","sourceRoot":"","sources":["../../src/utils/getContainerSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACH,eAAe,EACf,mBAAmB,EAItB,MAAM,iBAAiB,CAAC;AAUzB,wBAAgB,kBAAkB,CAC9B,4BAA4B,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,GACrE,eAAe,CAUjB;AAED,wBAAgB,2BAA2B,CACvC,4BAA4B,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,mBAgBvE"}
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { LiveEvent, LivePresence, LiveState, LiveTimer, } from "@microsoft/live-share";
6
+ import { LiveCanvas } from "@microsoft/live-share-canvas";
7
+ import { LiveMediaSession } from "@microsoft/live-share-media";
8
+ import { SharedDirectory, SharedMap, SharedString, } from "fluid-framework";
9
+ const schema = {
10
+ initialObjects: {
11
+ stateMap: SharedMap,
12
+ dynamicObjects: SharedMap,
13
+ },
14
+ dynamicObjectTypes: [SharedMap, SharedString, SharedDirectory],
15
+ };
16
+ export function getContainerSchema(additionalDynamicObjectTypes) {
17
+ const _additionalDynamicObjectTypes = additionalDynamicObjectTypes !== null && additionalDynamicObjectTypes !== void 0 ? additionalDynamicObjectTypes : [];
18
+ return {
19
+ initialObjects: schema.initialObjects,
20
+ dynamicObjectTypes: [
21
+ ...schema.dynamicObjectTypes,
22
+ ..._additionalDynamicObjectTypes,
23
+ ],
24
+ };
25
+ }
26
+ export function getLiveShareContainerSchema(additionalDynamicObjectTypes) {
27
+ const liveShareDynamicObjects = [
28
+ LiveEvent,
29
+ LivePresence,
30
+ LiveState,
31
+ LiveMediaSession,
32
+ LiveTimer,
33
+ LiveCanvas,
34
+ ];
35
+ const _additionalDynamicObjectTypes = additionalDynamicObjectTypes !== null && additionalDynamicObjectTypes !== void 0 ? additionalDynamicObjectTypes : [];
36
+ return getContainerSchema([
37
+ ...liveShareDynamicObjects,
38
+ ..._additionalDynamicObjectTypes,
39
+ ]);
40
+ }
41
+ //# sourceMappingURL=getContainerSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getContainerSchema.js","sourceRoot":"","sources":["../../src/utils/getContainerSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EACZ,SAAS,EACT,SAAS,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAGH,eAAe,EACf,SAAS,EACT,YAAY,GACf,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,GAAoB;IAC5B,cAAc,EAAE;QACZ,QAAQ,EAAE,SAAS;QACnB,cAAc,EAAE,SAAS;KAC5B;IACD,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,eAAe,CAAC;CACjE,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAC9B,4BAAoE;IAEpE,MAAM,6BAA6B,GAC/B,4BAA4B,aAA5B,4BAA4B,cAA5B,4BAA4B,GAAI,EAAE,CAAC;IACvC,OAAO;QACH,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,kBAAkB,EAAE;YAChB,GAAG,MAAM,CAAC,kBAAmB;YAC7B,GAAG,6BAA6B;SACnC;KACJ,CAAC;AACN,CAAC;AAED,MAAM,UAAU,2BAA2B,CACvC,4BAAoE;IAEpE,MAAM,uBAAuB,GAA+B;QACxD,SAAS;QACT,YAAY;QACZ,SAAS;QACT,gBAAgB;QAChB,SAAS;QACT,UAAU;KACb,CAAC;IACF,MAAM,6BAA6B,GAC/B,4BAA4B,aAA5B,4BAA4B,cAA5B,4BAA4B,GAAI,EAAE,CAAC;IACvC,OAAO,kBAAkB,CAAC;QACtB,GAAG,uBAAuB;QAC1B,GAAG,6BAA6B;KACnC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./type-check";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./type-check";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { ExtendedMediaMetadata, IMediaPlayer } from "@microsoft/live-share-media";
6
+ import React from "react";
7
+ export declare function isRefObject<T>(value: any): value is React.RefObject<T>;
8
+ export declare function isMediaElement(value: any): value is IMediaPlayer;
9
+ export declare function isExtendedMediaMetadata(value: any): value is ExtendedMediaMetadata;
10
+ export declare function isMap(value: any): value is Map<string, any>;
11
+ export declare function isEntries(value: any): value is readonly (readonly [string, any])[];
12
+ export declare function isJSON(value: any): value is {
13
+ [key: string]: any;
14
+ };
15
+ //# sourceMappingURL=type-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-check.d.ts","sourceRoot":"","sources":["../../src/utils/type-check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,qBAAqB,EACrB,YAAY,EACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAEtE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAoBhE;AAED,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,GAAG,GACX,KAAK,IAAI,qBAAqB,CAEhC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAE3D;AAED,wBAAgB,SAAS,CACrB,KAAK,EAAE,GAAG,GACX,KAAK,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAU9C;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAOlE"}
@@ -0,0 +1,54 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ export function isRefObject(value) {
6
+ return value.current === null || !!value.current;
7
+ }
8
+ export function isMediaElement(value) {
9
+ if (value) {
10
+ return (value.currentSrc !== undefined &&
11
+ value.currentTime !== undefined &&
12
+ value.duration !== undefined &&
13
+ value.ended !== undefined &&
14
+ value.muted !== undefined &&
15
+ value.paused !== undefined &&
16
+ value.playbackRate !== undefined &&
17
+ value.src !== undefined &&
18
+ value.volume !== undefined &&
19
+ value.load !== undefined &&
20
+ value.pause !== undefined &&
21
+ value.play !== undefined &&
22
+ value.addEventListener !== undefined &&
23
+ value.removeEventListener !== undefined);
24
+ }
25
+ return false;
26
+ }
27
+ export function isExtendedMediaMetadata(value) {
28
+ return value === null || !!(value === null || value === void 0 ? void 0 : value.trackIdentifier);
29
+ }
30
+ export function isMap(value) {
31
+ return value instanceof Map;
32
+ }
33
+ export function isEntries(value) {
34
+ try {
35
+ const tryValue = value;
36
+ if (typeof tryValue[0][0] === "string") {
37
+ return true;
38
+ }
39
+ return false;
40
+ }
41
+ catch (error) {
42
+ return false;
43
+ }
44
+ }
45
+ export function isJSON(value) {
46
+ try {
47
+ const tryValue = value;
48
+ return Object.keys(tryValue).length > 0;
49
+ }
50
+ catch (error) {
51
+ return false;
52
+ }
53
+ }
54
+ //# sourceMappingURL=type-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-check.js","sourceRoot":"","sources":["../../src/utils/type-check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,UAAU,WAAW,CAAI,KAAU;IACrC,OAAO,KAAK,CAAC,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAU;IACrC,IAAI,KAAK,EAAE;QACP,OAAO,CACH,KAAK,CAAC,UAAU,KAAK,SAAS;YAC9B,KAAK,CAAC,WAAW,KAAK,SAAS;YAC/B,KAAK,CAAC,QAAQ,KAAK,SAAS;YAC5B,KAAK,CAAC,KAAK,KAAK,SAAS;YACzB,KAAK,CAAC,KAAK,KAAK,SAAS;YACzB,KAAK,CAAC,MAAM,KAAK,SAAS;YAC1B,KAAK,CAAC,YAAY,KAAK,SAAS;YAChC,KAAK,CAAC,GAAG,KAAK,SAAS;YACvB,KAAK,CAAC,MAAM,KAAK,SAAS;YAC1B,KAAK,CAAC,IAAI,KAAK,SAAS;YACxB,KAAK,CAAC,KAAK,KAAK,SAAS;YACzB,KAAK,CAAC,IAAI,KAAK,SAAS;YACxB,KAAK,CAAC,gBAAgB,KAAK,SAAS;YACpC,KAAK,CAAC,mBAAmB,KAAK,SAAS,CAC1C,CAAC;KACL;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,uBAAuB,CACnC,KAAU;IAEV,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAA,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,KAAU;IAC5B,OAAO,KAAK,YAAY,GAAG,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,SAAS,CACrB,KAAU;IAEV,IAAI;QACA,MAAM,QAAQ,GAAG,KAAyC,CAAC;QAC3D,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YACpC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;KAChB;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;AACL,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAU;IAC7B,IAAI;QACA,MAAM,QAAQ,GAAG,KAA+B,CAAC;QACjD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;KAC3C;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/live-share-react",
3
- "version": "1.0.0-preview.11",
3
+ "version": "1.0.0-preview.13",
4
4
  "description": "Build collaborative React apps using Microsoft's Fluid & Live Share frameworks with ease.",
5
5
  "author": "Microsoft",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -12,29 +12,29 @@
12
12
  "typecheck": "tsc"
13
13
  },
14
14
  "dependencies": {
15
- "@microsoft/live-share-turbo": "1.0.0-preview.11",
15
+ "@microsoft/live-share-turbo": "1.0.0-preview.13",
16
16
  "url": "^0.11.0",
17
- "uuid": "^8.3.2"
17
+ "uuid": "^9.0.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@babel/core": "^7.12.3",
20
+ "@babel/core": "^7.21.8",
21
21
  "@fluidframework/azure-client": "~1.0.3",
22
22
  "@fluidframework/test-client-utils": "^1.3.6",
23
- "@microsoft/live-share": "1.0.0-preview.11",
24
- "@microsoft/live-share-canvas": "1.0.0-preview.11",
25
- "@microsoft/live-share-media": "1.0.0-preview.11",
23
+ "@microsoft/live-share": "1.0.0-preview.13",
24
+ "@microsoft/live-share-canvas": "1.0.0-preview.13",
25
+ "@microsoft/live-share-media": "1.0.0-preview.13",
26
26
  "@types/react": "^18.0.0",
27
27
  "@types/react-dom": "^18.0.0",
28
- "@types/uuid": "^8.3.4",
29
- "babel-loader": "^7.1.5",
28
+ "@types/uuid": "^9.0.1",
29
+ "babel-loader": "^9.1.2",
30
30
  "fluid-framework": "^1.3.6",
31
- "typescript": "^4.6.4"
31
+ "typescript": "^5.0.4"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@fluidframework/azure-client": "^1.0.0",
35
- "@microsoft/live-share": "1.0.0-preview.11",
36
- "@microsoft/live-share-canvas": "1.0.0-preview.11",
37
- "@microsoft/live-share-media": "1.0.0-preview.11",
35
+ "@microsoft/live-share": "1.0.0-preview.13",
36
+ "@microsoft/live-share-canvas": "1.0.0-preview.13",
37
+ "@microsoft/live-share-media": "1.0.0-preview.13",
38
38
  "fluid-framework": "^1.2.3",
39
39
  "react": "^16.8.0 || ^17 || ^18",
40
40
  "react-dom": "^16.8.0 || ^17 || ^18"
@@ -70,9 +70,8 @@ export const useSharedStateRegistry = (
70
70
  );
71
71
  }
72
72
  // Set initial values, if known
73
- const stateMap = results?.container.initialObjects.TURBO_STATE_MAP as
74
- | SharedMap
75
- | undefined;
73
+ const stateMap = results?.container.initialObjects
74
+ .TURBO_STATE_MAP as SharedMap | undefined;
76
75
  const initialValue = stateMap?.get(uniqueKey);
77
76
  if (initialValue) {
78
77
  setLocalStateAction(initialValue);
@@ -102,7 +101,8 @@ export const useSharedStateRegistry = (
102
101
  (uniqueKey: string, value: any) => {
103
102
  if (!results) return;
104
103
  const { container } = results;
105
- const stateMap = container.initialObjects.TURBO_STATE_MAP as SharedMap;
104
+ const stateMap = container.initialObjects
105
+ .TURBO_STATE_MAP as SharedMap;
106
106
  stateMap.set(uniqueKey, value);
107
107
  },
108
108
  [results]
@@ -118,7 +118,8 @@ export const useSharedStateRegistry = (
118
118
  let actionsMap =
119
119
  registeredSharedSetStateActionMapRef.current.get(uniqueKey);
120
120
  actionsMap?.clear();
121
- const stateMap = container.initialObjects.TURBO_STATE_MAP as SharedMap;
121
+ const stateMap = container.initialObjects
122
+ .TURBO_STATE_MAP as SharedMap;
122
123
  stateMap.delete(uniqueKey);
123
124
  },
124
125
  [results]
@@ -49,40 +49,36 @@ export function useLiveEvent<TEvent extends object = object>(
49
49
  /**
50
50
  * User facing: dynamically load the DDS for the given unique key.
51
51
  */
52
- const { dds: liveEvent } = useDynamicDDS<LiveEvent>(uniqueKey, LiveEvent);
52
+ const { dds: liveEvent } = useDynamicDDS<LiveEvent<TEvent>>(
53
+ uniqueKey,
54
+ LiveEvent<TEvent>
55
+ );
53
56
 
54
57
  /**
55
58
  * User facing: callback to send event through `LiveEvent`
56
59
  */
57
60
  const sendEvent: SendLiveEventAction<TEvent> = React.useCallback(
58
- (event: TEvent) => {
59
- if (liveEvent?.isInitialized === undefined) {
60
- console.error(
61
- new Error(
62
- "Cannot call emitEvent when liveEvent is undefined"
63
- )
61
+ async (event: TEvent) => {
62
+ if (liveEvent === undefined) {
63
+ throw new Error(
64
+ "Cannot call emitEvent when liveEvent is undefined"
64
65
  );
65
- return;
66
66
  }
67
67
  if (!liveEvent.isInitialized) {
68
- console.error(
69
- new Error(
70
- "Cannot call emitEvent while liveEvent is not started"
71
- )
68
+ throw new Error(
69
+ "Cannot call emitEvent while liveEvent is not started"
72
70
  );
73
- return;
74
71
  }
75
- liveEvent?.send(event);
72
+ return await liveEvent.send(event);
76
73
  },
77
- [liveEvent?.isInitialized]
74
+ [liveEvent]
78
75
  );
79
76
 
80
77
  /**
81
78
  * Setup change listeners and start `LiveEvent` if needed
82
79
  */
83
80
  React.useEffect(() => {
84
- if (liveEvent?.isInitialized === undefined)
85
- return;
81
+ if (liveEvent?.isInitialized === undefined) return;
86
82
  // Register event listener
87
83
  const onEventReceived = (event: any, local: boolean) => {
88
84
  // If developer passed the optional onReceivedEvent callback, we
@@ -106,7 +102,7 @@ export function useLiveEvent<TEvent extends object = object>(
106
102
  // on unmount, remove event listeners
107
103
  liveEvent?.off(LiveEventEvents.received, onEventReceived);
108
104
  };
109
- }, [liveEvent?.isInitialized]);
105
+ }, [liveEvent]);
110
106
 
111
107
  return {
112
108
  latestEvent,
@@ -7,6 +7,7 @@ import {
7
7
  LivePresenceUser,
8
8
  PresenceState,
9
9
  LivePresence,
10
+ UserMeetingRole,
10
11
  } from "@microsoft/live-share";
11
12
  import React from "react";
12
13
  import { IUseLivePresenceResults, OnUpdateLivePresenceAction } from "../types";
@@ -21,19 +22,20 @@ import { useDynamicDDS } from "../shared-hooks";
21
22
  * user data. This is useful for rendering a list of users, profile pictures, cursor positions, and more.
22
23
  *
23
24
  * @template TData Optional typing for the custom user presence data object. Default is `object` type.
24
-
25
+ * @param uniqueKey The unique key for `LivePresence`. If one does not yet exist, a new one
25
26
  * @param userId Optional. The unique ID for a user. If none is provided, a random UUID will be generated.
26
27
  * @param initialData Optional. Initial presence data object for the user.
27
28
  * @param initialPresenceState Optional. Initial status of the user's presence. Default is online.
28
- * @param uniqueKey Optional. The unique key for `LivePresence`. If one does not yet exist, a new one
29
+ * @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
29
30
  * will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
30
31
  * @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
31
32
  * to update the local user's presence and the `LivePresence` Fluid object.
32
33
  */
33
34
  export function useLivePresence<TData extends object = object>(
35
+ uniqueKey: string,
34
36
  initialData?: TData | undefined,
35
37
  initialPresenceState: PresenceState = PresenceState.online,
36
- uniqueKey: string = ":<dds-default>"
38
+ allowedRoles?: UserMeetingRole[]
37
39
  ): IUseLivePresenceResults<TData> {
38
40
  /**
39
41
  * Stateful all user presence list and its non-user-facing setter method.
@@ -67,7 +69,7 @@ export function useLivePresence<TData extends object = object>(
67
69
  * User facing: callback to update the local user's presence.
68
70
  */
69
71
  const updatePresence: OnUpdateLivePresenceAction<TData> = React.useCallback(
70
- (data?: TData | undefined, state?: PresenceState | undefined) => {
72
+ async (data?: TData | undefined, state?: PresenceState | undefined) => {
71
73
  if (!livePresence) {
72
74
  console.error(
73
75
  new Error(
@@ -84,7 +86,7 @@ export function useLivePresence<TData extends object = object>(
84
86
  );
85
87
  return;
86
88
  }
87
- livePresence.update(data, state);
89
+ return await livePresence.update(data, state);
88
90
  },
89
91
  [livePresence]
90
92
  );
@@ -97,7 +99,7 @@ export function useLivePresence<TData extends object = object>(
97
99
 
98
100
  const onPresenceChanged = () => {
99
101
  const updatedLocalUsers: LivePresenceUser<TData>[] = [];
100
- livePresence?.forEach((user) => {
102
+ livePresence?.getUsers().forEach((user) => {
101
103
  updatedLocalUsers.push(user);
102
104
  });
103
105
  setAllUsers(updatedLocalUsers);
@@ -105,7 +107,11 @@ export function useLivePresence<TData extends object = object>(
105
107
  livePresence.on("presenceChanged", onPresenceChanged);
106
108
 
107
109
  if (!livePresence.isInitialized) {
108
- livePresence.initialize(initialData, initialPresenceState);
110
+ livePresence.initialize(
111
+ initialData,
112
+ initialPresenceState,
113
+ allowedRoles
114
+ );
109
115
  } else {
110
116
  onPresenceChanged();
111
117
  }