Socket
Socket
Sign inDemoInstall

@microsoft/teams-js

Package Overview
Dependencies
Maintainers
3
Versions
488
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.3.0-beta.1 to 1.3.0-beta.2

198

dist/MicrosoftTeams.d.ts

@@ -8,2 +8,9 @@

}
interface TeamsNativeClient {
framelessPostMessage(msg: String): void;
}
interface Window {
nativeInterface: TeamsNativeClient;
onNativeMessage(evt: MessageEvent): void;
}
/**

@@ -14,2 +21,111 @@ * 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.
*/
namespace menus {
/**
* Represents information about item in View Configuration.
*/
interface ViewConfiguration {
/**
* Unique identifier of view.
*/
id: string;
/**
* Display title of the view.
*/
title: string;
/**
* Additional information for accessibility.
*/
contentDescription?: string;
}
/**
* Represents information about menu item for Action Menu and Navigation Bar Menu.
*/
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;
}
/**
* Represents information about view to show on Navigation Bar Menu item selection
*/
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;
}
/**
* Represents information about tabs for an app

@@ -100,2 +216,7 @@ */

}
const enum TaskModuleDimension {
Large = "large",
Medium = "medium",
Small = "small",
}
/**

@@ -480,4 +601,5 @@ * Initializes the library. This must be called before any other SDK calls

/**
* @deprecated Use loginHint or userPrincipalName.
* The UPN of the current user.
* Because a malicious party can host malicious content in a browser, this value should
* 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.

@@ -489,3 +611,3 @@ * This field is available only when the identity permission is requested in the manifest.

* The Azure AD tenant ID of the current user.
* Because a malicious party can host malicious content in a browser, this value should
* 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.

@@ -517,2 +639,4 @@ * This field is available only when the identity permission is requested in the manifest.

* 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.
*/

@@ -524,2 +648,28 @@ userTeamRole?: UserTeamRole;

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;
}

@@ -580,2 +730,46 @@ interface DeepLinkParameters {

}
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;
}
/**
* Namespace to interact with the task module-specific part of the SDK.
* This object is usable only on the content frame.
*/
namespace tasks {
/**
* Allows an app to open the task module.
* @param taskInfo An object containing the parameters of the task module
* @param completionHandler Handler to call when the task module is completed
*/
function startTask(taskInfo: TaskInfo, completionHandler?: (err: string, result: string) => void): void;
/**
* Complete 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 completeTask(result?: string | object, appIds?: string[]): void;
}
}

@@ -16,3 +16,3 @@ ;(function(root, factory) {

"use strict";
var version = "1.3.0-beta.1";
var version = "1.3.0-beta.2";
var validOrigins = [

@@ -38,5 +38,92 @@ "https://teams.microsoft.com",

};
/**
* 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.
*/
var menus;
(function (menus) {
/**
* Represents information about menu item for Action Menu and Navigation Bar Menu.
*/
var MenuItem = (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]);
}
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;

@@ -74,3 +161,2 @@ var parentWindow;

var messageListener = function (evt) { return processMessage(evt); };
currentWindow.addEventListener("message", messageListener, false);
// If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,

@@ -82,2 +168,10 @@ // it's the window that opened us (i.e., window.opener)

: currentWindow.opener;
if (!parentWindow) {
isFramelessWindow = true;
window.onNativeMessage = handleParentMessage;
}
else {
// For iFrame scenario, add listener to listen 'message'
currentWindow.addEventListener("message", messageListener, false);
}
try {

@@ -109,2 +203,5 @@ // Send the initialized message to any origin, because at this point we most likely don't know the origin

}
if (!isFramelessWindow) {
currentWindow.removeEventListener("message", messageListener, false);
}
initializeCalled = false;

@@ -121,3 +218,3 @@ parentWindow = null;

hostClientType = null;
currentWindow.removeEventListener("message", messageListener, false);
isFramelessWindow = false;
};

@@ -873,13 +970,18 @@ }

function sendMessageRequest(targetWindow, actionName,
// tslint:disable-next-line:no-any
// tslint:disable-next-line: no-any
args) {
var request = createMessageRequest(actionName, args);
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);
if (isFramelessWindow) {
currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(request));
}
else {
getTargetMessageQueue(targetWindow).push(request);
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);
}
}

@@ -912,2 +1014,34 @@ return request.id;

}
/**
* 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) {
/**
* Allows an app to open the task module.
* @param taskInfo An object containing the parameters of the task module
* @param completionHandler Handler to call when the task module is completed
*/
function startTask(taskInfo, completionHandler) {
// Ensure that the tab content is initialized
ensureInitialized(frameContexts.content);
var messageId = sendMessageRequest(parentWindow, "tasks.startTask", [
taskInfo
]);
callbacks[messageId] = completionHandler;
}
tasks.startTask = startTask;
/**
* Complete 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 completeTask(result, appIds) {
// Ensure that the tab content is initialized
ensureInitialized(frameContexts.content);
sendMessageRequest(parentWindow, "tasks.completeTask", [result, appIds]);
}
tasks.completeTask = completeTask;
})(tasks = microsoftTeams.tasks || (microsoftTeams.tasks = {}));
})(microsoftTeams || (microsoftTeams = {}));

@@ -914,0 +1048,0 @@

2

dist/MicrosoftTeams.min.js

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

!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.microsoftTeams=e()}(this,function(){var t;return function(t){"use strict";function e(){if(!R){R=!0,H=this._window||window;var t=function(t){return y(t)};H.addEventListener("message",t,!1),O=H.parent!==H.self?H.parent:H.opener;try{x="*";var e=S(O,"initialize",[D]);Y[e]=function(t,e){B=t,M=e}}finally{x=null}this._uninitialize=function(){B&&(i(null),r(null),s(null)),B===_.settings&&J.registerOnSaveHandler(null),B===_.remove&&J.registerOnRemoveHandler(null),R=!1,O=null,x=null,j=[],L=null,F=null,V=[],X=0,Y={},B=null,M=null,H.removeEventListener("message",t,!1)}}}function n(t){p();var e=S(O,"getContext");Y[e]=t}function i(t){p(),z=t}function o(t){z&&z(t),L&&S(L,"themeChange",[t])}function r(t){p(),q=t}function a(t){q&&q(t)}function s(t){p(),G=t}function u(){G&&G()||c()}function c(){p();var t=S(O,"navigateBack",[]);Y[t]=function(t){if(!t)throw new Error("Back navigation is not supported in the current client or context.")}}function l(t){p(_.content,_.settings,_.remove);var e=S(O,"navigateCrossDomain",[t]);Y[e]=function(t){if(!t)throw new Error("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.")}}function f(t,e){p();var n=S(O,"getTabInstances",[e]);Y[n]=t}function h(t,e){p();var n=S(O,"getMruTabInstances",[e]);Y[n]=t}function d(t){p(_.content),S(O,"shareDeepLink",[t.subEntityId,t.subEntityLabel,t.subEntityWebUrl])}function v(t){p(_.content);var e=[t.entityId,t.title,t.description,t.type,t.objectUrl,t.downloadUrl,t.webPreviewUrl,t.webEditUrl];t.baseUrl&&e.push(t.baseUrl),S(O,"openFilePreview",e)}function g(t){p();var e=S(O,"navigateToTab",[t]);Y[e]=function(t){if(!t)throw new Error("Invalid internalTabInstanceId and/or channelId were/was provided")}}function p(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!R)throw new Error("The library has not yet been initialized");if(B&&t&&t.length>0){for(var n=!1,i=0;i<t.length;i++)if(t[i]===B){n=!0;break}if(!n)throw new Error("This call is not allowed in the '"+B+"' context")}}function y(t){if(t&&t.data&&"object"==typeof t.data){var e=t.source||t.originalEvent.source,n=t.origin||t.originalEvent.origin;e===H||n!==H.location.origin&&A.indexOf(n.toLowerCase())===-1||(m(e,n),e===O?b(t):e===L&&w(t))}}function m(t,e){O&&t!==O?L&&t!==L||(L=t,F=e):(O=t,x=e),O&&O.closed&&(O=null,x=null),L&&L.closed&&(L=null,F=null),T(O),T(L)}function b(t){if("id"in t.data){var e=t.data,n=Y[e.id];n&&(n.apply(null,e.args),delete Y[e.id])}else if("func"in t.data){var e=t.data,i=W[e.func];i&&i.apply(this,e.args)}}function w(t){if("id"in t.data&&"func"in t.data){var e=t.data,n=W[e.func];if(n){var i=n.apply(this,e.args);i&&I(L,e.id,Array.isArray(i)?i:[i])}else{var o=S(O,e.func,e.args);Y[o]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];L&&I(L,e.id,t)}}}}function k(t){return t===O?j:t===L?V:[]}function C(t){return t===O?x:t===L?F:null}function T(t){for(var e=C(t),n=k(t);t&&e&&n.length>0;)t.postMessage(n.shift(),e)}function E(t,e){var n=H.setInterval(function(){0===k(t).length&&(clearInterval(n),e())},100)}function S(t,e,n){var i=N(e,n),o=C(t);return t&&o?t.postMessage(i,o):k(t).push(i),i.id}function I(t,e,n){var i=U(e,n),o=C(t);t&&o&&t.postMessage(i,o)}function N(t,e){return{id:X++,func:t,args:e||[]}}function U(t,e){return{id:t,args:e||[]}}var H,O,x,L,F,B,M,z,D="1.3.0-beta.1",A=["https://teams.microsoft.com","https://teams.microsoft.us","https://int.teams.microsoft.com","https://devspaces.skype.com","https://ssauth.skype.com","http://dev.local"],W={},_={settings:"settings",content:"content",authentication:"authentication",remove:"remove"},P={desktop:"desktop",web:"web"},R=!1,j=[],V=[],X=0,Y={};W.themeChange=o;var q;W.fullScreenChange=a;var G;W.backButtonPress=u,t.initialize=e,t.getContext=n,t.registerOnThemeChangeHandler=i,t.registerFullScreenHandler=r,t.registerBackButtonHandler=s,t.navigateBack=c,t.navigateCrossDomain=l,t.getTabInstances=f,t.getMruTabInstances=h,t.shareDeepLink=d,t.openFilePreview=v,t.navigateToTab=g;var J;!function(t){function e(t){p(_.settings,_.remove),S(O,"settings.setValidityState",[t])}function n(t){p(_.settings,_.remove);var e=S(O,"settings.getSettings");Y[e]=t}function i(t){p(_.settings),S(O,"settings.setSettings",[t])}function o(t){p(_.settings),u=t}function r(t){p(_.remove),c=t}function a(t){var e=new l(t);u?u(e):e.notifySuccess()}function s(){var t=new f;c?c(t):t.notifySuccess()}var u,c;W["settings.save"]=a,W["settings.remove"]=s,t.setValidityState=e,t.getSettings=n,t.setSettings=i,t.registerOnSaveHandler=o,t.registerOnRemoveHandler=r;var l=function(){function t(t){this.notified=!1,this.result=t?t:{}}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),S(O,"settings.save.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),S(O,"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}(),f=function(){function t(){this.notified=!1}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),S(O,"settings.remove.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),S(O,"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}()}(J=t.settings||(t.settings={}));var K;!function(t){function e(t){g=t}function n(t){var e=void 0!==t?t:g;if(p(_.content,_.settings,_.remove),M===P.desktop){var n=document.createElement("a");n.href=e.url;var i=S(O,"authentication.authenticate",[n.href,e.width,e.height]);Y[i]=function(t,n){t?e.successCallback(n):e.failureCallback(n)}}else a(e)}function i(t){p();var e=S(O,"authentication.getAuthToken",[t.resources]);Y[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}}function o(t){p();var e=S(O,"authentication.getUser");Y[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}}function r(){s();try{L&&L.close()}finally{L=null,F=null}}function a(t){g=t,r();var e=g.width||600,n=g.height||400;e=Math.min(e,H.outerWidth-400),n=Math.min(n,H.outerHeight-200);var i=document.createElement("a");i.href=g.url;var o="undefined"!=typeof H.screenLeft?H.screenLeft:H.screenX,a="undefined"!=typeof H.screenTop?H.screenTop:H.screenY;o+=H.outerWidth/2-e/2,a+=H.outerHeight/2-n/2,L=H.open(i.href,"_blank","toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top="+a+", left="+o+", width="+e+", height="+n),L?u():h("FailedToOpenWindow")}function s(){y&&(clearInterval(y),y=0),delete W.initialize,delete W.navigateCrossDomain}function u(){s(),y=H.setInterval(function(){if(!L||L.closed)h("CancelledByUser");else{var t=F;try{F="*",S(L,"ping")}finally{F=t}}},100),W.initialize=function(){return[_.authentication,M]},W.navigateCrossDomain=function(t){return!1}}function c(t,e){d(e,"result",t),p(_.authentication),S(O,"authentication.authenticate.success",[t]),E(O,function(){return setTimeout(function(){return H.close()},200)})}function l(t,e){d(e,"reason",t),p(_.authentication),S(O,"authentication.authenticate.failure",[t]),E(O,function(){return setTimeout(function(){return H.close()},200)})}function f(t){try{g&&g.successCallback&&g.successCallback(t)}finally{g=null,r()}}function h(t){try{g&&g.failureCallback&&g.failureCallback(t)}finally{g=null,r()}}function d(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)),H.location.assign(v(i.href,"authSuccess",""))),e&&"reason"===e&&(n&&(i.href=v(i.href,"reason",n)),H.location.assign(v(i.href,"authFailure",""))))}}function v(t,e,n){var i=t.indexOf("#"),o=i===-1?"#":t.substr(i);return o=o+"&"+e+(""!==n?"="+n:""),t=i===-1?t:t.substr(0,i),t+o}var g,y;W["authentication.authenticate.success"]=f,W["authentication.authenticate.failure"]=h,t.registerAuthenticationHandlers=e,t.authenticate=n,t.getAuthToken=i,t.getUser=o,t.notifySuccess=c,t.notifyFailure=l}(K=t.authentication||(t.authentication={}))}(t||(t={})),t});
!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.microsoftTeams=e()}(this,function(){var t;return function(t){"use strict";function e(){if(!R){R=!0,x=this._window||window;var t=function(t){return m(t)};A=x.parent!==x.self?x.parent:x.opener,A?x.addEventListener("message",t,!1):(j=!0,window.onNativeMessage=w);try{D="*";var e=M(A,"initialize",[O]);q[e]=function(t,e){V=t,W=e}}finally{D=null}this._uninitialize=function(){V&&(i(null),a(null),s(null)),V===H.settings&&Q.registerOnSaveHandler(null),V===H.remove&&Q.registerOnRemoveHandler(null),j||x.removeEventListener("message",t,!1),R=!1,A=null,D=null,J=[],F=null,z=null,X=[],Y=0,q={},V=null,W=null,j=!1}}}function n(t){p();var e=M(A,"getContext");q[e]=t}function i(t){p(),_=t}function o(t){_&&_(t),F&&M(F,"themeChange",[t])}function a(t){p(),G=t}function r(t){G&&G(t)}function s(t){p(),K=t}function u(){K&&K()||c()}function c(){p();var t=M(A,"navigateBack",[]);q[t]=function(t){if(!t)throw new Error("Back navigation is not supported in the current client or context.")}}function f(t){p(H.content,H.settings,H.remove);var e=M(A,"navigateCrossDomain",[t]);q[e]=function(t){if(!t)throw new Error("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.")}}function l(t,e){p();var n=M(A,"getTabInstances",[e]);q[n]=t}function h(t,e){p();var n=M(A,"getMruTabInstances",[e]);q[n]=t}function v(t){p(H.content),M(A,"shareDeepLink",[t.subEntityId,t.subEntityLabel,t.subEntityWebUrl])}function d(t){p(H.content);var e=[t.entityId,t.title,t.description,t.type,t.objectUrl,t.downloadUrl,t.webPreviewUrl,t.webEditUrl];t.baseUrl&&e.push(t.baseUrl),M(A,"openFilePreview",e)}function g(t){p();var e=M(A,"navigateToTab",[t]);q[e]=function(t){if(!t)throw new Error("Invalid internalTabInstanceId and/or channelId were/was provided")}}function p(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!R)throw new Error("The library has not yet been initialized");if(V&&t&&t.length>0){for(var n=!1,i=0;i<t.length;i++)if(t[i]===V){n=!0;break}if(!n)throw new Error("This call is not allowed in the '"+V+"' context")}}function m(t){if(t&&t.data&&"object"==typeof t.data){var e=t.source||t.originalEvent.source,n=t.origin||t.originalEvent.origin;e===x||n!==x.location.origin&&B.indexOf(n.toLowerCase())===-1||(y(e,n),e===A?w(t):e===F&&b(t))}}function y(t,e){A&&t!==A?F&&t!==F||(F=t,z=e):(A=t,D=e),A&&A.closed&&(A=null,D=null),F&&F.closed&&(F=null,z=null),C(A),C(F)}function w(t){if("id"in t.data){var e=t.data,n=q[e.id];n&&(n.apply(null,e.args),delete q[e.id])}else if("func"in t.data){var e=t.data,i=L[e.func];i&&i.apply(this,e.args)}}function b(t){if("id"in t.data&&"func"in t.data){var e=t.data,n=L[e.func];if(n){var i=n.apply(this,e.args);i&&E(F,e.id,Array.isArray(i)?i:[i])}else{var o=M(A,e.func,e.args);q[o]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];F&&E(F,e.id,t)}}}}function k(t){return t===A?J:t===F?X:[]}function T(t){return t===A?D:t===F?z:null}function C(t){for(var e=T(t),n=k(t);t&&e&&n.length>0;)t.postMessage(n.shift(),e)}function I(t,e){var n=x.setInterval(function(){0===k(t).length&&(clearInterval(n),e())},100)}function M(t,e,n){var i=S(e,n);if(j)x.nativeInterface.framelessPostMessage(JSON.stringify(i));else{var o=T(t);t&&o?t.postMessage(i,o):k(t).push(i)}return i.id}function E(t,e,n){var i=N(e,n),o=T(t);t&&o&&t.postMessage(i,o)}function S(t,e){return{id:Y++,func:t,args:e||[]}}function N(t,e){return{id:t,args:e||[]}}var U,O="1.3.0-beta.2",B=["https://teams.microsoft.com","https://teams.microsoft.us","https://int.teams.microsoft.com","https://devspaces.skype.com","https://ssauth.skype.com","http://dev.local"],L={},H={settings:"settings",content:"content",authentication:"authentication",remove:"remove"},P={desktop:"desktop",web:"web"};!function(t){function e(t,e){p(),l=e,M(A,"setUpViews",[t])}function n(t){l&&l(t)||(p(),M(A,"viewConfigItemPress",[t]))}function i(t,e){p(),c=e,M(A,"setNavBarMenu",[t])}function o(t){c&&c(t)||(p(),M(A,"handleNavBarMenuItemPress",[t]))}function a(t,e){p(),f=e,M(A,"showActionMenu",[t])}function r(t){f&&f(t)||(p(),M(A,"handleActionMenuItemPress",[t]))}var s=function(){function t(){this.enabled=!0}return t}();t.MenuItem=s;var u;!function(t){t.dropDown="dropDown",t.popOver="popOver"}(u=t.MenuListType||(t.MenuListType={}));var c;L.navBarMenuItemPress=o;var f;L.actionMenuItemPress=r;var l;L.setModuleView=n,t.setUpViews=e,t.setNavBarMenu=i,t.showActionMenu=a}(U=t.menus||(t.menus={}));var x,A,D,F,z,V,W,_,R=!1,j=!1,J=[],X=[],Y=0,q={};L.themeChange=o;var G;L.fullScreenChange=r;var K;L.backButtonPress=u,t.initialize=e,t.getContext=n,t.registerOnThemeChangeHandler=i,t.registerFullScreenHandler=a,t.registerBackButtonHandler=s,t.navigateBack=c,t.navigateCrossDomain=f,t.getTabInstances=l,t.getMruTabInstances=h,t.shareDeepLink=v,t.openFilePreview=d,t.navigateToTab=g;var Q;!function(t){function e(t){p(H.settings,H.remove),M(A,"settings.setValidityState",[t])}function n(t){p(H.settings,H.remove);var e=M(A,"settings.getSettings");q[e]=t}function i(t){p(H.settings),M(A,"settings.setSettings",[t])}function o(t){p(H.settings),u=t}function a(t){p(H.remove),c=t}function r(t){var e=new f(t);u?u(e):e.notifySuccess()}function s(){var t=new l;c?c(t):t.notifySuccess()}var u,c;L["settings.save"]=r,L["settings.remove"]=s,t.setValidityState=e,t.getSettings=n,t.setSettings=i,t.registerOnSaveHandler=o,t.registerOnRemoveHandler=a;var f=function(){function t(t){this.notified=!1,this.result=t?t:{}}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),M(A,"settings.save.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),M(A,"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}(),l=function(){function t(){this.notified=!1}return t.prototype.notifySuccess=function(){this.ensureNotNotified(),M(A,"settings.remove.success"),this.notified=!0},t.prototype.notifyFailure=function(t){this.ensureNotNotified(),M(A,"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}()}(Q=t.settings||(t.settings={}));var Z;!function(t){function e(t){g=t}function n(t){var e=void 0!==t?t:g;if(p(H.content,H.settings,H.remove),W===P.desktop){var n=document.createElement("a");n.href=e.url;var i=M(A,"authentication.authenticate",[n.href,e.width,e.height]);q[i]=function(t,n){t?e.successCallback(n):e.failureCallback(n)}}else r(e)}function i(t){p();var e=M(A,"authentication.getAuthToken",[t.resources]);q[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}}function o(t){p();var e=M(A,"authentication.getUser");q[e]=function(e,n){e?t.successCallback(n):t.failureCallback(n)}}function a(){s();try{F&&F.close()}finally{F=null,z=null}}function r(t){g=t,a();var e=g.width||600,n=g.height||400;e=Math.min(e,x.outerWidth-400),n=Math.min(n,x.outerHeight-200);var i=document.createElement("a");i.href=g.url;var o="undefined"!=typeof x.screenLeft?x.screenLeft:x.screenX,r="undefined"!=typeof x.screenTop?x.screenTop:x.screenY;o+=x.outerWidth/2-e/2,r+=x.outerHeight/2-n/2,F=x.open(i.href,"_blank","toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top="+r+", left="+o+", width="+e+", height="+n),F?u():h("FailedToOpenWindow")}function s(){m&&(clearInterval(m),m=0),delete L.initialize,delete L.navigateCrossDomain}function u(){s(),m=x.setInterval(function(){if(!F||F.closed)h("CancelledByUser");else{var t=z;try{z="*",M(F,"ping")}finally{z=t}}},100),L.initialize=function(){return[H.authentication,W]},L.navigateCrossDomain=function(t){return!1}}function c(t,e){v(e,"result",t),p(H.authentication),M(A,"authentication.authenticate.success",[t]),I(A,function(){return setTimeout(function(){return x.close()},200)})}function f(t,e){v(e,"reason",t),p(H.authentication),M(A,"authentication.authenticate.failure",[t]),I(A,function(){return setTimeout(function(){return x.close()},200)})}function l(t){try{g&&g.successCallback&&g.successCallback(t)}finally{g=null,a()}}function h(t){try{g&&g.failureCallback&&g.failureCallback(t)}finally{g=null,a()}}function v(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=d(i.href,"result",n)),x.location.assign(d(i.href,"authSuccess",""))),e&&"reason"===e&&(n&&(i.href=d(i.href,"reason",n)),x.location.assign(d(i.href,"authFailure",""))))}}function d(t,e,n){var i=t.indexOf("#"),o=i===-1?"#":t.substr(i);return o=o+"&"+e+(""!==n?"="+n:""),t=i===-1?t:t.substr(0,i),t+o}var g,m;L["authentication.authenticate.success"]=l,L["authentication.authenticate.failure"]=h,t.registerAuthenticationHandlers=e,t.authenticate=n,t.getAuthToken=i,t.getUser=o,t.notifySuccess=c,t.notifyFailure=f}(Z=t.authentication||(t.authentication={}));var $;!function(t){function e(t,e){p(H.content);var n=M(A,"tasks.startTask",[t]);q[n]=e}function n(t,e){p(H.content),M(A,"tasks.completeTask",[t,e])}t.startTask=e,t.completeTask=n}($=t.tasks||(t.tasks={}))}(t||(t={})),t});
{
"name": "@microsoft/teams-js",
"author": "Microsoft Teams",
"version": "1.3.0-beta.1",
"version": "1.3.0-beta.2",
"description": "Microsoft Client SDK for building app for Microsoft teams",

@@ -44,3 +44,7 @@ "main": "./dist/MicrosoftTeams.min.js",

},
"files": ["dist/**", "README.md", "LICENSE"]
}
"files": [
"dist/**",
"README.md",
"LICENSE"
]
}

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

## Getting Started
1. Clone the repo
2. Navigate to the repo root
3. `yarn install`
4. `gulp`
1. Clone the repo
2. Navigate to the repo root
3. `yarn install`
4. `gulp`
### Installation
To install the stable version:

@@ -29,3 +27,3 @@

You can access [these files on unpkg](https://unpkg.com/@microsoft/teams-js@1.3.0-beta.1/dist/MicrosoftTeams.min.js), download them, or point your package manager to them.
You can access [these files on unpkg](https://unpkg.com/@microsoft/teams-js@1.2.5/dist/MicrosoftTeams.min.js), download them, or point your package manager to them.

@@ -41,3 +39,3 @@ ## Usage

```typescript
import * as microsoftTeams from "@microsoft/teams-js";
import * as microsoftTeams from '@microsoft/teams-js';
```

@@ -48,9 +46,8 @@

Reference the library inside of your `.html` page using:
```html
<!-- Microsoft Teams JavaScript API (via CDN) -->
<script src="https://unpkg.com/@microsoft/teams-js@1.3.0-beta.1/dist/MicrosoftTeams.min.js" integrity="r/EIN1w/pKHLxOzTAmEp1yP9GAU9Pk0NC83oRG6hfhxWXljidL73iLLuAwHdowlb" crossorigin="anonymous"></script>
<script src="https://unpkg.com/@microsoft/teams-js@1.2.5/dist/MicrosoftTeams.min.js" integrity="sha384-fTjWNTelhUDsOG+6Xvsly5BVO8estmdrfVmaRQuTGRTtcjHYA3oQANo805/kHXvJ" crossorigin="anonymous"></script>
<!-- Microsoft Teams JavaScript API (via npm) -->
<script src="node_modules/@microsoft/teams-js@1.3.0-beta.1/dist/MicrosoftTeams.min.js"></script>
<script src="node_modules/@microsoft/teams-js@1.2.5/dist/MicrosoftTeams.min.js"></script>

@@ -62,7 +59,6 @@ <!-- Microsoft Teams JavaScript API (via local) -->

## Contributing
We strongly welcome and encourage contributions to this project. Please read the [contributor's guide](CONTRIBUTING.md).
---
- - -
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
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