@microsoft/teams-js 2.4.0-beta.0 → 2.4.0-beta.2

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Welcome to the Teams JavaScript client SDK! For breaking changes, please refer to our [changelog](./CHANGELOG.md) in the current `<root>/packages/teams-js` directory.
4
4
 
5
- This JavaScript library is part of the [Microsoft Teams developer platform](https://docs.microsoft.com/en-us/microsoftteams/platform/). See full [SDK reference documentation](https://docs.microsoft.com/javascript/api/overview/msteams-client?view=msteams-client-js-latest).
5
+ This JavaScript library is part of the [Microsoft Teams developer platform](https://learn.microsoft.com/microsoftteams/platform/). See full [SDK reference documentation](https://learn.microsoft.com/javascript/api/overview/msteams-client?view=msteams-client-js-latest).
6
6
 
7
7
  ## Getting Started
8
8
 
@@ -12,7 +12,7 @@ Whenever building or testing the Teams client SDK, you can run `yarn build` or `
12
12
 
13
13
  ## Installation
14
14
 
15
- To install the stable [version](https://docs.microsoft.com/javascript/api/overview/msteams-client?view=msteams-client-js-latest):
15
+ To install the stable [version](https://learn.microsoft.com/javascript/api/overview/msteams-client?view=msteams-client-js-latest):
16
16
 
17
17
  ### npm
18
18
 
@@ -1,4 +1,10 @@
1
1
  // Generated by dts-bundle v0.7.3
2
+ // Dependencies for this module:
3
+ // ../@fluidframework/azure-client
4
+ // ../@fluidframework/fluid-static
5
+
6
+ import type { AzureConnectionConfig, AzureContainerServices, ITelemetryBaseLogger } from '@fluidframework/azure-client';
7
+ import type { ContainerSchema, IFluidContainer } from '@fluidframework/fluid-static';
2
8
 
3
9
  /**
4
10
  * @hidden
@@ -895,21 +901,22 @@ export namespace files {
895
901
  /**
896
902
  * @hidden
897
903
  * Object used to represent a file
904
+ * @beta
898
905
  *
899
906
  * @internal
900
907
  * Limited to Microsoft-internal use
901
908
  */
902
909
  export interface File extends Blob {
903
910
  /**
904
- * Last modified timestamp
911
+ * A number that represents the number of milliseconds since the Unix epoch
905
912
  */
906
- lastModified: Date;
913
+ lastModified: number;
907
914
  /**
908
915
  * Name of the file
909
916
  */
910
917
  name: string;
911
918
  /**
912
- * The file path to uniquely identify it within the file hierarchy
919
+ * A string containing the path of the file relative to the ancestor directory the user selected
913
920
  */
914
921
  webkitRelativePath?: string;
915
922
  }
@@ -2786,7 +2793,7 @@ export interface ActionInfo {
2786
2793
  *
2787
2794
  * @remarks
2788
2795
  * For more details about the updated {@link app.Context} interface, visit the
2789
- * [Teams JavaScript client SDK](https://docs.microsoft.com/microsoftteams/platform/tabs/how-to/using-teams-client-sdk#updates-to-the-context-interface)
2796
+ * [Teams JavaScript client SDK](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/using-teams-client-sdk#updates-to-the-context-interface)
2790
2797
  * overview article.
2791
2798
  *
2792
2799
  * Represents the structure of the received context message.
@@ -3828,7 +3835,7 @@ export namespace app {
3828
3835
  */
3829
3836
  meeting?: MeetingInfo;
3830
3837
  /**
3831
- * SharePoint context. This is only available when hosted in SharePoint.
3838
+ * When hosted in SharePoint, this is the [SharePoint PageContext](https://learn.microsoft.com/en-us/javascript/api/sp-page-context/pagecontext?view=sp-typescript-latest), else `undefined`
3832
3839
  */
3833
3840
  sharepoint?: any;
3834
3841
  /**
@@ -3856,8 +3863,7 @@ export namespace app {
3856
3863
  * Initializes the library.
3857
3864
  *
3858
3865
  * @remarks
3859
- * This must be called before any other SDK calls
3860
- * but after the frame is loaded successfully.
3866
+ * Initialize must have completed successfully (as determined by the resolved Promise) before any other library calls are made
3861
3867
  *
3862
3868
  * @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
3863
3869
  * https: protocol otherwise they will be ignored. Example: https:www.example.com
@@ -4107,7 +4113,7 @@ export namespace dialog {
4107
4113
  * Submit the dialog module and close the dialog
4108
4114
  *
4109
4115
  * @param result - The result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
4110
- * @param appIds - Helps to validate that the call originates from the same appId as the one that invoked the task module
4116
+ * @param appIds - Valid application(s) that can receive the result of the submitted dialogs. Specifying this parameter helps prevent malicious apps from retrieving the dialog result. Multiple app IDs can be specified because a web app from a single underlying domain can power multiple apps across different environments and branding schemes.
4111
4117
  */
4112
4118
  function submit(result?: string | object, appIds?: string | string[]): void;
4113
4119
  /**
@@ -4679,6 +4685,53 @@ export namespace pages {
4679
4685
  */
4680
4686
  function isSupported(): boolean;
4681
4687
  }
4688
+ /**
4689
+ * Provides functions for navigating without needing to specify your application ID.
4690
+ *
4691
+ * @beta
4692
+ */
4693
+ namespace currentApp {
4694
+ /**
4695
+ * Parameters for the NavigateWithinApp
4696
+ *
4697
+ * @beta
4698
+ */
4699
+ interface NavigateWithinAppParams {
4700
+ /**
4701
+ * The developer-defined unique ID for the page defined in the manifest or when first configuring
4702
+ * the page. (Known as {entityId} prior to TeamsJS v.2.0.0)
4703
+ */
4704
+ pageId: string;
4705
+ /**
4706
+ * Optional developer-defined unique ID describing the content to navigate to within the page. This
4707
+ * can be retrieved from the Context object {@link app.PageInfo.subPageId | app.Context.page.subPageId}
4708
+ */
4709
+ subPageId?: string;
4710
+ }
4711
+ /**
4712
+ * Navigate within the currently running application with page ID, and sub-page ID (for navigating to
4713
+ * specific content within the page).
4714
+ * @param params - Parameters for the navigation
4715
+ * @returns a promise that will resolve if the navigation was successful
4716
+ *
4717
+ * @beta
4718
+ */
4719
+ function navigateTo(params: NavigateWithinAppParams): Promise<void>;
4720
+ /**
4721
+ * Navigate to the currently running application's first static page defined in the application
4722
+ * manifest.
4723
+ * @beta
4724
+ */
4725
+ function navigateToDefaultPage(): Promise<void>;
4726
+ /**
4727
+ * Checks if pages.currentApp capability is supported by the host
4728
+ * @returns true if the pages.currentApp capability is enabled in runtime.supports.pages.currentApp and
4729
+ * false if it is disabled
4730
+ *
4731
+ * @beta
4732
+ */
4733
+ function isSupported(): boolean;
4734
+ }
4682
4735
  }
4683
4736
 
4684
4737
  export interface IAppWindow {
@@ -5969,7 +6022,7 @@ export namespace profile {
5969
6022
  *
5970
6023
  * This id is guaranteed to be unique for an object within a tenant,
5971
6024
  * and so if provided will lead to a more performant lookup. It can
5972
- * be resolved via MS Graph (see https://docs.microsoft.com/en-us/graph/api/resources/users
6025
+ * be resolved via MS Graph (see https://learn.microsoft.com/graph/api/resources/users
5973
6026
  * for examples).
5974
6027
  */
5975
6028
  readonly AadObjectId?: string;
@@ -6836,7 +6889,7 @@ export namespace tasks {
6836
6889
  * Submit the task module.
6837
6890
  *
6838
6891
  * @param result - Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
6839
- * @param appIds - Helps to validate that the call originates from the same appId as the one that invoked the task module
6892
+ * @param appIds - Valid application(s) that can receive the result of the submitted dialogs. Specifying this parameter helps prevent malicious apps from retrieving the dialog result. Multiple app IDs can be specified because a web app from a single underlying domain can power multiple apps across different environments and branding schemes.
6840
6893
  */
6841
6894
  function submitTask(result?: string | object, appIds?: string | string[]): void;
6842
6895
  /**
@@ -6848,3 +6901,281 @@ export namespace tasks {
6848
6901
  function getDefaultSizeIfNotProvided(taskInfo: TaskInfo): TaskInfo;
6849
6902
  }
6850
6903
 
6904
+ /**
6905
+ * Namespace to interact with the Live Share module-specific part of the SDK.
6906
+ *
6907
+ * @beta
6908
+ */
6909
+ export namespace liveShare {
6910
+ /**
6911
+ * Options used to configure the Live Share client.
6912
+ *
6913
+ * @beta
6914
+ */
6915
+ interface LiveShareOptions {
6916
+ /**
6917
+ * Optional. Configuration to use when connecting to a custom Azure Fluid Relay instance.
6918
+ */
6919
+ readonly connection?: AzureConnectionConfig;
6920
+ /**
6921
+ * Optional. A logger instance to receive diagnostic messages.
6922
+ */
6923
+ readonly logger?: ITelemetryBaseLogger;
6924
+ /**
6925
+ * Optional. Function to lookup the ID of the container to use for local testing.
6926
+ *
6927
+ * @remarks
6928
+ * The default implementation attempts to retrieve the containerId from the `window.location.hash`.
6929
+ *
6930
+ * If the function returns 'undefined' a new container will be created.
6931
+ * @returns ID of the container to connect to or `undefined` if a new container should be created.
6932
+ */
6933
+ readonly getLocalTestContainerId?: () => string | undefined;
6934
+ /**
6935
+ * Optional. Function to save the ID of a newly created local test container.
6936
+ *
6937
+ * @remarks
6938
+ * The default implementation updates `window.location.hash` with the ID of the newly created
6939
+ * container.
6940
+ * @param containerId The ID of the container that was created.
6941
+ */
6942
+ readonly setLocalTestContainerId?: (containerId: string) => void;
6943
+ }
6944
+ /**
6945
+ * Initializes the Live Share client.
6946
+ * @param options Optional. Configuration options passed to the Live Share client.
6947
+ *
6948
+ * @beta
6949
+ */
6950
+ function initialize(options?: LiveShareOptions): Promise<void>;
6951
+ /**
6952
+ * Connects to the fluid container for the current teams context.
6953
+ *
6954
+ * @remarks
6955
+ * The first client joining the container will create the container resulting in the
6956
+ * `onContainerFirstCreated` callback being called. This callback can be used to set the initial
6957
+ * state of of the containers object prior to the container being attached.
6958
+ * @param fluidContainerSchema Fluid objects to create.
6959
+ * @param onContainerFirstCreated Optional. Callback that's called when the container is first created.
6960
+ * @returns The fluid `container` and `services` objects to use along with a `created` flag that if true means the container had to be created.
6961
+ *
6962
+ * @beta
6963
+ */
6964
+ function joinContainer(fluidContainerSchema: ContainerSchema, onContainerFirstCreated?: (container: IFluidContainer) => void): Promise<{
6965
+ container: IFluidContainer;
6966
+ services: AzureContainerServices;
6967
+ created: boolean;
6968
+ }>;
6969
+ /**
6970
+ * @hidden
6971
+ * Hide from docs
6972
+ * ------
6973
+ * Returns the LiveShareHost object. Called by existing apps that use the TeamsFluidClient
6974
+ * directly. This prevents existing apps from breaking and will be removed when Live Share
6975
+ * goes GA.
6976
+ *
6977
+ * @beta
6978
+ */
6979
+ function getHost(): LiveShareHost;
6980
+ }
6981
+
6982
+ /**
6983
+ * @hidden
6984
+ * @internal
6985
+ * Limited to Microsoft-internal use
6986
+ * ------
6987
+ * Allowed roles during a meeting.
6988
+ */
6989
+ export enum UserMeetingRole {
6990
+ guest = "Guest",
6991
+ attendee = "Attendee",
6992
+ presenter = "Presenter",
6993
+ organizer = "Organizer"
6994
+ }
6995
+ /**
6996
+ * @hidden
6997
+ * @internal
6998
+ * Limited to Microsoft-internal use
6999
+ * ------
7000
+ * State of the current Live Share sessions backing fluid container.
7001
+ */
7002
+ export enum ContainerState {
7003
+ /**
7004
+ * The call to `LiveShareHost.setContainerId()` successfully created the container mapping
7005
+ * for the current Live Share session.
7006
+ */
7007
+ added = "Added",
7008
+ /**
7009
+ * A container mapping for the current Live Share Session already exists and should be used
7010
+ * when joining the sessions Fluid container.
7011
+ */
7012
+ alreadyExists = "AlreadyExists",
7013
+ /**
7014
+ * The call to `LiveShareHost.setContainerId()` failed to create the container mapping due to
7015
+ * another client having already set the container ID for the current Live Share session.
7016
+ */
7017
+ conflict = "Conflict",
7018
+ /**
7019
+ * A container mapping for the current Live Share session doesn't exist yet.
7020
+ */
7021
+ notFound = "NotFound"
7022
+ }
7023
+ /**
7024
+ * @hidden
7025
+ * @internal
7026
+ * Limited to Microsoft-internal use
7027
+ * ------
7028
+ * Returned from `LiveShareHost.get/setFluidContainerId()` to specify the container mapping for the
7029
+ * current Live Share session.
7030
+ */
7031
+ export interface IFluidContainerInfo {
7032
+ /**
7033
+ * State of the containerId mapping.
7034
+ */
7035
+ containerState: ContainerState;
7036
+ /**
7037
+ * ID of the container to join for the meeting. Undefined if the container hasn't been
7038
+ * created yet.
7039
+ */
7040
+ containerId: string | undefined;
7041
+ /**
7042
+ * If true, the local client should create the container and then save the created containers
7043
+ * ID to the mapping service.
7044
+ */
7045
+ shouldCreate: boolean;
7046
+ /**
7047
+ * If `containerId` is undefined and `shouldCreate` is false, the container isn't ready but
7048
+ * another client is creating it. The local client should wait the specified amount of time and
7049
+ * then ask for the container info again.
7050
+ */
7051
+ retryAfter: number;
7052
+ }
7053
+ /**
7054
+ * @hidden
7055
+ * @internal
7056
+ * Limited to Microsoft-internal use
7057
+ * ------
7058
+ * Returned from `LiveShareHost.getNtpTime()` to specify the global timestamp for the current
7059
+ * Live Share session.
7060
+ */
7061
+ export interface INtpTimeInfo {
7062
+ /**
7063
+ * ISO 8601 formatted server time. For example: '2019-09-07T15:50-04:00'
7064
+ */
7065
+ ntpTime: string;
7066
+ /**
7067
+ * Server time expressed as the number of milliseconds since the ECMAScript epoch.
7068
+ */
7069
+ ntpTimeInUTC: number;
7070
+ }
7071
+ /**
7072
+ * @hidden
7073
+ * @internal
7074
+ * Limited to Microsoft-internal use
7075
+ * ------
7076
+ * Returned from `LiveShareHost.getFluidTenantInfo()` to specify the Fluid service to use for the
7077
+ * current Live Share session.
7078
+ */
7079
+ export interface IFluidTenantInfo {
7080
+ /**
7081
+ * The Fluid Tenant ID Live Share should use.
7082
+ */
7083
+ tenantId: string;
7084
+ /**
7085
+ * The Fluid service endpoint Live Share should use.
7086
+ */
7087
+ serviceEndpoint?: string;
7088
+ /**
7089
+ * @deprecated
7090
+ * As of Fluid 1.0 this configuration information has been deprecated in favor of
7091
+ * `serviceEndpoint`.
7092
+ */
7093
+ ordererEndpoint: string;
7094
+ /**
7095
+ * @deprecated
7096
+ * As of Fluid 1.0 this configuration information has been deprecated in favor of
7097
+ * `serviceEndpoint`.
7098
+ */
7099
+ storageEndpoint: string;
7100
+ }
7101
+ /**
7102
+ * @hidden
7103
+ * @internal
7104
+ * Limited to Microsoft-internal use
7105
+ * ------
7106
+ * Interface for hosting a Live Share session within a client like Teams.
7107
+ */
7108
+ export class LiveShareHost {
7109
+ /**
7110
+ * @hidden
7111
+ * @internal
7112
+ * Limited to Microsoft-internal use
7113
+ * ------
7114
+ * Returns the Fluid Tenant connection info for user's current context.
7115
+ */
7116
+ getFluidTenantInfo(): Promise<IFluidTenantInfo>;
7117
+ /**
7118
+ * @hidden
7119
+ * @internal
7120
+ * Limited to Microsoft-internal use
7121
+ * ------
7122
+ * Returns the fluid access token for mapped container Id.
7123
+ *
7124
+ * @param containerId Fluid's container Id for the request. Undefined for new containers.
7125
+ * @returns token for connecting to Fluid's session.
7126
+ */
7127
+ getFluidToken(containerId?: string): Promise<string>;
7128
+ /**
7129
+ * @hidden
7130
+ * @internal
7131
+ * Limited to Microsoft-internal use
7132
+ * ------
7133
+ * Returns the ID of the fluid container associated with the user's current context.
7134
+ */
7135
+ getFluidContainerId(): Promise<IFluidContainerInfo>;
7136
+ /**
7137
+ * @hidden
7138
+ * @internal
7139
+ * Limited to Microsoft-internal use
7140
+ * ------
7141
+ * Sets the ID of the fluid container associated with the current context.
7142
+ *
7143
+ * @remarks
7144
+ * If this returns false, the client should delete the container they created and then call
7145
+ * `getFluidContainerId()` to get the ID of the container being used.
7146
+ * @param containerId ID of the fluid container the client created.
7147
+ * @returns A data structure with a `containerState` indicating the success or failure of the request.
7148
+ */
7149
+ setFluidContainerId(containerId: string): Promise<IFluidContainerInfo>;
7150
+ /**
7151
+ * @hidden
7152
+ * @internal
7153
+ * Limited to Microsoft-internal use
7154
+ * ------
7155
+ * Returns the shared clock server's current time.
7156
+ */
7157
+ getNtpTime(): Promise<INtpTimeInfo>;
7158
+ /**
7159
+ * @hidden
7160
+ * @internal
7161
+ * Limited to Microsoft-internal use
7162
+ * ------
7163
+ * Associates the fluid client ID with a set of user roles.
7164
+ *
7165
+ * @param clientId The ID for the current user's Fluid client. Changes on reconnects.
7166
+ * @returns The roles for the current user.
7167
+ */
7168
+ registerClientId(clientId: string): Promise<UserMeetingRole[]>;
7169
+ /**
7170
+ * @hidden
7171
+ * @internal
7172
+ * Limited to Microsoft-internal use
7173
+ * ------
7174
+ * Returns the roles associated with a client ID.
7175
+ *
7176
+ * @param clientId The Client ID the message was received from.
7177
+ * @returns The roles for a given client. Returns `undefined` if the client ID hasn't been registered yet.
7178
+ */
7179
+ getClientRoles(clientId: string): Promise<UserMeetingRole[] | undefined>;
7180
+ }
7181
+