@microsoft/teams-js 2.34.0 → 2.34.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,12 +4,6 @@
4
4
  * This object is used for starting or completing authentication flows.
5
5
  * @module
6
6
  */
7
- /**
8
- * @hidden
9
- * @internal
10
- * Limited to Microsoft-internal use; automatically called when library is initialized
11
- */
12
- export declare function initialize(): void;
13
7
  /**
14
8
  * @deprecated
15
9
  * As of TeamsJS v2.0.0, this function has been deprecated in favor of a Promise-based pattern using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
@@ -1 +1 @@
1
- import{__awaiter as i}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{sendMessageToParent as e,sendAndHandleStatusAndReason as t,callFunctionInHostAndHandleResponse as n,initializeCommunication as o}from"./communication.js";import{errorLibraryNotInitialized as r,defaultSDKVersionForCompatCheck as s}from"./constants.js";import{GlobalVars as l}from"./globalVars.js";import{registerOnThemeChangeHandler as a,initializeHandlers as p}from"./handlers.js";import{ensureInitializeCalled as u,ensureInitialized as m,processAdditionalValidOrigins as c}from"./internalAPIs.js";import{getLogger as f}from"./telemetry.js";import{isNullOrUndefined as d}from"./typeCheckUtilities.js";import{inServerSideRenderingEnvironment as g,runWithTimeout as h,compareSDKVersions as j}from"./utils.js";import{Messages as S}from"../public/app/app.js";import{initialize as v}from"../public/authentication.js";import{FrameContexts as w}from"../public/constants.js";import{initialize as y}from"../public/dialog/dialog.js";import{initialize as z}from"../public/menus.js";import{runtime as b,applyRuntimeConfig as P,generateVersionBasedTeamsRuntimeConfig as C,mapTeamsVersionToSupportedCapabilities as x,versionAndPlatformAgnosticTeamsRuntimeConfig as D}from"../public/runtime.js";import{version as E}from"../public/version.js";import{SimpleTypeResponseHandler as V}from"./responseHandler.js";import{initialize as K}from"../public/pages/config.js";const _=f("app");function k(i,e){if(g()){return _.extend("initialize")("window object undefined at initialization"),Promise.resolve()}return h((()=>function(i,e){return new Promise((t=>{l.initializeCalled||(l.initializeCalled=!0,p(),l.initializePromise=o(e,i).then((({context:i,clientType:e,runtimeConfig:t,clientSupportedSDKVersion:n=s})=>{l.frameContext=i,l.hostClientType=e,l.clientSupportedSDKVersion=n;try{J("Parsing %s",t);const i=JSON.parse(t);if(J("Checking if %o is a valid runtime object",null!=i?i:"null"),!i||!i.apiVersion)throw new Error("Received runtime config is invalid");t&&P(i)}catch(i){if(!(i instanceof SyntaxError))throw i;try{J("Attempting to parse %s as an SDK version",t),isNaN(j(t,s))||(l.clientSupportedSDKVersion=t);const i=JSON.parse(n);if(J("givenRuntimeConfig parsed to %o",null!=i?i:"null"),!i)throw new Error("givenRuntimeConfig string was successfully parsed. However, it parsed to value of null");P(i)}catch(i){if(!(i instanceof SyntaxError))throw i;P(C(l.clientSupportedSDKVersion,D,x))}}l.initializeCompleted=!0})),v(),z(),K(),y()),Array.isArray(e)&&c(e),void 0!==l.initializePromise?t(l.initializePromise):J("GlobalVars.initializePromise is unexpectedly undefined")}))}(i,e)),6e4,new Error("SDK initialization timed out."))}function A(i){e(i,S.AppLoaded,[E])}function F(i,t){e(i,S.ExpectedFailure,[t.reason,t.message])}function N(i,t){e(i,S.Failure,[t.reason,t.message])}function R(e){return i(this,void 0,void 0,(function*(){if(l.initializeCompleted)return H(e);if(!l.initializePromise)throw new Error(r);return l.initializePromise.then((()=>H(e)))}))}function H(t){return i(this,void 0,void 0,(function*(){return m(b)&&(null===(i=b.supports.app)||void 0===i?void 0:i.notifySuccessResponse)?n(S.Success,[E],new V,t).then((()=>({hasFinishedSuccessfully:!0}))):(e(t,S.Success,[E]),{hasFinishedSuccessfully:"unknown"});var i}))}const J=_.extend("initializeHelper");function L(i,e){!d(e)&&u(),a(i,e)}function O(i,e){return new Promise((n=>{m(b,w.content,w.sidePanel,w.settings,w.task,w.stage,w.meetingStage),n(t(i,"executeDeepLink",e))}))}export{k as appInitializeHelper,H as callNotifySuccessInHost,A as notifyAppLoadedHelper,F as notifyExpectedFailureHelper,N as notifyFailureHelper,R as notifySuccessHelper,O as openLinkHelper,L as registerOnThemeChangeHandlerHelper};
1
+ import{__awaiter as i}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{sendMessageToParent as e,sendAndHandleStatusAndReason as n,callFunctionInHostAndHandleResponse as t,initializeCommunication as o}from"./communication.js";import{errorLibraryNotInitialized as r,defaultSDKVersionForCompatCheck as s}from"./constants.js";import{GlobalVars as l}from"./globalVars.js";import{registerOnThemeChangeHandler as a,initializeHandlers as p}from"./handlers.js";import{ensureInitializeCalled as u,ensureInitialized as m,processAdditionalValidOrigins as c}from"./internalAPIs.js";import{getLogger as f}from"./telemetry.js";import{isNullOrUndefined as d}from"./typeCheckUtilities.js";import{inServerSideRenderingEnvironment as g,runWithTimeout as h,compareSDKVersions as S}from"./utils.js";import{Messages as j}from"../public/app/app.js";import{FrameContexts as v}from"../public/constants.js";import{initialize as w}from"../public/dialog/dialog.js";import{initialize as y}from"../public/menus.js";import{runtime as z,applyRuntimeConfig as b,generateVersionBasedTeamsRuntimeConfig as P,mapTeamsVersionToSupportedCapabilities as C,versionAndPlatformAgnosticTeamsRuntimeConfig as x}from"../public/runtime.js";import{version as D}from"../public/version.js";import{SimpleTypeResponseHandler as E}from"./responseHandler.js";import{initialize as V}from"../public/pages/config.js";const K=f("app");function _(i,e){if(g()){return K.extend("initialize")("window object undefined at initialization"),Promise.resolve()}return h((()=>function(i,e){return new Promise((n=>{l.initializeCalled||(l.initializeCalled=!0,p(),l.initializePromise=o(e,i).then((({context:i,clientType:e,runtimeConfig:n,clientSupportedSDKVersion:t=s})=>{l.frameContext=i,l.hostClientType=e,l.clientSupportedSDKVersion=t;try{H("Parsing %s",n);const i=JSON.parse(n);if(H("Checking if %o is a valid runtime object",null!=i?i:"null"),!i||!i.apiVersion)throw new Error("Received runtime config is invalid");n&&b(i)}catch(i){if(!(i instanceof SyntaxError))throw i;try{H("Attempting to parse %s as an SDK version",n),isNaN(S(n,s))||(l.clientSupportedSDKVersion=n);const i=JSON.parse(t);if(H("givenRuntimeConfig parsed to %o",null!=i?i:"null"),!i)throw new Error("givenRuntimeConfig string was successfully parsed. However, it parsed to value of null");b(i)}catch(i){if(!(i instanceof SyntaxError))throw i;b(P(l.clientSupportedSDKVersion,x,C))}}l.initializeCompleted=!0})),y(),V(),w()),Array.isArray(e)&&c(e),void 0!==l.initializePromise?n(l.initializePromise):H("GlobalVars.initializePromise is unexpectedly undefined")}))}(i,e)),6e4,new Error("SDK initialization timed out."))}function k(i){e(i,j.AppLoaded,[D])}function A(i,n){e(i,j.ExpectedFailure,[n.reason,n.message])}function F(i,n){e(i,j.Failure,[n.reason,n.message])}function N(e){return i(this,void 0,void 0,(function*(){if(l.initializeCompleted)return R(e);if(!l.initializePromise)throw new Error(r);return l.initializePromise.then((()=>R(e)))}))}function R(n){return i(this,void 0,void 0,(function*(){return m(z)&&(null===(i=z.supports.app)||void 0===i?void 0:i.notifySuccessResponse)?t(j.Success,[D],new E,n).then((()=>({hasFinishedSuccessfully:!0}))):(e(n,j.Success,[D]),{hasFinishedSuccessfully:"unknown"});var i}))}const H=K.extend("initializeHelper");function J(i,e){!d(e)&&u(),a(i,e)}function L(i,e){return new Promise((t=>{m(z,v.content,v.sidePanel,v.settings,v.task,v.stage,v.meetingStage),t(n(i,"executeDeepLink",e))}))}export{_ as appInitializeHelper,R as callNotifySuccessInHost,k as notifyAppLoadedHelper,A as notifyExpectedFailureHelper,F as notifyFailureHelper,N as notifySuccessHelper,L as openLinkHelper,J as registerOnThemeChangeHandlerHelper};
@@ -1 +1 @@
1
- import{sendMessageToParentAsync as t,Communication as e,sendMessageEventToChild as n,sendMessageToParent as i,waitForMessageQueue as r}from"../internal/communication.js";import{GlobalVars as a}from"../internal/globalVars.js";import{registerHandler as o,removeHandler as c}from"../internal/handlers.js";import{ensureInitialized as l,ensureInitializeCalled as u}from"../internal/internalAPIs.js";import{getApiVersionTag as s}from"../internal/telemetry.js";import{fullyQualifyUrlString as h,validateUrl as d}from"../internal/utils.js";import{FrameContexts as f,HostClientType as w}from"./constants.js";import{runtime as m}from"./runtime.js";const g="v1",b="v2";let W,C,k;function p(){o(s(g,"authentication.registerAuthenticateSuccessHandler"),"authentication.authenticate.success",P,!1),o(s(g,"authentication.registerAuthenticateFailureHandler"),"authentication.authenticate.failure",I,!1)}function v(t){k=t}function y(i){const r=void 0!==i,c=r?i:k;if(!c)throw new Error("No parameters are provided for authentication");l(m,f.content,f.sidePanel,f.settings,f.remove,f.task,f.stage,f.meetingStage);return function(i,r){return new Promise(((c,l)=>{if(a.hostClientType!==w.web){const e=h(r.url);d(e),c(t(i,"authentication.authenticate",[e.href,r.width,r.height,r.isExternal]).then((([t,e])=>{if(t)return e;throw new Error(e)})))}else W={success:c,fail:l},function(t){E();let i=t.width||600,r=t.height||400;i=Math.min(i,e.currentWindow.outerWidth-400),r=Math.min(r,e.currentWindow.outerHeight-200);const c=h(t.url.replace("{oauthRedirectMethod}","web"));d(c);let l=void 0!==e.currentWindow.screenLeft?e.currentWindow.screenLeft:e.currentWindow.screenX,u=void 0!==e.currentWindow.screenTop?e.currentWindow.screenTop:e.currentWindow.screenY;l+=e.currentWindow.outerWidth/2-i/2,u+=e.currentWindow.outerHeight/2-r/2,e.childWindow=e.currentWindow.open(c.href,"_blank","toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top="+u+", left="+l+", width="+i+", height="+r),e.childWindow?(A(),C=e.currentWindow.setInterval((()=>{if(!e.childWindow||e.childWindow.closed)I("CancelledByUser");else{const t=e.childOrigin;try{e.childOrigin="*",n("ping")}finally{e.childOrigin=t}}}),100),o(s(g,"authentication.authenticationWindow.registerInitializeHandler"),"initialize",(()=>[f.authentication,a.hostClientType])),o(s(g,"authentication.authenticationWindow.registerNavigateCrossDomainHandler"),"navigateCrossDomain",(()=>!1))):I("FailedToOpenWindow")}(r)}))}(c.successCallback||c.failureCallback?s(g,"authentication.authenticate"):s(b,"authentication.authenticate"),c).then((t=>{try{return c&&c.successCallback?(c.successCallback(t),""):t}finally{r||(k=void 0)}})).catch((t=>{try{if(c&&c.failureCallback)return c.failureCallback(t.message),"";throw t}finally{r||(k=void 0)}}))}function T(e){u();return function(e,n){return new Promise((i=>{i(t(e,"authentication.getAuthToken",[null==n?void 0:n.resources,null==n?void 0:n.claims,null==n?void 0:n.silent,null==n?void 0:n.tenantId]))})).then((([t,e])=>{if(t)return e;throw new Error(e)}))}(e&&(e.successCallback||e.failureCallback)?s(g,"authentication.getAuthToken"):s(b,"authentication.getAuthToken"),e).then((t=>e&&e.successCallback?(e.successCallback(t),""):t)).catch((t=>{if(e&&e.failureCallback)return e.failureCallback(t.message),"";throw t}))}function j(e){u();return function(e){return new Promise((n=>{n(t(e,"authentication.getUser"))})).then((([t,e])=>{if(t)return e;throw e}))}(e&&(e.successCallback||e.failureCallback)?s(g,"authentication.getUser"):s(b,"authentication.getUser")).then((t=>e&&e.successCallback?(e.successCallback(t),null):t)).catch((t=>{const n=`Error returned, code = ${t.errorCode}, message = ${t.message}`;if(e&&e.failureCallback)return e.failureCallback(n),null;throw new Error(n)}))}function E(){A();try{e.childWindow&&e.childWindow.close()}finally{e.childWindow=null,e.childOrigin=null}}function A(){C&&(clearInterval(C),C=0),c("initialize"),c("navigateCrossDomain")}function H(t,n){l(m,f.authentication);const a=s(n?g:b,"authentication.notifySuccess");i(a,"authentication.authenticate.success",[t]),r(e.parentWindow,(()=>setTimeout((()=>e.currentWindow.close()),200)))}function O(t,n){l(m,f.authentication);const a=s(n?g:b,"authentication.notifyFailure");i(a,"authentication.authenticate.failure",[t]),r(e.parentWindow,(()=>setTimeout((()=>e.currentWindow.close()),200)))}function P(t){try{W&&W.success(t)}finally{W=void 0,E()}}function I(t){try{W&&W.fail(new Error(t))}finally{W=void 0,E()}}var U;!function(t){t.Public="public",t.EUDB="eudb",t.Other="other"}(U||(U={}));export{U as DataResidency,y as authenticate,T as getAuthToken,j as getUser,p as initialize,O as notifyFailure,H as notifySuccess,v as registerAuthenticationHandlers};
1
+ import{__awaiter as t}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{sendMessageToParentAsync as e,sendMessageToParent as n,waitForMessageQueue as i,Communication as r}from"../internal/communication.js";import{ensureInitialized as a,ensureInitializeCalled as o}from"../internal/internalAPIs.js";import{getApiVersionTag as c}from"../internal/telemetry.js";import{fullyQualifyUrlString as u,validateUrl as l}from"../internal/utils.js";import{FrameContexts as s}from"./constants.js";import{runtime as h}from"./runtime.js";const f="v1",m="v2";let d;function b(t){d=t}function k(n){const i=void 0!==n,r=i?n:d;if(!r)throw new Error("No parameters are provided for authentication");a(h,s.content,s.sidePanel,s.settings,s.remove,s.task,s.stage,s.meetingStage);return function(n,i){return t(this,void 0,void 0,(function*(){const t=u(i.url);return l(t),e(n,"authentication.authenticate",[t.href,i.width,i.height,i.isExternal]).then((([t,e])=>{if(t)return e;throw new Error(e)}))}))}(r.successCallback||r.failureCallback?c(f,"authentication.authenticate"):c(m,"authentication.authenticate"),r).then((t=>{try{return r&&r.successCallback?(r.successCallback(t),""):t}finally{i||(d=void 0)}})).catch((t=>{try{if(r&&r.failureCallback)return r.failureCallback(t.message),"";throw t}finally{i||(d=void 0)}}))}function p(t){o();return function(t,n){return new Promise((i=>{i(e(t,"authentication.getAuthToken",[null==n?void 0:n.resources,null==n?void 0:n.claims,null==n?void 0:n.silent,null==n?void 0:n.tenantId]))})).then((([t,e])=>{if(t)return e;throw new Error(e)}))}(t&&(t.successCallback||t.failureCallback)?c(f,"authentication.getAuthToken"):c(m,"authentication.getAuthToken"),t).then((e=>t&&t.successCallback?(t.successCallback(e),""):e)).catch((e=>{if(t&&t.failureCallback)return t.failureCallback(e.message),"";throw e}))}function C(t){o();return function(t){return new Promise((n=>{n(e(t,"authentication.getUser"))})).then((([t,e])=>{if(t)return e;throw e}))}(t&&(t.successCallback||t.failureCallback)?c(f,"authentication.getUser"):c(m,"authentication.getUser")).then((e=>t&&t.successCallback?(t.successCallback(e),null):e)).catch((e=>{const n=`Error returned, code = ${e.errorCode}, message = ${e.message}`;if(t&&t.failureCallback)return t.failureCallback(n),null;throw new Error(n)}))}function w(t,e){a(h,s.authentication);const o=c(e?f:m,"authentication.notifySuccess");n(o,"authentication.authenticate.success",[t]),i(r.parentWindow,(()=>setTimeout((()=>r.currentWindow.close()),200)))}function g(t,e){a(h,s.authentication);const o=c(e?f:m,"authentication.notifyFailure");n(o,"authentication.authenticate.failure",[t]),i(r.parentWindow,(()=>setTimeout((()=>r.currentWindow.close()),200)))}var v;!function(t){t.Public="public",t.EUDB="eudb",t.Other="other"}(v||(v={}));export{v as DataResidency,k as authenticate,p as getAuthToken,C as getUser,g as notifyFailure,w as notifySuccess,b as registerAuthenticationHandlers};
@@ -1 +1 @@
1
- const o="2.34.0";export{o as version};
1
+ const t="2.34.1-beta.0";export{t as version};