@microsoft/live-share-react 1.2.1-preview.0 → 1.2.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.
Files changed (65) hide show
  1. package/bin/internal/errors.d.ts.map +1 -1
  2. package/bin/internal/errors.js +7 -4
  3. package/bin/internal/errors.js.map +1 -1
  4. package/bin/live-hooks/useLiveCanvas.d.ts +1 -0
  5. package/bin/live-hooks/useLiveCanvas.d.ts.map +1 -1
  6. package/bin/live-hooks/useLiveCanvas.js +1 -0
  7. package/bin/live-hooks/useLiveCanvas.js.map +1 -1
  8. package/bin/live-hooks/useLiveEvent.d.ts +1 -0
  9. package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
  10. package/bin/live-hooks/useLiveEvent.js +1 -0
  11. package/bin/live-hooks/useLiveEvent.js.map +1 -1
  12. package/bin/live-hooks/useLiveFollowMode.d.ts +1 -0
  13. package/bin/live-hooks/useLiveFollowMode.d.ts.map +1 -1
  14. package/bin/live-hooks/useLiveFollowMode.js +7 -6
  15. package/bin/live-hooks/useLiveFollowMode.js.map +1 -1
  16. package/bin/live-hooks/useLivePresence.d.ts +1 -0
  17. package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
  18. package/bin/live-hooks/useLivePresence.js +1 -0
  19. package/bin/live-hooks/useLivePresence.js.map +1 -1
  20. package/bin/live-hooks/useLiveState.d.ts +1 -0
  21. package/bin/live-hooks/useLiveState.d.ts.map +1 -1
  22. package/bin/live-hooks/useLiveState.js +1 -0
  23. package/bin/live-hooks/useLiveState.js.map +1 -1
  24. package/bin/live-hooks/useLiveTimer.d.ts +17 -0
  25. package/bin/live-hooks/useLiveTimer.d.ts.map +1 -1
  26. package/bin/live-hooks/useLiveTimer.js +17 -0
  27. package/bin/live-hooks/useLiveTimer.js.map +1 -1
  28. package/bin/live-hooks/useMediaSynchronizer.d.ts +1 -0
  29. package/bin/live-hooks/useMediaSynchronizer.d.ts.map +1 -1
  30. package/bin/live-hooks/useMediaSynchronizer.js +1 -0
  31. package/bin/live-hooks/useMediaSynchronizer.js.map +1 -1
  32. package/bin/providers/AzureProvider.d.ts +82 -3
  33. package/bin/providers/AzureProvider.d.ts.map +1 -1
  34. package/bin/providers/AzureProvider.js +17 -0
  35. package/bin/providers/AzureProvider.js.map +1 -1
  36. package/bin/providers/LiveShareProvider.d.ts +36 -8
  37. package/bin/providers/LiveShareProvider.d.ts.map +1 -1
  38. package/bin/providers/LiveShareProvider.js +18 -0
  39. package/bin/providers/LiveShareProvider.js.map +1 -1
  40. package/bin/shared-hooks/useDynamicDDS.d.ts +4 -0
  41. package/bin/shared-hooks/useDynamicDDS.d.ts.map +1 -1
  42. package/bin/shared-hooks/useDynamicDDS.js +4 -0
  43. package/bin/shared-hooks/useDynamicDDS.js.map +1 -1
  44. package/bin/shared-hooks/useSharedMap.d.ts +1 -0
  45. package/bin/shared-hooks/useSharedMap.d.ts.map +1 -1
  46. package/bin/shared-hooks/useSharedMap.js +1 -0
  47. package/bin/shared-hooks/useSharedMap.js.map +1 -1
  48. package/bin/shared-hooks/useSharedState.d.ts +1 -0
  49. package/bin/shared-hooks/useSharedState.d.ts.map +1 -1
  50. package/bin/shared-hooks/useSharedState.js +1 -0
  51. package/bin/shared-hooks/useSharedState.js.map +1 -1
  52. package/package.json +8 -8
  53. package/src/internal/errors.ts +15 -6
  54. package/src/live-hooks/useLiveCanvas.ts +1 -0
  55. package/src/live-hooks/useLiveEvent.ts +1 -0
  56. package/src/live-hooks/useLiveFollowMode.ts +7 -6
  57. package/src/live-hooks/useLivePresence.ts +1 -0
  58. package/src/live-hooks/useLiveState.ts +1 -0
  59. package/src/live-hooks/useLiveTimer.ts +17 -0
  60. package/src/live-hooks/useMediaSynchronizer.ts +1 -0
  61. package/src/providers/AzureProvider.tsx +91 -2
  62. package/src/providers/LiveShareProvider.tsx +48 -8
  63. package/src/shared-hooks/useDynamicDDS.ts +4 -0
  64. package/src/shared-hooks/useSharedMap.ts +1 -0
  65. package/src/shared-hooks/useSharedState.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"AzureProvider.js","sourceRoot":"","sources":["../../src/providers/AzureProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAEH,sBAAsB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,gBAAgB,GAEnB,MAAM,6BAA6B,CAAC;AAiBrC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAC3C,EAAmB,CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAkB,EAAE;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAWF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkC,CAAC,KAAK,EAAE,EAAE;;IAClE,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAU,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAC1B,IAAI,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,CAC5C,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,EAEzC,CAAC;IACJ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAqB,CAAC;IAEtE,MAAM,sBAAsB,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAE/D;;OAEG;IACH,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAClC,CACI,WAAmB,EACnB,cAA0C,EACX,EAAE;QACjC,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,IAAI;gBACA,MAAM,OAAO,GACT,MAAM,SAAS,CAAC,OAAO,CAAC,YAAY,CAChC,WAAW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OAAO;YAElB,OAAO;QACX,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1B,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,UAAU,EAAE;YACvC,YAAY,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;SACzD;aAAM,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,YAAY,EAAE;YACjD,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;SACzC;IACL,CAAC,EAAE;QACC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,eAAe;QACnC,KAAK,CAAC,WAAW;QACjB,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,UAAU;QAChB,KAAK,CAAC,cAAc;QACpB,YAAY;QACZ,eAAe;KAClB,CAAC,CAAC;IAEH,OAAO,CACH,KAAC,YAAY,CAAC,QAAQ,kBAClB,KAAK,kBACD,SAAS,EACT,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAC7B,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAC3B,SAAS;YACT,eAAe;YACf,YAAY,IACT,sBAAsB,iBAG5B,KAAK,CAAC,QAAQ,IACK,CAC3B,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,qBAAqB,CAAC,KAAU;IACrC,OAAO,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,CAAC;AAC9B,CAAC"}
@@ -5,6 +5,13 @@
5
5
  import { IFluidContainer, LoadableObjectClassRecord } from "fluid-framework";
6
6
  import React from "react";
7
7
  import { ILiveShareClientOptions, ILiveShareHost, ILiveShareJoinResults, ITimestampProvider } from "@microsoft/live-share";
8
+ /**
9
+ * React Context provider values for `<LiveShareProvider>`.
10
+ *
11
+ * @remarks
12
+ * To get the latest values, use the {@link useLiveShareContext} hook.
13
+ * Use the {@link useFluidObjectsContext} hook for other relevant context values.
14
+ */
8
15
  export interface ILiveShareContext {
9
16
  /**
10
17
  * True if the local user created the Fluid container
@@ -24,34 +31,56 @@ export interface ILiveShareContext {
24
31
  */
25
32
  timestampProvider: ITimestampProvider | undefined;
26
33
  /**
27
- * Join callback method
34
+ * Join callback method for manually connecting to the Fluid container.
35
+ *
36
+ * @remarks
37
+ * Use this callback if `joinOnLoad` is `false` or `undefined` in {@link ILiveShareProviderProps}.
38
+ *
28
39
  * @param initialObjects Optional. The initial objects for the Fluid container schema.
29
40
  * @param onInitializeContainer Optional. Callback for when the container is first created.
30
- * @returns `ILiveShareJoinResults`, which includes the Fluid container
41
+ * @returns Promise with `ILiveShareJoinResults`, which includes the Fluid container
31
42
  */
32
43
  join: (initialObjects?: LoadableObjectClassRecord, onInitializeContainer?: (container: IFluidContainer) => void) => Promise<ILiveShareJoinResults>;
33
44
  }
45
+ /**
46
+ * @hidden
47
+ */
34
48
  export declare const LiveShareContext: React.Context<ILiveShareContext>;
49
+ /**
50
+ * Hook to get the latest React context state for `LiveShareContext`.
51
+ *
52
+ * @remarks
53
+ * This hook can only be used in a child component of `<LiveShareProvider>`.
54
+ * See `useFluidObjectsContext` for other information related to the Live Share session, such as the `container`.
55
+ *
56
+ * @returns current state of `LiveShareContext`
57
+ */
35
58
  export declare const useLiveShareContext: () => ILiveShareContext;
36
- interface ILiveShareProviderProps {
59
+ /**
60
+ * Prop types for {@link LiveShareProvider} component.
61
+ */
62
+ export interface ILiveShareProviderProps {
37
63
  /**
38
64
  * Optional. React children node for the React Context Provider
39
65
  */
40
66
  children?: React.ReactNode;
41
67
  /**
42
- * Optional. Options to pass into LiveShareClient initializer
68
+ * Optional. Options for initializing `LiveShareClient`.
43
69
  */
44
70
  clientOptions?: ILiveShareClientOptions;
45
71
  /**
46
- * Host to initialize LiveShareClient with
72
+ * Host to initialize `LiveShareClient` with.
73
+ *
74
+ * @remarks
75
+ * If using the `LiveShareClient` class from `@microsoft/teams-js`, you must ensure that you have first called `teamsJs.app.initialize()` before calling `LiveShareClient.create()`.
47
76
  */
48
77
  host: ILiveShareHost;
49
78
  /**
50
- * Optional. Initial Fluid objects to load when the container is first created
79
+ * The initial object schema to use when {@link joinOnLoad} is true.
51
80
  */
52
81
  initialObjects?: LoadableObjectClassRecord;
53
82
  /**
54
- * Optional. Flag to determine whether to join Fluid container on load
83
+ * Optional. Flag to determine whether to join Fluid container on load.
55
84
  */
56
85
  joinOnLoad?: boolean;
57
86
  }
@@ -59,5 +88,4 @@ interface ILiveShareProviderProps {
59
88
  * React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
60
89
  */
61
90
  export declare const LiveShareProvider: React.FC<ILiveShareProviderProps>;
62
- export {};
63
91
  //# sourceMappingURL=LiveShareProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LiveShareProvider.d.ts","sourceRoot":"","sources":["../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACrB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAClD;;;;;OAKG;IACH,IAAI,EAAE,CACF,cAAc,CAAC,EAAE,yBAAyB,EAC1C,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,KAC3D,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACvC;AAED,eAAO,MAAM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;GAQG;AACH,eAAO,MAAM,mBAAmB,QAAO,iBAQtC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,IAAI,EAAE,cAAc,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAuF/D,CAAC"}
@@ -12,9 +12,24 @@ import React from "react";
12
12
  import { useSharedStateRegistry } from "../internal";
13
13
  import { FluidContext } from "./AzureProvider";
14
14
  import { LiveShareTurboClient } from "@microsoft/live-share-turbo";
15
+ /**
16
+ * @hidden
17
+ */
15
18
  export const LiveShareContext = React.createContext({});
19
+ /**
20
+ * Hook to get the latest React context state for `LiveShareContext`.
21
+ *
22
+ * @remarks
23
+ * This hook can only be used in a child component of `<LiveShareProvider>`.
24
+ * See `useFluidObjectsContext` for other information related to the Live Share session, such as the `container`.
25
+ *
26
+ * @returns current state of `LiveShareContext`
27
+ */
16
28
  export const useLiveShareContext = () => {
17
29
  const context = React.useContext(LiveShareContext);
30
+ if (!isLiveShareContext(context)) {
31
+ throw new Error("@microsoft/live-share-react: attempting to use `useLiveShareContext()` from a component that is not a child of `<LiveShareProvider>`.\nTo fix this error, ensure that you are only using Live Share hooks (e.g., `useLiveState`) from a child component of `<LiveShareProvider>`.");
32
+ }
18
33
  return context;
19
34
  };
20
35
  /**
@@ -66,4 +81,7 @@ export const LiveShareProvider = (props) => {
66
81
  throw new Error("Cannot create new container through createContainer in LiveShareProvider");
67
82
  }) }, stateRegistryCallbacks) }, { children: props.children })) })));
68
83
  };
84
+ function isLiveShareContext(value) {
85
+ return (typeof (value === null || value === void 0 ? void 0 : value.created) === "boolean" && typeof (value === null || value === void 0 ? void 0 : value.join) === "function");
86
+ }
69
87
  //# sourceMappingURL=LiveShareProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LiveShareProvider.js","sourceRoot":"","sources":["../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAOrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAgCnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAC/C,EAAuB,CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAsB,EAAE;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAyBF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsC,CAAC,KAAK,EAAE,EAAE;IAC1E,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAC1B,IAAI,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAC5D,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,EAEzC,CAAC;IACJ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAqB,CAAC;IAEtE,MAAM,sBAAsB,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAE/D;;OAEG;IACH,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAC1B,CACI,cAA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";
7
7
  /**
8
8
  * Hook to gets or creates a DDS that corresponds to a given uniqueKey string.
9
+ *
10
+ * @remarks
11
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
12
+ *
9
13
  * @template T Type of Fluid LoadableObjectClass type to load. Must conform to IFluidLoadable interface.
10
14
  * @param uniqueKey uniqueKey value for the data object
11
15
  * @param loadableObjectClass Fluid LoadableObjectClass<T> to create/load.
@@ -1 +1 @@
1
- {"version":3,"file":"useDynamicDDS.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useDynamicDDS.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CACzB,CAAC,SAAS,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,cAAc,EAE5D,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC3C,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,GACrC;IACC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B,CAkDA"}
1
+ {"version":3,"file":"useDynamicDDS.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useDynamicDDS.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CACzB,CAAC,SAAS,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,cAAc,EAE5D,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC3C,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,GACrC;IACC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B,CAkDA"}
@@ -15,6 +15,10 @@ import React from "react";
15
15
  import { useFluidObjectsContext } from "../providers";
16
16
  /**
17
17
  * Hook to gets or creates a DDS that corresponds to a given uniqueKey string.
18
+ *
19
+ * @remarks
20
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
21
+ *
18
22
  * @template T Type of Fluid LoadableObjectClass type to load. Must conform to IFluidLoadable interface.
19
23
  * @param uniqueKey uniqueKey value for the data object
20
24
  * @param loadableObjectClass Fluid LoadableObjectClass<T> to create/load.
@@ -1 +1 @@
1
- {"version":3,"file":"useDynamicDDS.js","sourceRoot":"","sources":["../../src/shared-hooks/useDynamicDDS.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAGzB,SAAiB,EACjB,mBAA2C,EAC3C,iBAAoC;IAKpC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAK,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAS,CAAC;IAClD;;OAEG;IACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAE1D;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QACpC,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,uFAAuF;QACvF,MAAM,QAAQ,GAAG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AAG,EAAE;QACjB,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QACpC,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,uFAAuF;QACvF,MAAM,QAAQ,GAAG,GAAS,EAAE;YACxB,IAAI;gBACA,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CACtC,SAAS,EACT,mBAAmB,EACnB,iBAAiB,CACpB,CAAC;gBACF,IAAI,OAAO,EAAE;oBACT,MAAM,CAAC,GAAG,CAAC,CAAC;iBACf;aACJ;YAAC,OAAO,KAAc,EAAE;gBACrB,IAAI,KAAK,YAAY,KAAK,EAAE;oBACxB,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACnB;qBAAM;oBACH,QAAQ,CACJ,IAAI,KAAK,CACL,gEAAgE,CACnE,CACJ,CAAC;iBACL;aACJ;QACL,CAAC,CAAA,CAAC;QACF,QAAQ,EAAE,CAAC;QACX,OAAO,GAAG,EAAE;YACR,OAAO,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE9C,OAAO;QACH,GAAG;QACH,KAAK;KACR,CAAC;AACN,CAAC"}
@@ -10,6 +10,7 @@ import { IUseSharedMapResults, SharedMapInitialData } from "../types";
10
10
  * The primary benefit of using the `useSharedMap` hook rather than the Fluid `SharedMap`
11
11
  * directly is that it integrates nicely with React state and automates repetitive tasks.
12
12
  * If you want to use `SharedMap` this hook creates directly, you can do that as well.
13
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
13
14
  *
14
15
  * @template TData Optional typing for objects stored in the SharedMap. Default is `any` type.
15
16
  * @param uniqueKey the unique key for the `SharedMap`. If one does not yet exist, a new `SharedMap`
@@ -1 +1 @@
1
- {"version":3,"file":"useSharedMap.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useSharedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAStE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EACpC,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAC1C,oBAAoB,CAAC,KAAK,CAAC,CAmG7B"}
1
+ {"version":3,"file":"useSharedMap.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useSharedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAStE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EACpC,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAC1C,oBAAoB,CAAC,KAAK,CAAC,CAmG7B"}
@@ -15,6 +15,7 @@ import { ActionContainerNotJoinedError, ActionLiveDataObjectUndefinedError, } fr
15
15
  * The primary benefit of using the `useSharedMap` hook rather than the Fluid `SharedMap`
16
16
  * directly is that it integrates nicely with React state and automates repetitive tasks.
17
17
  * If you want to use `SharedMap` this hook creates directly, you can do that as well.
18
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
18
19
  *
19
20
  * @template TData Optional typing for objects stored in the SharedMap. Default is `any` type.
20
21
  * @param uniqueKey the unique key for the `SharedMap`. If one does not yet exist, a new `SharedMap`
@@ -1 +1 @@
1
- {"version":3,"file":"useSharedMap.js","sourceRoot":"","sources":["../../src/shared-hooks/useSharedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,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AO,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,SAAS,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC7C,uCAAuC;QACvC,cAAc,EAAE,CAAC;QAEjB,OAAO,GAAG,EAAE;YACR,gCAAgC;YAChC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACnD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO;QACH,GAAG;QACH,QAAQ;QACR,WAAW;QACX,SAAS;KACZ,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CACnB,WAAwC;IAExC,IAAI,KAAK,CAAC,WAAW,CAAC,EAAE;QACpB,OAAO,WAAW,CAAC;KACtB;SAAM,IAAI,SAAS,CAAC,WAAW,CAAC,EAAE;QAC/B,OAAO,IAAI,GAAG,CAAgB,WAAW,CAAC,CAAC;KAC9C;SAAM,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;QAC5B,MAAM,MAAM,GAAiC,MAAM,CAAC,IAAI,CACpD,WAAW,CACd,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACV,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,GAAG,CAAgB,MAAM,CAAC,CAAC;KACzC;IACD,OAAO,IAAI,GAAG,EAAiB,CAAC;AACpC,CAAC"}
@@ -10,6 +10,7 @@ import { DisposeSharedStateAction, SetSharedStateAction } from "../types";
10
10
  * Values set through this state is automatically attached to a `SharedMap` that the `AzureProvider`
11
11
  * creates. If you are synchronizing complex data structures that multiple users will be setting simultaneously,
12
12
  * consider using an optimized hook for your data structure (e.g., `useSharedMap`, `useSharedString`, etc.).
13
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
13
14
  *
14
15
  * @template S Typing for objects stored associated with the `uniqueKey`.
15
16
  * @param uniqueKey the unique key for a `SharedMap`. If you use the same key for multiple components, those components will reference the same state.
@@ -1 +1 @@
1
- {"version":3,"file":"useSharedState.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useSharedState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAI1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,GAChB,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAkExD"}
1
+ {"version":3,"file":"useSharedState.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useSharedState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAI1E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,GAChB,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAkExD"}
@@ -13,6 +13,7 @@ import { isPrevStateCallback } from "../internal";
13
13
  * Values set through this state is automatically attached to a `SharedMap` that the `AzureProvider`
14
14
  * creates. If you are synchronizing complex data structures that multiple users will be setting simultaneously,
15
15
  * consider using an optimized hook for your data structure (e.g., `useSharedMap`, `useSharedString`, etc.).
16
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
16
17
  *
17
18
  * @template S Typing for objects stored associated with the `uniqueKey`.
18
19
  * @param uniqueKey the unique key for a `SharedMap`. If you use the same key for multiple components, those components will reference the same state.
@@ -1 +1 @@
1
- {"version":3,"file":"useSharedState.js","sourceRo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G,mBAAmB,CAAI,KAAK,CAAC;gBAC5C,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;gBAClB,CAAC,CAAC,KAAK,CAAC;YACZ,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACzC,OAAO,UAAU,CAAC;QACtB,CAAC,CAAC,CAAC;IACP,CAAC,EACD,CAAC,SAAS,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAChD,CAAC;IAEF;;OAEG;IACH,MAAM,kBAAkB,GACpB,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACnB,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEvC;;;;;;OAMG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,4BAA4B,CACxB,SAAS,EACT,cAAc,CAAC,OAAO,EACtB,aAAa,CAChB,CAAC;QACF,OAAO,GAAG,EAAE;YACR,8BAA8B,CAAC,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QACtE,CAAC,CAAC;IACN,CAAC,EAAE;QACC,SAAS;QACT,4BAA4B;QAC5B,8BAA8B;KACjC,CAAC,CAAC;IAEH,OAAO,CAAC,UAAU,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAC5D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/live-share-react",
3
- "version": "1.2.1-preview.0",
3
+ "version": "1.2.2-preview.0",
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,7 +12,7 @@
12
12
  "typecheck": "tsc"
13
13
  },
14
14
  "dependencies": {
15
- "@microsoft/live-share-turbo": "1.2.1-preview.0",
15
+ "@microsoft/live-share-turbo": "1.2.2-preview.0",
16
16
  "url": "^0.11.0",
17
17
  "uuid": "^9.0.0"
18
18
  },
@@ -20,9 +20,9 @@
20
20
  "@babel/core": "^7.21.8",
21
21
  "@fluidframework/azure-client": "^1.1.1",
22
22
  "@fluidframework/test-client-utils": "^1.3.6",
23
- "@microsoft/live-share": "1.2.1",
24
- "@microsoft/live-share-canvas": "1.2.1",
25
- "@microsoft/live-share-media": "1.2.1",
23
+ "@microsoft/live-share": "1.2.2",
24
+ "@microsoft/live-share-canvas": "1.2.2",
25
+ "@microsoft/live-share-media": "1.2.2",
26
26
  "@types/react": "^18.0.0",
27
27
  "@types/react-dom": "^18.0.0",
28
28
  "@types/uuid": "^9.0.1",
@@ -32,9 +32,9 @@
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@fluidframework/azure-client": "^1.0.0",
35
- "@microsoft/live-share": "1.2.1",
36
- "@microsoft/live-share-canvas": "1.2.1",
37
- "@microsoft/live-share-media": "1.2.1",
35
+ "@microsoft/live-share": "1.2.2",
36
+ "@microsoft/live-share-canvas": "1.2.2",
37
+ "@microsoft/live-share-media": "1.2.2",
38
38
  "fluid-framework": "^1.2.3",
39
39
  "react": "^16.8.0 || ^17 || ^18",
40
40
  "react-dom": "^16.8.0 || ^17 || ^18"
@@ -3,9 +3,8 @@
3
3
  */
4
4
  class UseLiveDataObjectActionError extends Error {
5
5
  constructor(ddsName: string, functionName: string, message: string) {
6
- super(
7
- `use${toFirstLetterUppercase(ddsName)} ${functionName}: ${message}`
8
- );
6
+ const hookName = `use${toFirstLetterUppercase(ddsName)}`;
7
+ super(`${hookName} ${functionName}: ${message}`);
9
8
  }
10
9
  }
11
10
 
@@ -14,7 +13,11 @@ class UseLiveDataObjectActionError extends Error {
14
13
  */
15
14
  export class ActionContainerNotJoinedError extends UseLiveDataObjectActionError {
16
15
  constructor(ddsName: string, functionName: string) {
17
- super(ddsName, functionName, "container has not yet been joined");
16
+ super(
17
+ ddsName,
18
+ functionName,
19
+ "container has not yet been joined.\nTo fix this error, ensure `container` from `useFluidObjectsContext()` is defined before calling this function.\nIf using `<LiveShareProvider>`, you can instead check the `joined` response is true from `useLiveShareContext()` before calling this function."
20
+ );
18
21
  }
19
22
  }
20
23
 
@@ -23,10 +26,11 @@ export class ActionContainerNotJoinedError extends UseLiveDataObjectActionError
23
26
  */
24
27
  export class ActionLiveDataObjectUndefinedError extends UseLiveDataObjectActionError {
25
28
  constructor(ddsName: string, functionName: string) {
29
+ const hookName = `use${toFirstLetterUppercase(ddsName)}`;
26
30
  super(
27
31
  ddsName,
28
32
  functionName,
29
- `${ddsName} is undefined, which means it is still being dynamically created`
33
+ `${ddsName} is undefined, which means it is still being dynamically created.\nTo fix this error, ensure that \`${ddsName}\` (found in the response of \`${hookName}\`) is defined before calling this function.`
30
34
  );
31
35
  }
32
36
  }
@@ -36,7 +40,12 @@ export class ActionLiveDataObjectUndefinedError extends UseLiveDataObjectActionE
36
40
  */
37
41
  export class ActionLiveDataObjectInitializedError extends UseLiveDataObjectActionError {
38
42
  constructor(ddsName: string, functionName: string) {
39
- super(ddsName, functionName, `${ddsName} is not initialized`);
43
+ const hookName = `use${toFirstLetterUppercase(ddsName)}`;
44
+ super(
45
+ ddsName,
46
+ functionName,
47
+ `${ddsName} is not yet initialized.\nTo fix this error, ensure that \`${ddsName}?.isInitialized\` is true (found in the response of \`${hookName}\`) before calling this function.`
48
+ );
40
49
  }
41
50
  }
42
51
 
@@ -22,6 +22,7 @@ import { isRefObject } from "../utils";
22
22
  * @remarks
23
23
  * Use this hook to set up an `LiveCanvas` object, which is used for collaborative inking. It takes several input parameters, including a unique key,
24
24
  * a reference to a canvas element, and various settings for the inking tool, brush, and canvas offset and scale.
25
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
25
26
  *
26
27
  * @param uniqueKey the unique key for the `LiveCanvas`. If one does not yet exist, a new one.
27
28
  * @param canvasElementRef the HTML div element ref or document ID that `InkingManager` will use for canvas-based collaboration.
@@ -30,6 +30,7 @@ import { useFluidObjectsContext } from "../providers";
30
30
  * @remarks
31
31
  * Use this hook if you want to send transient JSON objects to everyone connected to the Fluid container,
32
32
  * such as when sending push notifications or reactions.
33
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
33
34
  *
34
35
  * @template TEvent Optional typing for events sent & received. Default is `object` type.
35
36
  * @param uniqueKey the unique key for the `LiveEvent`. If one does not yet exist, a new one
@@ -28,6 +28,7 @@ import { IUseLiveFollowModeResults } from "../types";
28
28
  * Use this hook if you want to add the ability to follow specific users or let a user present to everyone in the session.
29
29
  * Each user has their own `stateValue`, which is the value other users will reference when that user is presenting or being followed.
30
30
  * The `state` response includes the user's `value` that the local user is "following", whether it be their own or someone else's.
31
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
31
32
  *
32
33
  * @template TData Optional typing for the custom user presence data object. Default is `object` type.
33
34
  *
@@ -79,19 +80,19 @@ export function useLiveFollowMode<TData = any>(
79
80
  if (!container) {
80
81
  throw new ActionContainerNotJoinedError(
81
82
  "liveFollowMode",
82
- "updateState"
83
+ "update"
83
84
  );
84
85
  }
85
86
  if (liveFollowMode === undefined) {
86
87
  throw new ActionLiveDataObjectUndefinedError(
87
88
  "liveFollowMode",
88
- "updateState"
89
+ "update"
89
90
  );
90
91
  }
91
92
  if (!liveFollowMode.isInitialized) {
92
93
  throw new ActionLiveDataObjectInitializedError(
93
94
  "liveFollowMode",
94
- "updateState"
95
+ "update"
95
96
  );
96
97
  }
97
98
  return await liveFollowMode.update(stateValue);
@@ -106,19 +107,19 @@ export function useLiveFollowMode<TData = any>(
106
107
  if (!container) {
107
108
  throw new ActionContainerNotJoinedError(
108
109
  "liveFollowMode",
109
- "updateState"
110
+ "startPresenting"
110
111
  );
111
112
  }
112
113
  if (liveFollowMode === undefined) {
113
114
  throw new ActionLiveDataObjectUndefinedError(
114
115
  "liveFollowMode",
115
- "updateState"
116
+ "startPresenting"
116
117
  );
117
118
  }
118
119
  if (!liveFollowMode.isInitialized) {
119
120
  throw new ActionLiveDataObjectInitializedError(
120
121
  "liveFollowMode",
121
- "updateState"
122
+ "startPresenting"
122
123
  );
123
124
  }
124
125
  return await liveFollowMode.startPresenting();
@@ -27,6 +27,7 @@ import {
27
27
  * Use this hook if you want to track presence for who is currently using this component, such as
28
28
  * who is online or who is viewing a specific document. With presence, you can sent along any custom
29
29
  * user data. This is useful for rendering a list of users, profile pictures, cursor positions, and more.
30
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
30
31
  *
31
32
  * @template TData Optional typing for the custom user presence data object. Default is `object` type.
32
33
  * @param uniqueKey The unique key for `LivePresence`. If one does not yet exist, a new one will be created.
@@ -24,6 +24,7 @@ import {
24
24
  *
25
25
  * @remarks
26
26
  * Use this hook if you want to synchronize app state that will reset when all users leave the session.
27
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
27
28
  *
28
29
  * @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.
29
30
  * @param initialState Optional. the initial state value of type TState
@@ -30,6 +30,23 @@ import {
30
30
  ActionLiveDataObjectUndefinedError,
31
31
  } from "../internal";
32
32
 
33
+ /**
34
+ * React hook for using Live Share's `LiveTimer` DDS.
35
+ *
36
+ * @remarks
37
+ * Use this hook to create a synchronized countdown timer in your app or to schedule synchronized tasks.
38
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
39
+ *
40
+ * @param uniqueKey the unique key for the `LiveTimer`. If one does not yet exist, a new one will be created, otherwise it will use the existing one.
41
+ * @param allowedRoles Optional. the user roles that are allowed to start/stop/pause the timer.
42
+ * @param tickRate Optional. the interval in which the `milliRemaining` state should be updated and the `onTick` callback will trigger.
43
+ * @param onTick Optional. event handler callback for when an active timer ticks.
44
+ * @param onStart Optional. event handler callback for when the timer is started.
45
+ * @param onPause Optional. event handler callback for when the timer is paused.
46
+ * @param onPlay Optional. event handler callback for when the timer is resumed.
47
+ * @param onFinish Optional. event handler callback for when the timer finishes.
48
+ * @returns results and callbacks exposed via the hook.
49
+ */
33
50
  export function useLiveTimer(
34
51
  uniqueKey: string,
35
52
  allowedRoles?: UserMeetingRole[],
@@ -30,6 +30,7 @@ import {
30
30
  *
31
31
  * @remarks
32
32
  * Use this hook if you want to synchronize the playback position of a video or audio element during a Live Share session.
33
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
33
34
  *
34
35
  * @param uniqueKey uniqueKey value for the `LiveMediaSession` DDS object used by `MediaPlayerSynchronizer`.
35
36
  * @param mediaPlayerElement React RefObject containing object/element conforming to IMediaPlayer interface, `IMediaPlayer` object, or string id for <video> / <audio> element.
@@ -19,36 +19,121 @@ import {
19
19
  IFluidTurboClient,
20
20
  } from "@microsoft/live-share-turbo";
21
21
 
22
- interface IFluidContext extends ISharedStateRegistryResponse {
22
+ /**
23
+ * React Context provider values for `<AzureProvider>` and `<LiveShareProvider>`.
24
+ *
25
+ * @remarks
26
+ * To get the latest values, use the {@link useFluidObjectsContext} hook.
27
+ */
28
+ export interface IFluidContext extends ISharedStateRegistryResponse {
29
+ /**
30
+ * The Fluid Turbo client used for connecting to the Fluid container.
31
+ */
23
32
  clientRef: React.MutableRefObject<IFluidTurboClient>;
33
+ /**
34
+ * Stateful Fluid container.
35
+ */
24
36
  container: IFluidContainer | undefined;
37
+ /**
38
+ * The Azure container services (e.g., audience).
39
+ */
25
40
  services: AzureContainerServices | undefined;
41
+ /**
42
+ * A stateful error object that is set if there was an error connecting to the Fluid container.
43
+ */
26
44
  joinError: Error | undefined;
45
+ /**
46
+ * React callback function to connect to an existing Fluid container.
47
+ *
48
+ * @remarks
49
+ * The results will also be set to their stateful counterparts for `container` and `services`.
50
+ *
51
+ * @param containerId the containerId to connect to.
52
+ * @param initialObjects Optional. initial object schema, which should match that passed to `createContainer()`.
53
+ * @returns promise that returns a results object once complete (e.g., container, services, etc.)
54
+ */
27
55
  getContainer: (
28
56
  containerId: string,
29
57
  initialObjects?: LoadableObjectClassRecord
30
58
  ) => Promise<IAzureContainerResults>;
59
+ /**
60
+ * React callback function to create and connect to a new Fluid container.
61
+ *
62
+ * @remarks
63
+ * The results will also be set to their stateful counterparts for `container` and `services`.
64
+ *
65
+ * @param initialObjects Optional. The initial object schema to apply to the container.
66
+ * @param onInitializeContainer Optional. A callback for when the container is first initialized, which is useful for setting default values to objects in `initialObjects`.
67
+ * @returns promise that returns a results object once complete (e.g., container, services, etc.)
68
+ */
31
69
  createContainer: (
32
70
  initialObjects?: LoadableObjectClassRecord,
33
71
  onInitializeContainer?: (container: IFluidContainer) => void
34
72
  ) => Promise<IAzureContainerResults>;
35
73
  }
36
74
 
75
+ /**
76
+ * @hidden
77
+ */
37
78
  export const FluidContext = React.createContext<IFluidContext>(
38
79
  {} as IFluidContext
39
80
  );
40
81
 
82
+ /**
83
+ * Hook to get the latest React context state for `FluidContext`.
84
+ *
85
+ * @remarks
86
+ * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
87
+ *
88
+ * @returns current state of `LiveShareContext`
89
+ */
41
90
  export const useFluidObjectsContext = (): IFluidContext => {
42
91
  const context = React.useContext(FluidContext);
92
+ if (!isFluidObjectsContext(context)) {
93
+ throw new Error(
94
+ "@microsoft/live-share-react: attempting to use `useFluidObjectsContext()` from a component that is not a child of `<LiveShareProvider>` or `<AzureProvider>`.\nTo fix this error, ensure that you are only using Live Share hooks (e.g., `useLiveState`) from a child component of `<LiveShareProvider>` or `<AzureProvider>`."
95
+ );
96
+ }
43
97
  return context;
44
98
  };
45
99
 
46
- interface IAzureProviderProps {
100
+ /**
101
+ * Prop types for {@link AzureProvider} component.
102
+ */
103
+ export interface IAzureProviderProps {
104
+ /**
105
+ * Optional. React children node for the React Context Provider.
106
+ */
47
107
  children?: React.ReactNode;
108
+ /**
109
+ * Props for initializing a new `AzureClient` instance.
110
+ */
48
111
  clientOptions: AzureClientProps;
112
+ /**
113
+ * The `containerId` to connect to when {@link joinOnLoad} is true.
114
+ *
115
+ * @remarks
116
+ * If you pass in an `undefined` value when {@link createOnLoad} is true, a new container will be created.
117
+ */
49
118
  containerId?: string;
119
+ /**
120
+ * Flag to control whether or not a new container should be created on first mount.
121
+ *
122
+ * @remarks
123
+ * If no {@link containerId} is set when the component first mounts, setting this to `true` will automatically create a new container.
124
+ * This prop does not do anything if you are using `<LiveShareProvider>` instead of `<AzureProvider>`.
125
+ */
50
126
  createOnLoad?: boolean;
127
+ /**
128
+ * The initial object schema to use when {@link joinOnLoad} or {@link createOnLoad} is true.
129
+ */
51
130
  initialObjects?: LoadableObjectClassRecord;
131
+ /**
132
+ * Flag to control whether or not to connect to an existing container on first mount.
133
+ *
134
+ * @remarks
135
+ * Setting this to true will connect to the container if {@link containerId} is provided as a prop.
136
+ */
52
137
  joinOnLoad?: boolean;
53
138
  }
54
139
 
@@ -170,3 +255,7 @@ export const AzureProvider: React.FC<IAzureProviderProps> = (props) => {
170
255
  </FluidContext.Provider>
171
256
  );
172
257
  };
258
+
259
+ function isFluidObjectsContext(value: any): value is IFluidContext {
260
+ return !!value?.clientRef;
261
+ }