/*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Microsoft Live Share SDK License. */ import { IFluidContainer, LoadableObjectClassRecord } from "fluid-framework"; import React from "react"; import { ILiveShareClientOptions, ILiveShareHost, ILiveShareJoinResults, ITimestampProvider } from "@microsoft/live-share"; /** * React Context provider values for ``. * * @remarks * To get the latest values, use the {@link useLiveShareContext} hook. * Use the {@link useFluidObjectsContext} hook for other relevant context values. */ export interface ILiveShareContext { /** * True if the local user created the Fluid container */ created: boolean; /** * True if connected to the Live Share container */ joined: boolean; /** * An error that will be defined if there was a problem joining the container, or undefined if not. */ joinError: Error | undefined; /** * Live Share timestamp provider. Can be used to `.getTimestamp()` for a global clock value. * This reference timestamp value should be fairly consistent for all users in the session. */ timestampProvider: ITimestampProvider | undefined; /** * Join callback method for manually connecting to the Fluid container. * * @remarks * Use this callback if `joinOnLoad` is `false` or `undefined` in {@link ILiveShareProviderProps}. * * @param initialObjects Optional. The initial objects for the Fluid container schema. * @param onInitializeContainer Optional. Callback for when the container is first created. * @returns Promise with `ILiveShareJoinResults`, which includes the Fluid container */ join: (initialObjects?: LoadableObjectClassRecord, onInitializeContainer?: (container: IFluidContainer) => void) => Promise; } /** * @hidden */ export declare const LiveShareContext: React.Context; /** * Hook to get the latest React context state for `LiveShareContext`. * * @remarks * This hook can only be used in a child component of ``. * See `useFluidObjectsContext` for other information related to the Live Share session, such as the `container`. * * @returns current state of `LiveShareContext` */ export declare const useLiveShareContext: () => ILiveShareContext; /** * Prop types for {@link LiveShareProvider} component. */ export interface ILiveShareProviderProps { /** * Optional. React children node for the React Context Provider */ children?: React.ReactNode; /** * Optional. Options for initializing `LiveShareClient`. */ clientOptions?: ILiveShareClientOptions; /** * Host to initialize `LiveShareClient` with. * * @remarks * If using the `LiveShareClient` class from `@microsoft/teams-js`, you must ensure that you have first called `teamsJs.app.initialize()` before calling `LiveShareClient.create()`. */ host: ILiveShareHost; /** * The initial object schema to use when {@link joinOnLoad} is true. */ initialObjects?: LoadableObjectClassRecord; /** * Optional. Flag to determine whether to join Fluid container on load. */ joinOnLoad?: boolean; } /** * React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`. */ export declare const LiveShareProvider: React.FC; //# sourceMappingURL=LiveShareProvider.d.ts.map