@microsoft/teams-js 2.4.0-beta.1 → 2.4.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/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://
|
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://
|
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
|
|
@@ -24,7 +24,7 @@ To install the stable [version](https://docs.microsoft.com/javascript/api/overvi
|
|
24
24
|
|
25
25
|
### Production
|
26
26
|
|
27
|
-
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.
|
27
|
+
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.4.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 SDK 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.
|
49
|
-
integrity="sha384-
|
48
|
+
src="https://res.cdn.office.net/teams-js/2.4.0/js/MicrosoftTeams.min.js"
|
49
|
+
integrity="sha384-j7W8hHXQwShVeahI0Wmo/IDzHAYFCfOT6I/FEc9GzfriHk0ebQogvOx6bId6o9pL"
|
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.
|
54
|
+
<script src="node_modules/@microsoft/teams-js@2.4.0/dist/MicrosoftTeams.min.js"></script>
|
55
55
|
|
56
56
|
<!-- Microsoft Teams JavaScript API (via local) -->
|
57
57
|
<script src="MicrosoftTeams.min.js"></script>
|
package/dist/MicrosoftTeams.d.ts
CHANGED
@@ -2793,7 +2793,7 @@ export interface ActionInfo {
|
|
2793
2793
|
*
|
2794
2794
|
* @remarks
|
2795
2795
|
* For more details about the updated {@link app.Context} interface, visit the
|
2796
|
-
* [Teams JavaScript client SDK](https://
|
2796
|
+
* [Teams JavaScript client SDK](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/using-teams-client-sdk#updates-to-the-context-interface)
|
2797
2797
|
* overview article.
|
2798
2798
|
*
|
2799
2799
|
* Represents the structure of the received context message.
|
@@ -3863,8 +3863,7 @@ export namespace app {
|
|
3863
3863
|
* Initializes the library.
|
3864
3864
|
*
|
3865
3865
|
* @remarks
|
3866
|
-
*
|
3867
|
-
* 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
|
3868
3867
|
*
|
3869
3868
|
* @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
|
3870
3869
|
* https: protocol otherwise they will be ignored. Example: https:www.example.com
|
@@ -4114,7 +4113,7 @@ export namespace dialog {
|
|
4114
4113
|
* Submit the dialog module and close the dialog
|
4115
4114
|
*
|
4116
4115
|
* @param result - The result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
|
4117
|
-
* @param appIds -
|
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.
|
4118
4117
|
*/
|
4119
4118
|
function submit(result?: string | object, appIds?: string | string[]): void;
|
4120
4119
|
/**
|
@@ -4686,6 +4685,53 @@ export namespace pages {
|
|
4686
4685
|
*/
|
4687
4686
|
function isSupported(): boolean;
|
4688
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
|
+
}
|
4689
4735
|
}
|
4690
4736
|
|
4691
4737
|
export interface IAppWindow {
|
@@ -5976,7 +6022,7 @@ export namespace profile {
|
|
5976
6022
|
*
|
5977
6023
|
* This id is guaranteed to be unique for an object within a tenant,
|
5978
6024
|
* and so if provided will lead to a more performant lookup. It can
|
5979
|
-
* be resolved via MS Graph (see https://
|
6025
|
+
* be resolved via MS Graph (see https://learn.microsoft.com/graph/api/resources/users
|
5980
6026
|
* for examples).
|
5981
6027
|
*/
|
5982
6028
|
readonly AadObjectId?: string;
|
@@ -6843,7 +6889,7 @@ export namespace tasks {
|
|
6843
6889
|
* Submit the task module.
|
6844
6890
|
*
|
6845
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
|
6846
|
-
* @param appIds -
|
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.
|
6847
6893
|
*/
|
6848
6894
|
function submitTask(result?: string | object, appIds?: string | string[]): void;
|
6849
6895
|
/**
|
package/dist/MicrosoftTeams.js
CHANGED
@@ -909,7 +909,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
909
909
|
});
|
910
910
|
|
911
911
|
;// CONCATENATED MODULE: ./src/public/version.ts
|
912
|
-
var version = "2.4.0
|
912
|
+
var version = "2.4.0";
|
913
913
|
|
914
914
|
;// CONCATENATED MODULE: ./src/internal/globalVars.ts
|
915
915
|
var GlobalVars = /** @class */ (function () {
|
@@ -2241,10 +2241,11 @@ var runtime = {
|
|
2241
2241
|
notifications: undefined,
|
2242
2242
|
pages: {
|
2243
2243
|
appButton: undefined,
|
2244
|
-
tabs: undefined,
|
2245
|
-
config: undefined,
|
2246
2244
|
backStack: undefined,
|
2245
|
+
config: undefined,
|
2246
|
+
currentApp: undefined,
|
2247
2247
|
fullTrust: undefined,
|
2248
|
+
tabs: undefined,
|
2248
2249
|
},
|
2249
2250
|
people: undefined,
|
2250
2251
|
permissions: undefined,
|
@@ -2483,7 +2484,7 @@ var dialog;
|
|
2483
2484
|
* Submit the dialog module and close the dialog
|
2484
2485
|
*
|
2485
2486
|
* @param result - The result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
|
2486
|
-
* @param appIds -
|
2487
|
+
* @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.
|
2487
2488
|
*/
|
2488
2489
|
function submit(result, appIds) {
|
2489
2490
|
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.task, FrameContexts.meetingStage);
|
@@ -3033,8 +3034,7 @@ var app_app;
|
|
3033
3034
|
* Initializes the library.
|
3034
3035
|
*
|
3035
3036
|
* @remarks
|
3036
|
-
*
|
3037
|
-
* but after the frame is loaded successfully.
|
3037
|
+
* Initialize must have completed successfully (as determined by the resolved Promise) before any other library calls are made
|
3038
3038
|
*
|
3039
3039
|
* @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
|
3040
3040
|
* https: protocol otherwise they will be ignored. Example: https:www.example.com
|
@@ -3862,7 +3862,13 @@ var pages;
|
|
3862
3862
|
backStack.registerBackButtonHandlerHelper = registerBackButtonHandlerHelper;
|
3863
3863
|
function handleBackButtonPress() {
|
3864
3864
|
if (!backButtonPressHandler || !backButtonPressHandler()) {
|
3865
|
-
|
3865
|
+
if (Communication.childWindow) {
|
3866
|
+
// If the current window did not handle it let the child window
|
3867
|
+
sendMessageEventToChild('backButtonPress', []);
|
3868
|
+
}
|
3869
|
+
else {
|
3870
|
+
navigateBack();
|
3871
|
+
}
|
3866
3872
|
}
|
3867
3873
|
}
|
3868
3874
|
/**
|
@@ -3978,6 +3984,58 @@ var pages;
|
|
3978
3984
|
}
|
3979
3985
|
appButton.isSupported = isSupported;
|
3980
3986
|
})(appButton = pages.appButton || (pages.appButton = {}));
|
3987
|
+
/**
|
3988
|
+
* Provides functions for navigating without needing to specify your application ID.
|
3989
|
+
*
|
3990
|
+
* @beta
|
3991
|
+
*/
|
3992
|
+
var currentApp;
|
3993
|
+
(function (currentApp) {
|
3994
|
+
/**
|
3995
|
+
* Navigate within the currently running application with page ID, and sub-page ID (for navigating to
|
3996
|
+
* specific content within the page).
|
3997
|
+
* @param params - Parameters for the navigation
|
3998
|
+
* @returns a promise that will resolve if the navigation was successful
|
3999
|
+
*
|
4000
|
+
* @beta
|
4001
|
+
*/
|
4002
|
+
function navigateTo(params) {
|
4003
|
+
return new Promise(function (resolve) {
|
4004
|
+
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
4005
|
+
if (!isSupported()) {
|
4006
|
+
throw errorNotSupportedOnPlatform;
|
4007
|
+
}
|
4008
|
+
resolve(sendAndHandleSdkError('pages.currentApp.navigateTo', params));
|
4009
|
+
});
|
4010
|
+
}
|
4011
|
+
currentApp.navigateTo = navigateTo;
|
4012
|
+
/**
|
4013
|
+
* Navigate to the currently running application's first static page defined in the application
|
4014
|
+
* manifest.
|
4015
|
+
* @beta
|
4016
|
+
*/
|
4017
|
+
function navigateToDefaultPage() {
|
4018
|
+
return new Promise(function (resolve) {
|
4019
|
+
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
4020
|
+
if (!isSupported()) {
|
4021
|
+
throw errorNotSupportedOnPlatform;
|
4022
|
+
}
|
4023
|
+
resolve(sendAndHandleSdkError('pages.currentApp.navigateToDefaultPage'));
|
4024
|
+
});
|
4025
|
+
}
|
4026
|
+
currentApp.navigateToDefaultPage = navigateToDefaultPage;
|
4027
|
+
/**
|
4028
|
+
* Checks if pages.currentApp capability is supported by the host
|
4029
|
+
* @returns true if the pages.currentApp capability is enabled in runtime.supports.pages.currentApp and
|
4030
|
+
* false if it is disabled
|
4031
|
+
*
|
4032
|
+
* @beta
|
4033
|
+
*/
|
4034
|
+
function isSupported() {
|
4035
|
+
return runtime.supports.pages ? (runtime.supports.pages.currentApp ? true : false) : false;
|
4036
|
+
}
|
4037
|
+
currentApp.isSupported = isSupported;
|
4038
|
+
})(currentApp = pages.currentApp || (pages.currentApp = {}));
|
3981
4039
|
})(pages || (pages = {}));
|
3982
4040
|
|
3983
4041
|
;// CONCATENATED MODULE: ./src/internal/handlers.ts
|
@@ -4029,6 +4087,10 @@ function callHandler(name, args) {
|
|
4029
4087
|
var result = handler.apply(this, args);
|
4030
4088
|
return [true, result];
|
4031
4089
|
}
|
4090
|
+
else if (Communication.childWindow) {
|
4091
|
+
sendMessageEventToChild(name, [args]);
|
4092
|
+
return [false, undefined];
|
4093
|
+
}
|
4032
4094
|
else {
|
4033
4095
|
callHandlerLogger('Handler for action message %s not found.', name);
|
4034
4096
|
return [false, undefined];
|
@@ -4139,7 +4201,12 @@ function handleBeforeUnload() {
|
|
4139
4201
|
sendMessageToParent('readyToUnload', []);
|
4140
4202
|
};
|
4141
4203
|
if (!HandlersPrivate.beforeUnloadHandler || !HandlersPrivate.beforeUnloadHandler(readyToUnload)) {
|
4142
|
-
|
4204
|
+
if (Communication.childWindow) {
|
4205
|
+
sendMessageEventToChild('beforeUnload');
|
4206
|
+
}
|
4207
|
+
else {
|
4208
|
+
readyToUnload();
|
4209
|
+
}
|
4143
4210
|
}
|
4144
4211
|
}
|
4145
4212
|
|
@@ -7981,7 +8048,7 @@ var tasks;
|
|
7981
8048
|
* Submit the task module.
|
7982
8049
|
*
|
7983
8050
|
* @param result - Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
|
7984
|
-
* @param appIds -
|
8051
|
+
* @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.
|
7985
8052
|
*/
|
7986
8053
|
function submitTask(result, appIds) {
|
7987
8054
|
dialog.submit(result, appIds);
|