@microsoft/teams-js 2.58.0 → 2.59.0-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.
@@ -1,4 +1,4 @@
1
- import { Context } from '../public/app/app';
1
+ import { BrandColorPalettes, Context, themeHandler } from '../public/app/app';
2
2
  import { FrameContexts } from '../public/constants';
3
3
  import { HostToAppPerformanceMetrics, LoadContext, ResumeContext } from '../public/interfaces';
4
4
  /**
@@ -49,7 +49,7 @@ export declare function registerHandlerHelper(apiVersionTag: string, name: strin
49
49
  * @internal
50
50
  * Limited to Microsoft-internal use
51
51
  */
52
- export declare function registerOnThemeChangeHandler(apiVersionTag: string, handler: (theme: string) => void): void;
52
+ export declare function registerOnThemeChangeHandler(apiVersionTag: string, handler: themeHandler): void;
53
53
  /**
54
54
  * @internal
55
55
  * Limited to Microsoft-internal use
@@ -59,7 +59,7 @@ export declare function registerOnContextChangeHandler(apiVersionTag: string, ha
59
59
  * @internal
60
60
  * Limited to Microsoft-internal use
61
61
  */
62
- export declare function handleThemeChange(theme: string): void;
62
+ export declare function handleThemeChange(theme: string, brandColorPalettes?: BrandColorPalettes): void;
63
63
  /**
64
64
  * @internal
65
65
  * Limited to Microsoft-internal use
@@ -92,6 +92,18 @@ export interface IExpectedFailureRequest {
92
92
  */
93
93
  message?: string;
94
94
  }
95
+ /**
96
+ * A brand color ramp supplied by the host.
97
+ */
98
+ export interface BrandColorRamp {
99
+ readonly [shade: string]: string | undefined;
100
+ }
101
+ /**
102
+ * Brand color palettes supplied by the host.
103
+ */
104
+ export interface BrandColorPalettes {
105
+ readonly [format: string]: BrandColorRamp | undefined;
106
+ }
95
107
  /**
96
108
  * Represents application information.
97
109
  */
@@ -105,6 +117,14 @@ export interface AppInfo {
105
117
  * The current UI theme of the host. Possible values: "default", "dark", "contrast" or "glass".
106
118
  */
107
119
  theme: string;
120
+ /**
121
+ * Brand color palettes supplied by the host.
122
+ *
123
+ * Each key identifies a palette format (for example, `"fluentui/v9"`), which defines its required shades and color
124
+ * syntax. Each update replaces the whole map rather than merging with it. `undefined` means no palettes are available,
125
+ * such as after the host clears them.
126
+ */
127
+ brandColorPalettes?: BrandColorPalettes;
108
128
  /**
109
129
  * Unique ID for the current session for use in correlating telemetry data. A session corresponds to the lifecycle of an app. A new session begins upon the creation of a webview (on Teams mobile) or iframe (in Teams desktop) hosting the app, and ends when it is destroyed.
110
130
  */
@@ -500,9 +520,11 @@ export interface Context {
500
520
  dialogParameters: Record<string, string>;
501
521
  }
502
522
  /**
503
- * This function is passed to registerOnThemeHandler. It is called every time the user changes their theme.
523
+ * Called when the host sends a theme or brand color palette update.
524
+ *
525
+ * The theme, palettes, or both may change with each update.
504
526
  */
505
- export type themeHandler = (theme: string) => void;
527
+ export type themeHandler = (theme: string, brandColorPalettes?: BrandColorPalettes) => void;
506
528
  /**
507
529
  * @hidden
508
530
  * This function is passed to registerOnContextChangeHandler. It is called every time the user changes their context.
@@ -602,12 +624,13 @@ export declare function notifyFailure(appInitializationFailedRequest: IFailedReq
602
624
  */
603
625
  export declare function notifyExpectedFailure(expectedFailureRequest: IExpectedFailureRequest): void;
604
626
  /**
605
- * Registers a handler for theme changes.
627
+ * Registers a handler for host theme or brand color palette updates.
606
628
  *
607
629
  * @remarks
608
630
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
631
+ * The theme, palettes, or both may change with each update.
609
632
  *
610
- * @param handler - The handler to invoke when the user changes their theme.
633
+ * @param handler - The handler to call when the host sends an update.
611
634
  */
612
635
  export declare function registerOnThemeChangeHandler(handler: themeHandler): void;
613
636
  /**
@@ -1,4 +1,4 @@
1
- import { HostFeatures } from './app/app';
1
+ import type { BrandColorPalettes, HostFeatures } from './app/app';
2
2
  import { ChannelType, DialogDimension, HostClientType, HostName, RenderingSurfaces, TeamType, UserTeamRole } from './constants';
3
3
  import { FrameContexts } from './constants';
4
4
  /**
@@ -379,6 +379,18 @@ export interface Context {
379
379
  * The current UI theme.
380
380
  */
381
381
  theme?: string;
382
+ /**
383
+ * @deprecated
384
+ * As of TeamsJS v2.0.0, please use
385
+ * {@link app.AppInfo.brandColorPalettes | app.Context.app.brandColorPalettes} instead
386
+ *
387
+ * Brand color palettes supplied by the host.
388
+ *
389
+ * Each key identifies a palette format (for example, `"fluentui/v9"`), which defines its required shades and color
390
+ * syntax. Each update replaces the whole map rather than merging with it. `undefined` means no palettes are available,
391
+ * such as after the host clears them.
392
+ */
393
+ brandColorPalettes?: BrandColorPalettes;
382
394
  /**
383
395
  * @deprecated
384
396
  * As of TeamsJS v2.0.0, please use {@link app.PageInfo.isFullScreen | app.Context.page.isFullScreen} instead
@@ -1,3 +1,4 @@
1
+ import type { BrandColorPalettes } from './app/app';
1
2
  import { Context, DeepLinkParameters, FrameContext, LoadContext, TabInformation, TabInstanceParameters } from './interfaces';
2
3
  /** Type of callback used to indicate when {@link executeDeepLink} completes */
3
4
  export type executeDeepLinkOnCompleteFunctionType = (status: boolean, reason?: string) => void;
@@ -11,8 +12,8 @@ export type getTabInstancesCallbackFunctionType = (tabInfo: TabInformation) => v
11
12
  export type registerBackButtonHandlerFunctionType = () => boolean;
12
13
  /** Register full screen handler function type */
13
14
  export type registerFullScreenHandlerFunctionType = (isFullScreen: boolean) => void;
14
- /** Register on theme change handler function type */
15
- export type registerOnThemeChangeHandlerFunctionType = (theme: string) => void;
15
+ /** Called when the host sends a theme or brand color palette update. */
16
+ export type registerOnThemeChangeHandlerFunctionType = (theme: string, brandColorPalettes?: BrandColorPalettes) => void;
16
17
  /**
17
18
  * @deprecated
18
19
  * As of TeamsJS v2.0.0, please use {@link app.initialize app.initialize(validMessageOrigins?: string[]): Promise\<void\>} instead.
@@ -53,10 +54,11 @@ export declare function getContext(callback: getContextCallbackFunctionType): vo
53
54
  * @deprecated
54
55
  * As of TeamsJS v2.0.0, please use {@link app.registerOnThemeChangeHandler app.registerOnThemeChangeHandler(handler: registerOnThemeChangeHandlerFunctionType): void} instead.
55
56
  *
56
- * Registers a handler for theme changes.
57
+ * Registers a handler for host theme or brand color palette updates.
57
58
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
59
+ * The theme, palettes, or both may change with each update.
58
60
  *
59
- * @param handler - The handler to invoke when the user changes their theme.
61
+ * @param handler - The handler to call when the host sends an update.
60
62
  */
61
63
  export declare function registerOnThemeChangeHandler(handler: registerOnThemeChangeHandlerFunctionType): void;
62
64
  /**
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{getApiVersionTag as n,getLogger as r}from"./telemetry.js";import{runtime as l}from"../public/runtime.js";import{shouldEventBeRelayedToChild as a,sendMessageEventToChild as t}from"./childCommunication.js";import{sendMessageToParent as o}from"./communication.js";import{ensureInitialized as d}from"./internalAPIs.js";import{initializeBackStackHelper as i}from"./pagesHelpers.js";import{isNullOrUndefined as s}from"./typeCheckUtilities.js";const u=r("handlers");class c{static initializeHandlers(){c.handlers.themeChange=x,c.handlers.contextChange=v,c.handlers.load=S,c.handlers.beforeUnload=A,i()}static uninitializeHandlers(){c.handlers={},c.themeChangeHandler=null,c.beforeUnloadHandler=null,c.beforeSuspendOrTerminateHandler=null,c.resumeHandler=null,c.contextChangeHandler=null}}function f(){c.initializeHandlers()}function m(){c.uninitializeHandlers()}c.handlers={},c.themeChangeHandler=null,c.loadHandler=null,c.beforeUnloadHandler=null,c.beforeSuspendOrTerminateHandler=null,c.resumeHandler=null,c.hostToAppPerformanceMetricsHandler=null,c.contextChangeHandler=null;const H=u.extend("callHandler");function h(e,n){const r=c.handlers[e];if(r){H("Invoking the registered handler for message %s with arguments %o",e,n);return[!0,r.apply(this,n)]}return a()?(t(e,n),[!1,void 0]):(H("Handler for action message %s not found.",e),[!1,void 0])}function p(e,n,r,l=!0,a=[]){r?(c.handlers[n]=r,l&&o(e,"registerHandler",[n,...a])):delete c.handlers[n]}function g(e){delete c.handlers[e]}function b(e){return null!=c.handlers[e]}function C(e,n,r,a,t){r&&d(l,...a),t&&t(),p(e,n,r)}function U(e,n){c.themeChangeHandler=n,!s(n)&&o(e,"registerHandler",["themeChange"])}function T(e,n){c.contextChangeHandler=n,!s(n)&&o(e,"registerHandler",["contextChange"])}function x(e){c.themeChangeHandler&&c.themeChangeHandler(e),a()&&t("themeChange",[e])}function v(e){c.contextChangeHandler&&c.contextChangeHandler(e),a()&&t("contextChange",[e])}function y(e){c.hostToAppPerformanceMetricsHandler=e}function j(e){c.hostToAppPerformanceMetricsHandler&&c.hostToAppPerformanceMetricsHandler(e)}function O(e,n){c.loadHandler=n,!s(n)&&o(e,"registerHandler",["load"])}function S(e){const n={entityId:(r=e).entityId,contentUrl:new URL(r.contentUrl)};var r;c.resumeHandler?(c.resumeHandler(n),a()&&t("load",[n])):c.loadHandler&&(c.loadHandler(e),a()&&t("load",[e]))}function _(e,n){c.beforeUnloadHandler=n,!s(n)&&o(e,"registerHandler",["beforeUnload"])}function A(){return e(this,void 0,void 0,function*(){const e=()=>{o(n("v2","handleBeforeUnload"),"readyToUnload",[])};c.beforeSuspendOrTerminateHandler?(yield c.beforeSuspendOrTerminateHandler(),a()?t("beforeUnload"):e()):c.beforeUnloadHandler&&c.beforeUnloadHandler(e)||(a()?t("beforeUnload"):e())})}function P(e){c.beforeSuspendOrTerminateHandler=e,!s(e)&&o(n("v2","registerBeforeSuspendOrTerminateHandler"),"registerHandler",["beforeUnload"])}function z(e){c.resumeHandler=e,!s(e)&&o(n("v2","registerOnResumeHandler"),"registerHandler",["load"])}export{h as callHandler,b as doesHandlerExist,v as handleContextChange,j as handleHostToAppPerformanceMetrics,x as handleThemeChange,f as initializeHandlers,P as registerBeforeSuspendOrTerminateHandler,_ as registerBeforeUnloadHandler,p as registerHandler,C as registerHandlerHelper,y as registerHostToAppPerformanceMetricsHandler,T as registerOnContextChangeHandler,O as registerOnLoadHandler,z as registerOnResumeHandler,U as registerOnThemeChangeHandler,g as removeHandler,m as uninitializeHandlers};
1
+ import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{getApiVersionTag as n,getLogger as r}from"./telemetry.js";import{runtime as l}from"../public/runtime.js";import{shouldEventBeRelayedToChild as t,sendMessageEventToChild as a}from"./childCommunication.js";import{sendMessageToParent as o}from"./communication.js";import{ensureInitialized as d}from"./internalAPIs.js";import{initializeBackStackHelper as i}from"./pagesHelpers.js";import{isNullOrUndefined as s}from"./typeCheckUtilities.js";const u=r("handlers");class c{static initializeHandlers(){c.handlers.themeChange=v,c.handlers.contextChange=x,c.handlers.load=S,c.handlers.beforeUnload=A,i()}static uninitializeHandlers(){c.handlers={},c.themeChangeHandler=null,c.beforeUnloadHandler=null,c.beforeSuspendOrTerminateHandler=null,c.resumeHandler=null,c.contextChangeHandler=null}}function f(){c.initializeHandlers()}function m(){c.uninitializeHandlers()}c.handlers={},c.themeChangeHandler=null,c.loadHandler=null,c.beforeUnloadHandler=null,c.beforeSuspendOrTerminateHandler=null,c.resumeHandler=null,c.hostToAppPerformanceMetricsHandler=null,c.contextChangeHandler=null;const H=u.extend("callHandler");function h(e,n){const r=c.handlers[e];if(r){H("Invoking the registered handler for message %s with arguments %o",e,n);return[!0,r.apply(this,n)]}return t()?(a(e,n),[!1,void 0]):(H("Handler for action message %s not found.",e),[!1,void 0])}function p(e,n,r,l=!0,t=[]){r?(c.handlers[n]=r,l&&o(e,"registerHandler",[n,...t])):delete c.handlers[n]}function g(e){delete c.handlers[e]}function b(e){return null!=c.handlers[e]}function C(e,n,r,t,a){r&&d(l,...t),a&&a(),p(e,n,r)}function U(e,n){c.themeChangeHandler=n,!s(n)&&o(e,"registerHandler",["themeChange"])}function T(e,n){c.contextChangeHandler=n,!s(n)&&o(e,"registerHandler",["contextChange"])}function v(e,n){const r=!s(n);c.themeChangeHandler&&c.themeChangeHandler(e,r?n:void 0),t()&&a("themeChange",r?[e,n]:[e])}function x(e){c.contextChangeHandler&&c.contextChangeHandler(e),t()&&a("contextChange",[e])}function y(e){c.hostToAppPerformanceMetricsHandler=e}function j(e){c.hostToAppPerformanceMetricsHandler&&c.hostToAppPerformanceMetricsHandler(e)}function O(e,n){c.loadHandler=n,!s(n)&&o(e,"registerHandler",["load"])}function S(e){const n={entityId:(r=e).entityId,contentUrl:new URL(r.contentUrl)};var r;c.resumeHandler?(c.resumeHandler(n),t()&&a("load",[n])):c.loadHandler&&(c.loadHandler(e),t()&&a("load",[e]))}function _(e,n){c.beforeUnloadHandler=n,!s(n)&&o(e,"registerHandler",["beforeUnload"])}function A(){return e(this,void 0,void 0,function*(){const e=()=>{o(n("v2","handleBeforeUnload"),"readyToUnload",[])};c.beforeSuspendOrTerminateHandler?(yield c.beforeSuspendOrTerminateHandler(),t()?a("beforeUnload"):e()):c.beforeUnloadHandler&&c.beforeUnloadHandler(e)||(t()?a("beforeUnload"):e())})}function P(e){c.beforeSuspendOrTerminateHandler=e,!s(e)&&o(n("v2","registerBeforeSuspendOrTerminateHandler"),"registerHandler",["beforeUnload"])}function z(e){c.resumeHandler=e,!s(e)&&o(n("v2","registerOnResumeHandler"),"registerHandler",["load"])}export{h as callHandler,b as doesHandlerExist,x as handleContextChange,j as handleHostToAppPerformanceMetrics,v as handleThemeChange,f as initializeHandlers,P as registerBeforeSuspendOrTerminateHandler,_ as registerBeforeUnloadHandler,p as registerHandler,C as registerHandlerHelper,y as registerHostToAppPerformanceMetricsHandler,T as registerOnContextChangeHandler,O as registerOnLoadHandler,z as registerOnResumeHandler,U as registerOnThemeChangeHandler,g as removeHandler,m as uninitializeHandlers};
@@ -1 +1 @@
1
- import{appInitializeHelper as e,notifyAppLoadedHelper as i,notifySuccessHelper as t,notifyFailureHelper as n,notifyExpectedFailureHelper as a,registerOnThemeChangeHandlerHelper as o,registerOnContextChangeHandlerHelper as r,openLinkHelper as s}from"../../internal/appHelpers.js";import{uninitializeCommunication as l,sendAndUnwrap as m,Communication as d}from"../../internal/communication.js";import{GlobalVars as p}from"../../internal/globalVars.js";import{uninitializeHandlers as u,registerHostToAppPerformanceMetricsHandler as c}from"../../internal/handlers.js";import{ensureInitializeCalled as f}from"../../internal/internalAPIs.js";import{getLogger as h,getApiVersionTag as g}from"../../internal/telemetry.js";import{inServerSideRenderingEnvironment as I}from"../../internal/utils.js";import{AppId as y}from"../appId.js";import{HostClientType as S,HostName as T}from"../constants.js";import{version as v}from"../version.js";import*as C from"./lifecycle.js";export{C as lifecycle};import{_clearTelemetryPort as w}from"../../private/messageChannels/telemetry.js";import{_clearDataLayerPort as P}from"../../private/messageChannels/dataLayer.js";const j="v2",O=h("app"),N={AppLoaded:"appInitialization.appLoaded",Success:"appInitialization.success",Failure:"appInitialization.failure",ExpectedFailure:"appInitialization.expectedFailure"};var F,b;function x(){return p.initializeCompleted}function L(){return p.frameContext}function A(i){return e(g(j,"app.initialize"),i)}function z(){var e,i;if(I())return null;const t=null!==(e=d.currentWindow)&&void 0!==e?e:window;if(t.parent===t)return null;const n=t.location.ancestorOrigins,a=null==n?void 0:n.item(0);if(a)return a;const o=null===(i=t.document)||void 0===i?void 0:i.referrer;if(!o)return null;try{const e=new URL(o).origin;return e===t.location.origin?null:e}catch(e){return null}}function D(e){d.currentWindow=e}function k(){p.initializeCalled&&(u(),p.initializeCalled=!1,p.initializeCompleted=!1,p.initializePromise=void 0,p.additionalValidOrigins=[],p.frameContext=void 0,p.hostClientType=void 0,p.isFramelessWindow=!1,w(),P(),l())}function U(){return new Promise(e=>{f(),e(m(g(j,"app.getContext"),"getContext"))}).then(e=>function(e){var i;const t={actionInfo:e.actionInfo,app:{locale:e.locale,sessionId:e.appSessionId?e.appSessionId:"",theme:e.theme?e.theme:"default",iconPositionVertical:e.appIconPosition,osLocaleInfo:e.osLocaleInfo,messageId:e.messageId,parentMessageId:e.parentMessageId,userClickTime:e.userClickTime,userClickTimeV2:e.userClickTimeV2,userFileOpenPreference:e.userFileOpenPreference,host:{name:e.hostName?e.hostName:T.teams,clientType:e.hostClientType?e.hostClientType:S.web,features:e.hostFeatures,sessionId:e.sessionId?e.sessionId:"",ringId:e.ringId,ancestors:e.hostAncestors},appLaunchId:e.appLaunchId,appId:e.appId?new y(e.appId):void 0,manifestVersion:e.manifestVersion},page:{id:e.entityId,frameContext:e.frameContext?e.frameContext:p.frameContext,renderingSurface:e.renderingSurface?e.renderingSurface:void 0,subPageId:e.subEntityId,isFullScreen:e.isFullScreen,isMultiWindow:e.isMultiWindow,isBackgroundLoad:e.isBackgroundLoad,sourceOrigin:e.sourceOrigin},user:{id:null!==(i=e.userObjectId)&&void 0!==i?i:"",displayName:e.userDisplayName,isCallingAllowed:e.isCallingAllowed,isPSTNCallingAllowed:e.isPSTNCallingAllowed,licenseType:e.userLicenseType,loginHint:e.loginHint,userPrincipalName:e.userPrincipalName,tenant:e.tid?{id:e.tid,teamsSku:e.tenantSKU}:void 0},channel:e.channelId?{id:e.channelId,displayName:e.channelName,relativeUrl:e.channelRelativeUrl,membershipType:e.channelType,defaultOneNoteSectionId:e.defaultOneNoteSectionId,ownerGroupId:e.hostTeamGroupId,ownerTenantId:e.hostTeamTenantId}:void 0,chat:e.chatId?{id:e.chatId}:void 0,meeting:e.meetingId?{id:e.meetingId}:void 0,sharepoint:e.sharepoint,team:e.teamId?{internalId:e.teamId,displayName:e.teamName,type:e.teamType,groupId:e.groupId,templateId:e.teamTemplateId,isArchived:e.isTeamArchived,userRole:e.userTeamRole}:void 0,sharePointSite:e.teamSiteUrl||e.teamSiteDomain||e.teamSitePath||e.mySitePath||e.mySiteDomain?{teamSiteUrl:e.teamSiteUrl,teamSiteDomain:e.teamSiteDomain,teamSitePath:e.teamSitePath,teamSiteId:e.teamSiteId,mySitePath:e.mySitePath,mySiteDomain:e.mySiteDomain}:void 0,dialogParameters:e.dialogParameters||{}};return t}(e))}function H(){f(),i(g(j,"app.notifyAppLoaded"))}function V(){return t(g(j,"app.notifySuccess"))}function E(e){f(),n(g(j,"app.notifyFailure"),e)}function M(e){f(),a(g(j,"app.notifyExpectedFailure"),e)}function W(e){o(g(j,"app.registerOnThemeChangeHandler"),e)}function R(e){r(g(j,"app.registerOnContextChangeHandler"),e)}function B(e){c(e)}function G(e){return s(g(j,"app.openLink"),e)}!function(e){e.AuthFailed="AuthFailed",e.Timeout="Timeout",e.Other="Other"}(F||(F={})),function(e){e.PermissionError="PermissionError",e.NotFound="NotFound",e.Throttling="Throttling",e.Offline="Offline",e.Other="Other"}(b||(b={})),O("teamsjs instance is version %s, starting at %s UTC (%s local)",v,(new Date).toISOString(),(new Date).toLocaleString()),function(){if(I())return;const e=document.getElementsByTagName("script"),i=e&&e[e.length-1]&&e[e.length-1].src,t="Today, teamsjs can only be used from a single script or you may see undefined behavior. This log line is used to help detect cases where teamsjs is loaded multiple times -- it is always written. The presence of the log itself does not indicate a multi-load situation, but multiples of these log lines will. If you would like to use teamjs from more than one script at the same time, please open an issue at https://github.com/OfficeDev/microsoft-teams-library-js/issues";i&&0!==i.length?O("teamsjs is being used from %s. %s",i,t):O("teamsjs is being used from a script tag embedded directly in your html. %s",t)}();export{b as ExpectedFailureReason,F as FailedReason,N as Messages,D as _initialize,k as _uninitialize,U as getContext,L as getFrameContext,z as getImmediateParentOrigin,A as initialize,x as isInitialized,H as notifyAppLoaded,M as notifyExpectedFailure,E as notifyFailure,V as notifySuccess,G as openLink,B as registerHostToAppPerformanceMetricsHandler,R as registerOnContextChangeHandler,W as registerOnThemeChangeHandler};
1
+ import{appInitializeHelper as e,notifyAppLoadedHelper as i,notifySuccessHelper as t,notifyFailureHelper as n,notifyExpectedFailureHelper as a,registerOnThemeChangeHandlerHelper as o,registerOnContextChangeHandlerHelper as r,openLinkHelper as s}from"../../internal/appHelpers.js";import{uninitializeCommunication as l,sendAndUnwrap as m,Communication as d}from"../../internal/communication.js";import{GlobalVars as p}from"../../internal/globalVars.js";import{uninitializeHandlers as u,registerHostToAppPerformanceMetricsHandler as c}from"../../internal/handlers.js";import{ensureInitializeCalled as f}from"../../internal/internalAPIs.js";import{getLogger as h,getApiVersionTag as g}from"../../internal/telemetry.js";import{inServerSideRenderingEnvironment as I}from"../../internal/utils.js";import{AppId as y}from"../appId.js";import{HostClientType as S,HostName as T}from"../constants.js";import{version as C}from"../version.js";import*as v from"./lifecycle.js";export{v as lifecycle};import{_clearTelemetryPort as P}from"../../private/messageChannels/telemetry.js";import{_clearDataLayerPort as w}from"../../private/messageChannels/dataLayer.js";const j="v2",O=h("app"),N={AppLoaded:"appInitialization.appLoaded",Success:"appInitialization.success",Failure:"appInitialization.failure",ExpectedFailure:"appInitialization.expectedFailure"};var b,F;function x(){return p.initializeCompleted}function L(){return p.frameContext}function A(i){return e(g(j,"app.initialize"),i)}function z(){var e,i;if(I())return null;const t=null!==(e=d.currentWindow)&&void 0!==e?e:window;if(t.parent===t)return null;const n=t.location.ancestorOrigins,a=null==n?void 0:n.item(0);if(a)return a;const o=null===(i=t.document)||void 0===i?void 0:i.referrer;if(!o)return null;try{const e=new URL(o).origin;return e===t.location.origin?null:e}catch(e){return null}}function D(e){d.currentWindow=e}function k(){p.initializeCalled&&(u(),p.initializeCalled=!1,p.initializeCompleted=!1,p.initializePromise=void 0,p.additionalValidOrigins=[],p.frameContext=void 0,p.hostClientType=void 0,p.isFramelessWindow=!1,P(),w(),l())}function U(){return new Promise(e=>{f(),e(m(g(j,"app.getContext"),"getContext"))}).then(e=>function(e){var i;const t={actionInfo:e.actionInfo,app:{locale:e.locale,sessionId:e.appSessionId?e.appSessionId:"",theme:e.theme?e.theme:"default",brandColorPalettes:e.brandColorPalettes,iconPositionVertical:e.appIconPosition,osLocaleInfo:e.osLocaleInfo,messageId:e.messageId,parentMessageId:e.parentMessageId,userClickTime:e.userClickTime,userClickTimeV2:e.userClickTimeV2,userFileOpenPreference:e.userFileOpenPreference,host:{name:e.hostName?e.hostName:T.teams,clientType:e.hostClientType?e.hostClientType:S.web,features:e.hostFeatures,sessionId:e.sessionId?e.sessionId:"",ringId:e.ringId,ancestors:e.hostAncestors},appLaunchId:e.appLaunchId,appId:e.appId?new y(e.appId):void 0,manifestVersion:e.manifestVersion},page:{id:e.entityId,frameContext:e.frameContext?e.frameContext:p.frameContext,renderingSurface:e.renderingSurface?e.renderingSurface:void 0,subPageId:e.subEntityId,isFullScreen:e.isFullScreen,isMultiWindow:e.isMultiWindow,isBackgroundLoad:e.isBackgroundLoad,sourceOrigin:e.sourceOrigin},user:{id:null!==(i=e.userObjectId)&&void 0!==i?i:"",displayName:e.userDisplayName,isCallingAllowed:e.isCallingAllowed,isPSTNCallingAllowed:e.isPSTNCallingAllowed,licenseType:e.userLicenseType,loginHint:e.loginHint,userPrincipalName:e.userPrincipalName,tenant:e.tid?{id:e.tid,teamsSku:e.tenantSKU}:void 0},channel:e.channelId?{id:e.channelId,displayName:e.channelName,relativeUrl:e.channelRelativeUrl,membershipType:e.channelType,defaultOneNoteSectionId:e.defaultOneNoteSectionId,ownerGroupId:e.hostTeamGroupId,ownerTenantId:e.hostTeamTenantId}:void 0,chat:e.chatId?{id:e.chatId}:void 0,meeting:e.meetingId?{id:e.meetingId}:void 0,sharepoint:e.sharepoint,team:e.teamId?{internalId:e.teamId,displayName:e.teamName,type:e.teamType,groupId:e.groupId,templateId:e.teamTemplateId,isArchived:e.isTeamArchived,userRole:e.userTeamRole}:void 0,sharePointSite:e.teamSiteUrl||e.teamSiteDomain||e.teamSitePath||e.mySitePath||e.mySiteDomain?{teamSiteUrl:e.teamSiteUrl,teamSiteDomain:e.teamSiteDomain,teamSitePath:e.teamSitePath,teamSiteId:e.teamSiteId,mySitePath:e.mySitePath,mySiteDomain:e.mySiteDomain}:void 0,dialogParameters:e.dialogParameters||{}};return t}(e))}function H(){f(),i(g(j,"app.notifyAppLoaded"))}function V(){return t(g(j,"app.notifySuccess"))}function E(e){f(),n(g(j,"app.notifyFailure"),e)}function M(e){f(),a(g(j,"app.notifyExpectedFailure"),e)}function W(e){o(g(j,"app.registerOnThemeChangeHandler"),e)}function R(e){r(g(j,"app.registerOnContextChangeHandler"),e)}function B(e){c(e)}function G(e){return s(g(j,"app.openLink"),e)}!function(e){e.AuthFailed="AuthFailed",e.Timeout="Timeout",e.Other="Other"}(b||(b={})),function(e){e.PermissionError="PermissionError",e.NotFound="NotFound",e.Throttling="Throttling",e.Offline="Offline",e.Other="Other"}(F||(F={})),O("teamsjs instance is version %s, starting at %s UTC (%s local)",C,(new Date).toISOString(),(new Date).toLocaleString()),function(){if(I())return;const e=document.getElementsByTagName("script"),i=e&&e[e.length-1]&&e[e.length-1].src,t="Today, teamsjs can only be used from a single script or you may see undefined behavior. This log line is used to help detect cases where teamsjs is loaded multiple times -- it is always written. The presence of the log itself does not indicate a multi-load situation, but multiples of these log lines will. If you would like to use teamjs from more than one script at the same time, please open an issue at https://github.com/OfficeDev/microsoft-teams-library-js/issues";i&&0!==i.length?O("teamsjs is being used from %s. %s",i,t):O("teamsjs is being used from a script tag embedded directly in your html. %s",t)}();export{F as ExpectedFailureReason,b as FailedReason,N as Messages,D as _initialize,k as _uninitialize,U as getContext,L as getFrameContext,z as getImmediateParentOrigin,A as initialize,x as isInitialized,H as notifyAppLoaded,M as notifyExpectedFailure,E as notifyFailure,V as notifySuccess,G as openLink,B as registerHostToAppPerformanceMetricsHandler,R as registerOnContextChangeHandler,W as registerOnThemeChangeHandler};
@@ -1 +1 @@
1
- const o="2.58.0";export{o as version};
1
+ const t="2.59.0-beta.0";export{t as version};
@@ -4708,7 +4708,7 @@ function isSerializable(arg) {
4708
4708
  * @hidden
4709
4709
  * Package version.
4710
4710
  */
4711
- const version = "2.58.0";
4711
+ const version = "2.59.0-beta.0";
4712
4712
 
4713
4713
  ;// ./src/public/featureFlags.ts
4714
4714
  // All build feature flags are defined inside this object. Any build feature flag must have its own unique getter and setter function. This pattern allows for client apps to treeshake unused code and avoid including code guarded by this feature flags in the final bundle. If this property isn't desired, use the below runtime feature flags object.
@@ -5686,12 +5686,13 @@ function notifyExpectedFailure(expectedFailureRequest) {
5686
5686
  notifyExpectedFailureHelper(getApiVersionTag(appTelemetryVersionNumber, "app.notifyExpectedFailure" /* ApiName.App_NotifyExpectedFailure */), expectedFailureRequest);
5687
5687
  }
5688
5688
  /**
5689
- * Registers a handler for theme changes.
5689
+ * Registers a handler for host theme or brand color palette updates.
5690
5690
  *
5691
5691
  * @remarks
5692
5692
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
5693
+ * The theme, palettes, or both may change with each update.
5693
5694
  *
5694
- * @param handler - The handler to invoke when the user changes their theme.
5695
+ * @param handler - The handler to call when the host sends an update.
5695
5696
  */
5696
5697
  function registerOnThemeChangeHandler(handler) {
5697
5698
  registerOnThemeChangeHandlerHelper(getApiVersionTag(appTelemetryVersionNumber, "app.registerOnThemeChangeHandler" /* ApiName.App_RegisterOnThemeChangeHandler */), handler);
@@ -5772,6 +5773,7 @@ function transformLegacyContextToAppContext(legacyContext) {
5772
5773
  locale: legacyContext.locale,
5773
5774
  sessionId: legacyContext.appSessionId ? legacyContext.appSessionId : '',
5774
5775
  theme: legacyContext.theme ? legacyContext.theme : 'default',
5776
+ brandColorPalettes: legacyContext.brandColorPalettes,
5775
5777
  iconPositionVertical: legacyContext.appIconPosition,
5776
5778
  osLocaleInfo: legacyContext.osLocaleInfo,
5777
5779
  messageId: legacyContext.messageId,
@@ -7953,12 +7955,13 @@ function handlers_registerOnContextChangeHandler(apiVersionTag, handler) {
7953
7955
  * @internal
7954
7956
  * Limited to Microsoft-internal use
7955
7957
  */
7956
- function handleThemeChange(theme) {
7958
+ function handleThemeChange(theme, brandColorPalettes) {
7959
+ const hasBrandColorPalettes = !isNullOrUndefined(brandColorPalettes);
7957
7960
  if (HandlersPrivate.themeChangeHandler) {
7958
- HandlersPrivate.themeChangeHandler(theme);
7961
+ HandlersPrivate.themeChangeHandler(theme, hasBrandColorPalettes ? brandColorPalettes : undefined);
7959
7962
  }
7960
7963
  if (shouldEventBeRelayedToChild()) {
7961
- sendMessageEventToChild('themeChange', [theme]);
7964
+ sendMessageEventToChild('themeChange', hasBrandColorPalettes ? [theme, brandColorPalettes] : [theme]);
7962
7965
  }
7963
7966
  }
7964
7967
  /**
@@ -19524,10 +19527,11 @@ function publicAPIs_getContext(callback) {
19524
19527
  * @deprecated
19525
19528
  * As of TeamsJS v2.0.0, please use {@link app.registerOnThemeChangeHandler app.registerOnThemeChangeHandler(handler: registerOnThemeChangeHandlerFunctionType): void} instead.
19526
19529
  *
19527
- * Registers a handler for theme changes.
19530
+ * Registers a handler for host theme or brand color palette updates.
19528
19531
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
19532
+ * The theme, palettes, or both may change with each update.
19529
19533
  *
19530
- * @param handler - The handler to invoke when the user changes their theme.
19534
+ * @param handler - The handler to call when the host sends an update.
19531
19535
  */
19532
19536
  function publicAPIs_registerOnThemeChangeHandler(handler) {
19533
19537
  registerOnThemeChangeHandlerHelper(getApiVersionTag(publicAPIsTelemetryVersionNumber, "registerOnThemeChangeHandlerHelper" /* ApiName.PublicAPIs_RegisterOnThemeChangeHandlerHelper */), handler);