@microsoft/teams-js 2.26.0 → 2.27.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
24
24
 
25
25
  ### Production
26
26
 
27
- You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.26.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.27.0/js/MicrosoftTeams.min.js) or point your package manager at them.
28
28
 
29
29
  ## Usage
30
30
 
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
45
45
  ```html
46
46
  <!-- Microsoft Teams JavaScript API (via CDN) -->
47
47
  <script
48
- src="https://res.cdn.office.net/teams-js/2.26.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-gqPg5qCjdUgTGRZ/stLskrnJllL5h5+f4kTqvxVqtl2FdT7PVRa9Q7zq4gFlZ7bO"
48
+ src="https://res.cdn.office.net/teams-js/2.27.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-QGb/h0ACuraFEnqrpkMcMBTU+baTLZy1Mh61IGbM206IPGRWiWCIL5dkLzG1RKZH"
50
50
  crossorigin="anonymous"
51
51
  ></script>
52
52
 
53
53
  <!-- Microsoft Teams JavaScript API (via npm) -->
54
- <script src="node_modules/@microsoft/teams-js@2.26.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.27.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -488,6 +488,45 @@ export namespace conversations {
488
488
  function isSupported(): boolean;
489
489
  }
490
490
 
491
+ /**
492
+ * @beta
493
+ * @hidden
494
+ * Namespace to delegate copilot app specific APIs
495
+ * @internal
496
+ * Limited to Microsoft-internal use
497
+ */
498
+ export namespace copilot {
499
+ /**
500
+ * @beta
501
+ * @hidden
502
+ * User information required by specific apps
503
+ * @internal
504
+ * Limited to Microsoft-internal use
505
+ */
506
+ namespace eligibility {
507
+ /**
508
+ * @hidden
509
+ * @internal
510
+ * Limited to Microsoft-internal use
511
+ * @beta
512
+ * @returns boolean to represent whether copilot.eligibility capability is supported
513
+ *
514
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
515
+ */
516
+ function isSupported(): boolean;
517
+ /**
518
+ * @hidden
519
+ * @internal
520
+ * Limited to Microsoft-internal use
521
+ * @beta
522
+ * @returns the copilot eligibility information about the user
523
+ *
524
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
525
+ */
526
+ function getEligibilityInfo(): AppEligibilityInformation;
527
+ }
528
+ }
529
+
491
530
  /**
492
531
  * @hidden
493
532
  * Namespace to delegate authentication and message extension requests to the host
@@ -2957,6 +2996,182 @@ export namespace videoEffectsEx {
2957
2996
  function notifyFatalError(errorMessage: string): void;
2958
2997
  }
2959
2998
 
2999
+ /**
3000
+ * @hidden
3001
+ * @internal
3002
+ * @beta
3003
+ * Limited to Microsoft-internal use
3004
+ *
3005
+ * This capability allows an app to associate apps with a host entity, such as a Teams channel or chat, and configure them as needed.
3006
+ */
3007
+ export namespace hostEntity {
3008
+ export enum AppTypes {
3009
+ edu = "EDU"
3010
+ }
3011
+ /**
3012
+ * Id of the teams entity like channel, chat
3013
+ */
3014
+ interface TeamsEntityId {
3015
+ threadId: string;
3016
+ }
3017
+ /**
3018
+ * Id of message in which channel meeting is created
3019
+ */
3020
+ export interface TeamsChannelMeetingEntityIds extends TeamsEntityId {
3021
+ parentMessageId: string;
3022
+ }
3023
+ /**
3024
+ * Id of the host entity
3025
+ */
3026
+ export type HostEntityIds = TeamsEntityId | TeamsChannelMeetingEntityIds;
3027
+ /**
3028
+ * @hidden
3029
+ * @internal
3030
+ * @beta
3031
+ * Limited to Microsoft-internal use
3032
+ *
3033
+ * CRUD operations for tabs associated with apps
3034
+ */
3035
+ export namespace tab {
3036
+ /**
3037
+ * Represents information about a static tab instance
3038
+ */
3039
+ interface StaticTabInstance extends TabInstance {
3040
+ tabType: 'StaticTab';
3041
+ }
3042
+ /**
3043
+ * Represents information about a configurable tab instance
3044
+ */
3045
+ interface ConfigurableTabInstance extends TabInstance {
3046
+ tabType: 'ConfigurableTab';
3047
+ }
3048
+ /**
3049
+ * Represents information about a tab instance associated with a host entity like chat, channel or meeting. Cab be a configurable tab or static tab.
3050
+ */
3051
+ type HostEntityTabInstance = StaticTabInstance | ConfigurableTabInstance;
3052
+ /**
3053
+ * Represents all tabs associated with a host entity like chat, channel or meeting
3054
+ */
3055
+ interface HostEntityTabInstances {
3056
+ allTabs: HostEntityTabInstance[];
3057
+ }
3058
+ /**
3059
+ * @hidden
3060
+ * @internal
3061
+ * @beta
3062
+ * Limited to Microsoft-internal use
3063
+ *
3064
+ * Launches host-owned UI that lets a user select an app, installs it if required,
3065
+ * runs through app configuration if required, and then associates the app with the threadId provided
3066
+ *
3067
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
3068
+ *
3069
+ * @param appTypes What type of applications to show the user. If EDU is passed as appType, only apps supported by EDU tenant are shown.
3070
+ * If no value is passed, all apps are shown.
3071
+ *
3072
+ * @returns The HostEntityTabInstance of the newly associated app
3073
+ *
3074
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation or installing
3075
+ * or configuring or adding tab fails
3076
+ */
3077
+ function addAndConfigure(hostEntityIds: HostEntityIds, appTypes?: AppTypes[]): Promise<HostEntityTabInstance>;
3078
+ /**
3079
+ * @hidden
3080
+ * @internal
3081
+ * @beta
3082
+ * Limited to Microsoft-internal use
3083
+ *
3084
+ * Returns all tab instances associated with a host entity
3085
+ *
3086
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
3087
+ *
3088
+ * @returns Object with array of HostEntityTabInstance's associated with a host entity
3089
+ *
3090
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid or fetching tabs fails
3091
+ */
3092
+ function getAll(hostEntityIds: HostEntityIds): Promise<HostEntityTabInstances>;
3093
+ /**
3094
+ * @hidden
3095
+ * @internal
3096
+ * @beta
3097
+ * Limited to Microsoft-internal use
3098
+ *
3099
+ * Launches host-owned UI that lets a user re-configure the contentUrl of the tab
3100
+ *
3101
+ * @param tab Configurable tab instance that needs to be updated
3102
+ *
3103
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
3104
+ *
3105
+ * @returns The HostEntityTabInstance of the updated tab
3106
+ *
3107
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation,
3108
+ * re-configuring tab fails or if tab is a static tab
3109
+ */
3110
+ function reconfigure(tab: ConfigurableTabInstance, hostEntityIds: HostEntityIds): Promise<ConfigurableTabInstance>;
3111
+ /**
3112
+ * @hidden
3113
+ * @internal
3114
+ * @beta
3115
+ * Limited to Microsoft-internal use
3116
+ *
3117
+ * Launches host-owned UI that lets a user rename the tab
3118
+ *
3119
+ * @param tab Configurable tab instance that needs to be updated
3120
+ *
3121
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
3122
+ *
3123
+ * @returns The HostEntityTabInstance of the updated tab
3124
+ *
3125
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation,
3126
+ * re-naming tab fails or if tab is a static tab
3127
+ */
3128
+ function rename(tab: ConfigurableTabInstance, hostEntityIds: HostEntityIds): Promise<ConfigurableTabInstance>;
3129
+ /**
3130
+ * @hidden
3131
+ * @internal
3132
+ * @beta
3133
+ * Limited to Microsoft-internal use
3134
+ *
3135
+ * Launches host-owned UI that lets a user remove the tab
3136
+ *
3137
+ * @param tab tab instance that needs to be updated. Can be static tab or configurable tab.
3138
+ *
3139
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
3140
+ *
3141
+ * @returns Boolean. Returns true if removing tab was successful
3142
+ *
3143
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation or
3144
+ * removing tab fails
3145
+ */
3146
+ function remove(tab: HostEntityTabInstance, hostEntityIds: HostEntityIds): Promise<boolean>;
3147
+ /**
3148
+ * @hidden
3149
+ * @internal
3150
+ * @beta
3151
+ * Limited to Microsoft-internal use
3152
+ *
3153
+ * Checks if the hostEntity.tab capability is supported by the host
3154
+ * @returns boolean to represent whether the histEntity and hostEntity.tab capability is supported
3155
+ *
3156
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
3157
+ */
3158
+ function isSupported(): boolean;
3159
+ }
3160
+ /**
3161
+ * @hidden
3162
+ * @internal
3163
+ * @beta
3164
+ * Limited to Microsoft-internal use
3165
+ *
3166
+ * Checks if the hostEntity capability is supported by the host
3167
+ * @returns boolean to represent whether the hostEntity capability is supported
3168
+ *
3169
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
3170
+ */
3171
+ export function isSupported(): boolean;
3172
+ export {};
3173
+ }
3174
+
2960
3175
  export namespace authentication {
2961
3176
  /**
2962
3177
  * @hidden
@@ -3613,6 +3828,14 @@ export interface TabInstance {
3613
3828
  * Website URL of this tab
3614
3829
  */
3615
3830
  websiteUrl?: string;
3831
+ /**
3832
+ * AppId of this tab
3833
+ */
3834
+ appId?: string;
3835
+ /**
3836
+ * Order of this tab. Order is 1-indexed.
3837
+ */
3838
+ order?: number;
3616
3839
  }
3617
3840
  /**
3618
3841
  * Indicates information about the tab instance for filtering purposes.
@@ -4501,6 +4724,7 @@ export enum DevicePermission {
4501
4724
  /** @hidden */
4502
4725
  export interface HostVersionsInfo {
4503
4726
  adaptiveCardSchemaVersion?: AdaptiveCardVersion;
4727
+ appEligibilityInformation?: AppEligibilityInformation;
4504
4728
  }
4505
4729
  /**
4506
4730
  * Represents the major and minor versions of the Adaptive Card schema in the current host
@@ -4511,6 +4735,146 @@ export interface AdaptiveCardVersion {
4511
4735
  /** Represents the minor version number. */
4512
4736
  minorVersion: number;
4513
4737
  }
4738
+ /**
4739
+ * @hidden
4740
+ * Eligibility Information for the app user.
4741
+ *
4742
+ * @beta
4743
+ */
4744
+ export interface AppEligibilityInformation {
4745
+ /**
4746
+ * Describes the user’s age group, which can have implications on which product they are able to use.
4747
+ */
4748
+ ageGroup: LegalAgeGroupClassification | null;
4749
+ /**
4750
+ * Describes the user’s chat experience based on their eligible licenses & their tenant’s eligible licenses.
4751
+ * A user will be in at most one cohort.
4752
+ */
4753
+ cohort: Cohort | null;
4754
+ /**
4755
+ * Indicates that the user is eligible for Microsoft Entra ID Authenticated Copilot experience.
4756
+ */
4757
+ isCopilotEligible: boolean;
4758
+ /**
4759
+ * Implementation may change to be based on tenant-home region rather than IP.
4760
+ */
4761
+ isCopilotEnabledRegion: boolean;
4762
+ /**
4763
+ * Indicates if the tenant admin has opted the user out of Copilot.
4764
+ */
4765
+ isOptedOutByAdmin: boolean;
4766
+ /**
4767
+ * Education Eligibility Information for the app user
4768
+ */
4769
+ userClassification: UserClassification;
4770
+ }
4771
+ /**
4772
+ * @hidden
4773
+ *
4774
+ * @beta
4775
+ */
4776
+ export interface UserClassificationWithEduType {
4777
+ /**
4778
+ * For EDU tenants only. Indicates if the tenant is higher ed or K12.
4779
+ */
4780
+ eduType: EduType;
4781
+ /**
4782
+ * Describes additional traits of the user that contribute to FRE experience, etc.
4783
+ */
4784
+ persona: Persona.Faculty | Persona.Student;
4785
+ }
4786
+ /**
4787
+ * @hidden
4788
+ *
4789
+ * @beta
4790
+ */
4791
+ export interface UserClassificationWithOtherType {
4792
+ persona: Persona.Other;
4793
+ }
4794
+ /**
4795
+ * @hidden
4796
+ *
4797
+ * @beta
4798
+ */
4799
+ export type UserClassification = UserClassificationWithEduType | UserClassificationWithOtherType;
4800
+ /**
4801
+ * @hidden
4802
+ *
4803
+ * @beta
4804
+ */
4805
+ export enum Cohort {
4806
+ BCAIS = "bcais",
4807
+ BCWAF = "bcwaf",
4808
+ BCWBF = "bcwbf"
4809
+ }
4810
+ /**
4811
+ * @hidden
4812
+ *
4813
+ * @beta
4814
+ */
4815
+ export enum Persona {
4816
+ /**
4817
+ * User has a faculty license
4818
+ */
4819
+ Faculty = "faculty",
4820
+ /**
4821
+ * User has a student license
4822
+ */
4823
+ Student = "student",
4824
+ /**
4825
+ * When user is not a faculty or student
4826
+ */
4827
+ Other = "other"
4828
+ }
4829
+ /**
4830
+ * @hidden
4831
+ *
4832
+ * @beta
4833
+ */
4834
+ export enum LegalAgeGroupClassification {
4835
+ /**
4836
+ * The user is considered an adult based on the age-related regulations of their country or region.
4837
+ */
4838
+ Adult = "adult",
4839
+ /**
4840
+ * The user is a minor but is from a country or region that has no age-related regulations.
4841
+ */
4842
+ MinorNoParentalConsentRequired = "minorNoParentalConsentRequired",
4843
+ /**
4844
+ * Reserved for future use
4845
+ */
4846
+ MinorWithoutParentalConsent = "minorWithoutParentalConsent",
4847
+ /**
4848
+ * The user is considered a minor based on the age-related regulations of their country or region, and the administrator
4849
+ * of the account obtained appropriate consent from a parent or guardian.
4850
+ */
4851
+ MinorWithParentalConsent = "minorWithParentalConsent",
4852
+ /**
4853
+ * The user is from a country or region that has additional age-related regulations, such as the United States,
4854
+ * United Kingdom, European Union, or South Korea, and the user's age is between a minor and an adult age
4855
+ * (as stipulated based on country or region). Generally, this means that teenagers are considered as notAdult in regulated countries.
4856
+ */
4857
+ NonAdult = "nonAdult"
4858
+ }
4859
+ /**
4860
+ * @hidden
4861
+ *
4862
+ * @beta
4863
+ */
4864
+ export enum EduType {
4865
+ /**
4866
+ * User is from a tenant labeled as “HigherEd”
4867
+ */
4868
+ HigherEducation = "higherEducation",
4869
+ /**
4870
+ * User is from a tenant labeled as “K12”
4871
+ */
4872
+ K12 = "k12",
4873
+ /**
4874
+ * User is from a tenant labeled as “Others” (e.g. research institutions)
4875
+ */
4876
+ Other = "other"
4877
+ }
4514
4878
  /**
4515
4879
  * Currently supported Mime type
4516
4880
  */
@@ -5131,6 +5495,30 @@ export namespace app {
5131
5495
  }
5132
5496
  }
5133
5497
 
5498
+ /**
5499
+ * A strongly-typed class used to represent a "valid" app id.
5500
+ *
5501
+ * Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema:
5502
+ * https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id
5503
+ * However, there are some older internal/hard-coded apps which violate this schema and use names like
5504
+ * com.microsoft.teamspace.tab.youtube. For compatibility with these legacy apps, we unfortunately cannot
5505
+ * securely and completely validate app ids as UUIDs. Based on this, the validation is limited to checking
5506
+ * for script tags, length, and non-printable characters.
5507
+ */
5508
+ export class AppId {
5509
+ /**
5510
+ * Creates a strongly-typed AppId from a string
5511
+ *
5512
+ * @param appIdAsString An app id represented as a string
5513
+ * @throws Error with a message describing the exact validation violation
5514
+ */
5515
+ constructor(appIdAsString: string);
5516
+ /**
5517
+ * Returns the app id as a string
5518
+ */
5519
+ toString(): string;
5520
+ }
5521
+
5134
5522
  export namespace appInstallDialog {
5135
5523
  /** Represents set of parameters needed to open the appInstallDialog. */
5136
5524
  interface OpenAppInstallDialogParams {
@@ -5724,6 +6112,9 @@ export function getAdaptiveCardSchemaVersion(): AdaptiveCardVersion | undefined;
5724
6112
  export function navigateCrossDomainHelper(apiVersionTag: string, url: string): Promise<void>;
5725
6113
  export function backStackNavigateBackHelper(apiVersionTag: string): Promise<void>;
5726
6114
  export function tabsNavigateToTabHelper(apiVersionTag: string, tabInstance: TabInstance): Promise<void>;
6115
+ /**
6116
+ * @hidden
6117
+ */
5727
6118
  export function returnFocusHelper(apiVersionTag: string, navigateForward?: boolean): void;
5728
6119
  export function getTabInstancesHelper(apiVersionTag: string, tabInstanceParameters?: TabInstanceParameters): Promise<TabInformation>;
5729
6120
  export function getMruTabInstancesHelper(apiVersionTag: string, tabInstanceParameters?: TabInstanceParameters): Promise<TabInformation>;
@@ -5747,6 +6138,51 @@ export namespace pages {
5747
6138
  /** Remove event function */
5748
6139
  type removeEventType = (evt: pages.config.RemoveEvent) => void;
5749
6140
  /**
6141
+ * @hidden
6142
+ * List of enter focus action items
6143
+ *
6144
+ * @internal
6145
+ * Limited to Microsoft-internal use
6146
+ */
6147
+ enum EnterFocusType {
6148
+ /**
6149
+ * Determines the previous direction to focus in app when hot keys entered.
6150
+ */
6151
+ PreviousLandmark = 0,
6152
+ /**
6153
+ * Determines the next direction to focus in app when hot keys entered.
6154
+ */
6155
+ NextLandmark = 1,
6156
+ /**
6157
+ * Determines if the focus should go to the particular content of the app.
6158
+ * Read - Focus should go to the content of the app.
6159
+ */
6160
+ Read = 2,
6161
+ /**
6162
+ * Determines if the focus should go to the particular content of the app.
6163
+ * Compose - Focus should go to the compose area (such as textbox) of the app.
6164
+ */
6165
+ Compose = 3
6166
+ }
6167
+ /**
6168
+ * Return focus action items
6169
+ */
6170
+ enum ReturnFocusType {
6171
+ /**
6172
+ * Determines the direction to focus in host for previous landmark.
6173
+ */
6174
+ PreviousLandmark = 0,
6175
+ /**
6176
+ * Determines the direction to focus in host for next landmark.
6177
+ */
6178
+ NextLandmark = 1,
6179
+ /**
6180
+ * Determines if the focus should go to the host's activity feed
6181
+ */
6182
+ GoToActivityFeed = 2
6183
+ }
6184
+ /**
6185
+ * @deprecated
5750
6186
  * Return focus to the host. Will move focus forward or backward based on where the application container falls in
5751
6187
  * the F6/tab order in the host.
5752
6188
  * On mobile hosts or hosts where there is no keyboard interaction or UI notion of "focus" this function has no
@@ -5754,6 +6190,14 @@ export namespace pages {
5754
6190
  * @param navigateForward - Determines the direction to focus in host.
5755
6191
  */
5756
6192
  function returnFocus(navigateForward?: boolean): void;
6193
+ /**
6194
+ * Return focus to the host. Will attempt to send focus to the appropriate part of the host (as specified by returnFocusType) based on where the application container falls in
6195
+ * the F6/tab order in the host.
6196
+ * On mobile hosts or hosts where there is no keyboard interaction or UI notion of "focus" this function has no
6197
+ * effect and will be a no-op when called.
6198
+ * @param returnFocusType - Determines the type of focus to return to in the host.
6199
+ */
6200
+ function returnFocus(returnFocusType: pages.ReturnFocusType): void;
5757
6201
  /**
5758
6202
  * @hidden
5759
6203
  *
@@ -5766,7 +6210,7 @@ export namespace pages {
5766
6210
  * @internal
5767
6211
  * Limited to Microsoft-internal use
5768
6212
  */
5769
- function registerFocusEnterHandler(handler: (navigateForward: boolean) => void): void;
6213
+ function registerFocusEnterHandler(handler: (navigateForward: boolean, enterFocusType?: EnterFocusType) => void): void;
5770
6214
  /**
5771
6215
  * Sets/Updates the current frame with new information
5772
6216
  *
@@ -8807,6 +9251,10 @@ export namespace stageView {
8807
9251
  * The chat or channel ID.
8808
9252
  */
8809
9253
  threadId: string;
9254
+ /**
9255
+ * The messageId identifies a particular channel meeting within the channel as specified by the threadId above. This should be used only when trying to open the stage view for a channel meeting. It will be a no-op for other scenarios
9256
+ */
9257
+ messageId?: string;
8810
9258
  /**
8811
9259
  * The title to give the stage view.
8812
9260
  */
@@ -9111,6 +9559,7 @@ export namespace webStorage {
9111
9559
  */
9112
9560
  function isSupported(): boolean;
9113
9561
  }
9562
+ export function clearWebStorageCachedHostNameForTests(): void;
9114
9563
 
9115
9564
  /**
9116
9565
  * Used to interact with call functionality, including starting calls with other users.
@@ -9319,13 +9768,18 @@ export namespace thirdPartyCloudStorage {
9319
9768
  * @beta
9320
9769
  */
9321
9770
  interface DragAndDropFileCallback {
9322
- /** Callback from third party app */
9771
+ /**
9772
+ * Definition of the callback which is received from third party app when calling {@link thirdPartyCloudStorage.getDragAndDropFiles}
9773
+ * An array of drag and dropped files {@link thirdPartyCloudStorage.FilesFor3PStorage}
9774
+ * Error encountered during the API call {@link SdkError}
9775
+ */
9323
9776
  (files: FilesFor3PStorage[], error?: SdkError): void;
9324
9777
  }
9325
9778
  /**
9326
9779
  * Get drag-and-drop files using a callback.
9327
9780
  *
9328
- * @param {string} dragAndDropInput - Teams thread id or Teams conversation id from a Teams chat/channel
9781
+ * @param {string} dragAndDropInput - unique id which is a combination of replyToId + threadId of teams chat and channel.
9782
+ * Both replyToId and threadId can be fetched from application context.
9329
9783
  * @param {DragAndDropFileCallback} dragAndDropFileCallback - callback
9330
9784
  * A callback function to handle the result of the operation
9331
9785
  * @beta