Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/teams-js

Package Overview
Dependencies
Maintainers
3
Versions
499
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/teams-js - npm Package Compare versions

Comparing version 1.4.0-beta.4.0 to 1.4.0-beta.5

dts/MicrosoftTeams.interface.d.ts

2125

dist/MicrosoftTeams.js

@@ -5,7 +5,7 @@ (function webpackUniversalModuleDefinition(root, factory) {

else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
define("microsoftTeams", [], factory);
else if(typeof exports === 'object')
exports["microsoftTeams"] = factory();
else
root["microsoftTeams"] = factory();
})(window, function() {

@@ -104,5 +104,7 @@ return /******/ (function(modules) { // webpackBootstrap

function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
var MicrosoftTeams_1 = __webpack_require__(1);
exports.microsoftTeams = MicrosoftTeams_1.microsoftTeams;
__export(__webpack_require__(1));

@@ -122,474 +124,676 @@

}
var version = "1.3.6";
var validOrigins = [
"https://teams.microsoft.com",
"https://teams.microsoft.us",
"https://int.teams.microsoft.com",
"https://devspaces.skype.com",
"https://ssauth.skype.com",
"http://dev.local",
"https://msft.spoppe.com",
"https://*.sharepoint.com",
"https://*.sharepoint-df.com",
"https://*.sharepointonline.com",
"https://outlook.office.com",
"https://outlook-sdf.office.com"
];
// This will return a reg expression a given url
function generateRegExpFromUrl(url) {
var urlRegExpPart = "^";
var urlParts = url.split(".");
for (var j = 0; j < urlParts.length; j++) {
urlRegExpPart += (j > 0 ? "[.]" : "") + urlParts[j].replace("*", "[^/^.]+");
}
urlRegExpPart += "$";
return urlRegExpPart;
}
// This will return a reg expression for list of url
function generateRegExpFromUrls(urls) {
var urlRegExp = "";
for (var i = 0; i < urls.length; i++) {
urlRegExp += (i === 0 ? "" : "|") + generateRegExpFromUrl(urls[i]);
}
return new RegExp(urlRegExp);
}
var validOriginRegExp = generateRegExpFromUrls(validOrigins);
var handlers = {};
// Ensure these declarations stay in sync with the framework.
var frameContexts = {
settings: "settings",
content: "content",
authentication: "authentication",
remove: "remove",
task: "task"
};
/**
* This is the root namespace for the JavaScript SDK.
* Namespace to interact with the menu-specific part of the SDK.
* This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
*
* @private
* Hide from docs until feature is complete
*/
var microsoftTeams;
(function (microsoftTeams) {
"use strict";
var version = "1.3.6";
var validOrigins = [
"https://teams.microsoft.com",
"https://teams.microsoft.us",
"https://int.teams.microsoft.com",
"https://devspaces.skype.com",
"https://ssauth.skype.com",
"http://dev.local",
"https://msft.spoppe.com",
"https://*.sharepoint.com",
"https://*.sharepoint-df.com",
"https://*.sharepointonline.com",
"https://outlook.office.com",
"https://outlook-sdf.office.com"
];
// This will return a reg expression a given url
function generateRegExpFromUrl(url) {
var urlRegExpPart = "^";
var urlParts = url.split(".");
for (var j = 0; j < urlParts.length; j++) {
urlRegExpPart +=
(j > 0 ? "[.]" : "") + urlParts[j].replace("*", "[^/^.]+");
}
urlRegExpPart += "$";
return urlRegExpPart;
}
// This will return a reg expression for list of url
function generateRegExpFromUrls(urls) {
var urlRegExp = "";
for (var i = 0; i < urls.length; i++) {
urlRegExp += (i === 0 ? "" : "|") + generateRegExpFromUrl(urls[i]);
}
return new RegExp(urlRegExp);
}
var validOriginRegExp = generateRegExpFromUrls(validOrigins);
var handlers = {};
// Ensure these declarations stay in sync with the framework.
var frameContexts = {
settings: "settings",
content: "content",
authentication: "authentication",
remove: "remove",
task: "task"
};
var menus;
(function (menus) {
/**
* Namespace to interact with the menu-specific part of the SDK.
* This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
*
* @private
* Hide from docs until feature is complete
* Represents information about menu item for Action Menu and Navigation Bar Menu.
*/
var menus;
(function (menus) {
/**
* Represents information about menu item for Action Menu and Navigation Bar Menu.
*/
var MenuItem = /** @class */ (function () {
function MenuItem() {
/**
* State of the menu item
*/
this.enabled = true;
}
return MenuItem;
}());
menus.MenuItem = MenuItem;
/**
* Represents information about type of list to display in Navigation Bar Menu.
*/
var MenuListType;
(function (MenuListType) {
MenuListType["dropDown"] = "dropDown";
MenuListType["popOver"] = "popOver";
})(MenuListType = menus.MenuListType || (menus.MenuListType = {}));
var navBarMenuItemPressHandler;
handlers["navBarMenuItemPress"] = handleNavBarMenuItemPress;
var actionMenuItemPressHandler;
handlers["actionMenuItemPress"] = handleActionMenuItemPress;
var viewConfigItemPressHandler;
handlers["setModuleView"] = handleViewConfigItemPress;
/**
* Registers list of view configurations and it's handler.
* Handler is responsible for listening selection of View Configuration.
* @param viewConfig List of view configurations. Minimum 1 value is required.
* @param handler The handler to invoke when the user selects view configuration.
*/
function setUpViews(viewConfig, handler) {
ensureInitialized();
viewConfigItemPressHandler = handler;
sendMessageRequest(parentWindow, "setUpViews", [viewConfig]);
var MenuItem = /** @class */ (function () {
function MenuItem() {
/**
* State of the menu item
*/
this.enabled = true;
}
menus.setUpViews = setUpViews;
function handleViewConfigItemPress(id) {
if (!viewConfigItemPressHandler || !viewConfigItemPressHandler(id)) {
ensureInitialized();
sendMessageRequest(parentWindow, "viewConfigItemPress", [id]);
}
}
/**
* Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
* @param items List of MenuItems for Navigation Bar Menu.
* @param handler The handler to invoke when the user selects menu item.
*/
function setNavBarMenu(items, handler) {
ensureInitialized();
navBarMenuItemPressHandler = handler;
sendMessageRequest(parentWindow, "setNavBarMenu", [items]);
}
menus.setNavBarMenu = setNavBarMenu;
function handleNavBarMenuItemPress(id) {
if (!navBarMenuItemPressHandler || !navBarMenuItemPressHandler(id)) {
ensureInitialized();
sendMessageRequest(parentWindow, "handleNavBarMenuItemPress", [id]);
}
}
/**
* Used to show Action Menu.
* @param params Parameters for Menu Parameters
* @param handler The handler to invoke when the user selects menu item.
*/
function showActionMenu(params, handler) {
ensureInitialized();
actionMenuItemPressHandler = handler;
sendMessageRequest(parentWindow, "showActionMenu", [params]);
}
menus.showActionMenu = showActionMenu;
function handleActionMenuItemPress(id) {
if (!actionMenuItemPressHandler || !actionMenuItemPressHandler(id)) {
ensureInitialized();
sendMessageRequest(parentWindow, "handleActionMenuItemPress", [id]);
}
}
})(menus = microsoftTeams.menus || (microsoftTeams.menus = {}));
// This indicates whether initialize was called (started).
// It does not indicate whether initialization is complete. That can be inferred by whether parentOrigin is set.
var initializeCalled = false;
var isFramelessWindow = false;
var currentWindow;
var parentWindow;
var parentOrigin;
var parentMessageQueue = [];
var childWindow;
var childOrigin;
var childMessageQueue = [];
var nextMessageId = 0;
var callbacks = {};
var frameContext;
var hostClientType;
var printCapabilityEnabled = false;
var themeChangeHandler;
handlers["themeChange"] = handleThemeChange;
var fullScreenChangeHandler;
handlers["fullScreenChange"] = handleFullScreenChange;
var backButtonPressHandler;
handlers["backButtonPress"] = handleBackButtonPress;
return MenuItem;
}());
menus.MenuItem = MenuItem;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
* Represents information about type of list to display in Navigation Bar Menu.
*/
function initialize(hostWindow) {
if (hostWindow === void 0) { hostWindow = window; }
if (initializeCalled) {
// Independent components might not know whether the SDK is initialized so might call it to be safe.
// Just no-op if that happens to make it easier to use.
return;
}
initializeCalled = true;
// Undocumented field used to mock the window for unit tests
currentWindow = hostWindow;
// Listen for messages post to our window
var messageListener = function (evt) { return processMessage(evt); };
// If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,
// it's the window that opened us (i.e., window.opener)
parentWindow =
currentWindow.parent !== currentWindow.self
? currentWindow.parent
: currentWindow.opener;
if (!parentWindow) {
isFramelessWindow = true;
window.onNativeMessage = handleParentMessage;
}
else {
// For iFrame scenario, add listener to listen 'message'
currentWindow.addEventListener("message", messageListener, false);
}
try {
// Send the initialized message to any origin, because at this point we most likely don't know the origin
// of the parent window, and this message contains no data that could pose a security risk.
parentOrigin = "*";
var messageId = sendMessageRequest(parentWindow, "initialize", [version]);
callbacks[messageId] = function (context, clientType) {
frameContext = context;
hostClientType = clientType;
};
}
finally {
parentOrigin = null;
}
// Undocumented function used to clear state between unit tests
this._uninitialize = function () {
if (frameContext) {
registerOnThemeChangeHandler(null);
registerFullScreenHandler(null);
registerBackButtonHandler(null);
}
if (frameContext === frameContexts.settings) {
settings.registerOnSaveHandler(null);
}
if (frameContext === frameContexts.remove) {
settings.registerOnRemoveHandler(null);
}
if (!isFramelessWindow) {
currentWindow.removeEventListener("message", messageListener, false);
}
initializeCalled = false;
parentWindow = null;
parentOrigin = null;
parentMessageQueue = [];
childWindow = null;
childOrigin = null;
childMessageQueue = [];
nextMessageId = 0;
callbacks = {};
frameContext = null;
hostClientType = null;
isFramelessWindow = false;
};
}
microsoftTeams.initialize = initialize;
var MenuListType;
(function (MenuListType) {
MenuListType["dropDown"] = "dropDown";
MenuListType["popOver"] = "popOver";
})(MenuListType = menus.MenuListType || (menus.MenuListType = {}));
var navBarMenuItemPressHandler;
handlers["navBarMenuItemPress"] = handleNavBarMenuItemPress;
var actionMenuItemPressHandler;
handlers["actionMenuItemPress"] = handleActionMenuItemPress;
var viewConfigItemPressHandler;
handlers["setModuleView"] = handleViewConfigItemPress;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
* Registers list of view configurations and it's handler.
* Handler is responsible for listening selection of View Configuration.
* @param viewConfig List of view configurations. Minimum 1 value is required.
* @param handler The handler to invoke when the user selects view configuration.
*/
function _uninitialize() { }
microsoftTeams._uninitialize = _uninitialize;
/**
* Enable print capability to support printing page using Ctrl+P and cmd+P
*/
function enablePrintCapability() {
if (!printCapabilityEnabled) {
printCapabilityEnabled = true;
function setUpViews(viewConfig, handler) {
ensureInitialized();
viewConfigItemPressHandler = handler;
sendMessageRequest(parentWindow, "setUpViews", [viewConfig]);
}
menus.setUpViews = setUpViews;
function handleViewConfigItemPress(id) {
if (!viewConfigItemPressHandler || !viewConfigItemPressHandler(id)) {
ensureInitialized();
// adding ctrl+P and cmd+P handler
document.addEventListener("keydown", function (event) {
if ((event.ctrlKey || event.metaKey) && event.keyCode === 80) {
microsoftTeams.print();
event.cancelBubble = true;
event.preventDefault();
event.stopImmediatePropagation();
}
});
sendMessageRequest(parentWindow, "viewConfigItemPress", [id]);
}
}
microsoftTeams.enablePrintCapability = enablePrintCapability;
/**
* default print handler
* Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
* @param items List of MenuItems for Navigation Bar Menu.
* @param handler The handler to invoke when the user selects menu item.
*/
function print() {
window.print();
}
microsoftTeams.print = print;
/**
* Retrieves the current context the frame is running in.
* @param callback The callback to invoke when the {@link Context} object is retrieved.
*/
function getContext(callback) {
function setNavBarMenu(items, handler) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getContext");
callbacks[messageId] = callback;
navBarMenuItemPressHandler = handler;
sendMessageRequest(parentWindow, "setNavBarMenu", [items]);
}
microsoftTeams.getContext = getContext;
/**
* Registers a handler for theme changes.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user changes their theme.
*/
function registerOnThemeChangeHandler(handler) {
ensureInitialized();
themeChangeHandler = handler;
}
microsoftTeams.registerOnThemeChangeHandler = registerOnThemeChangeHandler;
function handleThemeChange(theme) {
if (themeChangeHandler) {
themeChangeHandler(theme);
menus.setNavBarMenu = setNavBarMenu;
function handleNavBarMenuItemPress(id) {
if (!navBarMenuItemPressHandler || !navBarMenuItemPressHandler(id)) {
ensureInitialized();
sendMessageRequest(parentWindow, "handleNavBarMenuItemPress", [id]);
}
if (childWindow) {
sendMessageRequest(childWindow, "themeChange", [theme]);
}
}
/**
* Registers a handler for changes from or to full-screen view for a tab.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user toggles full-screen view for a tab.
* Used to show Action Menu.
* @param params Parameters for Menu Parameters
* @param handler The handler to invoke when the user selects menu item.
*/
function registerFullScreenHandler(handler) {
function showActionMenu(params, handler) {
ensureInitialized();
fullScreenChangeHandler = handler;
actionMenuItemPressHandler = handler;
sendMessageRequest(parentWindow, "showActionMenu", [params]);
}
microsoftTeams.registerFullScreenHandler = registerFullScreenHandler;
function handleFullScreenChange(isFullScreen) {
if (fullScreenChangeHandler) {
fullScreenChangeHandler(isFullScreen);
menus.showActionMenu = showActionMenu;
function handleActionMenuItemPress(id) {
if (!actionMenuItemPressHandler || !actionMenuItemPressHandler(id)) {
ensureInitialized();
sendMessageRequest(parentWindow, "handleActionMenuItemPress", [id]);
}
}
/**
* Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
* navigation stack should use this handler to navigate the user back within their frame. If an app finds
* that after running its back button handler it cannot handle the event it should call the navigateBack
* method to ask the Teams client to handle it instead.
* @param handler The handler to invoke when the user presses their Team client's back button.
*/
function registerBackButtonHandler(handler) {
ensureInitialized();
backButtonPressHandler = handler;
})(menus = exports.menus || (exports.menus = {}));
// This indicates whether initialize was called (started).
// It does not indicate whether initialization is complete. That can be inferred by whether parentOrigin is set.
var initializeCalled = false;
var isFramelessWindow = false;
var currentWindow;
var parentWindow;
var parentOrigin;
var parentMessageQueue = [];
var childWindow;
var childOrigin;
var childMessageQueue = [];
var nextMessageId = 0;
var callbacks = {};
var frameContext;
var hostClientType;
var printCapabilityEnabled = false;
var themeChangeHandler;
handlers["themeChange"] = handleThemeChange;
var fullScreenChangeHandler;
handlers["fullScreenChange"] = handleFullScreenChange;
var backButtonPressHandler;
handlers["backButtonPress"] = handleBackButtonPress;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
*/
function initialize(hostWindow) {
if (hostWindow === void 0) { hostWindow = window; }
if (initializeCalled) {
// Independent components might not know whether the SDK is initialized so might call it to be safe.
// Just no-op if that happens to make it easier to use.
return;
}
microsoftTeams.registerBackButtonHandler = registerBackButtonHandler;
function handleBackButtonPress() {
if (!backButtonPressHandler || !backButtonPressHandler()) {
navigateBack();
initializeCalled = true;
// Undocumented field used to mock the window for unit tests
currentWindow = hostWindow;
// Listen for messages post to our window
var messageListener = function (evt) { return processMessage(evt); };
// If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,
// it's the window that opened us (i.e., window.opener)
parentWindow =
currentWindow.parent !== currentWindow.self
? currentWindow.parent
: currentWindow.opener;
if (!parentWindow) {
isFramelessWindow = true;
window.onNativeMessage = handleParentMessage;
}
else {
// For iFrame scenario, add listener to listen 'message'
currentWindow.addEventListener("message", messageListener, false);
}
try {
// Send the initialized message to any origin, because at this point we most likely don't know the origin
// of the parent window, and this message contains no data that could pose a security risk.
parentOrigin = "*";
var messageId = sendMessageRequest(parentWindow, "initialize", [version]);
callbacks[messageId] = function (context, clientType) {
frameContext = context;
hostClientType = clientType;
};
}
finally {
parentOrigin = null;
}
// Undocumented function used to clear state between unit tests
this._uninitialize = function () {
if (frameContext) {
registerOnThemeChangeHandler(null);
registerFullScreenHandler(null);
registerBackButtonHandler(null);
}
}
/**
* Navigates back in the Teams client. See registerBackButtonHandler for more information on when
* it's appropriate to use this method.
*/
function navigateBack() {
if (frameContext === frameContexts.settings) {
settings.registerOnSaveHandler(null);
}
if (frameContext === frameContexts.remove) {
settings.registerOnRemoveHandler(null);
}
if (!isFramelessWindow) {
currentWindow.removeEventListener("message", messageListener, false);
}
initializeCalled = false;
parentWindow = null;
parentOrigin = null;
parentMessageQueue = [];
childWindow = null;
childOrigin = null;
childMessageQueue = [];
nextMessageId = 0;
callbacks = {};
frameContext = null;
hostClientType = null;
isFramelessWindow = false;
};
}
exports.initialize = initialize;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
*/
function _uninitialize() { }
exports._uninitialize = _uninitialize;
/**
* Enable print capability to support printing page using Ctrl+P and cmd+P
*/
function enablePrintCapability() {
if (!printCapabilityEnabled) {
printCapabilityEnabled = true;
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "navigateBack", []);
callbacks[messageId] = function (success) {
if (!success) {
throw new Error("Back navigation is not supported in the current client or context.");
// adding ctrl+P and cmd+P handler
document.addEventListener("keydown", function (event) {
if ((event.ctrlKey || event.metaKey) && event.keyCode === 80) {
print();
event.cancelBubble = true;
event.preventDefault();
event.stopImmediatePropagation();
}
};
});
}
microsoftTeams.navigateBack = navigateBack;
}
exports.enablePrintCapability = enablePrintCapability;
/**
* default print handler
*/
function print() {
window.print();
}
exports.print = print;
/**
* Retrieves the current context the frame is running in.
* @param callback The callback to invoke when the {@link Context} object is retrieved.
*/
function getContext(callback) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getContext");
callbacks[messageId] = callback;
}
exports.getContext = getContext;
/**
* Registers a handler for theme changes.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user changes their theme.
*/
function registerOnThemeChangeHandler(handler) {
ensureInitialized();
themeChangeHandler = handler;
}
exports.registerOnThemeChangeHandler = registerOnThemeChangeHandler;
function handleThemeChange(theme) {
if (themeChangeHandler) {
themeChangeHandler(theme);
}
if (childWindow) {
sendMessageRequest(childWindow, "themeChange", [theme]);
}
}
/**
* Registers a handler for changes from or to full-screen view for a tab.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user toggles full-screen view for a tab.
*/
function registerFullScreenHandler(handler) {
ensureInitialized();
fullScreenChangeHandler = handler;
}
exports.registerFullScreenHandler = registerFullScreenHandler;
function handleFullScreenChange(isFullScreen) {
if (fullScreenChangeHandler) {
fullScreenChangeHandler(isFullScreen);
}
}
/**
* Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
* navigation stack should use this handler to navigate the user back within their frame. If an app finds
* that after running its back button handler it cannot handle the event it should call the navigateBack
* method to ask the Teams client to handle it instead.
* @param handler The handler to invoke when the user presses their Team client's back button.
*/
function registerBackButtonHandler(handler) {
ensureInitialized();
backButtonPressHandler = handler;
}
exports.registerBackButtonHandler = registerBackButtonHandler;
function handleBackButtonPress() {
if (!backButtonPressHandler || !backButtonPressHandler()) {
navigateBack();
}
}
/**
* Navigates back in the Teams client. See registerBackButtonHandler for more information on when
* it's appropriate to use this method.
*/
function navigateBack() {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "navigateBack", []);
callbacks[messageId] = function (success) {
if (!success) {
throw new Error("Back navigation is not supported in the current client or context.");
}
};
}
exports.navigateBack = navigateBack;
/**
* Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
* valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
* thrown. This function needs to be used only when navigating the frame to a URL in a different domain
* than the current one in a way that keeps the app informed of the change and allows the SDK to
* continue working.
* @param url The URL to navigate the frame to.
*/
function navigateCrossDomain(url) {
ensureInitialized(frameContexts.content, frameContexts.settings, frameContexts.remove, frameContexts.task);
var messageId = sendMessageRequest(parentWindow, "navigateCrossDomain", [
url
]);
callbacks[messageId] = function (success) {
if (!success) {
throw new Error("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.");
}
};
}
exports.navigateCrossDomain = navigateCrossDomain;
/**
* Allows an app to retrieve for this user tabs that are owned by this app.
* If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
* @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
* @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
*/
function getTabInstances(callback, tabInstanceParameters) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getTabInstances", [
tabInstanceParameters
]);
callbacks[messageId] = callback;
}
exports.getTabInstances = getTabInstances;
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all user joined teams
* @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
* @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
*/
function getUserJoinedTeams(callback, teamInstanceParameters) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getUserJoinedTeams", [
teamInstanceParameters
]);
callbacks[messageId] = callback;
}
exports.getUserJoinedTeams = getUserJoinedTeams;
/**
* Allows an app to retrieve the most recently used tabs for this user.
* @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
* @param tabInstanceParameters OPTIONAL Ignored, kept for future use
*/
function getMruTabInstances(callback, tabInstanceParameters) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getMruTabInstances", [
tabInstanceParameters
]);
callbacks[messageId] = callback;
}
exports.getMruTabInstances = getMruTabInstances;
/**
* Shares a deep link that a user can use to navigate back to a specific state in this page.
* @param deepLinkParameters ID and label for the link and fallback URL.
*/
function shareDeepLink(deepLinkParameters) {
ensureInitialized(frameContexts.content);
sendMessageRequest(parentWindow, "shareDeepLink", [
deepLinkParameters.subEntityId,
deepLinkParameters.subEntityLabel,
deepLinkParameters.subEntityWebUrl
]);
}
exports.shareDeepLink = shareDeepLink;
/**
* @private
* Hide from docs.
* ------
* Opens a client-friendly preview of the specified file.
* @param file The file to preview.
*/
function openFilePreview(filePreviewParameters) {
ensureInitialized(frameContexts.content);
var params = [
filePreviewParameters.entityId,
filePreviewParameters.title,
filePreviewParameters.description,
filePreviewParameters.type,
filePreviewParameters.objectUrl,
filePreviewParameters.downloadUrl,
filePreviewParameters.webPreviewUrl,
filePreviewParameters.webEditUrl,
filePreviewParameters.baseUrl,
filePreviewParameters.editFile,
filePreviewParameters.subEntityId
];
sendMessageRequest(parentWindow, "openFilePreview", params);
}
exports.openFilePreview = openFilePreview;
/**
* @private
* Hide from docs.
* ------
* display notification API.
* @param message Notification message.
* @param notificationType Notification type
*/
function showNotification(showNotificationParameters) {
ensureInitialized(frameContexts.content);
var params = [
showNotificationParameters.message,
showNotificationParameters.notificationType
];
sendMessageRequest(parentWindow, "showNotification", params);
}
exports.showNotification = showNotification;
/**
* @private
* Hide from docs.
* ------
* Upload a custom App manifest directly to both team and personal scopes.
* This method works just for the first party Apps.
*/
function uploadCustomApp(manifestBlob) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "uploadCustomApp", [
manifestBlob
]);
callbacks[messageId] = function (success, result) {
if (!success) {
throw new Error(result);
}
};
}
exports.uploadCustomApp = uploadCustomApp;
/**
* Navigates the Microsoft Teams app to the specified tab instance.
* @param tabInstance The tab instance to navigate to.
*/
function navigateToTab(tabInstance) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "navigateToTab", [
tabInstance
]);
callbacks[messageId] = function (success) {
if (!success) {
throw new Error("Invalid internalTabInstanceId and/or channelId were/was provided");
}
};
}
exports.navigateToTab = navigateToTab;
/**
* Namespace to interact with the settings-specific part of the SDK.
* This object is usable only on the settings frame.
*/
var settings;
(function (settings) {
var saveHandler;
var removeHandler;
handlers["settings.save"] = handleSave;
handlers["settings.remove"] = handleRemove;
/**
* Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
* valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
* thrown. This function needs to be used only when navigating the frame to a URL in a different domain
* than the current one in a way that keeps the app informed of the change and allows the SDK to
* continue working.
* @param url The URL to navigate the frame to.
* Sets the validity state for the settings.
* The initial value is false, so the user cannot save the settings until this is called with true.
* @param validityState Indicates whether the save or remove button is enabled for the user.
*/
function navigateCrossDomain(url) {
ensureInitialized(frameContexts.content, frameContexts.settings, frameContexts.remove, frameContexts.task);
var messageId = sendMessageRequest(parentWindow, "navigateCrossDomain", [
url
function setValidityState(validityState) {
ensureInitialized(frameContexts.settings, frameContexts.remove);
sendMessageRequest(parentWindow, "settings.setValidityState", [
validityState
]);
callbacks[messageId] = function (success) {
if (!success) {
throw new Error("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.");
}
};
}
microsoftTeams.navigateCrossDomain = navigateCrossDomain;
settings.setValidityState = setValidityState;
/**
* Allows an app to retrieve for this user tabs that are owned by this app.
* If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
* @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
* @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
* Gets the settings for the current instance.
* @param callback The callback to invoke when the {@link Settings} object is retrieved.
*/
function getTabInstances(callback, tabInstanceParameters) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getTabInstances", [
tabInstanceParameters
]);
function getSettings(callback) {
ensureInitialized(frameContexts.settings, frameContexts.remove);
var messageId = sendMessageRequest(parentWindow, "settings.getSettings");
callbacks[messageId] = callback;
}
microsoftTeams.getTabInstances = getTabInstances;
settings.getSettings = getSettings;
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all user joined teams
* @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
* @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
* Sets the settings for the current instance.
* This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
* @param settings The desired settings for this instance.
*/
function getUserJoinedTeams(callback, teamInstanceParameters) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getUserJoinedTeams", [
teamInstanceParameters
function setSettings(instanceSettings) {
ensureInitialized(frameContexts.settings);
sendMessageRequest(parentWindow, "settings.setSettings", [
instanceSettings
]);
callbacks[messageId] = callback;
}
microsoftTeams.getUserJoinedTeams = getUserJoinedTeams;
settings.setSettings = setSettings;
/**
* Allows an app to retrieve the most recently used tabs for this user.
* @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
* @param tabInstanceParameters OPTIONAL Ignored, kept for future use
* Registers a handler for when the user attempts to save the settings. This handler should be used
* to create or update the underlying resource powering the content.
* The object passed to the handler must be used to notify whether to proceed with the save.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user selects the save button.
*/
function getMruTabInstances(callback, tabInstanceParameters) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getMruTabInstances", [
tabInstanceParameters
]);
callbacks[messageId] = callback;
function registerOnSaveHandler(handler) {
ensureInitialized(frameContexts.settings);
saveHandler = handler;
}
microsoftTeams.getMruTabInstances = getMruTabInstances;
settings.registerOnSaveHandler = registerOnSaveHandler;
/**
* Shares a deep link that a user can use to navigate back to a specific state in this page.
* @param deepLinkParameters ID and label for the link and fallback URL.
* Registers a handler for user attempts to remove content. This handler should be used
* to remove the underlying resource powering the content.
* The object passed to the handler must be used to indicate whether to proceed with the removal.
* Only one handler may be registered at a time. Subsequent registrations will override the first.
* @param handler The handler to invoke when the user selects the remove button.
*/
function shareDeepLink(deepLinkParameters) {
ensureInitialized(frameContexts.content);
sendMessageRequest(parentWindow, "shareDeepLink", [
deepLinkParameters.subEntityId,
deepLinkParameters.subEntityLabel,
deepLinkParameters.subEntityWebUrl
]);
function registerOnRemoveHandler(handler) {
ensureInitialized(frameContexts.remove);
removeHandler = handler;
}
microsoftTeams.shareDeepLink = shareDeepLink;
settings.registerOnRemoveHandler = registerOnRemoveHandler;
function handleSave(result) {
var saveEvent = new SaveEventImpl(result);
if (saveHandler) {
saveHandler(saveEvent);
}
else {
// If no handler is registered, we assume success.
saveEvent.notifySuccess();
}
}
/**
* @private
* Hide from docs.
* ------
* Opens a client-friendly preview of the specified file.
* @param file The file to preview.
* Hide from docs, since this class is not directly used.
*/
function openFilePreview(filePreviewParameters) {
ensureInitialized(frameContexts.content);
var params = [
filePreviewParameters.entityId,
filePreviewParameters.title,
filePreviewParameters.description,
filePreviewParameters.type,
filePreviewParameters.objectUrl,
filePreviewParameters.downloadUrl,
filePreviewParameters.webPreviewUrl,
filePreviewParameters.webEditUrl,
filePreviewParameters.baseUrl,
filePreviewParameters.editFile,
filePreviewParameters.subEntityId
];
sendMessageRequest(parentWindow, "openFilePreview", params);
var SaveEventImpl = /** @class */ (function () {
function SaveEventImpl(result) {
this.notified = false;
this.result = result ? result : {};
}
SaveEventImpl.prototype.notifySuccess = function () {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.save.success");
this.notified = true;
};
SaveEventImpl.prototype.notifyFailure = function (reason) {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.save.failure", [reason]);
this.notified = true;
};
SaveEventImpl.prototype.ensureNotNotified = function () {
if (this.notified) {
throw new Error("The SaveEvent may only notify success or failure once.");
}
};
return SaveEventImpl;
}());
function handleRemove() {
var removeEvent = new RemoveEventImpl();
if (removeHandler) {
removeHandler(removeEvent);
}
else {
// If no handler is registered, we assume success.
removeEvent.notifySuccess();
}
}
microsoftTeams.openFilePreview = openFilePreview;
/**
* @private
* Hide from docs.
* ------
* display notification API.
* @param message Notification message.
* @param notificationType Notification type
* Hide from docs, since this class is not directly used.
*/
function showNotification(showNotificationParameters) {
ensureInitialized(frameContexts.content);
var params = [
showNotificationParameters.message,
showNotificationParameters.notificationType
];
sendMessageRequest(parentWindow, "showNotification", params);
var RemoveEventImpl = /** @class */ (function () {
function RemoveEventImpl() {
this.notified = false;
}
RemoveEventImpl.prototype.notifySuccess = function () {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.remove.success");
this.notified = true;
};
RemoveEventImpl.prototype.notifyFailure = function (reason) {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.remove.failure", [reason]);
this.notified = true;
};
RemoveEventImpl.prototype.ensureNotNotified = function () {
if (this.notified) {
throw new Error("The removeEvent may only notify success or failure once.");
}
};
return RemoveEventImpl;
}());
})(settings = exports.settings || (exports.settings = {}));
/**
* Namespace to interact with the authentication-specific part of the SDK.
* This object is used for starting or completing authentication flows.
*/
var authentication;
(function (authentication) {
var authParams;
var authWindowMonitor;
handlers["authentication.authenticate.success"] = handleSuccess;
handlers["authentication.authenticate.failure"] = handleFailure;
/**
* Registers the authentication handlers
* @param authenticateParameters A set of values that configure the authentication pop-up.
*/
function registerAuthenticationHandlers(authenticateParameters) {
authParams = authenticateParameters;
}
microsoftTeams.showNotification = showNotification;
authentication.registerAuthenticationHandlers = registerAuthenticationHandlers;
/**
* @private
* Hide from docs.
* ------
* execute deep link API.
* @param deepLink deep link.
* Initiates an authentication request, which opens a new window with the specified settings.
*/
function executeDeepLink(deepLinkParameters) {
ensureInitialized(frameContexts.content);
var params = [deepLinkParameters.deepLink];
sendMessageRequest(parentWindow, "handleDeepLink", params);
function authenticate(authenticateParameters) {
var authenticateParams = authenticateParameters !== undefined
? authenticateParameters
: authParams;
ensureInitialized(frameContexts.content, frameContexts.settings, frameContexts.remove, frameContexts.task);
if (hostClientType === "desktop" /* desktop */) {
// Convert any relative URLs into absolute URLs before sending them over to the parent window.
var link = document.createElement("a");
link.href = authenticateParams.url;
// Ask the parent window to open an authentication window with the parameters provided by the caller.
var messageId = sendMessageRequest(parentWindow, "authentication.authenticate", [link.href, authenticateParams.width, authenticateParams.height]);
callbacks[messageId] = function (success, response) {
if (success) {
authenticateParams.successCallback(response);
}
else {
authenticateParams.failureCallback(response);
}
};
}
else {
// Open an authentication window with the parameters provided by the caller.
openAuthenticationWindow(authenticateParams);
}
}
microsoftTeams.executeDeepLink = executeDeepLink;
authentication.authenticate = authenticate;
/**

@@ -599,718 +803,495 @@ * @private

* ------
* Upload a custom App manifest directly to both team and personal scopes.
* This method works just for the first party Apps.
* Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
* if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
* @param authTokenRequest A set of values that configure the token request.
*/
function uploadCustomApp(manifestBlob) {
function getAuthToken(authTokenRequest) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "uploadCustomApp", [
manifestBlob
]);
var messageId = sendMessageRequest(parentWindow, "authentication.getAuthToken", [authTokenRequest.resources]);
callbacks[messageId] = function (success, result) {
if (!success) {
throw new Error(result);
if (success) {
authTokenRequest.successCallback(result);
}
else {
authTokenRequest.failureCallback(result);
}
};
}
microsoftTeams.uploadCustomApp = uploadCustomApp;
authentication.getAuthToken = getAuthToken;
/**
* Navigates the Microsoft Teams app to the specified tab instance.
* @param tabInstance The tab instance to navigate to.
* @private
* Hide from docs.
* ------
* Requests the decoded Azure AD user identity on behalf of the app.
*/
function navigateToTab(tabInstance) {
function getUser(userRequest) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "navigateToTab", [
tabInstance
]);
callbacks[messageId] = function (success) {
if (!success) {
throw new Error("Invalid internalTabInstanceId and/or channelId were/was provided");
var messageId = sendMessageRequest(parentWindow, "authentication.getUser");
callbacks[messageId] = function (success, result) {
if (success) {
userRequest.successCallback(result);
}
else {
userRequest.failureCallback(result);
}
};
}
microsoftTeams.navigateToTab = navigateToTab;
/**
* Namespace to interact with the settings-specific part of the SDK.
* This object is usable only on the settings frame.
*/
var settings;
(function (settings) {
var saveHandler;
var removeHandler;
handlers["settings.save"] = handleSave;
handlers["settings.remove"] = handleRemove;
/**
* Sets the validity state for the settings.
* The initial value is false, so the user cannot save the settings until this is called with true.
* @param validityState Indicates whether the save or remove button is enabled for the user.
*/
function setValidityState(validityState) {
ensureInitialized(frameContexts.settings, frameContexts.remove);
sendMessageRequest(parentWindow, "settings.setValidityState", [
validityState
]);
authentication.getUser = getUser;
function closeAuthenticationWindow() {
// Stop monitoring the authentication window
stopAuthenticationWindowMonitor();
// Try to close the authentication window and clear all properties associated with it
try {
if (childWindow) {
childWindow.close();
}
}
settings.setValidityState = setValidityState;
/**
* Gets the settings for the current instance.
* @param callback The callback to invoke when the {@link Settings} object is retrieved.
*/
function getSettings(callback) {
ensureInitialized(frameContexts.settings, frameContexts.remove);
var messageId = sendMessageRequest(parentWindow, "settings.getSettings");
callbacks[messageId] = callback;
finally {
childWindow = null;
childOrigin = null;
}
settings.getSettings = getSettings;
/**
* Sets the settings for the current instance.
* This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
* @param settings The desired settings for this instance.
*/
function setSettings(instanceSettings) {
ensureInitialized(frameContexts.settings);
sendMessageRequest(parentWindow, "settings.setSettings", [
instanceSettings
]);
}
function openAuthenticationWindow(authenticateParameters) {
authParams = authenticateParameters;
// Close the previously opened window if we have one
closeAuthenticationWindow();
// Start with a sensible default size
var width = authParams.width || 600;
var height = authParams.height || 400;
// Ensure that the new window is always smaller than our app's window so that it never fully covers up our app
width = Math.min(width, currentWindow.outerWidth - 400);
height = Math.min(height, currentWindow.outerHeight - 200);
// Convert any relative URLs into absolute URLs before sending them over to the parent window
var link = document.createElement("a");
link.href = authParams.url;
// We are running in the browser, so we need to center the new window ourselves
var left = typeof currentWindow.screenLeft !== "undefined"
? currentWindow.screenLeft
: currentWindow.screenX;
var top = typeof currentWindow.screenTop !== "undefined"
? currentWindow.screenTop
: currentWindow.screenY;
left += currentWindow.outerWidth / 2 - width / 2;
top += currentWindow.outerHeight / 2 - height / 2;
// Open a child window with a desired set of standard browser features
childWindow = currentWindow.open(link.href, "_blank", "toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=" +
top +
", left=" +
left +
", width=" +
width +
", height=" +
height);
if (childWindow) {
// Start monitoring the authentication window so that we can detect if it gets closed before the flow completes
startAuthenticationWindowMonitor();
}
settings.setSettings = setSettings;
/**
* Registers a handler for when the user attempts to save the settings. This handler should be used
* to create or update the underlying resource powering the content.
* The object passed to the handler must be used to notify whether to proceed with the save.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user selects the save button.
*/
function registerOnSaveHandler(handler) {
ensureInitialized(frameContexts.settings);
saveHandler = handler;
else {
// If we failed to open the window, fail the authentication flow
handleFailure("FailedToOpenWindow");
}
settings.registerOnSaveHandler = registerOnSaveHandler;
/**
* Registers a handler for user attempts to remove content. This handler should be used
* to remove the underlying resource powering the content.
* The object passed to the handler must be used to indicate whether to proceed with the removal.
* Only one handler may be registered at a time. Subsequent registrations will override the first.
* @param handler The handler to invoke when the user selects the remove button.
*/
function registerOnRemoveHandler(handler) {
ensureInitialized(frameContexts.remove);
removeHandler = handler;
}
function stopAuthenticationWindowMonitor() {
if (authWindowMonitor) {
clearInterval(authWindowMonitor);
authWindowMonitor = 0;
}
settings.registerOnRemoveHandler = registerOnRemoveHandler;
function handleSave(result) {
var saveEvent = new SaveEventImpl(result);
if (saveHandler) {
saveHandler(saveEvent);
delete handlers["initialize"];
delete handlers["navigateCrossDomain"];
}
function startAuthenticationWindowMonitor() {
// Stop the previous window monitor if one is running
stopAuthenticationWindowMonitor();
// Create an interval loop that
// - Notifies the caller of failure if it detects that the authentication window is closed
// - Keeps pinging the authentication window while it is open to re-establish
// contact with any pages along the authentication flow that need to communicate
// with us
authWindowMonitor = currentWindow.setInterval(function () {
if (!childWindow || childWindow.closed) {
handleFailure("CancelledByUser");
}
else {
// If no handler is registered, we assume success.
saveEvent.notifySuccess();
}
}
/**
* @private
* Hide from docs, since this class is not directly used.
*/
var SaveEventImpl = /** @class */ (function () {
function SaveEventImpl(result) {
this.notified = false;
this.result = result ? result : {};
}
SaveEventImpl.prototype.notifySuccess = function () {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.save.success");
this.notified = true;
};
SaveEventImpl.prototype.notifyFailure = function (reason) {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.save.failure", [reason]);
this.notified = true;
};
SaveEventImpl.prototype.ensureNotNotified = function () {
if (this.notified) {
throw new Error("The SaveEvent may only notify success or failure once.");
var savedChildOrigin = childOrigin;
try {
childOrigin = "*";
sendMessageRequest(childWindow, "ping");
}
};
return SaveEventImpl;
}());
function handleRemove() {
var removeEvent = new RemoveEventImpl();
if (removeHandler) {
removeHandler(removeEvent);
finally {
childOrigin = savedChildOrigin;
}
}
else {
// If no handler is registered, we assume success.
removeEvent.notifySuccess();
}
}
/**
* @private
* Hide from docs, since this class is not directly used.
*/
var RemoveEventImpl = /** @class */ (function () {
function RemoveEventImpl() {
this.notified = false;
}
RemoveEventImpl.prototype.notifySuccess = function () {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.remove.success");
this.notified = true;
};
RemoveEventImpl.prototype.notifyFailure = function (reason) {
this.ensureNotNotified();
sendMessageRequest(parentWindow, "settings.remove.failure", [reason]);
this.notified = true;
};
RemoveEventImpl.prototype.ensureNotNotified = function () {
if (this.notified) {
throw new Error("The removeEvent may only notify success or failure once.");
}
};
return RemoveEventImpl;
}());
})(settings = microsoftTeams.settings || (microsoftTeams.settings = {}));
}, 100);
// Set up an initialize-message handler that gives the authentication window its frame context
handlers["initialize"] = function () {
return [frameContexts.authentication, hostClientType];
};
// Set up a navigateCrossDomain message handler that blocks cross-domain re-navigation attempts
// in the authentication window. We could at some point choose to implement this method via a call to
// authenticationWindow.location.href = url; however, we would first need to figure out how to
// validate the URL against the tab's list of valid domains.
handlers["navigateCrossDomain"] = function (url) {
return false;
};
}
/**
* Namespace to interact with the authentication-specific part of the SDK.
* This object is used for starting or completing authentication flows.
* Notifies the frame that initiated this authentication request that the request was successful.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
*/
var authentication;
(function (authentication) {
var authParams;
var authWindowMonitor;
handlers["authentication.authenticate.success"] = handleSuccess;
handlers["authentication.authenticate.failure"] = handleFailure;
/**
* Registers the authentication handlers
* @param authenticateParameters A set of values that configure the authentication pop-up.
*/
function registerAuthenticationHandlers(authenticateParameters) {
authParams = authenticateParameters;
}
authentication.registerAuthenticationHandlers = registerAuthenticationHandlers;
/**
* Initiates an authentication request, which opens a new window with the specified settings.
*/
function authenticate(authenticateParameters) {
var authenticateParams = authenticateParameters !== undefined
? authenticateParameters
: authParams;
ensureInitialized(frameContexts.content, frameContexts.settings, frameContexts.remove, frameContexts.task);
if (hostClientType === "desktop" /* desktop */) {
// Convert any relative URLs into absolute URLs before sending them over to the parent window.
var link = document.createElement("a");
link.href = authenticateParams.url;
// Ask the parent window to open an authentication window with the parameters provided by the caller.
var messageId = sendMessageRequest(parentWindow, "authentication.authenticate", [link.href, authenticateParams.width, authenticateParams.height]);
callbacks[messageId] = function (success, response) {
if (success) {
authenticateParams.successCallback(response);
}
else {
authenticateParams.failureCallback(response);
}
};
function notifySuccess(result, callbackUrl) {
redirectIfWin32Outlook(callbackUrl, "result", result);
ensureInitialized(frameContexts.authentication);
sendMessageRequest(parentWindow, "authentication.authenticate.success", [
result
]);
// Wait for the message to be sent before closing the window
waitForMessageQueue(parentWindow, function () {
return setTimeout(function () { return currentWindow.close(); }, 200);
});
}
authentication.notifySuccess = notifySuccess;
/**
* Notifies the frame that initiated this authentication request that the request failed.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
*/
function notifyFailure(reason, callbackUrl) {
redirectIfWin32Outlook(callbackUrl, "reason", reason);
ensureInitialized(frameContexts.authentication);
sendMessageRequest(parentWindow, "authentication.authenticate.failure", [
reason
]);
// Wait for the message to be sent before closing the window
waitForMessageQueue(parentWindow, function () {
return setTimeout(function () { return currentWindow.close(); }, 200);
});
}
authentication.notifyFailure = notifyFailure;
function handleSuccess(result) {
try {
if (authParams && authParams.successCallback) {
authParams.successCallback(result);
}
else {
// Open an authentication window with the parameters provided by the caller.
openAuthenticationWindow(authenticateParams);
}
}
authentication.authenticate = authenticate;
/**
* @private
* Hide from docs.
* ------
* Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
* if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
* @param authTokenRequest A set of values that configure the token request.
*/
function getAuthToken(authTokenRequest) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "authentication.getAuthToken", [authTokenRequest.resources]);
callbacks[messageId] = function (success, result) {
if (success) {
authTokenRequest.successCallback(result);
}
else {
authTokenRequest.failureCallback(result);
}
};
finally {
authParams = null;
closeAuthenticationWindow();
}
authentication.getAuthToken = getAuthToken;
/**
* @private
* Hide from docs.
* ------
* Requests the decoded Azure AD user identity on behalf of the app.
*/
function getUser(userRequest) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "authentication.getUser");
callbacks[messageId] = function (success, result) {
if (success) {
userRequest.successCallback(result);
}
else {
userRequest.failureCallback(result);
}
};
}
authentication.getUser = getUser;
function closeAuthenticationWindow() {
// Stop monitoring the authentication window
stopAuthenticationWindowMonitor();
// Try to close the authentication window and clear all properties associated with it
try {
if (childWindow) {
childWindow.close();
}
}
function handleFailure(reason) {
try {
if (authParams && authParams.failureCallback) {
authParams.failureCallback(reason);
}
finally {
childWindow = null;
childOrigin = null;
}
}
function openAuthenticationWindow(authenticateParameters) {
authParams = authenticateParameters;
// Close the previously opened window if we have one
finally {
authParams = null;
closeAuthenticationWindow();
// Start with a sensible default size
var width = authParams.width || 600;
var height = authParams.height || 400;
// Ensure that the new window is always smaller than our app's window so that it never fully covers up our app
width = Math.min(width, currentWindow.outerWidth - 400);
height = Math.min(height, currentWindow.outerHeight - 200);
// Convert any relative URLs into absolute URLs before sending them over to the parent window
}
}
/**
* Validates that the callbackUrl param is a valid connector url, appends the result/reason and authSuccess/authFailure as URL fragments and redirects the window
* @param callbackUrl - the connectors url to redirect to
* @param key - "result" in case of success and "reason" in case of failure
* @param value - the value of the passed result/reason parameter
*/
function redirectIfWin32Outlook(callbackUrl, key, value) {
if (callbackUrl) {
var link = document.createElement("a");
link.href = authParams.url;
// We are running in the browser, so we need to center the new window ourselves
var left = typeof currentWindow.screenLeft !== "undefined"
? currentWindow.screenLeft
: currentWindow.screenX;
var top = typeof currentWindow.screenTop !== "undefined"
? currentWindow.screenTop
: currentWindow.screenY;
left += currentWindow.outerWidth / 2 - width / 2;
top += currentWindow.outerHeight / 2 - height / 2;
// Open a child window with a desired set of standard browser features
childWindow = currentWindow.open(link.href, "_blank", "toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=" +
top +
", left=" +
left +
", width=" +
width +
", height=" +
height);
if (childWindow) {
// Start monitoring the authentication window so that we can detect if it gets closed before the flow completes
startAuthenticationWindowMonitor();
}
else {
// If we failed to open the window, fail the authentication flow
handleFailure("FailedToOpenWindow");
}
}
function stopAuthenticationWindowMonitor() {
if (authWindowMonitor) {
clearInterval(authWindowMonitor);
authWindowMonitor = 0;
}
delete handlers["initialize"];
delete handlers["navigateCrossDomain"];
}
function startAuthenticationWindowMonitor() {
// Stop the previous window monitor if one is running
stopAuthenticationWindowMonitor();
// Create an interval loop that
// - Notifies the caller of failure if it detects that the authentication window is closed
// - Keeps pinging the authentication window while it is open to re-establish
// contact with any pages along the authentication flow that need to communicate
// with us
authWindowMonitor = currentWindow.setInterval(function () {
if (!childWindow || childWindow.closed) {
handleFailure("CancelledByUser");
}
else {
var savedChildOrigin = childOrigin;
try {
childOrigin = "*";
sendMessageRequest(childWindow, "ping");
link.href = decodeURIComponent(callbackUrl);
if (link.host &&
link.host !== window.location.host &&
link.host === "outlook.office.com" &&
link.search.indexOf("client_type=Win32_Outlook") > -1) {
if (key && key === "result") {
if (value) {
link.href = updateUrlParameter(link.href, "result", value);
}
finally {
childOrigin = savedChildOrigin;
}
currentWindow.location.assign(updateUrlParameter(link.href, "authSuccess", ""));
}
}, 100);
// Set up an initialize-message handler that gives the authentication window its frame context
handlers["initialize"] = function () {
return [frameContexts.authentication, hostClientType];
};
// Set up a navigateCrossDomain message handler that blocks cross-domain re-navigation attempts
// in the authentication window. We could at some point choose to implement this method via a call to
// authenticationWindow.location.href = url; however, we would first need to figure out how to
// validate the URL against the tab's list of valid domains.
handlers["navigateCrossDomain"] = function (url) {
return false;
};
}
/**
* Notifies the frame that initiated this authentication request that the request was successful.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
*/
function notifySuccess(result, callbackUrl) {
redirectIfWin32Outlook(callbackUrl, "result", result);
ensureInitialized(frameContexts.authentication);
sendMessageRequest(parentWindow, "authentication.authenticate.success", [
result
]);
// Wait for the message to be sent before closing the window
waitForMessageQueue(parentWindow, function () {
return setTimeout(function () { return currentWindow.close(); }, 200);
});
}
authentication.notifySuccess = notifySuccess;
/**
* Notifies the frame that initiated this authentication request that the request failed.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
*/
function notifyFailure(reason, callbackUrl) {
redirectIfWin32Outlook(callbackUrl, "reason", reason);
ensureInitialized(frameContexts.authentication);
sendMessageRequest(parentWindow, "authentication.authenticate.failure", [
reason
]);
// Wait for the message to be sent before closing the window
waitForMessageQueue(parentWindow, function () {
return setTimeout(function () { return currentWindow.close(); }, 200);
});
}
authentication.notifyFailure = notifyFailure;
function handleSuccess(result) {
try {
if (authParams && authParams.successCallback) {
authParams.successCallback(result);
}
}
finally {
authParams = null;
closeAuthenticationWindow();
}
}
function handleFailure(reason) {
try {
if (authParams && authParams.failureCallback) {
authParams.failureCallback(reason);
}
}
finally {
authParams = null;
closeAuthenticationWindow();
}
}
/**
* Validates that the callbackUrl param is a valid connector url, appends the result/reason and authSuccess/authFailure as URL fragments and redirects the window
* @param callbackUrl - the connectors url to redirect to
* @param key - "result" in case of success and "reason" in case of failure
* @param value - the value of the passed result/reason parameter
*/
function redirectIfWin32Outlook(callbackUrl, key, value) {
if (callbackUrl) {
var link = document.createElement("a");
link.href = decodeURIComponent(callbackUrl);
if (link.host &&
link.host !== window.location.host &&
link.host === "outlook.office.com" &&
link.search.indexOf("client_type=Win32_Outlook") > -1) {
if (key && key === "result") {
if (value) {
link.href = updateUrlParameter(link.href, "result", value);
}
currentWindow.location.assign(updateUrlParameter(link.href, "authSuccess", ""));
if (key && key === "reason") {
if (value) {
link.href = updateUrlParameter(link.href, "reason", value);
}
if (key && key === "reason") {
if (value) {
link.href = updateUrlParameter(link.href, "reason", value);
}
currentWindow.location.assign(updateUrlParameter(link.href, "authFailure", ""));
}
currentWindow.location.assign(updateUrlParameter(link.href, "authFailure", ""));
}
}
}
/**
* Appends either result or reason as a fragment to the 'callbackUrl'
* @param uri - the url to modify
* @param key - the fragment key
* @param value - the fragment value
*/
function updateUrlParameter(uri, key, value) {
var i = uri.indexOf("#");
var hash = i === -1 ? "#" : uri.substr(i);
hash = hash + "&" + key + (value !== "" ? "=" + value : "");
uri = i === -1 ? uri : uri.substr(0, i);
return uri + hash;
}
})(authentication = microsoftTeams.authentication || (microsoftTeams.authentication = {}));
function ensureInitialized() {
var expectedFrameContexts = [];
for (var _i = 0; _i < arguments.length; _i++) {
expectedFrameContexts[_i] = arguments[_i];
}
if (!initializeCalled) {
throw new Error("The library has not yet been initialized");
}
if (frameContext &&
expectedFrameContexts &&
expectedFrameContexts.length > 0) {
var found = false;
for (var i = 0; i < expectedFrameContexts.length; i++) {
if (expectedFrameContexts[i] === frameContext) {
found = true;
break;
}
}
if (!found) {
throw new Error("This call is not allowed in the '" + frameContext + "' context");
}
}
}
function processMessage(evt) {
// Process only if we received a valid message
if (!evt || !evt.data || typeof evt.data !== "object") {
return;
}
// Process only if the message is coming from a different window and a valid origin
var messageSource = evt.source || evt.originalEvent.source;
var messageOrigin = evt.origin || evt.originalEvent.origin;
if (messageSource === currentWindow ||
(messageOrigin !== currentWindow.location.origin &&
!validOriginRegExp.test(messageOrigin.toLowerCase()))) {
return;
}
// Update our parent and child relationships based on this message
updateRelationships(messageSource, messageOrigin);
// Handle the message
if (messageSource === parentWindow) {
handleParentMessage(evt);
}
else if (messageSource === childWindow) {
handleChildMessage(evt);
}
/**
* Appends either result or reason as a fragment to the 'callbackUrl'
* @param uri - the url to modify
* @param key - the fragment key
* @param value - the fragment value
*/
function updateUrlParameter(uri, key, value) {
var i = uri.indexOf("#");
var hash = i === -1 ? "#" : uri.substr(i);
hash = hash + "&" + key + (value !== "" ? "=" + value : "");
uri = i === -1 ? uri : uri.substr(0, i);
return uri + hash;
}
function updateRelationships(messageSource, messageOrigin) {
// Determine whether the source of the message is our parent or child and update our
// window and origin pointer accordingly
if (!parentWindow || messageSource === parentWindow) {
parentWindow = messageSource;
parentOrigin = messageOrigin;
}
else if (!childWindow || messageSource === childWindow) {
childWindow = messageSource;
childOrigin = messageOrigin;
}
// Clean up pointers to closed parent and child windows
if (parentWindow && parentWindow.closed) {
parentWindow = null;
parentOrigin = null;
}
if (childWindow && childWindow.closed) {
childWindow = null;
childOrigin = null;
}
// If we have any messages in our queue, send them now
flushMessageQueue(parentWindow);
flushMessageQueue(childWindow);
})(authentication = exports.authentication || (exports.authentication = {}));
function ensureInitialized() {
var expectedFrameContexts = [];
for (var _i = 0; _i < arguments.length; _i++) {
expectedFrameContexts[_i] = arguments[_i];
}
function handleParentMessage(evt) {
if ("id" in evt.data) {
// Call any associated callbacks
var message = evt.data;
var callback = callbacks[message.id];
if (callback) {
callback.apply(null, message.args);
// Remove the callback to ensure that the callback is called only once and to free up memory.
delete callbacks[message.id];
if (!initializeCalled) {
throw new Error("The library has not yet been initialized");
}
if (frameContext &&
expectedFrameContexts &&
expectedFrameContexts.length > 0) {
var found = false;
for (var i = 0; i < expectedFrameContexts.length; i++) {
if (expectedFrameContexts[i] === frameContext) {
found = true;
break;
}
}
else if ("func" in evt.data) {
// Delegate the request to the proper handler
var message = evt.data;
var handler = handlers[message.func];
if (handler) {
// We don't expect any handler to respond at this point
handler.apply(this, message.args);
}
if (!found) {
throw new Error("This call is not allowed in the '" + frameContext + "' context");
}
}
function handleChildMessage(evt) {
if ("id" in evt.data && "func" in evt.data) {
// Try to delegate the request to the proper handler
var message_1 = evt.data;
var handler = handlers[message_1.func];
if (handler) {
var result = handler.apply(this, message_1.args);
if (result) {
sendMessageResponse(childWindow, message_1.id, Array.isArray(result) ? result : [result]);
}
}
else {
// Proxy to parent
var messageId = sendMessageRequest(parentWindow, message_1.func, message_1.args);
// tslint:disable-next-line:no-any
callbacks[messageId] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (childWindow) {
sendMessageResponse(childWindow, message_1.id, args);
}
};
}
}
}
function processMessage(evt) {
// Process only if we received a valid message
if (!evt || !evt.data || typeof evt.data !== "object") {
return;
}
function getTargetMessageQueue(targetWindow) {
return targetWindow === parentWindow
? parentMessageQueue
: targetWindow === childWindow
? childMessageQueue
: [];
// Process only if the message is coming from a different window and a valid origin
var messageSource = evt.source || evt.originalEvent.source;
var messageOrigin = evt.origin || evt.originalEvent.origin;
if (messageSource === currentWindow ||
(messageOrigin !== currentWindow.location.origin &&
!validOriginRegExp.test(messageOrigin.toLowerCase()))) {
return;
}
function getTargetOrigin(targetWindow) {
return targetWindow === parentWindow
? parentOrigin
: targetWindow === childWindow
? childOrigin
: null;
// Update our parent and child relationships based on this message
updateRelationships(messageSource, messageOrigin);
// Handle the message
if (messageSource === parentWindow) {
handleParentMessage(evt);
}
function flushMessageQueue(targetWindow) {
var targetOrigin = getTargetOrigin(targetWindow);
var targetMessageQueue = getTargetMessageQueue(targetWindow);
while (targetWindow && targetOrigin && targetMessageQueue.length > 0) {
targetWindow.postMessage(targetMessageQueue.shift(), targetOrigin);
else if (messageSource === childWindow) {
handleChildMessage(evt);
}
}
function updateRelationships(messageSource, messageOrigin) {
// Determine whether the source of the message is our parent or child and update our
// window and origin pointer accordingly
if (!parentWindow || messageSource === parentWindow) {
parentWindow = messageSource;
parentOrigin = messageOrigin;
}
else if (!childWindow || messageSource === childWindow) {
childWindow = messageSource;
childOrigin = messageOrigin;
}
// Clean up pointers to closed parent and child windows
if (parentWindow && parentWindow.closed) {
parentWindow = null;
parentOrigin = null;
}
if (childWindow && childWindow.closed) {
childWindow = null;
childOrigin = null;
}
// If we have any messages in our queue, send them now
flushMessageQueue(parentWindow);
flushMessageQueue(childWindow);
}
function handleParentMessage(evt) {
if ("id" in evt.data) {
// Call any associated callbacks
var message = evt.data;
var callback = callbacks[message.id];
if (callback) {
callback.apply(null, message.args);
// Remove the callback to ensure that the callback is called only once and to free up memory.
delete callbacks[message.id];
}
}
function waitForMessageQueue(targetWindow, callback) {
var messageQueueMonitor = currentWindow.setInterval(function () {
if (getTargetMessageQueue(targetWindow).length === 0) {
clearInterval(messageQueueMonitor);
callback();
}
}, 100);
else if ("func" in evt.data) {
// Delegate the request to the proper handler
var message = evt.data;
var handler = handlers[message.func];
if (handler) {
// We don't expect any handler to respond at this point
handler.apply(this, message.args);
}
}
function sendMessageRequest(targetWindow, actionName,
// tslint:disable-next-line: no-any
args) {
var request = createMessageRequest(actionName, args);
if (isFramelessWindow) {
if (currentWindow && currentWindow.nativeInterface) {
currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(request));
}
function handleChildMessage(evt) {
if ("id" in evt.data && "func" in evt.data) {
// Try to delegate the request to the proper handler
var message_1 = evt.data;
var handler = handlers[message_1.func];
if (handler) {
var result = handler.apply(this, message_1.args);
if (result) {
sendMessageResponse(childWindow, message_1.id, Array.isArray(result) ? result : [result]);
}
}
else {
var targetOrigin = getTargetOrigin(targetWindow);
// If the target window isn't closed and we already know its origin, send the message right away; otherwise,
// queue the message and send it after the origin is established
if (targetWindow && targetOrigin) {
targetWindow.postMessage(request, targetOrigin);
}
else {
getTargetMessageQueue(targetWindow).push(request);
}
// Proxy to parent
var messageId = sendMessageRequest(parentWindow, message_1.func, message_1.args);
// tslint:disable-next-line:no-any
callbacks[messageId] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (childWindow) {
sendMessageResponse(childWindow, message_1.id, args);
}
};
}
return request.id;
}
/**
* @private
* Internal use only
* Sends a custom action message to Teams.
* @param actionName Specifies name of the custom action to be sent
* @param args Specifies additional arguments passed to the action
* @returns id of sent message
*/
function sendCustomMessage(actionName,
// tslint:disable-next-line:no-any
args) {
ensureInitialized();
return sendMessageRequest(parentWindow, actionName, args);
}
function getTargetMessageQueue(targetWindow) {
return targetWindow === parentWindow
? parentMessageQueue
: targetWindow === childWindow
? childMessageQueue
: [];
}
function getTargetOrigin(targetWindow) {
return targetWindow === parentWindow
? parentOrigin
: targetWindow === childWindow
? childOrigin
: null;
}
function flushMessageQueue(targetWindow) {
var targetOrigin = getTargetOrigin(targetWindow);
var targetMessageQueue = getTargetMessageQueue(targetWindow);
while (targetWindow && targetOrigin && targetMessageQueue.length > 0) {
targetWindow.postMessage(targetMessageQueue.shift(), targetOrigin);
}
microsoftTeams.sendCustomMessage = sendCustomMessage;
function sendMessageResponse(targetWindow, id,
// tslint:disable-next-line:no-any
args) {
var response = createMessageResponse(id, args);
}
function waitForMessageQueue(targetWindow, callback) {
var messageQueueMonitor = currentWindow.setInterval(function () {
if (getTargetMessageQueue(targetWindow).length === 0) {
clearInterval(messageQueueMonitor);
callback();
}
}, 100);
}
function sendMessageRequest(targetWindow, actionName,
// tslint:disable-next-line: no-any
args) {
var request = createMessageRequest(actionName, args);
if (isFramelessWindow) {
if (currentWindow && currentWindow.nativeInterface) {
currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(request));
}
}
else {
var targetOrigin = getTargetOrigin(targetWindow);
// If the target window isn't closed and we already know its origin, send the message right away; otherwise,
// queue the message and send it after the origin is established
if (targetWindow && targetOrigin) {
targetWindow.postMessage(response, targetOrigin);
targetWindow.postMessage(request, targetOrigin);
}
else {
getTargetMessageQueue(targetWindow).push(request);
}
}
// tslint:disable-next-line:no-any
function createMessageRequest(func, args) {
return {
id: nextMessageId++,
func: func,
args: args || []
};
return request.id;
}
/**
* @private
* Internal use only
* Sends a custom action message to Teams.
* @param actionName Specifies name of the custom action to be sent
* @param args Specifies additional arguments passed to the action
* @returns id of sent message
*/
function sendCustomMessage(actionName,
// tslint:disable-next-line:no-any
args) {
ensureInitialized();
return sendMessageRequest(parentWindow, actionName, args);
}
exports.sendCustomMessage = sendCustomMessage;
function sendMessageResponse(targetWindow, id,
// tslint:disable-next-line:no-any
args) {
var response = createMessageResponse(id, args);
var targetOrigin = getTargetOrigin(targetWindow);
if (targetWindow && targetOrigin) {
targetWindow.postMessage(response, targetOrigin);
}
// tslint:disable-next-line:no-any
function createMessageResponse(id, args) {
return {
id: id,
args: args || []
};
}
}
// tslint:disable-next-line:no-any
function createMessageRequest(func, args) {
return {
id: nextMessageId++,
func: func,
args: args || []
};
}
// tslint:disable-next-line:no-any
function createMessageResponse(id, args) {
return {
id: id,
args: args || []
};
}
/**
* Namespace to interact with the task module-specific part of the SDK.
* This object is usable only on the content frame.
*/
var tasks;
(function (tasks) {
/**
* Namespace to interact with the task module-specific part of the SDK.
* This object is usable only on the content frame.
* Allows an app to open the task module.
* @param taskInfo An object containing the parameters of the task module
* @param submitHandler Handler to call when the task module is completed
*/
var tasks;
(function (tasks) {
/**
* Allows an app to open the task module.
* @param taskInfo An object containing the parameters of the task module
* @param submitHandler Handler to call when the task module is completed
*/
function startTask(taskInfo, submitHandler) {
ensureInitialized(frameContexts.content);
var messageId = sendMessageRequest(parentWindow, "tasks.startTask", [
taskInfo
]);
callbacks[messageId] = submitHandler;
}
tasks.startTask = startTask;
/**
* Submit the task module.
* @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
* @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
*/
function submitTask(result, appIds) {
ensureInitialized(frameContexts.content, frameContexts.task);
// Send tasks.completeTask instead of tasks.submitTask message for backward compatibility with Mobile clients
sendMessageRequest(parentWindow, "tasks.completeTask", [
result,
Array.isArray(appIds) ? appIds : [appIds]
]);
}
tasks.submitTask = submitTask;
})(tasks = microsoftTeams.tasks || (microsoftTeams.tasks = {}));
function startTask(taskInfo, submitHandler) {
ensureInitialized(frameContexts.content);
var messageId = sendMessageRequest(parentWindow, "tasks.startTask", [
taskInfo
]);
callbacks[messageId] = submitHandler;
}
tasks.startTask = startTask;
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all chat members
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the members are and never as proof of membership.
* @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
* Submit the task module.
* @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
* @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
*/
function getChatMembers(callback) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getChatMembers");
callbacks[messageId] = callback;
function submitTask(result, appIds) {
ensureInitialized(frameContexts.content, frameContexts.task);
// Send tasks.completeTask instead of tasks.submitTask message for backward compatibility with Mobile clients
sendMessageRequest(parentWindow, "tasks.completeTask", [
result,
Array.isArray(appIds) ? appIds : [appIds]
]);
}
microsoftTeams.getChatMembers = getChatMembers;
})(microsoftTeams = exports.microsoftTeams || (exports.microsoftTeams = {}));
tasks.submitTask = submitTask;
})(tasks = exports.tasks || (exports.tasks = {}));
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all chat members
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the members are and never as proof of membership.
* @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
*/
function getChatMembers(callback) {
ensureInitialized();
var messageId = sendMessageRequest(parentWindow, "getChatMembers");
callbacks[messageId] = callback;
}
exports.getChatMembers = getChatMembers;

@@ -1317,0 +1298,0 @@

@@ -1,1 +0,1 @@

!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1);e.microsoftTeams=i.microsoftTeams},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return this.substr(!e||e<0?0:+e,t.length)===t}),function(t){var e="1.3.6";function n(t){for(var e="^",n=t.split("."),i=0;i<n.length;i++)e+=(i>0?"[.]":"")+n[i].replace("*","[^/^.]+");return e+="$"}var i=function(t){for(var e="",i=0;i<t.length;i++)e+=(0===i?"":"|")+n(t[i]);return new RegExp(e)}(["https://teams.microsoft.com","https://teams.microsoft.us","https://int.teams.microsoft.com","https://devspaces.skype.com","https://ssauth.skype.com","http://dev.local","https://msft.spoppe.com","https://*.sharepoint.com","https://*.sharepoint-df.com","https://*.sharepointonline.com","https://outlook.office.com","https://outlook-sdf.office.com"]),o={},r={settings:"settings",content:"content",authentication:"authentication",remove:"remove",task:"task"};!function(t){var e,n,i,r=function(){return function(){this.enabled=!0}}();t.MenuItem=r,function(t){t.dropDown="dropDown",t.popOver="popOver"}(t.MenuListType||(t.MenuListType={})),o.navBarMenuItemPress=function(t){e&&e(t)||(O(),_(s,"handleNavBarMenuItemPress",[t]))},o.actionMenuItemPress=function(t){n&&n(t)||(O(),_(s,"handleActionMenuItemPress",[t]))},o.setModuleView=function(t){i&&i(t)||(O(),_(s,"viewConfigItemPress",[t]))},t.setUpViews=function(t,e){O(),i=e,_(s,"setUpViews",[t])},t.setNavBarMenu=function(t,n){O(),e=n,_(s,"setNavBarMenu",[t])},t.showActionMenu=function(t,e){O(),n=e,_(s,"showActionMenu",[t])}}(t.menus||(t.menus={}));var a,s,u,c,f,l,d,h,v,p,g,m=!1,y=!1,b=[],w=[],k=0,T={},C=!1;function M(t){O(),h=t}function I(t){O(),v=t}function S(t){O(),p=t}function E(){O();var t=_(s,"navigateBack",[]);T[t]=function(t){if(!t)throw new Error("Back navigation is not supported in the current client or context.")}}function O(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!m)throw new Error("The library has not yet been initialized");if(l&&t&&t.length>0){for(var n=!1,i=0;i<t.length;i++)if(t[i]===l){n=!0;break}if(!n)throw new Error("This call is not allowed in the '"+l+"' context")}}function N(t){if("id"in t.data){var e=t.data,n=T[e.id];n&&(n.apply(null,e.args),delete T[e.id])}else if("func"in t.data){e=t.data;var i=o[e.func];i&&i.apply(this,e.args)}}function P(t){return t===s?b:t===c?w:[]}function x(t){return t===s?u:t===c?f:null}function L(t){for(var e=x(t),n=P(t);t&&e&&n.length>0;)t.postMessage(n.shift(),e)}function U(t,e){var n=a.setInterval(function(){0===P(t).length&&(clearInterval(n),e())},100)}function _(t,e,n){var i=function(t,e){return{id:k++,func:t,args:e||[]}}(e,n);if(y)a&&a.nativeInterface&&a.nativeInterface.framelessPostMessage(JSON.stringify(i));else{var o=x(t);t&&o?t.postMessage(i,o):P(t).push(i)}return i.id}function j(t,e,n){var i=function(t,e){return{id:t,args:e||[]}}(e,n),o=x(t);t&&o&&t.postMessage(i,o)}o.themeChange=function(t){h&&h(t);c&&_(c,"themeChange",[t])},o.fullScreenChange=function(t){v&&v(t)},o.backButtonPress=function(){p&&p()||E()},t.initialize=function(t){if(void 0===t&&(t=window),!m){m=!0;var n=function(t){return function(t){if(t&&t.data&&"object"==typeof t.data){var e=t.source||t.originalEvent.source,n=t.origin||t.originalEvent.origin;e===a||n!==a.location.origin&&!i.test(n.toLowerCase())||(function(t,e){s&&t!==s?c&&t!==c||(c=t,f=e):(s=t,u=e),s&&s.closed&&(s=null,u=null),c&&c.closed&&(c=null,f=null),L(s),L(c)}(e,n),e===s?N(t):e===c&&function(t){if("id"in t.data&&"func"in t.data){var e=t.data,n=o[e.func];if(n){var i=n.apply(this,e.args);i&&j(c,e.id,Array.isArray(i)?i:[i])}else{var r=_(s,e.func,e.args);T[r]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];c&&j(c,e.id,t)}}}}(t))}}(t)};(s=(a=t).parent!==a.self?a.parent:a.opener)?a.addEventListener("message",n,!1):(y=!0,window.onNativeMessage=N);try{u="*";var h=_(s,"initialize",[e]);T[h]=function(t,e){l=t,d=e}}finally{u=null}this._uninitialize=function(){l&&(M(null),I(null),S(null)),l===r.settings&&g.registerOnSaveHandler(null),l===r.remove&&g.registerOnRemoveHandler(null),y||a.removeEventListener("message",n,!1),m=!1,s=null,u=null,b=[],c=null,f=null,w=[],k=0,T={},l=null,d=null,y=!1}}},t._uninitialize=function(){},t.enablePrintCapability=function(){C||(C=!0,O(),document.addEventListener("keydown",function(e){(e.ctrlKey||e.metaKey)&&80===e.keyCode&&(t.print(),e.cancelBubble=!0,e.preventDefault(),e.stopImmediatePropagation())}))},t.print=function(){window.print()},t.getContext=function(t){O();var e=_(s,"getContext");T[e]=t},t.registerOnThemeChangeHandler=M,t.registerFullScreenHandler=I,t.registerBackButtonHandler=S,t.navigateBack=E,t.navigateCrossDomain=function(t){O(r.content,r.settings,r.remove,r.task);var e=_(s,"navigateCrossDomain",[t]);T[e]=function(t){if(!t)throw new Error("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.")}},t.getTabInstances=function(t,e){O();var n=_(s,"getTabInstances",[e]);T[n]=t},t.getUserJoinedTeams=function(t,e){O();var n=_(s,"getUserJoinedTeams",[e]);T[n]=t},t.getMruTabInstances=function(t,e){O();var n=_(s,"getMruTabInstances",[e]);T[n]=t},t.shareDeepLink=function(t){O(r.content),_(s,"shareDeepLink",[t.subEntityId,t.subEntityLabel,t.subEntityWebUrl])},t.openFilePreview=function(t){O(r.content);var e=[t.entityId,t.title,t.description,t.type,t.objectUrl,t.downloadUrl,t.webPreviewUrl,t.webEditUrl,t.baseUrl,t.editFile,t.subEntityId];_(s,"openFilePreview",e)},t.showNotification=function(t){O(r.content);var e=[t.message,t.notificationType];_(s,"showNotification",e)},t.executeDeepLink=function(t){O(r.content);var e=[t.deepLink];_(s,"handleDeepLink",e)},t.uploadCustomApp=function(t){O();var e=_(s,"uploadCustomApp",[t]);T[e]=function(t,e){if(!t)throw new Error(e)}},t.navigateToTab=function(t){O();var e=_(s,"navigateToTab",[t]);T[e]=function(t){if(!t)throw new Error("Invalid internalTabInstanceId and/or channelId were/was provided")}},function(t){var e,n;o["settings.save"]=function(t){var n=new i(t);e?e(n):n.notifySuccess()},o["settings.remove"]=function(){var t=new a;n?n(t):t.notifySuccess()},t.setValidityState=function(t){O(r.settings,r.remove),_(s,"settings.setValidityState",[t])},t.getSettings=function(t){O(r.settings,r.remove);var e=_(s,"settings.getSettings");T[e]=t},t.setSettings=function(t){O(r.settings),_(s,"settings.setSettings",[t])},t.registerOnSaveHandler=function(t){O(r.settings),e=t},t.registerOnRemoveHandler=function(t){O(r.remove),n=t};var i=function(){function t(t){this.notified=!1,this.result=t||{}}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),_(s,"settings.save.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),_(s,"settings.save.failure",[t]),this.notified=!0},t.prototype.ensureNotNotified=function(){if(this.notified)throw new Error("The SaveEvent may only notify success or failure once.")},t}();var a=function(){function t(){this.notified=!1}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),_(s,"settings.remove.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),_(s,"settings.remove.failure",[t]),this.notified=!0},t.prototype.ensureNotNotified=function(){if(this.notified)throw new Error("The removeEvent may only notify success or failure once.")},t}()}(g=t.settings||(t.settings={})),function(t){var e,n;function i(){u();try{c&&c.close()}finally{c=null,f=null}}function u(){n&&(clearInterval(n),n=0),delete o.initialize,delete o.navigateCrossDomain}function l(t){try{e&&e.failureCallback&&e.failureCallback(t)}finally{e=null,i()}}function h(t,e,n){if(t){var i=document.createElement("a");i.href=decodeURIComponent(t),i.host&&i.host!==window.location.host&&"outlook.office.com"===i.host&&i.search.indexOf("client_type=Win32_Outlook")>-1&&(e&&"result"===e&&(n&&(i.href=v(i.href,"result",n)),a.location.assign(v(i.href,"authSuccess",""))),e&&"reason"===e&&(n&&(i.href=v(i.href,"reason",n)),a.location.assign(v(i.href,"authFailure",""))))}}function v(t,e,n){var i=t.indexOf("#"),o=-1===i?"#":t.substr(i);return o=o+"&"+e+(""!==n?"="+n:""),(t=-1===i?t:t.substr(0,i))+o}o["authentication.authenticate.success"]=function(t){try{e&&e.successCallback&&e.successCallback(t)}finally{e=null,i()}},o["authentication.authenticate.failure"]=l,t.registerAuthenticationHandlers=function(t){e=t},t.authenticate=function(t){var h=void 0!==t?t:e;if(O(r.content,r.settings,r.remove,r.task),"desktop"===d){var v=document.createElement("a");v.href=h.url;var p=_(s,"authentication.authenticate",[v.href,h.width,h.height]);T[p]=function(t,e){t?h.successCallback(e):h.failureCallback(e)}}else!function(t){e=t,i();var s=e.width||600,h=e.height||400;s=Math.min(s,a.outerWidth-400),h=Math.min(h,a.outerHeight-200);var v=document.createElement("a");v.href=e.url;var p=void 0!==a.screenLeft?a.screenLeft:a.screenX,g=void 0!==a.screenTop?a.screenTop:a.screenY;p+=a.outerWidth/2-s/2,g+=a.outerHeight/2-h/2,(c=a.open(v.href,"_blank","toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top="+g+", left="+p+", width="+s+", height="+h))?(u(),n=a.setInterval(function(){if(!c||c.closed)l("CancelledByUser");else{var t=f;try{f="*",_(c,"ping")}finally{f=t}}},100),o.initialize=function(){return[r.authentication,d]},o.navigateCrossDomain=function(t){return!1}):l("FailedToOpenWindow")}(h)},t.getAuthToken=function(t){O();var e=_(s,"authentication.getAuthToken",[t.resources]);T[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}},t.getUser=function(t){O();var e=_(s,"authentication.getUser");T[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}},t.notifySuccess=function(t,e){h(e,"result",t),O(r.authentication),_(s,"authentication.authenticate.success",[t]),U(s,function(){return setTimeout(function(){return a.close()},200)})},t.notifyFailure=function(t,e){h(e,"reason",t),O(r.authentication),_(s,"authentication.authenticate.failure",[t]),U(s,function(){return setTimeout(function(){return a.close()},200)})}}(t.authentication||(t.authentication={})),t.sendCustomMessage=function(t,e){return O(),_(s,t,e)},function(t){t.startTask=function(t,e){O(r.content);var n=_(s,"tasks.startTask",[t]);T[n]=e},t.submitTask=function(t,e){O(r.content,r.task),_(s,"tasks.completeTask",[t,Array.isArray(e)?e:[e]])}}(t.tasks||(t.tasks={})),t.getChatMembers=function(t){O();var e=_(s,"getChatMembers");T[e]=t}}(e.microsoftTeams||(e.microsoftTeams={}))}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("microsoftTeams",[],e):"object"==typeof exports?exports.microsoftTeams=e():t.microsoftTeams=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(1))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return this.substr(!e||e<0?0:+e,t.length)===t});var i="1.3.6";function o(t){for(var e="^",n=t.split("."),i=0;i<n.length;i++)e+=(i>0?"[.]":"")+n[i].replace("*","[^/^.]+");return e+="$"}var r=function(t){for(var e="",n=0;n<t.length;n++)e+=(0===n?"":"|")+o(t[n]);return new RegExp(e)}(["https://teams.microsoft.com","https://teams.microsoft.us","https://int.teams.microsoft.com","https://devspaces.skype.com","https://ssauth.skype.com","http://dev.local","https://msft.spoppe.com","https://*.sharepoint.com","https://*.sharepoint-df.com","https://*.sharepointonline.com","https://outlook.office.com","https://outlook-sdf.office.com"]),a={},s={settings:"settings",content:"content",authentication:"authentication",remove:"remove",task:"task"};!function(t){var e,n,i,o=function(){return function(){this.enabled=!0}}();t.MenuItem=o,function(t){t.dropDown="dropDown",t.popOver="popOver"}(t.MenuListType||(t.MenuListType={})),a.navBarMenuItemPress=function(t){e&&e(t)||(x(),L(c,"handleNavBarMenuItemPress",[t]))},a.actionMenuItemPress=function(t){n&&n(t)||(x(),L(c,"handleActionMenuItemPress",[t]))},a.setModuleView=function(t){i&&i(t)||(x(),L(c,"viewConfigItemPress",[t]))},t.setUpViews=function(t,e){x(),i=e,L(c,"setUpViews",[t])},t.setNavBarMenu=function(t,n){x(),e=n,L(c,"setNavBarMenu",[t])},t.showActionMenu=function(t,e){x(),n=e,L(c,"showActionMenu",[t])}}(e.menus||(e.menus={}));var u,c,f,l,d,h,v,p,g,m,y,b=!1,w=!1,k=[],T=[],C=0,M={},I=!1;function S(){window.print()}function E(t){x(),p=t}function O(t){x(),g=t}function P(t){x(),m=t}function N(){x();var t=L(c,"navigateBack",[]);M[t]=function(t){if(!t)throw new Error("Back navigation is not supported in the current client or context.")}}function x(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!b)throw new Error("The library has not yet been initialized");if(h&&t&&t.length>0){for(var n=!1,i=0;i<t.length;i++)if(t[i]===h){n=!0;break}if(!n)throw new Error("This call is not allowed in the '"+h+"' context")}}function U(t){if("id"in t.data){var e=t.data,n=M[e.id];n&&(n.apply(null,e.args),delete M[e.id])}else if("func"in t.data){e=t.data;var i=a[e.func];i&&i.apply(this,e.args)}}function _(t){return t===c?k:t===l?T:[]}function j(t){return t===c?f:t===l?d:null}function A(t){for(var e=j(t),n=_(t);t&&e&&n.length>0;)t.postMessage(n.shift(),e)}function B(t,e){var n=u.setInterval(function(){0===_(t).length&&(clearInterval(n),e())},100)}function L(t,e,n){var i=function(t,e){return{id:C++,func:t,args:e||[]}}(e,n);if(w)u&&u.nativeInterface&&u.nativeInterface.framelessPostMessage(JSON.stringify(i));else{var o=j(t);t&&o?t.postMessage(i,o):_(t).push(i)}return i.id}function H(t,e,n){var i=function(t,e){return{id:t,args:e||[]}}(e,n),o=j(t);t&&o&&t.postMessage(i,o)}a.themeChange=function(t){p&&p(t);l&&L(l,"themeChange",[t])},a.fullScreenChange=function(t){g&&g(t)},a.backButtonPress=function(){m&&m()||N()},e.initialize=function(t){if(void 0===t&&(t=window),!b){b=!0;var e=function(t){return function(t){if(t&&t.data&&"object"==typeof t.data){var e=t.source||t.originalEvent.source,n=t.origin||t.originalEvent.origin;e===u||n!==u.location.origin&&!r.test(n.toLowerCase())||(function(t,e){c&&t!==c?l&&t!==l||(l=t,d=e):(c=t,f=e),c&&c.closed&&(c=null,f=null),l&&l.closed&&(l=null,d=null),A(c),A(l)}(e,n),e===c?U(t):e===l&&function(t){if("id"in t.data&&"func"in t.data){var e=t.data,n=a[e.func];if(n){var i=n.apply(this,e.args);i&&H(l,e.id,Array.isArray(i)?i:[i])}else{var o=L(c,e.func,e.args);M[o]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];l&&H(l,e.id,t)}}}}(t))}}(t)};(c=(u=t).parent!==u.self?u.parent:u.opener)?u.addEventListener("message",e,!1):(w=!0,window.onNativeMessage=U);try{f="*";var n=L(c,"initialize",[i]);M[n]=function(t,e){h=t,v=e}}finally{f=null}this._uninitialize=function(){h&&(E(null),O(null),P(null)),h===s.settings&&y.registerOnSaveHandler(null),h===s.remove&&y.registerOnRemoveHandler(null),w||u.removeEventListener("message",e,!1),b=!1,c=null,f=null,k=[],l=null,d=null,T=[],C=0,M={},h=null,v=null,w=!1}}},e._uninitialize=function(){},e.enablePrintCapability=function(){I||(I=!0,x(),document.addEventListener("keydown",function(t){(t.ctrlKey||t.metaKey)&&80===t.keyCode&&(S(),t.cancelBubble=!0,t.preventDefault(),t.stopImmediatePropagation())}))},e.print=S,e.getContext=function(t){x();var e=L(c,"getContext");M[e]=t},e.registerOnThemeChangeHandler=E,e.registerFullScreenHandler=O,e.registerBackButtonHandler=P,e.navigateBack=N,e.navigateCrossDomain=function(t){x(s.content,s.settings,s.remove,s.task);var e=L(c,"navigateCrossDomain",[t]);M[e]=function(t){if(!t)throw new Error("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.")}},e.getTabInstances=function(t,e){x();var n=L(c,"getTabInstances",[e]);M[n]=t},e.getUserJoinedTeams=function(t,e){x();var n=L(c,"getUserJoinedTeams",[e]);M[n]=t},e.getMruTabInstances=function(t,e){x();var n=L(c,"getMruTabInstances",[e]);M[n]=t},e.shareDeepLink=function(t){x(s.content),L(c,"shareDeepLink",[t.subEntityId,t.subEntityLabel,t.subEntityWebUrl])},e.openFilePreview=function(t){x(s.content);var e=[t.entityId,t.title,t.description,t.type,t.objectUrl,t.downloadUrl,t.webPreviewUrl,t.webEditUrl,t.baseUrl,t.editFile,t.subEntityId];L(c,"openFilePreview",e)},e.showNotification=function(t){x(s.content);var e=[t.message,t.notificationType];L(c,"showNotification",e)},e.uploadCustomApp=function(t){x();var e=L(c,"uploadCustomApp",[t]);M[e]=function(t,e){if(!t)throw new Error(e)}},e.navigateToTab=function(t){x();var e=L(c,"navigateToTab",[t]);M[e]=function(t){if(!t)throw new Error("Invalid internalTabInstanceId and/or channelId were/was provided")}},function(t){var e,n;a["settings.save"]=function(t){var n=new i(t);e?e(n):n.notifySuccess()},a["settings.remove"]=function(){var t=new o;n?n(t):t.notifySuccess()},t.setValidityState=function(t){x(s.settings,s.remove),L(c,"settings.setValidityState",[t])},t.getSettings=function(t){x(s.settings,s.remove);var e=L(c,"settings.getSettings");M[e]=t},t.setSettings=function(t){x(s.settings),L(c,"settings.setSettings",[t])},t.registerOnSaveHandler=function(t){x(s.settings),e=t},t.registerOnRemoveHandler=function(t){x(s.remove),n=t};var i=function(){function t(t){this.notified=!1,this.result=t||{}}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),L(c,"settings.save.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),L(c,"settings.save.failure",[t]),this.notified=!0},t.prototype.ensureNotNotified=function(){if(this.notified)throw new Error("The SaveEvent may only notify success or failure once.")},t}();var o=function(){function t(){this.notified=!1}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),L(c,"settings.remove.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),L(c,"settings.remove.failure",[t]),this.notified=!0},t.prototype.ensureNotNotified=function(){if(this.notified)throw new Error("The removeEvent may only notify success or failure once.")},t}()}(y=e.settings||(e.settings={})),function(t){var e,n;function i(){o();try{l&&l.close()}finally{l=null,d=null}}function o(){n&&(clearInterval(n),n=0),delete a.initialize,delete a.navigateCrossDomain}function r(t){try{e&&e.failureCallback&&e.failureCallback(t)}finally{e=null,i()}}function f(t,e,n){if(t){var i=document.createElement("a");i.href=decodeURIComponent(t),i.host&&i.host!==window.location.host&&"outlook.office.com"===i.host&&i.search.indexOf("client_type=Win32_Outlook")>-1&&(e&&"result"===e&&(n&&(i.href=h(i.href,"result",n)),u.location.assign(h(i.href,"authSuccess",""))),e&&"reason"===e&&(n&&(i.href=h(i.href,"reason",n)),u.location.assign(h(i.href,"authFailure",""))))}}function h(t,e,n){var i=t.indexOf("#"),o=-1===i?"#":t.substr(i);return o=o+"&"+e+(""!==n?"="+n:""),(t=-1===i?t:t.substr(0,i))+o}a["authentication.authenticate.success"]=function(t){try{e&&e.successCallback&&e.successCallback(t)}finally{e=null,i()}},a["authentication.authenticate.failure"]=r,t.registerAuthenticationHandlers=function(t){e=t},t.authenticate=function(t){var f=void 0!==t?t:e;if(x(s.content,s.settings,s.remove,s.task),"desktop"===v){var h=document.createElement("a");h.href=f.url;var p=L(c,"authentication.authenticate",[h.href,f.width,f.height]);M[p]=function(t,e){t?f.successCallback(e):f.failureCallback(e)}}else!function(t){e=t,i();var c=e.width||600,f=e.height||400;c=Math.min(c,u.outerWidth-400),f=Math.min(f,u.outerHeight-200);var h=document.createElement("a");h.href=e.url;var p=void 0!==u.screenLeft?u.screenLeft:u.screenX,g=void 0!==u.screenTop?u.screenTop:u.screenY;p+=u.outerWidth/2-c/2,g+=u.outerHeight/2-f/2,(l=u.open(h.href,"_blank","toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top="+g+", left="+p+", width="+c+", height="+f))?(o(),n=u.setInterval(function(){if(!l||l.closed)r("CancelledByUser");else{var t=d;try{d="*",L(l,"ping")}finally{d=t}}},100),a.initialize=function(){return[s.authentication,v]},a.navigateCrossDomain=function(t){return!1}):r("FailedToOpenWindow")}(f)},t.getAuthToken=function(t){x();var e=L(c,"authentication.getAuthToken",[t.resources]);M[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}},t.getUser=function(t){x();var e=L(c,"authentication.getUser");M[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}},t.notifySuccess=function(t,e){f(e,"result",t),x(s.authentication),L(c,"authentication.authenticate.success",[t]),B(c,function(){return setTimeout(function(){return u.close()},200)})},t.notifyFailure=function(t,e){f(e,"reason",t),x(s.authentication),L(c,"authentication.authenticate.failure",[t]),B(c,function(){return setTimeout(function(){return u.close()},200)})}}(e.authentication||(e.authentication={})),e.sendCustomMessage=function(t,e){return x(),L(c,t,e)},function(t){t.startTask=function(t,e){x(s.content);var n=L(c,"tasks.startTask",[t]);M[n]=e},t.submitTask=function(t,e){x(s.content,s.task),L(c,"tasks.completeTask",[t,Array.isArray(e)?e:[e]])}}(e.tasks||(e.tasks={})),e.getChatMembers=function(t){x();var e=L(c,"getChatMembers");M[e]=t}}])});

@@ -1,1 +0,1 @@

export { microsoftTeams } from './MicrosoftTeams';
export * from "./MicrosoftTeams";

@@ -0,813 +1,592 @@

export declare const enum HostClientType {
desktop = "desktop",
web = "web",
android = "android",
ios = "ios"
}
/**
* This is the root namespace for the JavaScript SDK.
* Namespace to interact with the menu-specific part of the SDK.
* This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
*
* @private
* Hide from docs until feature is complete
*/
export declare namespace microsoftTeams {
const enum HostClientType {
desktop = "desktop",
web = "web",
android = "android",
ios = "ios"
}
export declare namespace menus {
/**
* Namespace to interact with the menu-specific part of the SDK.
* This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
*
* @private
* Hide from docs until feature is complete
* Represents information about item in View Configuration.
*/
namespace menus {
interface ViewConfiguration {
/**
* Represents information about item in View Configuration.
* Unique identifier of view.
*/
interface ViewConfiguration {
/**
* Unique identifier of view.
*/
id: string;
/**
* Display title of the view.
*/
title: string;
/**
* Additional information for accessibility.
*/
contentDescription?: string;
}
id: string;
/**
* Represents information about menu item for Action Menu and Navigation Bar Menu.
* Display title of the view.
*/
class MenuItem {
/**
* Unique identifier for the menu item.
*/
id: string;
/**
* Display title of the menu item.
*/
title: string;
/**
* Display icon of the menu item. The icon value must be a string having SVG icon content.
*/
icon?: string;
/**
* Selected state display icon of the menu item. The icon value must be a string having SVG icon content.
*/
iconSelected?: string;
/**
* Additional information for accessibility.
*/
contentDescription?: string;
/**
* State of the menu item
*/
enabled: boolean;
/**
* Interface to show list of items on selection of menu item.
*/
viewData: ViewData;
}
title: string;
/**
* Represents information about view to show on Navigation Bar Menu item selection
* Additional information for accessibility.
*/
interface ViewData {
/**
* Display header title of the item list.
*/
listTitle?: string;
/**
* Type of the menu item.
*/
listType: MenuListType;
/**
* Array of MenuItem. Icon value will be required for all items in the list.
*/
listItems: MenuItem[];
}
/**
* Represents information about type of list to display in Navigation Bar Menu.
*/
enum MenuListType {
dropDown = "dropDown",
popOver = "popOver"
}
/**
* Registers list of view configurations and it's handler.
* Handler is responsible for listening selection of View Configuration.
* @param viewConfig List of view configurations. Minimum 1 value is required.
* @param handler The handler to invoke when the user selects view configuration.
*/
function setUpViews(viewConfig: ViewConfiguration[], handler: (id: string) => boolean): void;
/**
* Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
* @param items List of MenuItems for Navigation Bar Menu.
* @param handler The handler to invoke when the user selects menu item.
*/
function setNavBarMenu(items: MenuItem[], handler: (id: string) => boolean): void;
interface ActionMenuParameters {
/**
* Display title for Action Menu
*/
title: string;
/**
* List of MenuItems for Action Menu
*/
items: MenuItem[];
}
/**
* Used to show Action Menu.
* @param params Parameters for Menu Parameters
* @param handler The handler to invoke when the user selects menu item.
*/
function showActionMenu(params: ActionMenuParameters, handler: (id: string) => boolean): void;
contentDescription?: string;
}
/**
* Represents information about tabs for an app
* Represents information about menu item for Action Menu and Navigation Bar Menu.
*/
interface TabInformation {
teamTabs: TabInstance[];
}
/**
* Represents information about a tab instance
*/
interface TabInstance {
class MenuItem {
/**
* The name of the tab
* Unique identifier for the menu item.
*/
tabName: string;
id: string;
/**
* Internal: do not use
* @protected
* Display title of the menu item.
*/
internalTabInstanceId?: string;
title: string;
/**
* Last viewed time of this tab. null means unknown
* Display icon of the menu item. The icon value must be a string having SVG icon content.
*/
lastViewUnixEpochTime?: string;
icon?: string;
/**
* The developer-defined unique ID for the entity this content points to.
* Selected state display icon of the menu item. The icon value must be a string having SVG icon content.
*/
entityId?: string;
iconSelected?: string;
/**
* The Microsoft Teams ID for the channel with which the content is associated.
* Additional information for accessibility.
*/
channelId?: string;
contentDescription?: string;
/**
* The name for the channel with which the content is associated.
* State of the menu item
*/
channelName?: string;
enabled: boolean;
/**
* Is this tab in a favorite channel?
* Interface to show list of items on selection of menu item.
*/
channelIsFavorite?: boolean;
viewData: ViewData;
}
/**
* Represents information about view to show on Navigation Bar Menu item selection
*/
interface ViewData {
/**
* The Microsoft Teams ID for the team with which the content is associated.
* Display header title of the item list.
*/
teamId?: string;
listTitle?: string;
/**
* The name for the team with which the content is associated.
* Type of the menu item.
*/
teamName?: string;
listType: MenuListType;
/**
* Is this tab in a favorite team?
* Array of MenuItem. Icon value will be required for all items in the list.
*/
teamIsFavorite?: boolean;
/**
* The Office 365 group ID for the team with which the content is associated.
* This field is available only when the identity permission is requested in the manifest.
*/
groupId?: string;
/**
* Content URL of this tab
*/
url?: string;
/**
* Website URL of this tab
*/
websiteUrl?: string;
listItems: MenuItem[];
}
/**
* Indicates the team type, currently used to distinguish between different team
* types in Office 365 for Education (team types 1, 2, 3, and 4).
* Represents information about type of list to display in Navigation Bar Menu.
*/
const enum TeamType {
Standard = 0,
Edu = 1,
Class = 2,
Plc = 3,
Staff = 4
enum MenuListType {
dropDown = "dropDown",
popOver = "popOver"
}
/**
* Indicates the various types of roles of a user in a team.
* Registers list of view configurations and it's handler.
* Handler is responsible for listening selection of View Configuration.
* @param viewConfig List of view configurations. Minimum 1 value is required.
* @param handler The handler to invoke when the user selects view configuration.
*/
const enum UserTeamRole {
Admin = 0,
User = 1,
Guest = 2
}
function setUpViews(viewConfig: ViewConfiguration[], handler: (id: string) => boolean): void;
/**
* Indicates information about the tab instance for filtering purposes.
* Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
* @param items List of MenuItems for Navigation Bar Menu.
* @param handler The handler to invoke when the user selects menu item.
*/
interface TabInstanceParameters {
function setNavBarMenu(items: MenuItem[], handler: (id: string) => boolean): void;
interface ActionMenuParameters {
/**
* Flag allowing to select favorite channels only
* Display title for Action Menu
*/
favoriteChannelsOnly?: boolean;
title: string;
/**
* Flag allowing to select favorite teams only
* List of MenuItems for Action Menu
*/
favoriteTeamsOnly?: boolean;
items: MenuItem[];
}
/**
* @private
* Hide from docs
* --------
* Query parameters used when fetching team information
* Used to show Action Menu.
* @param params Parameters for Menu Parameters
* @param handler The handler to invoke when the user selects menu item.
*/
interface TeamInstanceParameters {
/**
* Flag allowing to select favorite teams only
*/
favoriteTeamsOnly?: boolean;
}
function showActionMenu(params: ActionMenuParameters, handler: (id: string) => boolean): void;
}
/**
* Represents information about tabs for an app
*/
export interface TabInformation {
teamTabs: TabInstance[];
}
/**
* Represents information about a tab instance
*/
export interface TabInstance {
/**
* @private
* Hide from docs
* --------
* Information on userJoined Teams
* The name of the tab
*/
interface UserJoinedTeamsInformation {
/**
* List of team information
*/
userJoinedTeams: TeamInformation[];
}
tabName: string;
/**
* Represends Team Information
* Internal: do not use
* @protected
*/
interface TeamInformation {
/**
* Id of the team
*/
teamId: string;
/**
* Team display name
*/
teamName: string;
/**
* Team description
*/
teamDescription?: string;
/**
* Thumbnail Uri
*/
thumbnailUri?: string;
/**
* The Office 365 group ID for the team with which the content is associated.
* This field is available only when the identity permission is requested in the manifest.
*/
groupId?: string;
/**
* Role of current user in the team
*/
userTeamRole?: UserTeamRole;
}
const enum TaskModuleDimension {
Large = "large",
Medium = "medium",
Small = "small"
}
internalTabInstanceId?: string;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
* Last viewed time of this tab. null means unknown
*/
function initialize(hostWindow?: any): void;
lastViewUnixEpochTime?: string;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
* The developer-defined unique ID for the entity this content points to.
*/
function _uninitialize(): void;
entityId?: string;
/**
* Enable print capability to support printing page using Ctrl+P and cmd+P
* The Microsoft Teams ID for the channel with which the content is associated.
*/
function enablePrintCapability(): void;
channelId?: string;
/**
* default print handler
* The name for the channel with which the content is associated.
*/
function print(): void;
channelName?: string;
/**
* Retrieves the current context the frame is running in.
* @param callback The callback to invoke when the {@link Context} object is retrieved.
* Is this tab in a favorite channel?
*/
function getContext(callback: (context: Context) => void): void;
channelIsFavorite?: boolean;
/**
* Registers a handler for theme changes.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user changes their theme.
* The Microsoft Teams ID for the team with which the content is associated.
*/
function registerOnThemeChangeHandler(handler: (theme: string) => void): void;
teamId?: string;
/**
* Registers a handler for changes from or to full-screen view for a tab.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user toggles full-screen view for a tab.
* The name for the team with which the content is associated.
*/
function registerFullScreenHandler(handler: (isFullScreen: boolean) => void): void;
teamName?: string;
/**
* Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
* navigation stack should use this handler to navigate the user back within their frame. If an app finds
* that after running its back button handler it cannot handle the event it should call the navigateBack
* method to ask the Teams client to handle it instead.
* @param handler The handler to invoke when the user presses their Team client's back button.
* Is this tab in a favorite team?
*/
function registerBackButtonHandler(handler: () => boolean): void;
teamIsFavorite?: boolean;
/**
* Navigates back in the Teams client. See registerBackButtonHandler for more information on when
* it's appropriate to use this method.
* The Office 365 group ID for the team with which the content is associated.
* This field is available only when the identity permission is requested in the manifest.
*/
function navigateBack(): void;
groupId?: string;
/**
* Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
* valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
* thrown. This function needs to be used only when navigating the frame to a URL in a different domain
* than the current one in a way that keeps the app informed of the change and allows the SDK to
* continue working.
* @param url The URL to navigate the frame to.
* Content URL of this tab
*/
function navigateCrossDomain(url: string): void;
url?: string;
/**
* Allows an app to retrieve for this user tabs that are owned by this app.
* If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
* @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
* @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
* Website URL of this tab
*/
function getTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
websiteUrl?: string;
}
/**
* Indicates the team type, currently used to distinguish between different team
* types in Office 365 for Education (team types 1, 2, 3, and 4).
*/
export declare const enum TeamType {
Standard = 0,
Edu = 1,
Class = 2,
Plc = 3,
Staff = 4
}
/**
* Indicates the various types of roles of a user in a team.
*/
export declare const enum UserTeamRole {
Admin = 0,
User = 1,
Guest = 2
}
/**
* Indicates information about the tab instance for filtering purposes.
*/
export interface TabInstanceParameters {
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all user joined teams
* @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
* @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
* Flag allowing to select favorite channels only
*/
function getUserJoinedTeams(callback: (userJoinedTeamsInformation: UserJoinedTeamsInformation) => void, teamInstanceParameters?: TeamInstanceParameters): void;
favoriteChannelsOnly?: boolean;
/**
* Allows an app to retrieve the most recently used tabs for this user.
* @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
* @param tabInstanceParameters OPTIONAL Ignored, kept for future use
* Flag allowing to select favorite teams only
*/
function getMruTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
favoriteTeamsOnly?: boolean;
}
/**
* @private
* Hide from docs
* --------
* Query parameters used when fetching team information
*/
export interface TeamInstanceParameters {
/**
* Shares a deep link that a user can use to navigate back to a specific state in this page.
* @param deepLinkParameters ID and label for the link and fallback URL.
* Flag allowing to select favorite teams only
*/
function shareDeepLink(deepLinkParameters: DeepLinkParameters): void;
favoriteTeamsOnly?: boolean;
}
/**
* @private
* Hide from docs
* --------
* Information on userJoined Teams
*/
export interface UserJoinedTeamsInformation {
/**
* @private
* Hide from docs.
* ------
* Opens a client-friendly preview of the specified file.
* @param file The file to preview.
* List of team information
*/
function openFilePreview(filePreviewParameters: FilePreviewParameters): void;
const enum NotificationTypes {
fileDownloadStart = "fileDownloadStart",
fileDownloadComplete = "fileDownloadComplete"
}
interface ShowNotificationParameters {
message: string;
notificationType: NotificationTypes;
}
interface ExecuteDeepLinkParameters {
deepLink: string;
}
userJoinedTeams: TeamInformation[];
}
/**
* Represends Team Information
*/
export interface TeamInformation {
/**
* @private
* Hide from docs.
* ------
* display notification API.
* @param message Notification message.
* @param notificationType Notification type
* Id of the team
*/
function showNotification(showNotificationParameters: ShowNotificationParameters): void;
teamId: string;
/**
* @private
* Hide from docs.
* ------
* execute deep link API.
* @param deepLink deep link.
* Team display name
*/
function executeDeepLink(deepLinkParameters: ExecuteDeepLinkParameters): void;
teamName: string;
/**
* @private
* Hide from docs.
* ------
* Upload a custom App manifest directly to both team and personal scopes.
* This method works just for the first party Apps.
* Team description
*/
function uploadCustomApp(manifestBlob: Blob): void;
teamDescription?: string;
/**
* Navigates the Microsoft Teams app to the specified tab instance.
* @param tabInstance The tab instance to navigate to.
* Thumbnail Uri
*/
function navigateToTab(tabInstance: TabInstance): void;
thumbnailUri?: string;
/**
* Namespace to interact with the settings-specific part of the SDK.
* This object is usable only on the settings frame.
* The Office 365 group ID for the team with which the content is associated.
* This field is available only when the identity permission is requested in the manifest.
*/
namespace settings {
/**
* Sets the validity state for the settings.
* The initial value is false, so the user cannot save the settings until this is called with true.
* @param validityState Indicates whether the save or remove button is enabled for the user.
*/
function setValidityState(validityState: boolean): void;
/**
* Gets the settings for the current instance.
* @param callback The callback to invoke when the {@link Settings} object is retrieved.
*/
function getSettings(callback: (instanceSettings: Settings) => void): void;
/**
* Sets the settings for the current instance.
* This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
* @param settings The desired settings for this instance.
*/
function setSettings(instanceSettings: Settings): void;
/**
* Registers a handler for when the user attempts to save the settings. This handler should be used
* to create or update the underlying resource powering the content.
* The object passed to the handler must be used to notify whether to proceed with the save.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user selects the save button.
*/
function registerOnSaveHandler(handler: (evt: SaveEvent) => void): void;
/**
* Registers a handler for user attempts to remove content. This handler should be used
* to remove the underlying resource powering the content.
* The object passed to the handler must be used to indicate whether to proceed with the removal.
* Only one handler may be registered at a time. Subsequent registrations will override the first.
* @param handler The handler to invoke when the user selects the remove button.
*/
function registerOnRemoveHandler(handler: (evt: RemoveEvent) => void): void;
interface Settings {
/**
* A suggested display name for the new content.
* In the settings for an existing instance being updated, this call has no effect.
*/
suggestedDisplayName?: string;
/**
* Sets the URL to use for the content of this instance.
*/
contentUrl: string;
/**
* Sets the URL for the removal configuration experience.
*/
removeUrl?: string;
/**
* Sets the URL to use for the external link to view the underlying resource in a browser.
*/
websiteUrl?: string;
/**
* The developer-defined unique ID for the entity to which this content points.
*/
entityId: string;
}
interface SaveEvent {
/**
* Object containing properties passed as arguments to the settings.save event.
*/
result: SaveParameters;
/**
* Indicates that the underlying resource has been created and the settings can be saved.
*/
notifySuccess(): void;
/**
* Indicates that creation of the underlying resource failed and that the settings cannot be saved.
* @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
*/
notifyFailure(reason?: string): void;
}
interface RemoveEvent {
/**
* Indicates that the underlying resource has been removed and the content can be removed.
*/
notifySuccess(): void;
/**
* Indicates that removal of the underlying resource failed and that the content cannot be removed.
* @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
*/
notifyFailure(reason?: string): void;
}
interface SaveParameters {
/**
* Connector's webhook Url returned as arguments to settings.save event as part of user clicking on Save
*/
webhookUrl?: string;
}
}
groupId?: string;
/**
* Namespace to interact with the authentication-specific part of the SDK.
* This object is used for starting or completing authentication flows.
* Role of current user in the team
*/
namespace authentication {
userTeamRole?: UserTeamRole;
}
export declare const enum TaskModuleDimension {
Large = "large",
Medium = "medium",
Small = "small"
}
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
*/
export declare function initialize(hostWindow?: any): void;
/**
* Initializes the library. This must be called before any other SDK calls
* but after the frame is loaded successfully.
*/
export declare function _uninitialize(): void;
/**
* Enable print capability to support printing page using Ctrl+P and cmd+P
*/
export declare function enablePrintCapability(): void;
/**
* default print handler
*/
export declare function print(): void;
/**
* Retrieves the current context the frame is running in.
* @param callback The callback to invoke when the {@link Context} object is retrieved.
*/
export declare function getContext(callback: (context: Context) => void): void;
/**
* Registers a handler for theme changes.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user changes their theme.
*/
export declare function registerOnThemeChangeHandler(handler: (theme: string) => void): void;
/**
* Registers a handler for changes from or to full-screen view for a tab.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user toggles full-screen view for a tab.
*/
export declare function registerFullScreenHandler(handler: (isFullScreen: boolean) => void): void;
/**
* Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
* navigation stack should use this handler to navigate the user back within their frame. If an app finds
* that after running its back button handler it cannot handle the event it should call the navigateBack
* method to ask the Teams client to handle it instead.
* @param handler The handler to invoke when the user presses their Team client's back button.
*/
export declare function registerBackButtonHandler(handler: () => boolean): void;
/**
* Navigates back in the Teams client. See registerBackButtonHandler for more information on when
* it's appropriate to use this method.
*/
export declare function navigateBack(): void;
/**
* Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
* valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
* thrown. This function needs to be used only when navigating the frame to a URL in a different domain
* than the current one in a way that keeps the app informed of the change and allows the SDK to
* continue working.
* @param url The URL to navigate the frame to.
*/
export declare function navigateCrossDomain(url: string): void;
/**
* Allows an app to retrieve for this user tabs that are owned by this app.
* If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
* @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
* @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
*/
export declare function getTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all user joined teams
* @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
* @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
*/
export declare function getUserJoinedTeams(callback: (userJoinedTeamsInformation: UserJoinedTeamsInformation) => void, teamInstanceParameters?: TeamInstanceParameters): void;
/**
* Allows an app to retrieve the most recently used tabs for this user.
* @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
* @param tabInstanceParameters OPTIONAL Ignored, kept for future use
*/
export declare function getMruTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
/**
* Shares a deep link that a user can use to navigate back to a specific state in this page.
* @param deepLinkParameters ID and label for the link and fallback URL.
*/
export declare function shareDeepLink(deepLinkParameters: DeepLinkParameters): void;
/**
* @private
* Hide from docs.
* ------
* Opens a client-friendly preview of the specified file.
* @param file The file to preview.
*/
export declare function openFilePreview(filePreviewParameters: FilePreviewParameters): void;
export declare const enum NotificationTypes {
fileDownloadStart = "fileDownloadStart",
fileDownloadComplete = "fileDownloadComplete"
}
export interface ShowNotificationParameters {
message: string;
notificationType: NotificationTypes;
}
/**
* @private
* Hide from docs.
* ------
* display notification API.
* @param message Notification message.
* @param notificationType Notification type
*/
export declare function showNotification(showNotificationParameters: ShowNotificationParameters): void;
/**
* @private
* Hide from docs.
* ------
* Upload a custom App manifest directly to both team and personal scopes.
* This method works just for the first party Apps.
*/
export declare function uploadCustomApp(manifestBlob: Blob): void;
/**
* Navigates the Microsoft Teams app to the specified tab instance.
* @param tabInstance The tab instance to navigate to.
*/
export declare function navigateToTab(tabInstance: TabInstance): void;
/**
* Namespace to interact with the settings-specific part of the SDK.
* This object is usable only on the settings frame.
*/
export declare namespace settings {
/**
* Sets the validity state for the settings.
* The initial value is false, so the user cannot save the settings until this is called with true.
* @param validityState Indicates whether the save or remove button is enabled for the user.
*/
function setValidityState(validityState: boolean): void;
/**
* Gets the settings for the current instance.
* @param callback The callback to invoke when the {@link Settings} object is retrieved.
*/
function getSettings(callback: (instanceSettings: Settings) => void): void;
/**
* Sets the settings for the current instance.
* This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
* @param settings The desired settings for this instance.
*/
function setSettings(instanceSettings: Settings): void;
/**
* Registers a handler for when the user attempts to save the settings. This handler should be used
* to create or update the underlying resource powering the content.
* The object passed to the handler must be used to notify whether to proceed with the save.
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
* @param handler The handler to invoke when the user selects the save button.
*/
function registerOnSaveHandler(handler: (evt: SaveEvent) => void): void;
/**
* Registers a handler for user attempts to remove content. This handler should be used
* to remove the underlying resource powering the content.
* The object passed to the handler must be used to indicate whether to proceed with the removal.
* Only one handler may be registered at a time. Subsequent registrations will override the first.
* @param handler The handler to invoke when the user selects the remove button.
*/
function registerOnRemoveHandler(handler: (evt: RemoveEvent) => void): void;
interface Settings {
/**
* Registers the authentication handlers
* @param authenticateParameters A set of values that configure the authentication pop-up.
* A suggested display name for the new content.
* In the settings for an existing instance being updated, this call has no effect.
*/
function registerAuthenticationHandlers(authenticateParameters: AuthenticateParameters): void;
suggestedDisplayName?: string;
/**
* Initiates an authentication request, which opens a new window with the specified settings.
* Sets the URL to use for the content of this instance.
*/
function authenticate(authenticateParameters?: AuthenticateParameters): void;
contentUrl: string;
/**
* @private
* Hide from docs.
* ------
* Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
* if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
* @param authTokenRequest A set of values that configure the token request.
* Sets the URL for the removal configuration experience.
*/
function getAuthToken(authTokenRequest: AuthTokenRequest): void;
removeUrl?: string;
/**
* @private
* Hide from docs.
* ------
* Requests the decoded Azure AD user identity on behalf of the app.
* Sets the URL to use for the external link to view the underlying resource in a browser.
*/
function getUser(userRequest: UserRequest): void;
websiteUrl?: string;
/**
* Notifies the frame that initiated this authentication request that the request was successful.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
* The developer-defined unique ID for the entity to which this content points.
*/
function notifySuccess(result?: string, callbackUrl?: string): void;
entityId: string;
}
interface SaveEvent {
/**
* Notifies the frame that initiated this authentication request that the request failed.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
* Object containing properties passed as arguments to the settings.save event.
*/
function notifyFailure(reason?: string, callbackUrl?: string): void;
interface AuthenticateParameters {
/**
* The URL for the authentication pop-up.
*/
url: string;
/**
* The preferred width for the pop-up. This value can be ignored if outside the acceptable bounds.
*/
width?: number;
/**
* The preferred height for the pop-up. This value can be ignored if outside the acceptable bounds.
*/
height?: number;
/**
* A function that is called if the authentication succeeds, with the result returned from the authentication pop-up.
*/
successCallback?: (result?: string) => void;
/**
* A function that is called if the authentication fails, with the reason for the failure returned from the authentication pop-up.
*/
failureCallback?: (reason?: string) => void;
}
result: SaveParameters;
/**
* @private
* Hide from docs.
* ------
* Indicates that the underlying resource has been created and the settings can be saved.
*/
interface AuthTokenRequest {
/**
* An array of resource URIs identifying the target resources for which the token should be requested.
*/
resources: string[];
/**
* A function that is called if the token request succeeds, with the resulting token.
*/
successCallback?: (token: string) => void;
/**
* A function that is called if the token request fails, with the reason for the failure.
*/
failureCallback?: (reason: string) => void;
}
notifySuccess(): void;
/**
* @private
* Hide from docs.
* ------
* Indicates that creation of the underlying resource failed and that the settings cannot be saved.
* @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
*/
interface UserRequest {
/**
* A function that is called if the token request succeeds, with the resulting token.
*/
successCallback?: (user: UserProfile) => void;
/**
* A function that is called if the token request fails, with the reason for the failure.
*/
failureCallback?: (reason: string) => void;
}
/**
* @private
* Hide from docs.
* ------
*/
interface UserProfile {
/**
* The intended recipient of the token. The application that receives the token must verify that the audience
* value is correct and reject any tokens intended for a different audience.
*/
aud: string;
/**
* Identifies how the subject of the token was authenticated.
*/
amr: string[];
/**
* Stores the time at which the token was issued. It is often used to measure token freshness.
*/
iat: number;
/**
* Identifies the security token service (STS) that constructs and returns the token. In the tokens that Azure AD
* returns, the issuer is sts.windows.net. The GUID in the issuer claim value is the tenant ID of the Azure AD
* directory. The tenant ID is an immutable and reliable identifier of the directory.
*/
iss: string;
/**
* Provides the last name, surname, or family name of the user as defined in the Azure AD user object.
*/
family_name: string;
/**
* Provides the first or "given" name of the user, as set on the Azure AD user object.
*/
given_name: string;
/**
* Provides a human-readable value that identifies the subject of the token. This value is not guaranteed to
* be unique within a tenant and is designed to be used only for display purposes.
*/
unique_name: string;
/**
* Contains a unique identifier of an object in Azure AD. This value is immutable and cannot be reassigned or
* reused. Use the object ID to identify an object in queries to Azure AD.
*/
oid: string;
/**
* Identifies the principal about which the token asserts information, such as the user of an application.
* This value is immutable and cannot be reassigned or reused, so it can be used to perform authorization
* checks safely. Because the subject is always present in the tokens the Azure AD issues, we recommended
* using this value in a general-purpose authorization system.
*/
sub: string;
/**
* An immutable, non-reusable identifier that identifies the directory tenant that issued the token. You can
* use this value to access tenant-specific directory resources in a multitenant application. For example,
* you can use this value to identify the tenant in a call to the Graph API.
*/
tid: string;
/**
* Defines the time interval within which a token is valid. The service that validates the token should verify
* that the current date is within the token lifetime; otherwise it should reject the token. The service might
* allow for up to five minutes beyond the token lifetime to account for any differences in clock time ("time
* skew") between Azure AD and the service.
*/
exp: number;
nbf: number;
/**
* Stores the user name of the user principal.
*/
upn: string;
/**
* Stores the version number of the token.
*/
ver: string;
}
notifyFailure(reason?: string): void;
}
interface Context {
interface RemoveEvent {
/**
* The Office 365 group ID for the team with which the content is associated.
* This field is available only when the identity permission is requested in the manifest.
* Indicates that the underlying resource has been removed and the content can be removed.
*/
groupId?: string;
notifySuccess(): void;
/**
* The Microsoft Teams ID for the team with which the content is associated.
* Indicates that removal of the underlying resource failed and that the content cannot be removed.
* @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
*/
teamId?: string;
notifyFailure(reason?: string): void;
}
interface SaveParameters {
/**
* The name for the team with which the content is associated.
* Connector's webhook Url returned as arguments to settings.save event as part of user clicking on Save
*/
teamName?: string;
webhookUrl?: string;
}
}
/**
* Namespace to interact with the authentication-specific part of the SDK.
* This object is used for starting or completing authentication flows.
*/
export declare namespace authentication {
/**
* Registers the authentication handlers
* @param authenticateParameters A set of values that configure the authentication pop-up.
*/
function registerAuthenticationHandlers(authenticateParameters: AuthenticateParameters): void;
/**
* Initiates an authentication request, which opens a new window with the specified settings.
*/
function authenticate(authenticateParameters?: AuthenticateParameters): void;
/**
* @private
* Hide from docs.
* ------
* Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
* if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
* @param authTokenRequest A set of values that configure the token request.
*/
function getAuthToken(authTokenRequest: AuthTokenRequest): void;
/**
* @private
* Hide from docs.
* ------
* Requests the decoded Azure AD user identity on behalf of the app.
*/
function getUser(userRequest: UserRequest): void;
/**
* Notifies the frame that initiated this authentication request that the request was successful.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
*/
function notifySuccess(result?: string, callbackUrl?: string): void;
/**
* Notifies the frame that initiated this authentication request that the request failed.
* This function is usable only on the authentication window.
* This call causes the authentication window to be closed.
* @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
* @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
*/
function notifyFailure(reason?: string, callbackUrl?: string): void;
interface AuthenticateParameters {
/**
* The Microsoft Teams ID for the channel with which the content is associated.
* The URL for the authentication pop-up.
*/
channelId?: string;
url: string;
/**
* The name for the channel with which the content is associated.
* The preferred width for the pop-up. This value can be ignored if outside the acceptable bounds.
*/
channelName?: string;
width?: number;
/**
* The developer-defined unique ID for the entity this content points to.
* The preferred height for the pop-up. This value can be ignored if outside the acceptable bounds.
*/
entityId: string;
height?: number;
/**
* The developer-defined unique ID for the sub-entity this content points to.
* This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
* A function that is called if the authentication succeeds, with the result returned from the authentication pop-up.
*/
subEntityId?: string;
successCallback?: (result?: string) => void;
/**
* The current locale that the user has configured for the app formatted as
* languageId-countryId (for example, en-us).
* A function that is called if the authentication fails, with the reason for the failure returned from the authentication pop-up.
*/
locale: string;
failureCallback?: (reason?: string) => void;
}
/**
* @private
* Hide from docs.
* ------
*/
interface AuthTokenRequest {
/**
* @deprecated Use loginHint or userPrincipalName.
* The UPN of the current user.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
* An array of resource URIs identifying the target resources for which the token should be requested.
*/
upn?: string;
resources: string[];
/**
* The Azure AD tenant ID of the current user.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
* A function that is called if the token request succeeds, with the resulting token.
*/
tid?: string;
successCallback?: (token: string) => void;
/**
* The current UI theme.
* A function that is called if the token request fails, with the reason for the failure.
*/
theme?: string;
/**
* Indication whether the tab is in full-screen mode.
*/
isFullScreen?: boolean;
/**
* The type of the team.
*/
teamType?: TeamType;
/**
* The root ShatePoint folder associated with the team.
*/
teamSiteUrl?: string;
/**
* The relative path to the SharePoint folder associated with the channel.
*/
channelRelativeUrl?: string;
/**
* Unique ID for the current Teams session for use in correlating telemetry data.
*/
sessionId?: string;
/**
* The user's role in the team.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to the user's role, and never as proof of her role.
*/
userTeamRole?: UserTeamRole;
/**
* The Microsoft Teams ID for the chat with which the content is associated.
*/
chatId?: string;
/**
* A value suitable for use as a login_hint when authenticating with Azure AD.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
loginHint?: string;
/**
* The UPN of the current user. This may be an externally-authenticated UPN (e.g., guest users).
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
userPrincipalName?: string;
/**
* The Azure AD object id of the current user.
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
userObjectId?: string;
/**
* Indicates wheather team is archived.
* Apps should use this as a signal to prevent any changes to content associated with archived teams.
*/
isTeamArchived?: boolean;
/**
* The type of the host client. Possible values are : android, ios, web, desktop
*/
hostClientType?: HostClientType;
failureCallback?: (reason: string) => void;
}
interface DeepLinkParameters {
/**
* @private
* Hide from docs.
* ------
*/
interface UserRequest {
/**
* The developer-defined unique ID for the sub-entity to which this deep link points in the current entity.
* This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
* A function that is called if the token request succeeds, with the resulting token.
*/
subEntityId: string;
successCallback?: (user: UserProfile) => void;
/**
* The label for the sub-entity that should be displayed when the deep link is rendered in a client.
* A function that is called if the token request fails, with the reason for the failure.
*/
subEntityLabel: string;
/**
* The fallback URL to which to navigate the user if the client cannot render the page.
* This URL should lead directly to the sub-entity.
*/
subEntityWebUrl?: string;
failureCallback?: (reason: string) => void;
}

@@ -819,139 +598,344 @@ /**

*/
interface FilePreviewParameters {
interface UserProfile {
/**
* The developer-defined unique ID for the file.
* The intended recipient of the token. The application that receives the token must verify that the audience
* value is correct and reject any tokens intended for a different audience.
*/
entityId: string;
aud: string;
/**
* The display name of the file.
* Identifies how the subject of the token was authenticated.
*/
title: string;
amr: string[];
/**
* An optional description of the file.
* Stores the time at which the token was issued. It is often used to measure token freshness.
*/
description?: string;
iat: number;
/**
* The file extension; e.g. pptx, docx, etc.
* Identifies the security token service (STS) that constructs and returns the token. In the tokens that Azure AD
* returns, the issuer is sts.windows.net. The GUID in the issuer claim value is the tenant ID of the Azure AD
* directory. The tenant ID is an immutable and reliable identifier of the directory.
*/
type: string;
iss: string;
/**
* A url to the source of the file, used to open the content in the user's default browser
* Provides the last name, surname, or family name of the user as defined in the Azure AD user object.
*/
objectUrl: string;
family_name: string;
/**
* Optional; an alternate self-authenticating url used to preview the file in Mobile clients and offer it for download by the user
* Provides the first or "given" name of the user, as set on the Azure AD user object.
*/
downloadUrl?: string;
given_name: string;
/**
* Optional; an alternate url optimized for previewing the file in Teams web and desktop clients
* Provides a human-readable value that identifies the subject of the token. This value is not guaranteed to
* be unique within a tenant and is designed to be used only for display purposes.
*/
webPreviewUrl?: string;
unique_name: string;
/**
* Optional; an alternate url that allows editing of the file in Teams web and desktop clients
* Contains a unique identifier of an object in Azure AD. This value is immutable and cannot be reassigned or
* reused. Use the object ID to identify an object in queries to Azure AD.
*/
webEditUrl?: string;
oid: string;
/**
* Optional; the base url of the site where the file is hosted
* Identifies the principal about which the token asserts information, such as the user of an application.
* This value is immutable and cannot be reassigned or reused, so it can be used to perform authorization
* checks safely. Because the subject is always present in the tokens the Azure AD issues, we recommended
* using this value in a general-purpose authorization system.
*/
baseUrl?: string;
sub: string;
/**
* Optional; indicates whether the file should be opened in edit mode
* An immutable, non-reusable identifier that identifies the directory tenant that issued the token. You can
* use this value to access tenant-specific directory resources in a multitenant application. For example,
* you can use this value to identify the tenant in a call to the Graph API.
*/
editFile?: boolean;
tid: string;
/**
* Optional; the developer-defined unique ID for the sub-entity to return to when the file stage closes.
* This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
* Defines the time interval within which a token is valid. The service that validates the token should verify
* that the current date is within the token lifetime; otherwise it should reject the token. The service might
* allow for up to five minutes beyond the token lifetime to account for any differences in clock time ("time
* skew") between Azure AD and the service.
*/
subEntityId?: string;
}
/**
* @private
* Internal use only
* Sends a custom action message to Teams.
* @param actionName Specifies name of the custom action to be sent
* @param args Specifies additional arguments passed to the action
* @returns id of sent message
*/
function sendCustomMessage(actionName: string, args?: any[]): number;
interface TaskInfo {
exp: number;
nbf: number;
/**
* The url to be rendered in the webview/iframe.
* Stores the user name of the user principal.
*/
url?: string;
upn: string;
/**
* JSON defining an adaptive card.
* Stores the version number of the token.
*/
card?: string;
/**
* The requested height of the webview/iframe.
*/
height?: TaskModuleDimension | Number;
/**
* The requested width of the webview/iframe.
*/
width?: TaskModuleDimension | Number;
/**
* Title of the task module.
*/
title?: string;
/**
* If client doesnt support the URL, the URL that needs to be opened in the browser.
*/
fallbackUrl?: string;
/**
* Specifies a bot ID to send the result of the user's interaction with the task module.
* If specified, the bot will receive a task/complete invoke event with a JSON object
* in the event payload.
*/
completionBotId?: string;
ver: string;
}
}
export interface Context {
/**
* Namespace to interact with the task module-specific part of the SDK.
* This object is usable only on the content frame.
* The Office 365 group ID for the team with which the content is associated.
* This field is available only when the identity permission is requested in the manifest.
*/
namespace tasks {
/**
* Allows an app to open the task module.
* @param taskInfo An object containing the parameters of the task module
* @param submitHandler Handler to call when the task module is completed
*/
function startTask(taskInfo: TaskInfo, submitHandler?: (err: string, result: string) => void): void;
/**
* Submit the task module.
* @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
* @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
*/
function submitTask(result?: string | object, appIds?: string | string[]): void;
}
groupId?: string;
/**
* @private
* Hide from docs
* --------
* Information about all members in a chat
* The Microsoft Teams ID for the team with which the content is associated.
*/
interface ChatMembersInformation {
members: ThreadMember[];
}
teamId?: string;
/**
* @private
* Hide from docs
* --------
* Information about a chat member
* The name for the team with which the content is associated.
*/
interface ThreadMember {
/**
* The member's user principal name in the current tenant.
*/
upn: string;
}
teamName?: string;
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all chat members
* The Microsoft Teams ID for the channel with which the content is associated.
*/
channelId?: string;
/**
* The name for the channel with which the content is associated.
*/
channelName?: string;
/**
* The developer-defined unique ID for the entity this content points to.
*/
entityId: string;
/**
* The developer-defined unique ID for the sub-entity this content points to.
* This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
*/
subEntityId?: string;
/**
* The current locale that the user has configured for the app formatted as
* languageId-countryId (for example, en-us).
*/
locale: string;
/**
* @deprecated Use loginHint or userPrincipalName.
* The UPN of the current user.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
upn?: string;
/**
* The Azure AD tenant ID of the current user.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
tid?: string;
/**
* The current UI theme.
*/
theme?: string;
/**
* Indication whether the tab is in full-screen mode.
*/
isFullScreen?: boolean;
/**
* The type of the team.
*/
teamType?: TeamType;
/**
* The root ShatePoint folder associated with the team.
*/
teamSiteUrl?: string;
/**
* The relative path to the SharePoint folder associated with the channel.
*/
channelRelativeUrl?: string;
/**
* Unique ID for the current Teams session for use in correlating telemetry data.
*/
sessionId?: string;
/**
* The user's role in the team.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to the user's role, and never as proof of her role.
*/
userTeamRole?: UserTeamRole;
/**
* The Microsoft Teams ID for the chat with which the content is associated.
*/
chatId?: string;
/**
* A value suitable for use as a login_hint when authenticating with Azure AD.
* Because a malicious party can run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
loginHint?: string;
/**
* The UPN of the current user. This may be an externally-authenticated UPN (e.g., guest users).
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the members are and never as proof of membership.
* @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
function getChatMembers(callback: (chatMembersInformation: ChatMembersInformation) => void): void;
userPrincipalName?: string;
/**
* The Azure AD object id of the current user.
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the user is and never as proof of identity.
* This field is available only when the identity permission is requested in the manifest.
*/
userObjectId?: string;
/**
* Indicates wheather team is archived.
* Apps should use this as a signal to prevent any changes to content associated with archived teams.
*/
isTeamArchived?: boolean;
/**
* The type of the host client. Possible values are : android, ios, web, desktop
*/
hostClientType?: HostClientType;
}
export interface DeepLinkParameters {
/**
* The developer-defined unique ID for the sub-entity to which this deep link points in the current entity.
* This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
*/
subEntityId: string;
/**
* The label for the sub-entity that should be displayed when the deep link is rendered in a client.
*/
subEntityLabel: string;
/**
* The fallback URL to which to navigate the user if the client cannot render the page.
* This URL should lead directly to the sub-entity.
*/
subEntityWebUrl?: string;
}
/**
* @private
* Hide from docs.
* ------
*/
export interface FilePreviewParameters {
/**
* The developer-defined unique ID for the file.
*/
entityId: string;
/**
* The display name of the file.
*/
title: string;
/**
* An optional description of the file.
*/
description?: string;
/**
* The file extension; e.g. pptx, docx, etc.
*/
type: string;
/**
* A url to the source of the file, used to open the content in the user's default browser
*/
objectUrl: string;
/**
* Optional; an alternate self-authenticating url used to preview the file in Mobile clients and offer it for download by the user
*/
downloadUrl?: string;
/**
* Optional; an alternate url optimized for previewing the file in Teams web and desktop clients
*/
webPreviewUrl?: string;
/**
* Optional; an alternate url that allows editing of the file in Teams web and desktop clients
*/
webEditUrl?: string;
/**
* Optional; the base url of the site where the file is hosted
*/
baseUrl?: string;
/**
* Optional; indicates whether the file should be opened in edit mode
*/
editFile?: boolean;
/**
* Optional; the developer-defined unique ID for the sub-entity to return to when the file stage closes.
* This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
*/
subEntityId?: string;
}
/**
* @private
* Internal use only
* Sends a custom action message to Teams.
* @param actionName Specifies name of the custom action to be sent
* @param args Specifies additional arguments passed to the action
* @returns id of sent message
*/
export declare function sendCustomMessage(actionName: string, args?: any[]): number;
export interface TaskInfo {
/**
* The url to be rendered in the webview/iframe.
*/
url?: string;
/**
* JSON defining an adaptive card.
*/
card?: string;
/**
* The requested height of the webview/iframe.
*/
height?: TaskModuleDimension | Number;
/**
* The requested width of the webview/iframe.
*/
width?: TaskModuleDimension | Number;
/**
* Title of the task module.
*/
title?: string;
/**
* If client doesnt support the URL, the URL that needs to be opened in the browser.
*/
fallbackUrl?: string;
/**
* Specifies a bot ID to send the result of the user's interaction with the task module.
* If specified, the bot will receive a task/complete invoke event with a JSON object
* in the event payload.
*/
completionBotId?: string;
}
/**
* Namespace to interact with the task module-specific part of the SDK.
* This object is usable only on the content frame.
*/
export declare namespace tasks {
/**
* Allows an app to open the task module.
* @param taskInfo An object containing the parameters of the task module
* @param submitHandler Handler to call when the task module is completed
*/
function startTask(taskInfo: TaskInfo, submitHandler?: (err: string, result: string) => void): void;
/**
* Submit the task module.
* @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
* @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
*/
function submitTask(result?: string | object, appIds?: string | string[]): void;
}
/**
* @private
* Hide from docs
* --------
* Information about all members in a chat
*/
export interface ChatMembersInformation {
members: ThreadMember[];
}
/**
* @private
* Hide from docs
* --------
* Information about a chat member
*/
export interface ThreadMember {
/**
* The member's user principal name in the current tenant.
*/
upn: string;
}
/**
* @private
* Hide from docs
* ------
* Allows an app to retrieve information of all chat members
* Because a malicious party run your content in a browser, this value should
* be used only as a hint as to who the members are and never as proof of membership.
* @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
*/
export declare function getChatMembers(callback: (chatMembersInformation: ChatMembersInformation) => void): void;
{
"name": "@microsoft/teams-js",
"author": "Microsoft Teams",
"version": "1.4.0-beta.4.0",
"version": "1.4.0-beta.5",
"description": "Microsoft Client SDK for building app for Microsoft teams",

@@ -6,0 +6,0 @@ "main": "./dist/MicrosoftTeams.min.js",

@@ -13,3 +13,4 @@ # [Microsoft Teams JavaScript Library](https://msdn.microsoft.com/en-us/microsoft-teams/)

3. `yarn install`
4. `gulp`
4. `yarn build`
5. to run Unit test `yarn test`

@@ -16,0 +17,0 @@ ### Installation

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc