@microsoft/live-share-react 1.4.0-preview.0 → 1.4.2-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cjs/index.d.ts +7 -0
- package/bin/cjs/index.d.ts.map +1 -0
- package/bin/cjs/index.js +23 -0
- package/bin/cjs/index.js.map +1 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts +26 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.js +7 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.js.map +1 -0
- package/bin/cjs/interfaces/index.d.ts +2 -0
- package/bin/cjs/interfaces/index.d.ts.map +1 -0
- package/bin/cjs/interfaces/index.js +18 -0
- package/bin/cjs/interfaces/index.js.map +1 -0
- package/bin/cjs/internal/errors.d.ts +41 -0
- package/bin/cjs/internal/errors.d.ts.map +1 -0
- package/bin/cjs/internal/errors.js +48 -0
- package/bin/cjs/internal/errors.js.map +1 -0
- package/bin/cjs/internal/index.d.ts +3 -0
- package/bin/cjs/internal/index.d.ts.map +1 -0
- package/bin/cjs/internal/index.js +19 -0
- package/bin/cjs/internal/index.js.map +1 -0
- package/bin/cjs/internal/type-guards.d.ts +11 -0
- package/bin/cjs/internal/type-guards.d.ts.map +1 -0
- package/bin/cjs/internal/type-guards.js +24 -0
- package/bin/cjs/internal/type-guards.js.map +1 -0
- package/bin/cjs/live-hooks/index.d.ts +8 -0
- package/bin/cjs/live-hooks/index.d.ts.map +1 -0
- package/bin/cjs/live-hooks/index.js +24 -0
- package/bin/cjs/live-hooks/index.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveCanvas.d.ts +80 -0
- package/bin/cjs/live-hooks/useLiveCanvas.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveCanvas.js +244 -0
- package/bin/cjs/live-hooks/useLiveCanvas.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveEvent.d.ts +59 -0
- package/bin/cjs/live-hooks/useLiveEvent.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveEvent.js +150 -0
- package/bin/cjs/live-hooks/useLiveEvent.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.d.ts +163 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.js +360 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/cjs/live-hooks/useLivePresence.d.ts +76 -0
- package/bin/cjs/live-hooks/useLivePresence.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLivePresence.js +170 -0
- package/bin/cjs/live-hooks/useLivePresence.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveState.d.ts +66 -0
- package/bin/cjs/live-hooks/useLiveState.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveState.js +134 -0
- package/bin/cjs/live-hooks/useLiveState.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveTimer.d.ts +80 -0
- package/bin/cjs/live-hooks/useLiveTimer.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveTimer.js +233 -0
- package/bin/cjs/live-hooks/useLiveTimer.js.map +1 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts +86 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.js +301 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.js.map +1 -0
- package/bin/cjs/package.json +1 -0
- package/bin/cjs/providers/AzureProvider.d.ts +113 -0
- package/bin/cjs/providers/AzureProvider.d.ts.map +1 -0
- package/bin/cjs/providers/AzureProvider.js +127 -0
- package/bin/cjs/providers/AzureProvider.js.map +1 -0
- package/bin/cjs/providers/LiveShareProvider.d.ts +193 -0
- package/bin/cjs/providers/LiveShareProvider.d.ts.map +1 -0
- package/bin/cjs/providers/LiveShareProvider.js +205 -0
- package/bin/cjs/providers/LiveShareProvider.js.map +1 -0
- package/bin/cjs/providers/index.d.ts +3 -0
- package/bin/cjs/providers/index.d.ts.map +1 -0
- package/bin/cjs/providers/index.js +19 -0
- package/bin/cjs/providers/index.js.map +1 -0
- package/bin/cjs/shared-hooks/index.d.ts +7 -0
- package/bin/cjs/shared-hooks/index.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/index.js +23 -0
- package/bin/cjs/shared-hooks/index.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts +3 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.js +6 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts +10 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.js +23 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts +33 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.js +193 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.js.map +1 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.d.ts +23 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.js +87 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedMap.d.ts +25 -0
- package/bin/cjs/shared-hooks/useSharedMap.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedMap.js +134 -0
- package/bin/cjs/shared-hooks/useSharedMap.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedState.d.ts +22 -0
- package/bin/cjs/shared-hooks/useSharedState.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedState.js +80 -0
- package/bin/cjs/shared-hooks/useSharedState.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts +37 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.js +120 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedTree.d.ts +57 -0
- package/bin/cjs/shared-hooks/useSharedTree.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedTree.js +123 -0
- package/bin/cjs/shared-hooks/useSharedTree.js.map +1 -0
- package/bin/cjs/shared-hooks/useTreeNode.d.ts +96 -0
- package/bin/cjs/shared-hooks/useTreeNode.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useTreeNode.js +135 -0
- package/bin/cjs/shared-hooks/useTreeNode.js.map +1 -0
- package/bin/cjs/types/ActionTypes.d.ts +112 -0
- package/bin/cjs/types/ActionTypes.d.ts.map +1 -0
- package/bin/cjs/types/ActionTypes.js +7 -0
- package/bin/cjs/types/ActionTypes.js.map +1 -0
- package/bin/cjs/types/PropTypes.d.ts +56 -0
- package/bin/cjs/types/PropTypes.d.ts.map +1 -0
- package/bin/cjs/types/PropTypes.js +7 -0
- package/bin/cjs/types/PropTypes.js.map +1 -0
- package/bin/cjs/types/ResultTypes.d.ts +334 -0
- package/bin/cjs/types/ResultTypes.d.ts.map +1 -0
- package/bin/cjs/types/ResultTypes.js +7 -0
- package/bin/cjs/types/ResultTypes.js.map +1 -0
- package/bin/cjs/types/index.d.ts +4 -0
- package/bin/cjs/types/index.d.ts.map +1 -0
- package/bin/cjs/types/index.js +20 -0
- package/bin/cjs/types/index.js.map +1 -0
- package/bin/cjs/utils/index.d.ts +2 -0
- package/bin/cjs/utils/index.d.ts.map +1 -0
- package/bin/cjs/utils/index.js +18 -0
- package/bin/cjs/utils/index.js.map +1 -0
- package/bin/cjs/utils/type-check.d.ts +15 -0
- package/bin/cjs/utils/type-check.d.ts.map +1 -0
- package/bin/cjs/utils/type-check.js +62 -0
- package/bin/cjs/utils/type-check.js.map +1 -0
- package/bin/esm/index.d.ts +7 -0
- package/bin/esm/index.d.ts.map +1 -0
- package/bin/esm/index.js +7 -0
- package/bin/esm/index.js.map +1 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.d.ts +26 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.js +6 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.js.map +1 -0
- package/bin/esm/interfaces/index.d.ts +2 -0
- package/bin/esm/interfaces/index.d.ts.map +1 -0
- package/bin/esm/interfaces/index.js +2 -0
- package/bin/esm/interfaces/index.js.map +1 -0
- package/bin/esm/internal/errors.d.ts +41 -0
- package/bin/esm/internal/errors.d.ts.map +1 -0
- package/bin/esm/internal/errors.js +42 -0
- package/bin/esm/internal/errors.js.map +1 -0
- package/bin/esm/internal/index.d.ts +3 -0
- package/bin/esm/internal/index.d.ts.map +1 -0
- package/bin/esm/internal/index.js +3 -0
- package/bin/esm/internal/index.js.map +1 -0
- package/bin/esm/internal/type-guards.d.ts +11 -0
- package/bin/esm/internal/type-guards.d.ts.map +1 -0
- package/bin/esm/internal/type-guards.js +20 -0
- package/bin/esm/internal/type-guards.js.map +1 -0
- package/bin/esm/live-hooks/index.d.ts +8 -0
- package/bin/esm/live-hooks/index.d.ts.map +1 -0
- package/bin/esm/live-hooks/index.js +8 -0
- package/bin/esm/live-hooks/index.js.map +1 -0
- package/bin/esm/live-hooks/useLiveCanvas.d.ts +80 -0
- package/bin/esm/live-hooks/useLiveCanvas.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveCanvas.js +238 -0
- package/bin/esm/live-hooks/useLiveCanvas.js.map +1 -0
- package/bin/esm/live-hooks/useLiveEvent.d.ts +59 -0
- package/bin/esm/live-hooks/useLiveEvent.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveEvent.js +144 -0
- package/bin/esm/live-hooks/useLiveEvent.js.map +1 -0
- package/bin/esm/live-hooks/useLiveFollowMode.d.ts +163 -0
- package/bin/esm/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveFollowMode.js +354 -0
- package/bin/esm/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/esm/live-hooks/useLivePresence.d.ts +76 -0
- package/bin/esm/live-hooks/useLivePresence.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLivePresence.js +164 -0
- package/bin/esm/live-hooks/useLivePresence.js.map +1 -0
- package/bin/esm/live-hooks/useLiveState.d.ts +66 -0
- package/bin/esm/live-hooks/useLiveState.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveState.js +128 -0
- package/bin/esm/live-hooks/useLiveState.js.map +1 -0
- package/bin/esm/live-hooks/useLiveTimer.d.ts +80 -0
- package/bin/esm/live-hooks/useLiveTimer.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveTimer.js +227 -0
- package/bin/esm/live-hooks/useLiveTimer.js.map +1 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.d.ts +86 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.js +295 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.js.map +1 -0
- package/bin/esm/providers/AzureProvider.d.ts +113 -0
- package/bin/esm/providers/AzureProvider.d.ts.map +1 -0
- package/bin/esm/providers/AzureProvider.js +119 -0
- package/bin/esm/providers/AzureProvider.js.map +1 -0
- package/bin/esm/providers/LiveShareProvider.d.ts +193 -0
- package/bin/esm/providers/LiveShareProvider.d.ts.map +1 -0
- package/bin/esm/providers/LiveShareProvider.js +197 -0
- package/bin/esm/providers/LiveShareProvider.js.map +1 -0
- package/bin/esm/providers/index.d.ts +3 -0
- package/bin/esm/providers/index.d.ts.map +1 -0
- package/bin/esm/providers/index.js +3 -0
- package/bin/esm/providers/index.js.map +1 -0
- package/bin/esm/shared-hooks/index.d.ts +7 -0
- package/bin/esm/shared-hooks/index.d.ts.map +1 -0
- package/bin/esm/shared-hooks/index.js +7 -0
- package/bin/esm/shared-hooks/index.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.d.ts +3 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.js +3 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.d.ts +10 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.js +18 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.d.ts +33 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.js +188 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.js.map +1 -0
- package/bin/esm/shared-hooks/useDynamicDDS.d.ts +23 -0
- package/bin/esm/shared-hooks/useDynamicDDS.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useDynamicDDS.js +81 -0
- package/bin/esm/shared-hooks/useDynamicDDS.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedMap.d.ts +25 -0
- package/bin/esm/shared-hooks/useSharedMap.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedMap.js +128 -0
- package/bin/esm/shared-hooks/useSharedMap.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedState.d.ts +22 -0
- package/bin/esm/shared-hooks/useSharedState.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedState.js +74 -0
- package/bin/esm/shared-hooks/useSharedState.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.d.ts +37 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.js +113 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedTree.d.ts +57 -0
- package/bin/esm/shared-hooks/useSharedTree.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedTree.js +117 -0
- package/bin/esm/shared-hooks/useSharedTree.js.map +1 -0
- package/bin/esm/shared-hooks/useTreeNode.d.ts +96 -0
- package/bin/esm/shared-hooks/useTreeNode.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useTreeNode.js +132 -0
- package/bin/esm/shared-hooks/useTreeNode.js.map +1 -0
- package/bin/esm/types/ActionTypes.d.ts +112 -0
- package/bin/esm/types/ActionTypes.d.ts.map +1 -0
- package/bin/esm/types/ActionTypes.js +6 -0
- package/bin/esm/types/ActionTypes.js.map +1 -0
- package/bin/esm/types/PropTypes.d.ts +56 -0
- package/bin/esm/types/PropTypes.d.ts.map +1 -0
- package/bin/esm/types/PropTypes.js +6 -0
- package/bin/esm/types/PropTypes.js.map +1 -0
- package/bin/esm/types/ResultTypes.d.ts +334 -0
- package/bin/esm/types/ResultTypes.d.ts.map +1 -0
- package/bin/esm/types/ResultTypes.js +6 -0
- package/bin/esm/types/ResultTypes.js.map +1 -0
- package/bin/esm/types/index.d.ts +4 -0
- package/bin/esm/types/index.d.ts.map +1 -0
- package/bin/esm/types/index.js +4 -0
- package/bin/esm/types/index.js.map +1 -0
- package/bin/esm/utils/index.d.ts +2 -0
- package/bin/esm/utils/index.d.ts.map +1 -0
- package/bin/esm/utils/index.js +2 -0
- package/bin/esm/utils/index.js.map +1 -0
- package/bin/esm/utils/type-check.d.ts +15 -0
- package/bin/esm/utils/type-check.d.ts.map +1 -0
- package/bin/esm/utils/type-check.js +54 -0
- package/bin/esm/utils/type-check.js.map +1 -0
- package/bin/internal/errors.d.ts +15 -0
- package/bin/internal/errors.d.ts.map +1 -1
- package/bin/internal/errors.js.map +1 -1
- package/bin/internal/type-guards.d.ts +5 -0
- package/bin/internal/type-guards.d.ts.map +1 -1
- package/bin/internal/type-guards.js +12 -0
- package/bin/internal/type-guards.js.map +1 -1
- package/bin/live-hooks/useLiveState.d.ts.map +1 -1
- package/bin/live-hooks/useLiveState.js +6 -2
- package/bin/live-hooks/useLiveState.js.map +1 -1
- package/bin/providers/LiveShareProvider.d.ts.map +1 -1
- package/bin/providers/LiveShareProvider.js +8 -0
- package/bin/providers/LiveShareProvider.js.map +1 -1
- package/package.json +50 -50
- package/src/internal/errors.ts +16 -0
- package/src/internal/type-guards.ts +12 -0
- package/src/live-hooks/useLiveState.ts +5 -2
- package/src/providers/LiveShareProvider.tsx +12 -0
|
@@ -0,0 +1,354 @@
|
|
|
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 { LiveDataObjectInitializeState, LiveFollowMode, } from "@microsoft/live-share";
|
|
15
|
+
import React from "react";
|
|
16
|
+
import { useDynamicDDS } from "../shared-hooks/index.js";
|
|
17
|
+
import { useFluidObjectsContext } from "../providers/index.js";
|
|
18
|
+
import { ActionContainerNotJoinedError, ActionLiveDataObjectInitializedError, ActionLiveDataObjectUndefinedError, } from "../internal/index.js";
|
|
19
|
+
/**
|
|
20
|
+
* React hook for using a Live Share `LiveFollowMode`.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Use this hook if you want to add the ability to follow specific users or let a user present to everyone in the session.
|
|
24
|
+
* Each user has their own `stateValue`, which is the value other users will reference when that user is presenting or being followed.
|
|
25
|
+
* The `state` response includes the user's `value` that the local user is "following", whether it be their own or someone else's.
|
|
26
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
27
|
+
*
|
|
28
|
+
* @template TData Optional typing for the custom user presence data object. Default is `object` type.
|
|
29
|
+
*
|
|
30
|
+
* @param uniqueKey The unique key for `LiveFollowMode`. If one does not yet exist, a new one will be created.
|
|
31
|
+
* @param initialData The initial value for the local user's `stateValue`.
|
|
32
|
+
* @param allowedRoles Optional. The user roles that are allowed to present to use `startPresenting()` or `stopPresenting()`.
|
|
33
|
+
* @returns `IUseLiveFollowModeResults` results, which contains React stateful objects and callbacks.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
```jsx
|
|
37
|
+
import { FollowModeType } from "@microsoft/live-share";
|
|
38
|
+
import { useLiveFollowMode } from "@microsoft/live-share-react";
|
|
39
|
+
// As an example, we will use a fake component to denote what a 3D viewer might look like in an app
|
|
40
|
+
import { Example3DModelViewer } from "./components";
|
|
41
|
+
|
|
42
|
+
// Define a unique key that differentiates this usage of `useLiveFollowMode` from others in your app
|
|
43
|
+
const MY_UNIQUE_KEY = "follow-mode-key";
|
|
44
|
+
|
|
45
|
+
// Define the initial stateValue for the local user (optional).
|
|
46
|
+
const startingCameraPosition = {
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 0,
|
|
49
|
+
z: 0,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Example component for using useLiveFollowMode
|
|
53
|
+
export function MyLiveFollowMode() {
|
|
54
|
+
const {
|
|
55
|
+
state,
|
|
56
|
+
localUser,
|
|
57
|
+
otherUsers,
|
|
58
|
+
allUsers,
|
|
59
|
+
liveFollowMode,
|
|
60
|
+
update,
|
|
61
|
+
startPresenting,
|
|
62
|
+
stopPresenting,
|
|
63
|
+
beginSuspension,
|
|
64
|
+
endSuspension,
|
|
65
|
+
followUser,
|
|
66
|
+
stopFollowing,
|
|
67
|
+
} = useLiveFollowMode(MY_UNIQUE_KEY, startingCameraPosition);
|
|
68
|
+
|
|
69
|
+
// Example of an event listener for a camera position changed event.
|
|
70
|
+
// For something like a camera change event, you should use a debounce function.
|
|
71
|
+
function onCameraPositionChanged(position, isUserAction) {
|
|
72
|
+
// Broadcast change to other users so that they have their latest camera position
|
|
73
|
+
update(position);
|
|
74
|
+
// If the local user changed the position while following another user, we want to suspend.
|
|
75
|
+
// Note: helps to distinguish changes initiated by the local user (e.g., drag mouse) separately from other change events.
|
|
76
|
+
if (!isUserAction) return;
|
|
77
|
+
switch (state.type) {
|
|
78
|
+
case FollowModeType.followPresenter:
|
|
79
|
+
case FollowModeType.followUser: {
|
|
80
|
+
// This will trigger a "stateChanged" event update for the local user only.
|
|
81
|
+
followMode.beginSuspension();
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
default: {
|
|
85
|
+
// No need to suspend for other types
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Can optionally get the relevant user's presence object
|
|
92
|
+
const followingUser = liveFollowMode?.getUser(state.followingUserId);
|
|
93
|
+
|
|
94
|
+
// Render loading UI when creating LiveFollowMode instance for first time
|
|
95
|
+
if (!liveFollowMode) return <>Loading...</>;
|
|
96
|
+
|
|
97
|
+
// Render UI
|
|
98
|
+
return (
|
|
99
|
+
<div>
|
|
100
|
+
{state.type === FollowModeType.local && (
|
|
101
|
+
<div>
|
|
102
|
+
<p>{""}</p>
|
|
103
|
+
<button onClick={startPresenting}>
|
|
104
|
+
{"Start presenting"}
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
{state.type === FollowModeType.activeFollowers && (
|
|
109
|
+
<div>
|
|
110
|
+
<p>{`${state.otherUsersCount} users are following you`}</p>
|
|
111
|
+
<button onClick={startPresenting}>
|
|
112
|
+
{"Present to all"}
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
{state.type === FollowModeType.activePresenter && (
|
|
117
|
+
<div>
|
|
118
|
+
<p>{`You are actively presenting to everyone`}</p>
|
|
119
|
+
<button onClick={stopPresenting}>
|
|
120
|
+
{"Stop presenting"}
|
|
121
|
+
</button>
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
{state.type === FollowModeType.followPresenter && (
|
|
125
|
+
<div>
|
|
126
|
+
<p>{`${followingUser?.displayName} is presenting to everyone`}</p>
|
|
127
|
+
<button onClick={startPresenting}>{"Take control"}</button>
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
{state.type === FollowModeType.suspendFollowPresenter && (
|
|
131
|
+
<div>
|
|
132
|
+
<p>{`${followingUser?.displayName} is presenting to everyone`}</p>
|
|
133
|
+
<button onClick={endSuspension}>
|
|
134
|
+
{"Sync to presenter"}
|
|
135
|
+
</button>
|
|
136
|
+
</div>
|
|
137
|
+
)}
|
|
138
|
+
{state.type === FollowModeType.followUser && (
|
|
139
|
+
<div>
|
|
140
|
+
<p>{`You are following ${followingUser?.displayName}`}</p>
|
|
141
|
+
<button onClick={stopFollowing}>{"Stop following"}</button>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
{state.type === FollowModeType.suspendFollowUser && (
|
|
145
|
+
<div>
|
|
146
|
+
<p>{`You were following ${followingUser?.displayName}`}</p>
|
|
147
|
+
<button onClick={stopFollowing}>
|
|
148
|
+
{"Resume following"}
|
|
149
|
+
</button>
|
|
150
|
+
</div>
|
|
151
|
+
)}
|
|
152
|
+
<div>
|
|
153
|
+
<p>{"Follow a specific user:"}</p>
|
|
154
|
+
{otherUsers.map((user) => (
|
|
155
|
+
<button
|
|
156
|
+
onClick={() => {
|
|
157
|
+
followUser(user.userId);
|
|
158
|
+
}}
|
|
159
|
+
key={user.userId}
|
|
160
|
+
>
|
|
161
|
+
{user.displayName}
|
|
162
|
+
</button>
|
|
163
|
+
))}
|
|
164
|
+
</div>
|
|
165
|
+
<Example3DModelViewer
|
|
166
|
+
cameraPosition={state.value}
|
|
167
|
+
onCameraPositionChanged={onCameraPositionChanged}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
*/
|
|
174
|
+
export function useLiveFollowMode(uniqueKey, initialData, allowedRoles) {
|
|
175
|
+
/**
|
|
176
|
+
* Stateful follow state.
|
|
177
|
+
*/
|
|
178
|
+
const [state, setState] = React.useState();
|
|
179
|
+
/**
|
|
180
|
+
* Stateful all user presence list and its non-user-facing setter method.
|
|
181
|
+
*/
|
|
182
|
+
const [allUsers, setAllUsers] = React.useState([]);
|
|
183
|
+
/**
|
|
184
|
+
* User facing: dynamically load the DDS for the given unique key.
|
|
185
|
+
*/
|
|
186
|
+
const { dds: liveFollowMode } = useDynamicDDS(uniqueKey, (LiveFollowMode));
|
|
187
|
+
/**
|
|
188
|
+
* User facing: list of non-local user's presence objects.
|
|
189
|
+
*/
|
|
190
|
+
const otherUsers = React.useMemo(() => {
|
|
191
|
+
return allUsers.filter((user) => !user.isLocalUser);
|
|
192
|
+
}, [allUsers]);
|
|
193
|
+
/**
|
|
194
|
+
* User facing: local user's presence object.
|
|
195
|
+
*/
|
|
196
|
+
const localUser = React.useMemo(() => {
|
|
197
|
+
return allUsers.find((user) => user.isLocalUser);
|
|
198
|
+
}, [allUsers]);
|
|
199
|
+
const { container } = useFluidObjectsContext();
|
|
200
|
+
/**
|
|
201
|
+
* User facing: callback to update the local user's custom data for their follow state.
|
|
202
|
+
*/
|
|
203
|
+
const update = React.useCallback((stateValue) => __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
if (!container) {
|
|
205
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "update");
|
|
206
|
+
}
|
|
207
|
+
if (liveFollowMode === undefined) {
|
|
208
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "update");
|
|
209
|
+
}
|
|
210
|
+
if (!liveFollowMode.isInitialized) {
|
|
211
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "update");
|
|
212
|
+
}
|
|
213
|
+
return yield liveFollowMode.update(stateValue);
|
|
214
|
+
}), [container, liveFollowMode]);
|
|
215
|
+
/**
|
|
216
|
+
* User facing: callback to start presenting.
|
|
217
|
+
*/
|
|
218
|
+
const startPresenting = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
if (!container) {
|
|
220
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "startPresenting");
|
|
221
|
+
}
|
|
222
|
+
if (liveFollowMode === undefined) {
|
|
223
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "startPresenting");
|
|
224
|
+
}
|
|
225
|
+
if (!liveFollowMode.isInitialized) {
|
|
226
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "startPresenting");
|
|
227
|
+
}
|
|
228
|
+
return yield liveFollowMode.startPresenting();
|
|
229
|
+
}), [container, liveFollowMode]);
|
|
230
|
+
/**
|
|
231
|
+
* User facing: callback to stop presenting.
|
|
232
|
+
*/
|
|
233
|
+
const stopPresenting = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
if (!container) {
|
|
235
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "stopPresenting");
|
|
236
|
+
}
|
|
237
|
+
if (liveFollowMode === undefined) {
|
|
238
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "stopPresenting");
|
|
239
|
+
}
|
|
240
|
+
if (!liveFollowMode.isInitialized) {
|
|
241
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "stopPresenting");
|
|
242
|
+
}
|
|
243
|
+
return yield liveFollowMode.stopPresenting();
|
|
244
|
+
}), [container, liveFollowMode]);
|
|
245
|
+
/**
|
|
246
|
+
* User facing: callback to suspend sync.
|
|
247
|
+
*/
|
|
248
|
+
const beginSuspension = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
if (!container) {
|
|
250
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "syncToPresenter");
|
|
251
|
+
}
|
|
252
|
+
if (liveFollowMode === undefined) {
|
|
253
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "syncToPresenter");
|
|
254
|
+
}
|
|
255
|
+
if (!liveFollowMode.isInitialized) {
|
|
256
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "syncToPresenter");
|
|
257
|
+
}
|
|
258
|
+
return yield liveFollowMode.beginSuspension();
|
|
259
|
+
}), [container, liveFollowMode]);
|
|
260
|
+
/**
|
|
261
|
+
* User facing: callback to end current suspension.
|
|
262
|
+
*/
|
|
263
|
+
const endSuspension = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
if (!container) {
|
|
265
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "syncToPresenter");
|
|
266
|
+
}
|
|
267
|
+
if (liveFollowMode === undefined) {
|
|
268
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "syncToPresenter");
|
|
269
|
+
}
|
|
270
|
+
if (!liveFollowMode.isInitialized) {
|
|
271
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "syncToPresenter");
|
|
272
|
+
}
|
|
273
|
+
return yield liveFollowMode.endSuspension();
|
|
274
|
+
}), [container, liveFollowMode]);
|
|
275
|
+
/**
|
|
276
|
+
* User facing: callback to follow a specific user.
|
|
277
|
+
*/
|
|
278
|
+
const followUser = React.useCallback((userId) => __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
if (!container) {
|
|
280
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "followUser");
|
|
281
|
+
}
|
|
282
|
+
if (liveFollowMode === undefined) {
|
|
283
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "followUser");
|
|
284
|
+
}
|
|
285
|
+
if (!liveFollowMode.isInitialized) {
|
|
286
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "followUser");
|
|
287
|
+
}
|
|
288
|
+
return yield liveFollowMode.followUser(userId);
|
|
289
|
+
}), [container, liveFollowMode]);
|
|
290
|
+
/**
|
|
291
|
+
* User facing: callback to stop following a user.
|
|
292
|
+
*/
|
|
293
|
+
const stopFollowing = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
294
|
+
if (!container) {
|
|
295
|
+
throw new ActionContainerNotJoinedError("liveFollowMode", "stopFollowing");
|
|
296
|
+
}
|
|
297
|
+
if (liveFollowMode === undefined) {
|
|
298
|
+
throw new ActionLiveDataObjectUndefinedError("liveFollowMode", "stopFollowing");
|
|
299
|
+
}
|
|
300
|
+
if (!liveFollowMode.isInitialized) {
|
|
301
|
+
throw new ActionLiveDataObjectInitializedError("liveFollowMode", "stopFollowing");
|
|
302
|
+
}
|
|
303
|
+
return yield liveFollowMode.stopFollowing();
|
|
304
|
+
}), [container, liveFollowMode]);
|
|
305
|
+
/**
|
|
306
|
+
* Setup change listeners and start `LiveFollowMode` if needed
|
|
307
|
+
*/
|
|
308
|
+
React.useEffect(() => {
|
|
309
|
+
if (liveFollowMode === undefined)
|
|
310
|
+
return;
|
|
311
|
+
const onPresenceChanged = () => {
|
|
312
|
+
const updatedLocalUsers = [];
|
|
313
|
+
liveFollowMode === null || liveFollowMode === void 0 ? void 0 : liveFollowMode.getUsers().forEach((user) => {
|
|
314
|
+
updatedLocalUsers.push(user);
|
|
315
|
+
});
|
|
316
|
+
setAllUsers(updatedLocalUsers);
|
|
317
|
+
};
|
|
318
|
+
liveFollowMode.on("presenceChanged", onPresenceChanged);
|
|
319
|
+
const onStateChanged = () => {
|
|
320
|
+
setState(liveFollowMode === null || liveFollowMode === void 0 ? void 0 : liveFollowMode.state);
|
|
321
|
+
};
|
|
322
|
+
liveFollowMode.on("stateChanged", onStateChanged);
|
|
323
|
+
if (liveFollowMode.initializeState ===
|
|
324
|
+
LiveDataObjectInitializeState.needed) {
|
|
325
|
+
liveFollowMode.initialize(isInitialDataCallback(initialData)
|
|
326
|
+
? initialData()
|
|
327
|
+
: initialData, allowedRoles);
|
|
328
|
+
}
|
|
329
|
+
onPresenceChanged();
|
|
330
|
+
onStateChanged();
|
|
331
|
+
return () => {
|
|
332
|
+
liveFollowMode === null || liveFollowMode === void 0 ? void 0 : liveFollowMode.off("presenceChanged", onPresenceChanged);
|
|
333
|
+
liveFollowMode === null || liveFollowMode === void 0 ? void 0 : liveFollowMode.off("stateChanged", onStateChanged);
|
|
334
|
+
};
|
|
335
|
+
}, [liveFollowMode]);
|
|
336
|
+
return {
|
|
337
|
+
state,
|
|
338
|
+
localUser,
|
|
339
|
+
otherUsers,
|
|
340
|
+
allUsers,
|
|
341
|
+
liveFollowMode,
|
|
342
|
+
update,
|
|
343
|
+
startPresenting,
|
|
344
|
+
stopPresenting,
|
|
345
|
+
beginSuspension,
|
|
346
|
+
endSuspension,
|
|
347
|
+
followUser,
|
|
348
|
+
stopFollowing,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function isInitialDataCallback(value) {
|
|
352
|
+
return typeof value === "function";
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=useLiveFollowMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveFollowMode.js","sourceRoot":"","sources":["../../../src/live-hooks/useLiveFollowMode.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAEH,OAAO,EAGH,6BAA6B,EAC7B,cAAc,GAGjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EA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AC,CAAC;IACN,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO;QACH,KAAK;QACL,SAAS;QACT,UAAU;QACV,QAAQ;QACR,cAAc;QACd,MAAM;QACN,eAAe;QACf,cAAc;QACd,eAAe;QACf,aAAa;QACb,UAAU;QACV,aAAa;KAChB,CAAC;AACN,CAAC;AAED,SAAS,qBAAqB,CAAQ,KAAU;IAC5C,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
import { UserMeetingRole, LivePresenceData } from "@microsoft/live-share";
|
|
6
|
+
import { IUseLivePresenceResults } from "../types/index.js";
|
|
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
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
15
|
+
*
|
|
16
|
+
* @template TData Optional typing for the custom user presence data object. Default is `object` type.
|
|
17
|
+
* @param uniqueKey The unique key for `LivePresence`. If one does not yet exist, a new one will be created.
|
|
18
|
+
* @param initialData Initial presence data object for the user. Can be value or a function to get the value.
|
|
19
|
+
* @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
|
|
20
|
+
* will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
|
|
21
|
+
* @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
|
|
22
|
+
* to update the local user's presence and the `LivePresence` Fluid object.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
```jsx
|
|
26
|
+
import { useLivePresence } from "@microsoft/live-share-react";
|
|
27
|
+
|
|
28
|
+
// Define a unique key that differentiates this usage of `useLivePresence` from others in your app
|
|
29
|
+
const MY_UNIQUE_KEY = "presence-key";
|
|
30
|
+
|
|
31
|
+
// Example component for using useLivePresence
|
|
32
|
+
export const MyCustomPresence = () => {
|
|
33
|
+
const {
|
|
34
|
+
allUsers,
|
|
35
|
+
localUser,
|
|
36
|
+
livePresence,
|
|
37
|
+
updatePresence,
|
|
38
|
+
} = useLivePresence(MY_UNIQUE_KEY, {
|
|
39
|
+
picture: "DEFAULT_PROFILE_PICTURE_URL",
|
|
40
|
+
readyToStart: false,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Callback to update the user's presence
|
|
44
|
+
const onToggleReady = () => {
|
|
45
|
+
updatePresence({
|
|
46
|
+
...localUser.data,
|
|
47
|
+
readyToStart: !localUser.data.readyToStart,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Render loading UI while loading LivePresence for first time
|
|
52
|
+
if (!livePresence) return <>Loading...</>;
|
|
53
|
+
|
|
54
|
+
// Render presence UI
|
|
55
|
+
return (
|
|
56
|
+
{allUsers.map((user) => (
|
|
57
|
+
<div key={user.userId}>
|
|
58
|
+
<div>
|
|
59
|
+
{user.displayName}
|
|
60
|
+
</div>
|
|
61
|
+
<div>
|
|
62
|
+
{`Ready: ${user.data.readyToStart}`}
|
|
63
|
+
</div>
|
|
64
|
+
{user.isLocalUser && (
|
|
65
|
+
<button onClick={onToggleReady}>
|
|
66
|
+
{"Toggle ready"}
|
|
67
|
+
</button>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
))}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
*/
|
|
75
|
+
export declare function useLivePresence<TData extends LivePresenceData = any>(uniqueKey: string, initialData: TData | (() => TData), allowedRoles?: UserMeetingRole[]): IUseLivePresenceResults<TData>;
|
|
76
|
+
//# sourceMappingURL=useLivePresence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLivePresence.d.ts","sourceRoot":"","sources":["../../../src/live-hooks/useLivePresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGH,eAAe,EAEf,gBAAgB,EAEnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACH,uBAAuB,EAE1B,MAAM,mBAAmB,CAAC;AAS3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,wBAAgB,eAAe,CAAC,KAAK,SAAS,gBAAgB,GAAG,GAAG,EAChE,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAClC,YAAY,CAAC,EAAE,eAAe,EAAE,GACjC,uBAAuB,CAAC,KAAK,CAAC,CAwGhC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
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 { LivePresence, LiveDataObjectInitializeState, PresenceStatus, } from "@microsoft/live-share";
|
|
15
|
+
import React from "react";
|
|
16
|
+
import { useDynamicDDS } from "../shared-hooks/index.js";
|
|
17
|
+
import { useFluidObjectsContext } from "../providers/index.js";
|
|
18
|
+
import { ActionContainerNotJoinedError, ActionLiveDataObjectInitializedError, ActionLiveDataObjectUndefinedError, } from "../internal/index.js";
|
|
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
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
27
|
+
*
|
|
28
|
+
* @template TData Optional typing for the custom user presence data object. Default is `object` type.
|
|
29
|
+
* @param uniqueKey The unique key for `LivePresence`. If one does not yet exist, a new one will be created.
|
|
30
|
+
* @param initialData Initial presence data object for the user. Can be value or a function to get the value.
|
|
31
|
+
* @param allowedRoles Optional. the user roles that are allowed to mutate the synchronized state
|
|
32
|
+
* will be created, otherwise it will use the existing one. Default value is ":<dds-default>"
|
|
33
|
+
* @returns stateful `localUser`, `otherUsers` list, and `allUsers` list. Also returns a callback method
|
|
34
|
+
* to update the local user's presence and the `LivePresence` Fluid object.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
```jsx
|
|
38
|
+
import { useLivePresence } from "@microsoft/live-share-react";
|
|
39
|
+
|
|
40
|
+
// Define a unique key that differentiates this usage of `useLivePresence` from others in your app
|
|
41
|
+
const MY_UNIQUE_KEY = "presence-key";
|
|
42
|
+
|
|
43
|
+
// Example component for using useLivePresence
|
|
44
|
+
export const MyCustomPresence = () => {
|
|
45
|
+
const {
|
|
46
|
+
allUsers,
|
|
47
|
+
localUser,
|
|
48
|
+
livePresence,
|
|
49
|
+
updatePresence,
|
|
50
|
+
} = useLivePresence(MY_UNIQUE_KEY, {
|
|
51
|
+
picture: "DEFAULT_PROFILE_PICTURE_URL",
|
|
52
|
+
readyToStart: false,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Callback to update the user's presence
|
|
56
|
+
const onToggleReady = () => {
|
|
57
|
+
updatePresence({
|
|
58
|
+
...localUser.data,
|
|
59
|
+
readyToStart: !localUser.data.readyToStart,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Render loading UI while loading LivePresence for first time
|
|
64
|
+
if (!livePresence) return <>Loading...</>;
|
|
65
|
+
|
|
66
|
+
// Render presence UI
|
|
67
|
+
return (
|
|
68
|
+
{allUsers.map((user) => (
|
|
69
|
+
<div key={user.userId}>
|
|
70
|
+
<div>
|
|
71
|
+
{user.displayName}
|
|
72
|
+
</div>
|
|
73
|
+
<div>
|
|
74
|
+
{`Ready: ${user.data.readyToStart}`}
|
|
75
|
+
</div>
|
|
76
|
+
{user.isLocalUser && (
|
|
77
|
+
<button onClick={onToggleReady}>
|
|
78
|
+
{"Toggle ready"}
|
|
79
|
+
</button>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
))}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
*/
|
|
87
|
+
export function useLivePresence(uniqueKey, initialData, allowedRoles) {
|
|
88
|
+
/**
|
|
89
|
+
* Stateful all user presence list and its non-user-facing setter method.
|
|
90
|
+
*/
|
|
91
|
+
const [allUsers, setAllUsers] = React.useState([]);
|
|
92
|
+
/**
|
|
93
|
+
* User facing: dynamically load the DDS for the given unique key.
|
|
94
|
+
*/
|
|
95
|
+
const { dds: livePresence } = useDynamicDDS(uniqueKey, LivePresence);
|
|
96
|
+
/**
|
|
97
|
+
* User facing: list of non-local user's presence objects.
|
|
98
|
+
*/
|
|
99
|
+
const otherUsers = React.useMemo(() => {
|
|
100
|
+
return allUsers.filter((user) => !user.isLocalUser);
|
|
101
|
+
}, [allUsers]);
|
|
102
|
+
/**
|
|
103
|
+
* User facing: local user's presence object.
|
|
104
|
+
*/
|
|
105
|
+
const localUser = React.useMemo(() => {
|
|
106
|
+
return allUsers.find((user) => user.isLocalUser);
|
|
107
|
+
}, [allUsers]);
|
|
108
|
+
const onlineUsers = React.useMemo(() => {
|
|
109
|
+
return allUsers.filter((user) => user.status === PresenceStatus.online);
|
|
110
|
+
}, [allUsers]);
|
|
111
|
+
const { container } = useFluidObjectsContext();
|
|
112
|
+
/**
|
|
113
|
+
* User facing: callback to update the local user's presence.
|
|
114
|
+
*/
|
|
115
|
+
const updatePresence = React.useCallback((data) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
if (!container) {
|
|
117
|
+
throw new ActionContainerNotJoinedError("livePresence", "updatePresence");
|
|
118
|
+
}
|
|
119
|
+
if (livePresence === undefined) {
|
|
120
|
+
throw new ActionLiveDataObjectUndefinedError("livePresence", "updatePresence");
|
|
121
|
+
}
|
|
122
|
+
if (!livePresence.isInitialized) {
|
|
123
|
+
throw new ActionLiveDataObjectInitializedError("livePresence", "updatePresence");
|
|
124
|
+
}
|
|
125
|
+
return yield livePresence.update(data);
|
|
126
|
+
}), [container, livePresence]);
|
|
127
|
+
/**
|
|
128
|
+
* Setup change listeners and start `LivePresence` if needed
|
|
129
|
+
*/
|
|
130
|
+
React.useEffect(() => {
|
|
131
|
+
if (livePresence === undefined)
|
|
132
|
+
return;
|
|
133
|
+
const onPresenceChanged = () => {
|
|
134
|
+
const updatedLocalUsers = [];
|
|
135
|
+
livePresence === null || livePresence === void 0 ? void 0 : livePresence.getUsers().forEach((user) => {
|
|
136
|
+
updatedLocalUsers.push(user);
|
|
137
|
+
});
|
|
138
|
+
setAllUsers(updatedLocalUsers);
|
|
139
|
+
};
|
|
140
|
+
livePresence.on("presenceChanged", onPresenceChanged);
|
|
141
|
+
if (livePresence.initializeState ===
|
|
142
|
+
LiveDataObjectInitializeState.needed) {
|
|
143
|
+
livePresence.initialize(isInitialDataCallback(initialData)
|
|
144
|
+
? initialData()
|
|
145
|
+
: initialData, allowedRoles);
|
|
146
|
+
}
|
|
147
|
+
onPresenceChanged();
|
|
148
|
+
return () => {
|
|
149
|
+
livePresence === null || livePresence === void 0 ? void 0 : livePresence.off("presenceChanged", onPresenceChanged);
|
|
150
|
+
};
|
|
151
|
+
}, [livePresence]);
|
|
152
|
+
return {
|
|
153
|
+
localUser,
|
|
154
|
+
otherUsers,
|
|
155
|
+
allUsers,
|
|
156
|
+
onlineUsers,
|
|
157
|
+
livePresence,
|
|
158
|
+
updatePresence,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function isInitialDataCallback(value) {
|
|
162
|
+
return typeof value === "function";
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=useLivePresence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLivePresence.js","sourceRoot":"","sources":["../../../src/live-hooks/useLivePresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAEH,OAAO,EAEH,YAAY,EAEZ,6BAA6B,EAE7B,cAAc,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACH,6BAA6B,EAC7B,oCAAoC,EACpC,kCAAkC,GACrC,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,UAAU,eAAe,CAC3B,SAAiB,EACjB,WAAkC,EAClC,YAAgC;IAEhC;;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,GAA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