@microsoft/teams-js 2.19.1-beta.0 → 2.20.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1012,8 +1012,8 @@ var ApiName;
1012
1012
  ApiName["Dialog_Url_Bot_Open"] = "dialog.url.bot.open";
1013
1013
  ApiName["Dialog_Url_Open"] = "dialog.url.open";
1014
1014
  ApiName["Dialog_Url_Submit"] = "dialog.url.submit";
1015
- ApiName["Dialog_Url_SendMessageToParentFromDialog"] = "dialog.url.sendMessageToParentFromDialog";
1016
- ApiName["Dialog_Url_SendMessageToDialog"] = "dialog.url.sendMessageToDialog";
1015
+ ApiName["Dialog_Url_ParentCommunication_SendMessageToParentFromDialog"] = "dialog.url.parentCommunication.sendMessageToParentFromDialog";
1016
+ ApiName["Dialog_Url_ParentCommunication_SendMessageToDialog"] = "dialog.url.parentCommunication.sendMessageToDialog";
1017
1017
  ApiName["Files_AddCloudStorageFolder"] = "files.addCloudStorageFolder";
1018
1018
  ApiName["Files_AddCloudStorageProvider"] = "files.addCloudStorageProvider";
1019
1019
  ApiName["Files_AddCloudStorageProviderFile"] = "files.addCloudStorageProviderFile";
@@ -1035,7 +1035,7 @@ var ApiName;
1035
1035
  ApiName["GeoLocation_GetCurrentLocation"] = "geoLocation.getCurrentLocation";
1036
1036
  ApiName["GeoLocation_HasPermission"] = "geoLocation.hasPermission";
1037
1037
  ApiName["GeoLocation_Map_ChooseLocation"] = "geoLocation.map.chooseLocation";
1038
- ApiName["GeoLocation_RequestPermission"] = "geoLocation.hasPermission";
1038
+ ApiName["GeoLocation_RequestPermission"] = "geoLocation.requestPermission";
1039
1039
  ApiName["GeoLocation_ShowLocation"] = "geoLocation.showLocation";
1040
1040
  ApiName["Interactive_GetClientInfo"] = "interactive.getClientInfo";
1041
1041
  ApiName["Interactive_GetClientRoles"] = "interactive.getClientRoles";
@@ -1108,8 +1108,8 @@ var ApiName;
1108
1108
  ApiName["Pages_BackStack_NavigateBack"] = "pages.backStack.navigateBack";
1109
1109
  ApiName["Pages_BackStack_RegisterBackButtonHandler"] = "pages.backStack.registerBackButtonHandler";
1110
1110
  ApiName["Pages_Config_RegisterChangeConfigHandler"] = "pages.config.registerChangeConfigHandler";
1111
- ApiName["Pages_Config_RegisterOnRemoveHandlerHelper"] = "pages.config.registerOnRemoveHandlerHelper";
1112
- ApiName["Pages_Config_RegisterOnSaveHandlerHelper"] = "pages.config.registerOnSaveHandlerHelper";
1111
+ ApiName["Pages_Config_RegisterOnRemoveHandler"] = "pages.config.registerOnRemoveHandler";
1112
+ ApiName["Pages_Config_RegisterOnSaveHandler"] = "pages.config.registerOnSaveHandler";
1113
1113
  ApiName["Pages_Config_SetConfig"] = "pages.config.setConfig";
1114
1114
  ApiName["Pages_Config_SetValidityState"] = "pages.config.setValidityState";
1115
1115
  ApiName["Pages_CurrentApp_NavigateTo"] = "pages.currentApp.navigateTo";
@@ -1121,13 +1121,18 @@ var ApiName;
1121
1121
  ApiName["Pages_NavigateToApp"] = "pages.navigateToApp";
1122
1122
  ApiName["Pages_RegisterFocusEnterHandler"] = "pages.registerFocusEnterHandler";
1123
1123
  ApiName["Pages_RegisterFullScreenHandler"] = "pages.registerFullScreenHandler";
1124
+ ApiName["Pages_RemoveEvent_NotifyFailure"] = "pages.removeEvent.notifyFailure";
1125
+ ApiName["Pages_RemoveEvent_NotifySuccess"] = "pages.removeEvent.notifySuccess";
1124
1126
  ApiName["Pages_ReturnFocus"] = "pages.returnFocus";
1127
+ ApiName["Pages_SaveEvent_NotifyFailure"] = "pages.saveEvent.notifyFailure";
1128
+ ApiName["Pages_SaveEvent_NotifySuccess"] = "pages.saveEvent.notifySuccess";
1125
1129
  ApiName["Pages_SetCurrentFrame"] = "pages.setCurrentFrame";
1126
1130
  ApiName["Pages_ShareDeepLink"] = "pages.shareDeepLink";
1127
1131
  ApiName["Pages_Tabs_GetMruTabInstances"] = "pages.tabs.getMruTabInstances";
1128
1132
  ApiName["Pages_Tabs_GetTabInstances"] = "pages.tabs.getTabInstances";
1129
1133
  ApiName["Pages_Tabs_NavigateToTab"] = "pages.tabs.navigateToTab";
1130
1134
  ApiName["People_SelectPeople"] = "people.selectPeople";
1135
+ ApiName["Profile_ShowProfile"] = "profile.showProfile";
1131
1136
  ApiName["PublicAPIs_ExecuteDeepLink"] = "executeDeepLink";
1132
1137
  ApiName["PublicAPIs_GetContext"] = "getContext";
1133
1138
  ApiName["PublicAPIs_GetMruTabInstances"] = "getMruTabInstances";
@@ -1146,17 +1151,43 @@ var ApiName;
1146
1151
  ApiName["PublicAPIs_ShareDeepLink"] = "shareDeepLink";
1147
1152
  ApiName["RegisterHandler"] = "registerHandler";
1148
1153
  ApiName["RegisterOnThemeChangeHandler"] = "registerOnThemeChangeHandler";
1149
- ApiName["Settings_Remove_Failure"] = "settings.remove.failure";
1150
- ApiName["Settings_Remove_Success"] = "settings.remove.success";
1151
- ApiName["Settings_Save_Failure"] = "settings.save.failure";
1152
- ApiName["Settings_Save_Success"] = "settings.save.success";
1154
+ ApiName["Search_CloseSearch"] = "search.closeSearch";
1155
+ ApiName["Search_RegisterOnChangeHandler"] = "search.registerOnChangeHandler";
1156
+ ApiName["Search_RegisterOnClosedHandler"] = "search.registerOnClosedHandler";
1157
+ ApiName["Search_RegisterOnExecutedHandler"] = "search.registerOnExecutedHandler";
1158
+ ApiName["Search_UnregisterHandlers"] = "search.unregisterHandlers";
1159
+ ApiName["SecondaryBrowser_OpenUrl"] = "secondaryBrowser.openUrl";
1160
+ ApiName["Settings_GetSettings"] = "settings.getSettings";
1161
+ ApiName["Settings_RegisterOnRemoveHandler"] = "settings.registerOnRemoveHandler";
1162
+ ApiName["Settings_RegisterOnSaveHandler"] = "settings.registerOnSaveHandler";
1163
+ ApiName["Settings_SetSettings"] = "settings.setSettings";
1164
+ ApiName["Settings_SetValidityState"] = "settings.setValidityState";
1165
+ ApiName["StageView_Open"] = "stageView.open";
1153
1166
  ApiName["Tasks_StartTask"] = "tasks.startTask";
1154
1167
  ApiName["Tasks_SubmitTask"] = "tasks.submitTask";
1155
1168
  ApiName["Tasks_UpdateTask"] = "tasks.updateTask";
1169
+ ApiName["VideoEffects_MediaStream_RegisterForVideoFrame"] = "videoEffects.mediaStream.registerForVideoFrame";
1170
+ ApiName["VideoEffects_NotifySelectedVideoEffectChanged"] = "videoEffects.notifySelectedVideoEffectChanged";
1171
+ ApiName["VideoEffects_NotifyError"] = "videoEffects.notifyError";
1172
+ ApiName["VideoEffects_NotifyVideoFrameProcessed"] = "videoEffects.notifyVideoFrameProcessed";
1173
+ ApiName["VideoEffects_RegisterEffectParameterChangeHandler"] = "videoEffects.registerEffectParameterChangeHandler";
1174
+ ApiName["VideoEffects_RegisterForVideoEffect"] = "videoEffects.registerForVideoEffect";
1175
+ ApiName["VideoEffects_RegisterForVideoFrame"] = "videoEffects.registerForVideoFrame";
1176
+ ApiName["VideoEffects_RegisterSetFrameProcessTimeLimitHandler"] = "videoEffects.setFrameProcessTimeLimitHandler";
1177
+ ApiName["VideoEffects_RegisterStartVideoExtensibilityVideoStreamHandler"] = "videoEffects.startVideoExtensibilityVideoStreamHandler";
1178
+ ApiName["VideoEffects_RegisterForVideoBufferHandler"] = "videoEffects.registerForVideoBufferHandler";
1179
+ ApiName["VideoPerformanceMonitor_Constructor"] = "videoPerformanceMonitor.performanceDataGenerated";
1180
+ ApiName["VideoPerformanceMonitor_ReportFrameProcessed"] = "videoPerformanceMonitor.reportFrameProcessed";
1181
+ ApiName["VideoPerformanceMonitor_ReportTextureStreamAcquired"] = "videoPerformanceMonitor.reportTextureStreamAcquired";
1182
+ ApiName["VideoPerformanceMonitor_StartMonitorSlowFrameProcessing"] = "videoPerformanceMonitor.startMonitorSlowFrameProcessing";
1183
+ ApiName["VisualMedia_HasPermission"] = "visualMedia.hasPermission";
1184
+ ApiName["VisualMedia_Image_CaptureImages"] = "visualMedia.image.captureImages";
1185
+ ApiName["VisualMedia_Image_RetrieveImages"] = "visualMedia.image.retrieveImages";
1186
+ ApiName["VisualMedia_RequestPermission"] = "visualMedia.requestPermission";
1156
1187
  })(ApiName || (ApiName = {}));
1157
1188
 
1158
1189
  ;// CONCATENATED MODULE: ./src/artifactsForCDN/validDomains.json
1159
- const validDomains_namespaceObject = JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","teams.live.com","devspaces.skype.com","ssauth.skype.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.live.com","outlook-sdf.live.com","*.teams.microsoft.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","www.bing.com","www.staging-bing-int.com","teams.cloud.microsoft","outlook.cloud.microsoft","m365.cloud.microsoft","copilot.microsoft.com"]}');
1190
+ const validDomains_namespaceObject = JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","*.teams.microsoft.com","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.live.com","outlook-sdf.live.com","teams.live.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","devspaces.skype.com","ssauth.skype.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","www.bing.com","www.staging-bing-int.com","teams.cloud.microsoft","outlook.cloud.microsoft","m365.cloud.microsoft","copilot.microsoft.com","windows.msn.com"]}');
1160
1191
  var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
1161
1192
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1162
1193
 
@@ -2102,7 +2133,7 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
2102
2133
 
2103
2134
 
2104
2135
  const runtimeLogger = getLogger('runtime');
2105
- const latestRuntimeApiVersion = 3;
2136
+ const latestRuntimeApiVersion = 4;
2106
2137
  function isLatestRuntimeVersion(runtime) {
2107
2138
  return runtime.apiVersion === latestRuntimeApiVersion;
2108
2139
  }
@@ -2134,7 +2165,7 @@ function isRuntimeInitialized(runtime) {
2134
2165
  }
2135
2166
  let runtime_runtime = _uninitializedRuntime;
2136
2167
  const versionAndPlatformAgnosticTeamsRuntimeConfig = {
2137
- apiVersion: 3,
2168
+ apiVersion: 4,
2138
2169
  hostVersionsInfo: teamsMinAdaptiveCardVersion,
2139
2170
  isLegacyTeams: true,
2140
2171
  supports: {
@@ -2149,6 +2180,7 @@ const versionAndPlatformAgnosticTeamsRuntimeConfig = {
2149
2180
  },
2150
2181
  url: {
2151
2182
  bot: {},
2183
+ parentCommunication: {},
2152
2184
  },
2153
2185
  update: {},
2154
2186
  },
@@ -2246,6 +2278,27 @@ const upgradeChain = [
2246
2278
  return Object.assign(Object.assign({}, previousVersionRuntime), { apiVersion: 3, supports: newSupports });
2247
2279
  },
2248
2280
  },
2281
+ {
2282
+ versionToUpgradeFrom: 3,
2283
+ upgradeToNextVersion: (previousVersionRuntime) => {
2284
+ var _a, _b, _c, _d, _e;
2285
+ return {
2286
+ apiVersion: 4,
2287
+ hostVersionsInfo: previousVersionRuntime.hostVersionsInfo,
2288
+ isLegacyTeams: previousVersionRuntime.isLegacyTeams,
2289
+ supports: Object.assign(Object.assign({}, previousVersionRuntime.supports), { dialog: previousVersionRuntime.supports.dialog
2290
+ ? {
2291
+ card: (_a = previousVersionRuntime.supports.dialog) === null || _a === void 0 ? void 0 : _a.card,
2292
+ url: {
2293
+ bot: (_c = (_b = previousVersionRuntime.supports.dialog) === null || _b === void 0 ? void 0 : _b.url) === null || _c === void 0 ? void 0 : _c.bot,
2294
+ parentCommunication: ((_d = previousVersionRuntime.supports.dialog) === null || _d === void 0 ? void 0 : _d.url) ? {} : undefined,
2295
+ },
2296
+ update: (_e = previousVersionRuntime.supports.dialog) === null || _e === void 0 ? void 0 : _e.update,
2297
+ }
2298
+ : undefined }),
2299
+ };
2300
+ },
2301
+ },
2249
2302
  ];
2250
2303
  const mapTeamsVersionToSupportedCapabilities = {
2251
2304
  // 1.0.0 just signifies "these capabilities have practically always been supported." For some of these
@@ -2417,7 +2470,7 @@ const _minRuntimeConfigToUninitialize = {
2417
2470
  * @hidden
2418
2471
  * Package version.
2419
2472
  */
2420
- const version = "2.19.1-beta.0";
2473
+ const version = "2.20.0-beta.0";
2421
2474
 
2422
2475
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2423
2476
 
@@ -2691,7 +2744,6 @@ function validateOrigin(messageOrigin) {
2691
2744
 
2692
2745
 
2693
2746
 
2694
-
2695
2747
  /**
2696
2748
  * Namespace to interact with the authentication-specific part of the SDK.
2697
2749
  *
@@ -2830,6 +2882,7 @@ var authentication;
2830
2882
  authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.resources,
2831
2883
  authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.claims,
2832
2884
  authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.silent,
2885
+ authTokenRequest === null || authTokenRequest === void 0 ? void 0 : authTokenRequest.tenantId,
2833
2886
  ]));
2834
2887
  }).then(([success, result]) => {
2835
2888
  if (success) {
@@ -2968,21 +3021,11 @@ var authentication;
2968
3021
  });
2969
3022
  }
2970
3023
  /**
2971
- * When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
2972
- * window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
2973
- * {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
2974
- * authentication request was successful.
2975
- *
2976
- * @remarks
2977
- * This function is usable only from the authentication window.
2978
- * This call causes the authentication window to be closed.
2979
- *
2980
- * @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
2981
- * this value in its callback or via the `Promise` return value
2982
- * @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
3024
+ * @deprecated
3025
+ * This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
3026
+ * Please use the {@link authentication.notifySuccess authentication.notifySuccess(result?: string): void} instead.
2983
3027
  */
2984
- function notifySuccess(result, callbackUrl) {
2985
- redirectIfWin32Outlook(callbackUrl, 'result', result);
3028
+ function notifySuccess(result, _callbackUrl) {
2986
3029
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.authentication);
2987
3030
  sendMessageToParent('authentication.authenticate.success', [result]);
2988
3031
  // Wait for the message to be sent before closing the window
@@ -2990,22 +3033,11 @@ var authentication;
2990
3033
  }
2991
3034
  authentication.notifySuccess = notifySuccess;
2992
3035
  /**
2993
- * When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
2994
- * window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
2995
- * {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
2996
- * authentication request failed.
2997
-
2998
- *
2999
- * @remarks
3000
- * This function is usable only on the authentication window.
3001
- * This call causes the authentication window to be closed.
3002
- *
3003
- * @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
3004
- * this value in its callback or via the `Promise` return value
3005
- * @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
3036
+ * @deprecated
3037
+ * This function used to have an unused optional second parameter called callbackUrl. Because it was not used, it has been removed.
3038
+ * Please use the {@link authentication.notifyFailure authentication.notifyFailure(result?: string): void} instead.
3006
3039
  */
3007
- function notifyFailure(reason, callbackUrl) {
3008
- redirectIfWin32Outlook(callbackUrl, 'reason', reason);
3040
+ function notifyFailure(reason, _callbackUrl) {
3009
3041
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.authentication);
3010
3042
  sendMessageToParent('authentication.authenticate.failure', [reason]);
3011
3043
  // Wait for the message to be sent before closing the window
@@ -3034,48 +3066,6 @@ var authentication;
3034
3066
  closeAuthenticationWindow();
3035
3067
  }
3036
3068
  }
3037
- /**
3038
- * Validates that the callbackUrl param is a valid connector url, appends the result/reason and authSuccess/authFailure as URL fragments and redirects the window
3039
- * @param callbackUrl - the connectors url to redirect to
3040
- * @param key - "result" in case of success and "reason" in case of failure
3041
- * @param value - the value of the passed result/reason parameter
3042
- */
3043
- function redirectIfWin32Outlook(callbackUrl, key, value) {
3044
- if (callbackUrl) {
3045
- const link = document.createElement('a');
3046
- link.href = decodeURIComponent(callbackUrl);
3047
- if (link.host &&
3048
- link.host !== ssrSafeWindow().location.host &&
3049
- link.host === 'outlook.office.com' &&
3050
- link.search.indexOf('client_type=Win32_Outlook') > -1) {
3051
- if (key && key === 'result') {
3052
- if (value) {
3053
- link.href = updateUrlParameter(link.href, 'result', value);
3054
- }
3055
- Communication.currentWindow.location.assign(updateUrlParameter(link.href, 'authSuccess', ''));
3056
- }
3057
- if (key && key === 'reason') {
3058
- if (value) {
3059
- link.href = updateUrlParameter(link.href, 'reason', value);
3060
- }
3061
- Communication.currentWindow.location.assign(updateUrlParameter(link.href, 'authFailure', ''));
3062
- }
3063
- }
3064
- }
3065
- }
3066
- /**
3067
- * Appends either result or reason as a fragment to the 'callbackUrl'
3068
- * @param uri - the url to modify
3069
- * @param key - the fragment key
3070
- * @param value - the fragment value
3071
- */
3072
- function updateUrlParameter(uri, key, value) {
3073
- const i = uri.indexOf('#');
3074
- let hash = i === -1 ? '#' : uri.substr(i);
3075
- hash = hash + '&' + key + (value !== '' ? '=' + value : '');
3076
- uri = i === -1 ? uri : uri.substr(0, i);
3077
- return uri + hash;
3078
- }
3079
3069
  /**
3080
3070
  * @hidden
3081
3071
  * Limited set of data residencies information exposed to 1P application developers
@@ -3245,69 +3235,94 @@ var dialog;
3245
3235
  }
3246
3236
  url.submit = submit;
3247
3237
  /**
3248
- * Send message to the parent from dialog
3238
+ * Subcapability that allows communication between the dialog and the parent app.
3249
3239
  *
3250
3240
  * @remarks
3251
- * This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
3252
- *
3253
- * @param message - The message to send to the parent
3241
+ * Note that dialog can be invoked from parentless scenarios e.g. Search Message Extensions. The subcapability `parentCommunication` is not supported in such scenarios.
3254
3242
  *
3255
3243
  * @beta
3256
3244
  */
3257
- function sendMessageToParentFromDialog(
3258
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3259
- message) {
3260
- internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.task);
3261
- if (!isSupported()) {
3262
- throw errorNotSupportedOnPlatform;
3245
+ let parentCommunication;
3246
+ (function (parentCommunication) {
3247
+ /**
3248
+ * Send message to the parent from dialog
3249
+ *
3250
+ * @remarks
3251
+ * This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
3252
+ *
3253
+ * @param message - The message to send to the parent
3254
+ *
3255
+ * @beta
3256
+ */
3257
+ function sendMessageToParentFromDialog(
3258
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3259
+ message) {
3260
+ internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.task);
3261
+ if (!isSupported()) {
3262
+ throw errorNotSupportedOnPlatform;
3263
+ }
3264
+ sendMessageToParentWithVersion(getApiVersionTag(dialogTelemetryVersionNumber, ApiName.Dialog_Url_ParentCommunication_SendMessageToParentFromDialog), 'messageForParent', [message]);
3263
3265
  }
3264
- sendMessageToParentWithVersion(getApiVersionTag(dialogTelemetryVersionNumber, ApiName.Dialog_Url_SendMessageToParentFromDialog), 'messageForParent', [message]);
3265
- }
3266
- url.sendMessageToParentFromDialog = sendMessageToParentFromDialog;
3267
- /**
3268
- * Send message to the dialog from the parent
3269
- *
3270
- * @param message - The message to send
3271
- *
3272
- * @beta
3273
- */
3274
- function sendMessageToDialog(
3275
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3276
- message) {
3277
- internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
3278
- if (!isSupported()) {
3279
- throw errorNotSupportedOnPlatform;
3266
+ parentCommunication.sendMessageToParentFromDialog = sendMessageToParentFromDialog;
3267
+ /**
3268
+ * Send message to the dialog from the parent
3269
+ *
3270
+ * @param message - The message to send
3271
+ *
3272
+ * @beta
3273
+ */
3274
+ function sendMessageToDialog(
3275
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3276
+ message) {
3277
+ internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
3278
+ if (!isSupported()) {
3279
+ throw errorNotSupportedOnPlatform;
3280
+ }
3281
+ sendMessageToParentWithVersion(getApiVersionTag(dialogTelemetryVersionNumber, ApiName.Dialog_Url_ParentCommunication_SendMessageToDialog), 'messageForChild', [message]);
3280
3282
  }
3281
- sendMessageToParentWithVersion(getApiVersionTag(dialogTelemetryVersionNumber, ApiName.Dialog_Url_SendMessageToDialog), 'messageForChild', [message]);
3282
- }
3283
- url.sendMessageToDialog = sendMessageToDialog;
3284
- /**
3285
- * Register a listener that will be triggered when a message is received from the app that opened the dialog.
3286
- *
3287
- * @remarks
3288
- * This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
3289
- *
3290
- * @param listener - The listener that will be triggered.
3291
- *
3292
- * @beta
3293
- */
3294
- function registerOnMessageFromParent(listener) {
3295
- internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.task);
3296
- if (!isSupported()) {
3297
- throw errorNotSupportedOnPlatform;
3283
+ parentCommunication.sendMessageToDialog = sendMessageToDialog;
3284
+ /**
3285
+ * Register a listener that will be triggered when a message is received from the app that opened the dialog.
3286
+ *
3287
+ * @remarks
3288
+ * This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
3289
+ *
3290
+ * @param listener - The listener that will be triggered.
3291
+ *
3292
+ * @beta
3293
+ */
3294
+ function registerOnMessageFromParent(listener) {
3295
+ internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.task);
3296
+ if (!isSupported()) {
3297
+ throw errorNotSupportedOnPlatform;
3298
+ }
3299
+ // We need to remove the original 'messageForChild'
3300
+ // handler since the original does not allow for post messages.
3301
+ // It is replaced by the user specified listener that is passed in.
3302
+ removeHandler('messageForChild');
3303
+ registerHandler('messageForChild', listener);
3304
+ storedMessages.reverse();
3305
+ while (storedMessages.length > 0) {
3306
+ const message = storedMessages.pop();
3307
+ listener(message);
3308
+ }
3298
3309
  }
3299
- // We need to remove the original 'messageForChild'
3300
- // handler since the original does not allow for post messages.
3301
- // It is replaced by the user specified listener that is passed in.
3302
- removeHandler('messageForChild');
3303
- registerHandler('messageForChild', listener);
3304
- storedMessages.reverse();
3305
- while (storedMessages.length > 0) {
3306
- const message = storedMessages.pop();
3307
- listener(message);
3310
+ parentCommunication.registerOnMessageFromParent = registerOnMessageFromParent;
3311
+ /**
3312
+ * Checks if dialog.url.parentCommunication capability is supported by the host
3313
+ *
3314
+ * @returns boolean to represent whether dialog.url.parentCommunication capability is supported
3315
+ *
3316
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
3317
+ *
3318
+ * @beta
3319
+ */
3320
+ function isSupported() {
3321
+ var _a, _b;
3322
+ return internalAPIs_ensureInitialized(runtime_runtime) && !!((_b = (_a = runtime_runtime.supports.dialog) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.parentCommunication);
3308
3323
  }
3309
- }
3310
- url.registerOnMessageFromParent = registerOnMessageFromParent;
3324
+ parentCommunication.isSupported = isSupported;
3325
+ })(parentCommunication = url.parentCommunication || (url.parentCommunication = {}));
3311
3326
  /**
3312
3327
  * Checks if dialog.url module is supported by the host
3313
3328
  *
@@ -4310,6 +4325,31 @@ function setCurrentFrameHelper(apiVersionTag, frameInfo) {
4310
4325
  }
4311
4326
  sendMessageToParentWithVersion(apiVersionTag, 'setFrameContext', [frameInfo]);
4312
4327
  }
4328
+ function configSetValidityStateHelper(apiVersionTag, validityState) {
4329
+ internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.settings, FrameContexts.remove);
4330
+ if (!pages.config.isSupported()) {
4331
+ throw errorNotSupportedOnPlatform;
4332
+ }
4333
+ sendMessageToParentWithVersion(apiVersionTag, 'settings.setValidityState', [validityState]);
4334
+ }
4335
+ function getConfigHelper(apiVersionTag) {
4336
+ return new Promise((resolve) => {
4337
+ internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.settings, FrameContexts.remove, FrameContexts.sidePanel);
4338
+ if (!pages.isSupported()) {
4339
+ throw errorNotSupportedOnPlatform;
4340
+ }
4341
+ resolve(sendAndUnwrapWithVersion(apiVersionTag, 'settings.getSettings'));
4342
+ });
4343
+ }
4344
+ function configSetConfigHelper(apiVersionTag, instanceConfig) {
4345
+ return new Promise((resolve) => {
4346
+ internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.settings, FrameContexts.sidePanel);
4347
+ if (!pages.config.isSupported()) {
4348
+ throw errorNotSupportedOnPlatform;
4349
+ }
4350
+ resolve(sendAndHandleStatusAndReasonWithVersion(apiVersionTag, 'settings.setSettings', instanceConfig));
4351
+ });
4352
+ }
4313
4353
  /**
4314
4354
  * Navigation-specific part of the SDK.
4315
4355
  */
@@ -4375,13 +4415,7 @@ var pages;
4375
4415
  * @returns Promise that resolves with the {@link InstanceConfig} object.
4376
4416
  */
4377
4417
  function getConfig() {
4378
- return new Promise((resolve) => {
4379
- internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.settings, FrameContexts.remove, FrameContexts.sidePanel);
4380
- if (!isSupported()) {
4381
- throw errorNotSupportedOnPlatform;
4382
- }
4383
- resolve(sendAndUnwrapWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_GetConfig), 'settings.getSettings'));
4384
- });
4418
+ return getConfigHelper(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_GetConfig));
4385
4419
  }
4386
4420
  pages.getConfig = getConfig;
4387
4421
  /**
@@ -4533,11 +4567,7 @@ var pages;
4533
4567
  * @param validityState - Indicates whether the save or remove button is enabled for the user.
4534
4568
  */
4535
4569
  function setValidityState(validityState) {
4536
- internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.settings, FrameContexts.remove);
4537
- if (!isSupported()) {
4538
- throw errorNotSupportedOnPlatform;
4539
- }
4540
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_SetValidityState), 'settings.setValidityState', [validityState]);
4570
+ return configSetValidityStateHelper(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_SetValidityState), validityState);
4541
4571
  }
4542
4572
  config.setValidityState = setValidityState;
4543
4573
  /**
@@ -4547,13 +4577,7 @@ var pages;
4547
4577
  * @returns Promise that resolves when the operation has completed.
4548
4578
  */
4549
4579
  function setConfig(instanceConfig) {
4550
- return new Promise((resolve) => {
4551
- internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.settings, FrameContexts.sidePanel);
4552
- if (!isSupported()) {
4553
- throw errorNotSupportedOnPlatform;
4554
- }
4555
- resolve(sendAndHandleStatusAndReasonWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_SetConfig), 'settings.setSettings', instanceConfig));
4556
- });
4580
+ return configSetConfigHelper(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_SetConfig), instanceConfig);
4557
4581
  }
4558
4582
  config.setConfig = setConfig;
4559
4583
  /**
@@ -4564,7 +4588,7 @@ var pages;
4564
4588
  * @param handler - The handler to invoke when the user selects the Save button.
4565
4589
  */
4566
4590
  function registerOnSaveHandler(handler) {
4567
- registerOnSaveHandlerHelper(handler, () => {
4591
+ registerOnSaveHandlerHelper(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_RegisterOnSaveHandler), handler, () => {
4568
4592
  if (!isNullOrUndefined(handler) && !isSupported()) {
4569
4593
  throw errorNotSupportedOnPlatform;
4570
4594
  }
@@ -4578,18 +4602,18 @@ var pages;
4578
4602
  * @internal
4579
4603
  * Limited to Microsoft-internal use
4580
4604
  *
4605
+ * @param apiVersionTag - The API version tag, which is used for telemetry, composed by API version number and source API name.
4581
4606
  * @param handler - The handler to invoke when the user selects the Save button.
4582
4607
  * @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
4583
4608
  */
4584
- function registerOnSaveHandlerHelper(handler, versionSpecificHelper) {
4609
+ function registerOnSaveHandlerHelper(apiVersionTag, handler, versionSpecificHelper) {
4585
4610
  // allow for registration cleanup even when not finished initializing
4586
4611
  !isNullOrUndefined(handler) && internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.settings);
4587
4612
  if (versionSpecificHelper) {
4588
4613
  versionSpecificHelper();
4589
4614
  }
4590
4615
  saveHandler = handler;
4591
- !isNullOrUndefined(handler) &&
4592
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_RegisterOnSaveHandlerHelper), 'registerHandler', ['save']);
4616
+ !isNullOrUndefined(handler) && sendMessageToParentWithVersion(apiVersionTag, 'registerHandler', ['save']);
4593
4617
  }
4594
4618
  config.registerOnSaveHandlerHelper = registerOnSaveHandlerHelper;
4595
4619
  /**
@@ -4600,7 +4624,7 @@ var pages;
4600
4624
  * @param handler - The handler to invoke when the user selects the Remove button.
4601
4625
  */
4602
4626
  function registerOnRemoveHandler(handler) {
4603
- registerOnRemoveHandlerHelper(handler, () => {
4627
+ registerOnRemoveHandlerHelper(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_RegisterOnRemoveHandler), handler, () => {
4604
4628
  if (!isNullOrUndefined(handler) && !isSupported()) {
4605
4629
  throw errorNotSupportedOnPlatform;
4606
4630
  }
@@ -4614,18 +4638,18 @@ var pages;
4614
4638
  * @internal
4615
4639
  * Limited to Microsoft-internal use
4616
4640
  *
4641
+ * @param apiVersionTag - The API version tag, which is used for telemetry, composed by API version number and source API name.
4617
4642
  * @param handler - The handler to invoke when the user selects the Remove button.
4618
4643
  * @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
4619
4644
  */
4620
- function registerOnRemoveHandlerHelper(handler, versionSpecificHelper) {
4645
+ function registerOnRemoveHandlerHelper(apiVersionTag, handler, versionSpecificHelper) {
4621
4646
  // allow for registration cleanup even when not finished initializing
4622
4647
  !isNullOrUndefined(handler) && internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.remove, FrameContexts.settings);
4623
4648
  if (versionSpecificHelper) {
4624
4649
  versionSpecificHelper();
4625
4650
  }
4626
4651
  removeHandler = handler;
4627
- !isNullOrUndefined(handler) &&
4628
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_Config_RegisterOnRemoveHandlerHelper), 'registerHandler', ['remove']);
4652
+ !isNullOrUndefined(handler) && sendMessageToParentWithVersion(apiVersionTag, 'registerHandler', ['remove']);
4629
4653
  }
4630
4654
  config.registerOnRemoveHandlerHelper = registerOnRemoveHandlerHelper;
4631
4655
  function handleSave(result) {
@@ -4664,12 +4688,12 @@ var pages;
4664
4688
  }
4665
4689
  notifySuccess() {
4666
4690
  this.ensureNotNotified();
4667
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Settings_Save_Success), 'settings.save.success');
4691
+ sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_SaveEvent_NotifySuccess), 'settings.save.success');
4668
4692
  this.notified = true;
4669
4693
  }
4670
4694
  notifyFailure(reason) {
4671
4695
  this.ensureNotNotified();
4672
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Settings_Save_Failure), 'settings.save.failure', [reason]);
4696
+ sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_SaveEvent_NotifyFailure), 'settings.save.failure', [reason]);
4673
4697
  this.notified = true;
4674
4698
  }
4675
4699
  ensureNotNotified() {
@@ -4701,12 +4725,12 @@ var pages;
4701
4725
  }
4702
4726
  notifySuccess() {
4703
4727
  this.ensureNotNotified();
4704
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Settings_Remove_Success), 'settings.remove.success');
4728
+ sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_RemoveEvent_NotifySuccess), 'settings.remove.success');
4705
4729
  this.notified = true;
4706
4730
  }
4707
4731
  notifyFailure(reason) {
4708
4732
  this.ensureNotNotified();
4709
- sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Settings_Remove_Failure), 'settings.remove.failure', [reason]);
4733
+ sendMessageToParentWithVersion(getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_RemoveEvent_NotifyFailure), 'settings.remove.failure', [reason]);
4710
4734
  this.notified = true;
4711
4735
  }
4712
4736
  ensureNotNotified() {
@@ -4821,6 +4845,8 @@ var pages;
4821
4845
  * Hide from docs
4822
4846
  * ------
4823
4847
  * Provides APIs to interact with the full-trust part of the SDK. Limited to 1P applications
4848
+ * @internal
4849
+ * Limited to Microsoft-internal use
4824
4850
  */
4825
4851
  let fullTrust;
4826
4852
  (function (fullTrust) {
@@ -4829,6 +4855,7 @@ var pages;
4829
4855
  * Hide from docs
4830
4856
  * ------
4831
4857
  * Place the tab into full-screen mode.
4858
+ *
4832
4859
  */
4833
4860
  function enterFullscreen() {
4834
4861
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content);
@@ -5261,6 +5288,125 @@ function handlers_registerOnResumeHandler(handler) {
5261
5288
  !isNullOrUndefined(handler) && sendMessageToParent('registerHandler', ['load']);
5262
5289
  }
5263
5290
 
5291
+ ;// CONCATENATED MODULE: ./src/internal/nestedAppAuth.ts
5292
+
5293
+
5294
+ const nestedAppAuthLogger = getLogger('nestedAppAuth');
5295
+ const tryPolyfillWithNestedAppAuthBridgeLogger = nestedAppAuthLogger.extend('tryPolyfillWithNestedAppAuthBridge');
5296
+ /**
5297
+ * @hidden
5298
+ * Enumeration for nested app authentication message event names.
5299
+ *
5300
+ * @internal
5301
+ * Limited to Microsoft-internal use
5302
+ *
5303
+ * @enum {string}
5304
+ *
5305
+ * @property {string} Request - Event name for a nested app authentication request.
5306
+ * @property {string} Response - Event name for a nested app authentication response.
5307
+ */
5308
+ var NestedAppAuthMessageEventNames;
5309
+ (function (NestedAppAuthMessageEventNames) {
5310
+ NestedAppAuthMessageEventNames["Request"] = "NestedAppAuthRequest";
5311
+ NestedAppAuthMessageEventNames["Response"] = "NestedAppAuthResponse";
5312
+ })(NestedAppAuthMessageEventNames || (NestedAppAuthMessageEventNames = {}));
5313
+ /**
5314
+ * @hidden
5315
+ * Attempt to polyfill the nestedAppAuthBridge object on the given window
5316
+ *
5317
+ * @internal
5318
+ * Limited to Microsoft-internal use
5319
+ */
5320
+ function tryPolyfillWithNestedAppAuthBridge(clientSupportedSDKVersion, window, handlers) {
5321
+ var _a;
5322
+ const logger = tryPolyfillWithNestedAppAuthBridgeLogger;
5323
+ if (GlobalVars.isFramelessWindow) {
5324
+ logger('Cannot polyfill nestedAppAuthBridge as current window is frameless');
5325
+ return;
5326
+ }
5327
+ if (!window) {
5328
+ logger('Cannot polyfill nestedAppAuthBridge as current window does not exist');
5329
+ return;
5330
+ }
5331
+ const parsedClientSupportedSDKVersion = (() => {
5332
+ try {
5333
+ return JSON.parse(clientSupportedSDKVersion);
5334
+ }
5335
+ catch (e) {
5336
+ return null;
5337
+ }
5338
+ })();
5339
+ if (!parsedClientSupportedSDKVersion || !((_a = parsedClientSupportedSDKVersion.supports) === null || _a === void 0 ? void 0 : _a.nestedAppAuth)) {
5340
+ logger('Cannot polyfill nestedAppAuthBridge as current hub does not support nested app auth');
5341
+ return;
5342
+ }
5343
+ const extendedWindow = window;
5344
+ if (extendedWindow.nestedAppAuthBridge) {
5345
+ logger('nestedAppAuthBridge already exists on current window, skipping polyfill');
5346
+ return;
5347
+ }
5348
+ const nestedAppAuthBridge = createNestedAppAuthBridge(extendedWindow, handlers);
5349
+ if (nestedAppAuthBridge) {
5350
+ extendedWindow.nestedAppAuthBridge = nestedAppAuthBridge;
5351
+ }
5352
+ }
5353
+ const createNestedAppAuthBridgeLogger = nestedAppAuthLogger.extend('createNestedAppAuthBridge');
5354
+ /**
5355
+ * @hidden
5356
+ * Creates a bridge for nested app authentication.
5357
+ *
5358
+ * @internal
5359
+ * Limited to Microsoft-internal use
5360
+ *
5361
+ * @param {Window | null} window - The window object where the nested app authentication bridge will be created. If null, the function will log an error message and return null.
5362
+ * @returns {NestedAppAuthBridge | null} Returns an object with methods for adding and removing event listeners, and posting messages. If the provided window is null, returns null.
5363
+ *
5364
+ * @property {Function} addEventListener - Adds an event listener to the window. Only supports the 'message' event. If an unsupported event is passed, logs an error message.
5365
+ * @property {Function} postMessage - Posts a message to the window. The message should be a stringified JSON object with a messageType of 'NestedAppAuthRequest'. If the message does not meet these criteria, logs an error message.
5366
+ * @property {Function} removeEventListener - Removes an event listener from the window.
5367
+ */
5368
+ function createNestedAppAuthBridge(window, bridgeHandlers) {
5369
+ const logger = createNestedAppAuthBridgeLogger;
5370
+ if (!window) {
5371
+ logger('nestedAppAuthBridge cannot be created as current window does not exist');
5372
+ return null;
5373
+ }
5374
+ const { onMessage, sendPostMessage } = bridgeHandlers;
5375
+ const nestedAppAuthBridgeHandler = (callback) => (evt) => onMessage(evt, callback);
5376
+ return {
5377
+ addEventListener: (eventName, callback) => {
5378
+ if (eventName === 'message') {
5379
+ window.addEventListener(eventName, nestedAppAuthBridgeHandler(callback));
5380
+ }
5381
+ else {
5382
+ logger(`Event ${eventName} is not supported by nestedAppAuthBridge`);
5383
+ }
5384
+ },
5385
+ postMessage: (message) => {
5386
+ // Validate that it is a valid auth bridge request message
5387
+ const parsedMessage = (() => {
5388
+ try {
5389
+ return JSON.parse(message);
5390
+ }
5391
+ catch (e) {
5392
+ return null;
5393
+ }
5394
+ })();
5395
+ if (!parsedMessage ||
5396
+ typeof parsedMessage !== 'object' ||
5397
+ parsedMessage.messageType !== NestedAppAuthMessageEventNames.Request) {
5398
+ logger('Unrecognized data format received by app, message being ignored. Message: %o', message);
5399
+ return;
5400
+ }
5401
+ // Post the message to the top window
5402
+ sendPostMessage(message);
5403
+ },
5404
+ removeEventListener: (eventName, callback) => {
5405
+ window.removeEventListener(eventName, nestedAppAuthBridgeHandler(callback));
5406
+ },
5407
+ };
5408
+ }
5409
+
5264
5410
  ;// CONCATENATED MODULE: ./src/internal/communication.ts
5265
5411
  /* eslint-disable @typescript-eslint/ban-types */
5266
5412
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -5282,6 +5428,7 @@ var communication_awaiter = (undefined && undefined.__awaiter) || function (this
5282
5428
 
5283
5429
 
5284
5430
 
5431
+
5285
5432
  const communicationLogger = getLogger('communication');
5286
5433
  /**
5287
5434
  * @internal
@@ -5297,6 +5444,7 @@ class CommunicationPrivate {
5297
5444
  }
5298
5445
  CommunicationPrivate.parentMessageQueue = [];
5299
5446
  CommunicationPrivate.childMessageQueue = [];
5447
+ CommunicationPrivate.topMessageQueue = [];
5300
5448
  CommunicationPrivate.nextMessageId = 0;
5301
5449
  CommunicationPrivate.callbacks = {};
5302
5450
  CommunicationPrivate.promiseCallbacks = {};
@@ -5314,6 +5462,7 @@ function initializeCommunication(validMessageOrigins, apiVersionTag) {
5314
5462
  Communication.currentWindow.parent !== Communication.currentWindow.self
5315
5463
  ? Communication.currentWindow.parent
5316
5464
  : Communication.currentWindow.opener;
5465
+ Communication.topWindow = Communication.currentWindow.top;
5317
5466
  // Listen to messages from the parent or child frame.
5318
5467
  // Frameless windows will only receive this event from child frames and if validMessageOrigins is passed.
5319
5468
  if (Communication.parentWindow || validMessageOrigins) {
@@ -5338,6 +5487,10 @@ function initializeCommunication(validMessageOrigins, apiVersionTag) {
5338
5487
  version,
5339
5488
  latestRuntimeApiVersion,
5340
5489
  ]).then(([context, clientType, runtimeConfig, clientSupportedSDKVersion]) => {
5490
+ tryPolyfillWithNestedAppAuthBridge(clientSupportedSDKVersion, Communication.currentWindow, {
5491
+ onMessage: processAuthBridgeMessage,
5492
+ sendPostMessage: sendNestedAuthRequestToTopWindow,
5493
+ });
5341
5494
  return { context, clientType, runtimeConfig, clientSupportedSDKVersion };
5342
5495
  });
5343
5496
  }
@@ -5553,19 +5706,29 @@ function sendMessageToParent(actionName, argsOrCallback, callback) {
5553
5706
  CommunicationPrivate.callbacks[request.id] = callback;
5554
5707
  }
5555
5708
  }
5556
- const sendMessageToParentHelperLogger = communicationLogger.extend('sendMessageToParentHelper');
5709
+ const sendNestedAuthRequestToTopWindowLogger = communicationLogger.extend('sendNestedAuthRequestToTopWindow');
5557
5710
  /**
5558
5711
  * @internal
5559
5712
  * Limited to Microsoft-internal use
5560
5713
  */
5561
- function sendMessageToParentHelper(apiVersionTag, actionName, args) {
5562
- const logger = sendMessageToParentHelperLogger;
5563
- const targetWindow = Communication.parentWindow;
5564
- const request = createMessageRequest(apiVersionTag, actionName, args);
5565
- logger('Message %i information: %o', request.id, { actionName, args });
5714
+ function sendNestedAuthRequestToTopWindow(message) {
5715
+ const logger = sendNestedAuthRequestToTopWindowLogger;
5716
+ const targetWindow = Communication.topWindow;
5717
+ const request = createNestedAppAuthRequest(message);
5718
+ logger('Message %i information: %o', request.id, { actionName: request.func });
5719
+ return sendRequestToTargetWindowHelper(targetWindow, request);
5720
+ }
5721
+ const sendRequestToTargetWindowHelperLogger = communicationLogger.extend('sendRequestToTargetWindowHelper');
5722
+ /**
5723
+ * @internal
5724
+ * Limited to Microsoft-internal use
5725
+ */
5726
+ function sendRequestToTargetWindowHelper(targetWindow, request) {
5727
+ const logger = sendRequestToTargetWindowHelperLogger;
5728
+ const targetWindowName = getTargetName(targetWindow);
5566
5729
  if (GlobalVars.isFramelessWindow) {
5567
5730
  if (Communication.currentWindow && Communication.currentWindow.nativeInterface) {
5568
- logger('Sending message %i to parent via framelessPostMessage interface', request.id);
5731
+ logger(`Sending message %i to ${targetWindowName} via framelessPostMessage interface`, request.id);
5569
5732
  Communication.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(request));
5570
5733
  }
5571
5734
  }
@@ -5574,16 +5737,29 @@ function sendMessageToParentHelper(apiVersionTag, actionName, args) {
5574
5737
  // If the target window isn't closed and we already know its origin, send the message right away; otherwise,
5575
5738
  // queue the message and send it after the origin is established
5576
5739
  if (targetWindow && targetOrigin) {
5577
- logger('Sending message %i to parent via postMessage', request.id);
5740
+ logger(`Sending message %i to ${targetWindowName} via postMessage`, request.id);
5578
5741
  targetWindow.postMessage(request, targetOrigin);
5579
5742
  }
5580
5743
  else {
5581
- logger('Adding message %i to parent message queue', request.id);
5744
+ logger(`Adding message %i to ${targetWindowName} message queue`, request.id);
5582
5745
  getTargetMessageQueue(targetWindow).push(request);
5583
5746
  }
5584
5747
  }
5585
5748
  return request;
5586
5749
  }
5750
+ const sendMessageToParentHelperLogger = communicationLogger.extend('sendMessageToParentHelper');
5751
+ /**
5752
+ * @internal
5753
+ * Limited to Microsoft-internal use
5754
+ */
5755
+ function sendMessageToParentHelper(apiVersionTag, actionName, args) {
5756
+ const logger = sendMessageToParentHelperLogger;
5757
+ const targetWindow = Communication.parentWindow;
5758
+ const request = createMessageRequest(apiVersionTag, actionName, args);
5759
+ /* eslint-disable-next-line strict-null-checks/all */ /* Fix tracked by 5730662 */
5760
+ logger('Message %i information: %o', request.id, { actionName, args });
5761
+ return sendRequestToTargetWindowHelper(targetWindow, request);
5762
+ }
5587
5763
  const processMessageLogger = communicationLogger.extend('processMessage');
5588
5764
  /**
5589
5765
  * @internal
@@ -5618,6 +5794,69 @@ function processMessage(evt) {
5618
5794
  });
5619
5795
  });
5620
5796
  }
5797
+ const processAuthBridgeMessageLogger = communicationLogger.extend('processAuthBridgeMessage');
5798
+ /**
5799
+ * @internal
5800
+ * Limited to Microsoft-internal use
5801
+ */
5802
+ function processAuthBridgeMessage(evt, onMessageReceived) {
5803
+ var _a, _b;
5804
+ const logger = processAuthBridgeMessageLogger;
5805
+ // Process only if we received a valid message
5806
+ if (!evt || !evt.data || typeof evt.data !== 'object') {
5807
+ logger('Unrecognized message format received by app, message being ignored. Message: %o', evt);
5808
+ return;
5809
+ }
5810
+ const { args } = evt.data;
5811
+ const [, message] = args !== null && args !== void 0 ? args : [];
5812
+ const parsedData = (() => {
5813
+ try {
5814
+ return JSON.parse(message);
5815
+ }
5816
+ catch (e) {
5817
+ return null;
5818
+ }
5819
+ })();
5820
+ // Validate that it is a valid auth bridge response message
5821
+ if (!parsedData ||
5822
+ typeof parsedData !== 'object' ||
5823
+ parsedData.messageType !== NestedAppAuthMessageEventNames.Response) {
5824
+ logger('Unrecognized data format received by app, message being ignored. Message: %o', evt);
5825
+ return;
5826
+ }
5827
+ // Process only if the message is coming from a different window and a valid origin
5828
+ // valid origins are either a pre-known origin or one specified by the app developer
5829
+ // in their call to app.initialize
5830
+ const messageSource = evt.source || ((_a = evt === null || evt === void 0 ? void 0 : evt.originalEvent) === null || _a === void 0 ? void 0 : _a.source);
5831
+ const messageOrigin = evt.origin || ((_b = evt === null || evt === void 0 ? void 0 : evt.originalEvent) === null || _b === void 0 ? void 0 : _b.origin);
5832
+ if (!messageSource) {
5833
+ logger('Message being ignored by app because it is coming for a target that is null');
5834
+ return;
5835
+ }
5836
+ if (!shouldProcessMessage(messageSource, messageOrigin)) {
5837
+ logger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
5838
+ return;
5839
+ }
5840
+ /**
5841
+ * In most cases, top level window and the parent window will be same.
5842
+ * If they're not, perform the necessary updates for the top level window.
5843
+ *
5844
+ * Top window logic to flush messages is kept independent so that we don't affect
5845
+ * any of the code for the existing communication channel.
5846
+ */
5847
+ if (!Communication.topWindow || Communication.topWindow.closed || messageSource === Communication.topWindow) {
5848
+ Communication.topWindow = messageSource;
5849
+ Communication.topOrigin = messageOrigin;
5850
+ }
5851
+ // Clean up pointers to closed parent and child windows
5852
+ if (Communication.topWindow && Communication.topWindow.closed) {
5853
+ Communication.topWindow = null;
5854
+ Communication.topOrigin = null;
5855
+ }
5856
+ flushMessageQueue(Communication.topWindow);
5857
+ // Return the response to the registered callback
5858
+ onMessageReceived(message);
5859
+ }
5621
5860
  const shouldProcessMessageLogger = communicationLogger.extend('shouldProcessMessage');
5622
5861
  /**
5623
5862
  * @hidden
@@ -5756,27 +5995,70 @@ function handleChildMessage(evt) {
5756
5995
  }
5757
5996
  }
5758
5997
  }
5998
+ /**
5999
+ * @internal
6000
+ * Limited to Microsoft-internal use
6001
+ *
6002
+ * Checks if the top window and the parent window are different.
6003
+ *
6004
+ * @returns {boolean} Returns true if the top window and the parent window are different, false otherwise.
6005
+ */
6006
+ function areTopAndParentWindowsDistinct() {
6007
+ return Communication.topWindow !== Communication.parentWindow;
6008
+ }
5759
6009
  /**
5760
6010
  * @internal
5761
6011
  * Limited to Microsoft-internal use
5762
6012
  */
5763
6013
  function getTargetMessageQueue(targetWindow) {
5764
- return targetWindow === Communication.parentWindow
5765
- ? CommunicationPrivate.parentMessageQueue
5766
- : targetWindow === Communication.childWindow
5767
- ? CommunicationPrivate.childMessageQueue
5768
- : [];
6014
+ if (targetWindow === Communication.topWindow && areTopAndParentWindowsDistinct()) {
6015
+ return CommunicationPrivate.topMessageQueue;
6016
+ }
6017
+ else if (targetWindow === Communication.parentWindow) {
6018
+ return CommunicationPrivate.parentMessageQueue;
6019
+ }
6020
+ else if (targetWindow === Communication.childWindow) {
6021
+ return CommunicationPrivate.childMessageQueue;
6022
+ }
6023
+ else {
6024
+ return [];
6025
+ }
5769
6026
  }
5770
6027
  /**
5771
6028
  * @internal
5772
6029
  * Limited to Microsoft-internal use
5773
6030
  */
5774
6031
  function getTargetOrigin(targetWindow) {
5775
- return targetWindow === Communication.parentWindow
5776
- ? Communication.parentOrigin
5777
- : targetWindow === Communication.childWindow
5778
- ? Communication.childOrigin
5779
- : null;
6032
+ if (targetWindow === Communication.topWindow && areTopAndParentWindowsDistinct()) {
6033
+ return Communication.topOrigin;
6034
+ }
6035
+ else if (targetWindow === Communication.parentWindow) {
6036
+ return Communication.parentOrigin;
6037
+ }
6038
+ else if (targetWindow === Communication.childWindow) {
6039
+ return Communication.childOrigin;
6040
+ }
6041
+ else {
6042
+ return null;
6043
+ }
6044
+ }
6045
+ /**
6046
+ * @internal
6047
+ * Limited to Microsoft-internal use
6048
+ */
6049
+ function getTargetName(targetWindow) {
6050
+ if (targetWindow === Communication.topWindow && areTopAndParentWindowsDistinct()) {
6051
+ return 'top';
6052
+ }
6053
+ else if (targetWindow === Communication.parentWindow) {
6054
+ return 'parent';
6055
+ }
6056
+ else if (targetWindow === Communication.childWindow) {
6057
+ return 'child';
6058
+ }
6059
+ else {
6060
+ return null;
6061
+ }
5780
6062
  }
5781
6063
  const flushMessageQueueLogger = communicationLogger.extend('flushMessageQueue');
5782
6064
  /**
@@ -5786,7 +6068,7 @@ const flushMessageQueueLogger = communicationLogger.extend('flushMessageQueue');
5786
6068
  function flushMessageQueue(targetWindow) {
5787
6069
  const targetOrigin = getTargetOrigin(targetWindow);
5788
6070
  const targetMessageQueue = getTargetMessageQueue(targetWindow);
5789
- const target = targetWindow == Communication.parentWindow ? 'parent' : 'child';
6071
+ const target = getTargetName(targetWindow);
5790
6072
  while (targetWindow && targetOrigin && targetMessageQueue.length > 0) {
5791
6073
  const request = targetMessageQueue.shift();
5792
6074
  /* eslint-disable-next-line strict-null-checks/all */ /* Fix tracked by 5730662 */
@@ -5860,6 +6142,28 @@ function createMessageRequest(apiVersionTag, func, args) {
5860
6142
  apiversiontag: apiVersionTag,
5861
6143
  };
5862
6144
  }
6145
+ /**
6146
+ * @internal
6147
+ * Limited to Microsoft-internal use
6148
+ *
6149
+ * Creates a nested app authentication request.
6150
+ *
6151
+ * @param {string} message - The message to be included in the request. This is typically a stringified JSON object containing the details of the authentication request.
6152
+ * The reason for using a string is to allow complex data structures to be sent as a message while avoiding potential issues with object serialization and deserialization.
6153
+ *
6154
+ * @returns {NestedAppAuthRequest} Returns a NestedAppAuthRequest object with a unique id, the function name set to 'nestedAppAuthRequest', the current timestamp, an empty args array, and the provided message as data.
6155
+ */
6156
+ function createNestedAppAuthRequest(message) {
6157
+ return {
6158
+ id: CommunicationPrivate.nextMessageId++,
6159
+ func: 'nestedAppAuth.execute',
6160
+ timestamp: Date.now(),
6161
+ // Since this is a nested app auth request, we don't need to send any args.
6162
+ // We avoid overloading the args array with the message to avoid potential issues processing of these messages on the hubSDK.
6163
+ args: [],
6164
+ data: message,
6165
+ };
6166
+ }
5863
6167
  /**
5864
6168
  * @internal
5865
6169
  * Limited to Microsoft-internal use
@@ -7621,6 +7925,11 @@ class ParentAppWindow {
7621
7925
 
7622
7926
 
7623
7927
 
7928
+
7929
+ /**
7930
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
7931
+ */
7932
+ const secondaryBrowserTelemetryVersionNumber = ApiVersionNumber.V_2;
7624
7933
  /**
7625
7934
  * Namespace to power up the in-app browser experiences in the host app.
7626
7935
  * For e.g., opening a URL in the host app inside a browser
@@ -7651,7 +7960,7 @@ var secondaryBrowser;
7651
7960
  if (!url || !isValidHttpsURL(url)) {
7652
7961
  throw { errorCode: ErrorCode.INVALID_ARGUMENTS, message: 'Invalid Url: Only https URL is allowed' };
7653
7962
  }
7654
- return sendAndHandleSdkError('secondaryBrowser.open', url.toString());
7963
+ return sendAndHandleSdkErrorWithVersion(getApiVersionTag(secondaryBrowserTelemetryVersionNumber, ApiName.SecondaryBrowser_OpenUrl), 'secondaryBrowser.open', url.toString());
7655
7964
  }
7656
7965
  secondaryBrowser.open = open;
7657
7966
  /**
@@ -8880,6 +9189,11 @@ function validatePersona(persona) {
8880
9189
 
8881
9190
 
8882
9191
 
9192
+
9193
+ /**
9194
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
9195
+ */
9196
+ const profileTelemetryVersionNumber = ApiVersionNumber.V_2;
8883
9197
  /**
8884
9198
  * Namespace for profile related APIs.
8885
9199
  *
@@ -8913,7 +9227,7 @@ var profile;
8913
9227
  height: showProfileRequest.targetElementBoundingRect.height,
8914
9228
  },
8915
9229
  };
8916
- resolve(sendAndHandleSdkError('profile.showProfile', requestInternal));
9230
+ resolve(sendAndHandleSdkErrorWithVersion(getApiVersionTag(profileTelemetryVersionNumber, ApiName.Profile_ShowProfile), 'profile.showProfile', requestInternal));
8917
9231
  });
8918
9232
  }
8919
9233
  profile.showProfile = showProfile;
@@ -9414,6 +9728,11 @@ VideoPerformanceStatistics.maxSessionTimeoutInMs = 1000 * 30;
9414
9728
  ;// CONCATENATED MODULE: ./src/internal/videoPerformanceMonitor.ts
9415
9729
 
9416
9730
 
9731
+
9732
+ /**
9733
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
9734
+ */
9735
+ const videoPerformanceMonitorTelemetryVersionNumber = ApiVersionNumber.V_2;
9417
9736
  /**
9418
9737
  * This class is used to monitor the performance of video processing, and report performance events.
9419
9738
  */
@@ -9425,7 +9744,7 @@ class VideoPerformanceMonitor {
9425
9744
  this.frameProcessingStartedAt = 0;
9426
9745
  this.frameProcessingTimeCost = 0;
9427
9746
  this.processedFrameCount = 0;
9428
- this.performanceStatistics = new VideoPerformanceStatistics(VideoPerformanceMonitor.distributionBinSize, (result) => this.reportPerformanceEvent('video.performance.performanceDataGenerated', [result]));
9747
+ this.performanceStatistics = new VideoPerformanceStatistics(VideoPerformanceMonitor.distributionBinSize, (result) => this.reportPerformanceEvent(getApiVersionTag(videoPerformanceMonitorTelemetryVersionNumber, ApiName.VideoPerformanceMonitor_Constructor), 'video.performance.performanceDataGenerated', [result]));
9429
9748
  }
9430
9749
  /**
9431
9750
  * Start to check frame processing time intervally
@@ -9438,7 +9757,7 @@ class VideoPerformanceMonitor {
9438
9757
  }
9439
9758
  const averageFrameProcessingTime = this.frameProcessingTimeCost / this.processedFrameCount;
9440
9759
  if (averageFrameProcessingTime > this.frameProcessTimeLimit) {
9441
- this.reportPerformanceEvent('video.performance.frameProcessingSlow', [averageFrameProcessingTime]);
9760
+ this.reportPerformanceEvent(getApiVersionTag(videoPerformanceMonitorTelemetryVersionNumber, ApiName.VideoPerformanceMonitor_StartMonitorSlowFrameProcessing), 'video.performance.frameProcessingSlow', [averageFrameProcessingTime]);
9442
9761
  }
9443
9762
  this.frameProcessingTimeCost = 0;
9444
9763
  this.processedFrameCount = 0;
@@ -9506,11 +9825,7 @@ class VideoPerformanceMonitor {
9506
9825
  this.performanceStatistics.processEnds();
9507
9826
  if (!this.isFirstFrameProcessed) {
9508
9827
  this.isFirstFrameProcessed = true;
9509
- this.reportPerformanceEvent('video.performance.firstFrameProcessed', [
9510
- Date.now(),
9511
- this.appliedEffect.effectId,
9512
- (_a = this.appliedEffect) === null || _a === void 0 ? void 0 : _a.effectParam,
9513
- ]);
9828
+ this.reportPerformanceEvent(getApiVersionTag(videoPerformanceMonitorTelemetryVersionNumber, ApiName.VideoPerformanceMonitor_ReportFrameProcessed), 'video.performance.firstFrameProcessed', [Date.now(), this.appliedEffect.effectId, (_a = this.appliedEffect) === null || _a === void 0 ? void 0 : _a.effectParam]);
9514
9829
  }
9515
9830
  }
9516
9831
  /**
@@ -9526,7 +9841,7 @@ class VideoPerformanceMonitor {
9526
9841
  reportTextureStreamAcquired() {
9527
9842
  if (this.gettingTextureStreamStartedAt !== undefined) {
9528
9843
  const timeTaken = performance.now() - this.gettingTextureStreamStartedAt;
9529
- this.reportPerformanceEvent('video.performance.textureStreamAcquired', [this.currentStreamId, timeTaken]);
9844
+ this.reportPerformanceEvent(getApiVersionTag(videoPerformanceMonitorTelemetryVersionNumber, ApiName.VideoPerformanceMonitor_ReportTextureStreamAcquired), 'video.performance.textureStreamAcquired', [this.currentStreamId, timeTaken]);
9530
9845
  }
9531
9846
  }
9532
9847
  }
@@ -9562,6 +9877,11 @@ var videoEffects_rest = (undefined && undefined.__rest) || function (s, e) {
9562
9877
 
9563
9878
 
9564
9879
 
9880
+
9881
+ /**
9882
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
9883
+ */
9884
+ const videoEffectsTelemetryVersionNumber = ApiVersionNumber.V_2;
9565
9885
  /**
9566
9886
  * Namespace to video extensibility of the SDK
9567
9887
  * @beta
@@ -9570,7 +9890,7 @@ var videoEffects;
9570
9890
  (function (videoEffects) {
9571
9891
  const videoPerformanceMonitor = inServerSideRenderingEnvironment()
9572
9892
  ? undefined
9573
- : new VideoPerformanceMonitor(sendMessageToParent);
9893
+ : new VideoPerformanceMonitor(sendMessageToParentWithVersion);
9574
9894
  /**
9575
9895
  * Video frame format enum, currently only support NV12
9576
9896
  * @beta
@@ -9656,7 +9976,7 @@ var videoEffects;
9656
9976
  if (!parameters.videoFrameHandler || !parameters.videoBufferHandler) {
9657
9977
  throw new Error('Both videoFrameHandler and videoBufferHandler must be provided');
9658
9978
  }
9659
- registerHandler('video.setFrameProcessTimeLimit', (timeLimitInfo) => videoPerformanceMonitor === null || videoPerformanceMonitor === void 0 ? void 0 : videoPerformanceMonitor.setFrameProcessTimeLimit(timeLimitInfo.timeLimit), false);
9979
+ registerHandlerWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_RegisterSetFrameProcessTimeLimitHandler), 'video.setFrameProcessTimeLimit', (timeLimitInfo) => videoPerformanceMonitor === null || videoPerformanceMonitor === void 0 ? void 0 : videoPerformanceMonitor.setFrameProcessTimeLimit(timeLimitInfo.timeLimit), false);
9660
9980
  if (doesSupportMediaStream()) {
9661
9981
  registerForMediaStream(parameters.videoFrameHandler, parameters.config);
9662
9982
  }
@@ -9683,7 +10003,7 @@ var videoEffects;
9683
10003
  if (!isSupported()) {
9684
10004
  throw errorNotSupportedOnPlatform;
9685
10005
  }
9686
- sendMessageToParent('video.videoEffectChanged', [effectChangeType, effectId]);
10006
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_NotifySelectedVideoEffectChanged), 'video.videoEffectChanged', [effectChangeType, effectId]);
9687
10007
  }
9688
10008
  videoEffects.notifySelectedVideoEffectChanged = notifySelectedVideoEffectChanged;
9689
10009
  /**
@@ -9696,8 +10016,8 @@ var videoEffects;
9696
10016
  if (!isSupported()) {
9697
10017
  throw errorNotSupportedOnPlatform;
9698
10018
  }
9699
- registerHandler('video.effectParameterChange', createEffectParameterChangeCallback(callback, videoPerformanceMonitor), false);
9700
- sendMessageToParent('video.registerForVideoEffect');
10019
+ registerHandlerWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_RegisterEffectParameterChangeHandler), 'video.effectParameterChange', createEffectParameterChangeCallback(callback, videoPerformanceMonitor), false);
10020
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_RegisterForVideoEffect), 'video.registerForVideoEffect');
9701
10021
  }
9702
10022
  videoEffects.registerForVideoEffect = registerForVideoEffect;
9703
10023
  /**
@@ -9706,7 +10026,7 @@ var videoEffects;
9706
10026
  * @beta
9707
10027
  */
9708
10028
  function notifyVideoFrameProcessed(timestamp) {
9709
- sendMessageToParent('video.videoFrameProcessed', [timestamp]);
10029
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_NotifyVideoFrameProcessed), 'video.videoFrameProcessed', [timestamp]);
9710
10030
  }
9711
10031
  /**
9712
10032
  * Sending error notification to host
@@ -9714,7 +10034,7 @@ var videoEffects;
9714
10034
  * @param errorMessage - The error message that will be sent to the host
9715
10035
  */
9716
10036
  function notifyError(errorMessage) {
9717
- sendMessageToParent('video.notifyError', [errorMessage]);
10037
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_NotifyError), 'video.notifyError', [errorMessage]);
9718
10038
  }
9719
10039
  /**
9720
10040
  * Checks if video capability is supported by the host.
@@ -9736,13 +10056,13 @@ var videoEffects;
9736
10056
  if (!isSupported() || !doesSupportMediaStream()) {
9737
10057
  throw errorNotSupportedOnPlatform;
9738
10058
  }
9739
- registerHandler('video.startVideoExtensibilityVideoStream', (mediaStreamInfo) => videoEffects_awaiter(this, void 0, void 0, function* () {
10059
+ registerHandlerWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_RegisterStartVideoExtensibilityVideoStreamHandler), 'video.startVideoExtensibilityVideoStream', (mediaStreamInfo) => videoEffects_awaiter(this, void 0, void 0, function* () {
9740
10060
  // when a new streamId is ready:
9741
10061
  const { streamId } = mediaStreamInfo;
9742
10062
  const monitoredVideoFrameHandler = createMonitoredVideoFrameHandler(videoFrameHandler, videoPerformanceMonitor);
9743
10063
  yield processMediaStream(streamId, monitoredVideoFrameHandler, notifyError, videoPerformanceMonitor);
9744
10064
  }), false);
9745
- sendMessageToParent('video.mediaStream.registerForVideoFrame', [config]);
10065
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_MediaStream_RegisterForVideoFrame), 'video.mediaStream.registerForVideoFrame', [config]);
9746
10066
  }
9747
10067
  function createMonitoredVideoFrameHandler(videoFrameHandler, videoPerformanceMonitor) {
9748
10068
  return (videoFrameData) => videoEffects_awaiter(this, void 0, void 0, function* () {
@@ -9759,7 +10079,7 @@ var videoEffects;
9759
10079
  if (!isSupported() || !doesSupportSharedFrame()) {
9760
10080
  throw errorNotSupportedOnPlatform;
9761
10081
  }
9762
- registerHandler('video.newVideoFrame',
10082
+ registerHandlerWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_RegisterForVideoBufferHandler), 'video.newVideoFrame',
9763
10083
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9764
10084
  (videoBufferData) => {
9765
10085
  if (videoBufferData) {
@@ -9771,7 +10091,7 @@ var videoEffects;
9771
10091
  }, notifyError);
9772
10092
  }
9773
10093
  }, false);
9774
- sendMessageToParent('video.registerForVideoFrame', [config]);
10094
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsTelemetryVersionNumber, ApiName.VideoEffects_RegisterForVideoFrame), 'video.registerForVideoFrame', [config]);
9775
10095
  }
9776
10096
  function normalizeVideoBufferData(videoBufferData) {
9777
10097
  if ('videoFrameBuffer' in videoBufferData) {
@@ -9805,6 +10125,11 @@ var videoEffects;
9805
10125
 
9806
10126
 
9807
10127
 
10128
+
10129
+ /**
10130
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
10131
+ */
10132
+ const searchTelemetryVersionNumber = ApiVersionNumber.V_2;
9808
10133
  /**
9809
10134
  * Allows your application to interact with the host M365 application's search box.
9810
10135
  * By integrating your application with the host's search box, users can search
@@ -9864,10 +10189,10 @@ var search;
9864
10189
  if (!isSupported()) {
9865
10190
  throw errorNotSupportedOnPlatform;
9866
10191
  }
9867
- registerHandler(onClosedHandlerName, onClosedHandler);
9868
- registerHandler(onExecutedHandlerName, onExecuteHandler);
10192
+ registerHandlerWithVersion(getApiVersionTag(searchTelemetryVersionNumber, ApiName.Search_RegisterOnClosedHandler), onClosedHandlerName, onClosedHandler);
10193
+ registerHandlerWithVersion(getApiVersionTag(searchTelemetryVersionNumber, ApiName.Search_RegisterOnExecutedHandler), onExecutedHandlerName, onExecuteHandler);
9869
10194
  if (onChangeHandler) {
9870
- registerHandler(onChangeHandlerName, onChangeHandler);
10195
+ registerHandlerWithVersion(getApiVersionTag(searchTelemetryVersionNumber, ApiName.Search_RegisterOnChangeHandler), onChangeHandlerName, onChangeHandler);
9871
10196
  }
9872
10197
  }
9873
10198
  search.registerHandlers = registerHandlers;
@@ -9884,7 +10209,7 @@ var search;
9884
10209
  }
9885
10210
  // This should let the host know to stop making the app scope show up in the search experience
9886
10211
  // Can also be used to clean up handlers on the host if desired
9887
- sendMessageToParent('search.unregister');
10212
+ sendMessageToParentWithVersion(getApiVersionTag(searchTelemetryVersionNumber, ApiName.Search_UnregisterHandlers), 'search.unregister');
9888
10213
  removeHandler(onChangeHandlerName);
9889
10214
  removeHandler(onClosedHandlerName);
9890
10215
  removeHandler(onExecutedHandlerName);
@@ -9913,7 +10238,7 @@ var search;
9913
10238
  if (!isSupported()) {
9914
10239
  throw new Error('Not supported');
9915
10240
  }
9916
- resolve(sendAndHandleStatusAndReason('search.closeSearch'));
10241
+ resolve(sendAndHandleStatusAndReasonWithVersion(getApiVersionTag(searchTelemetryVersionNumber, ApiName.Search_CloseSearch), 'search.closeSearch'));
9917
10242
  });
9918
10243
  }
9919
10244
  search.closeSearch = closeSearch;
@@ -9926,6 +10251,10 @@ var search;
9926
10251
 
9927
10252
 
9928
10253
 
10254
+
10255
+ /* eslint-disable @typescript-eslint/no-unused-vars */
10256
+ const sharingTelemetryVersionNumber_v1 = ApiVersionNumber.V_1;
10257
+ const sharingTelemetryVersionNumber_v2 = ApiVersionNumber.V_2;
9929
10258
  /**
9930
10259
  * Namespace to open a share dialog for web content.
9931
10260
  * For more info, see [Share to Teams from personal app or tab](https://learn.microsoft.com/microsoftteams/platform/concepts/build-and-test/share-to-teams-from-personal-app-or-tab)
@@ -9941,6 +10270,7 @@ var sharing;
9941
10270
  shareWebContent: 'sharing.shareWebContent',
9942
10271
  };
9943
10272
  function shareWebContent(shareWebContentRequest, callback) {
10273
+ const apiVersionTag = '';
9944
10274
  // validate the given input (synchronous check)
9945
10275
  try {
9946
10276
  validateNonEmptyContent(shareWebContentRequest);
@@ -10029,6 +10359,11 @@ var sharing;
10029
10359
 
10030
10360
 
10031
10361
 
10362
+
10363
+ /**
10364
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
10365
+ */
10366
+ const stageViewTelemetryVersionNumber = ApiVersionNumber.V_2;
10032
10367
  /**
10033
10368
  * Namespace to interact with the stage view specific part of the SDK.
10034
10369
  *
@@ -10072,7 +10407,7 @@ var stageView;
10072
10407
  if (!stageViewParams) {
10073
10408
  throw new Error('[stageView.open] Stage view params cannot be null');
10074
10409
  }
10075
- resolve(sendAndHandleSdkError('stageView.open', stageViewParams));
10410
+ resolve(sendAndHandleSdkErrorWithVersion(getApiVersionTag(stageViewTelemetryVersionNumber, ApiName.StageView_Open), 'stageView.open', stageViewParams));
10076
10411
  });
10077
10412
  }
10078
10413
  stageView.open = open;
@@ -10105,6 +10440,11 @@ var visualMedia_awaiter = (undefined && undefined.__awaiter) || function (thisAr
10105
10440
 
10106
10441
 
10107
10442
 
10443
+
10444
+ /**
10445
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
10446
+ */
10447
+ const visualMediaTelemetryVersionNumber = ApiVersionNumber.V_2;
10108
10448
  /**
10109
10449
  * @hidden
10110
10450
  * Interact with images. Allows the app developer ask the user to get images from their camera / camera roll / file system.
@@ -10158,7 +10498,7 @@ var visualMedia;
10158
10498
  throw errorNotSupportedOnPlatform;
10159
10499
  }
10160
10500
  const permissions = DevicePermission.Media;
10161
- return sendAndHandleSdkError('permissions.has', permissions);
10501
+ return sendAndHandleSdkErrorWithVersion(getApiVersionTag(visualMediaTelemetryVersionNumber, ApiName.VisualMedia_HasPermission), 'permissions.has', permissions);
10162
10502
  }
10163
10503
  visualMedia.hasPermission = hasPermission;
10164
10504
  /**
@@ -10176,7 +10516,7 @@ var visualMedia;
10176
10516
  throw errorNotSupportedOnPlatform;
10177
10517
  }
10178
10518
  const permissions = DevicePermission.Media;
10179
- return sendAndHandleSdkError('permissions.request', permissions);
10519
+ return sendAndHandleSdkErrorWithVersion(getApiVersionTag(visualMediaTelemetryVersionNumber, ApiName.VisualMedia_RequestPermission), 'permissions.request', permissions);
10180
10520
  }
10181
10521
  visualMedia.requestPermission = requestPermission;
10182
10522
  /**
@@ -10201,7 +10541,7 @@ var visualMedia;
10201
10541
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.task);
10202
10542
  ensureSupported();
10203
10543
  ensureImageInputValid(cameraImageInputs);
10204
- const files = yield sendAndHandleSdkError('visualMedia.image.captureImages', cameraImageInputs);
10544
+ const files = yield sendAndHandleSdkErrorWithVersion(getApiVersionTag(visualMediaTelemetryVersionNumber, ApiName.VisualMedia_Image_CaptureImages), 'visualMedia.image.captureImages', cameraImageInputs);
10205
10545
  ensureResponseValid(cameraImageInputs.maxVisualMediaCount, files);
10206
10546
  return files;
10207
10547
  });
@@ -10221,7 +10561,7 @@ var visualMedia;
10221
10561
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.task);
10222
10562
  ensureSupported();
10223
10563
  ensureImageInputValid(galleryImageInputs);
10224
- const files = yield sendAndHandleSdkError('visualMedia.image.retrieveImages', galleryImageInputs);
10564
+ const files = yield sendAndHandleSdkErrorWithVersion(getApiVersionTag(visualMediaTelemetryVersionNumber, ApiName.VisualMedia_Image_RetrieveImages), 'visualMedia.image.retrieveImages', galleryImageInputs);
10225
10565
  ensureResponseValid(galleryImageInputs.maxVisualMediaCount, files);
10226
10566
  return files;
10227
10567
  });
@@ -10996,6 +11336,11 @@ function navigateBack(onComplete) {
10996
11336
 
10997
11337
 
10998
11338
 
11339
+
11340
+ /**
11341
+ * v1 APIs telemetry file: All of APIs in this capability file should send out API version v1 ONLY
11342
+ */
11343
+ const settingsTelemetryVersionNumber = ApiVersionNumber.V_1;
10999
11344
  /**
11000
11345
  * @deprecated
11001
11346
  * As of 2.0.0, please use {@link pages.config} namespace instead.
@@ -11015,7 +11360,7 @@ var settings;
11015
11360
  * @param validityState - Indicates whether the save or remove button is enabled for the user.
11016
11361
  */
11017
11362
  function setValidityState(validityState) {
11018
- pages.config.setValidityState(validityState);
11363
+ configSetValidityStateHelper(getApiVersionTag(settingsTelemetryVersionNumber, ApiName.Settings_SetValidityState), validityState);
11019
11364
  }
11020
11365
  settings.setValidityState = setValidityState;
11021
11366
  /**
@@ -11028,7 +11373,7 @@ var settings;
11028
11373
  */
11029
11374
  function getSettings(callback) {
11030
11375
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.settings, FrameContexts.remove, FrameContexts.sidePanel);
11031
- pages.getConfig().then((config) => {
11376
+ getConfigHelper(getApiVersionTag(settingsTelemetryVersionNumber, ApiName.Settings_GetSettings)).then((config) => {
11032
11377
  callback(config);
11033
11378
  });
11034
11379
  }
@@ -11045,8 +11390,7 @@ var settings;
11045
11390
  function setSettings(instanceSettings, onComplete) {
11046
11391
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.settings, FrameContexts.sidePanel);
11047
11392
  const completionHandler = onComplete !== null && onComplete !== void 0 ? onComplete : getGenericOnCompleteHandler();
11048
- pages.config
11049
- .setConfig(instanceSettings)
11393
+ configSetConfigHelper(getApiVersionTag(settingsTelemetryVersionNumber, ApiName.Settings_SetSettings), instanceSettings)
11050
11394
  .then(() => {
11051
11395
  completionHandler(true);
11052
11396
  })
@@ -11067,7 +11411,7 @@ var settings;
11067
11411
  * @param handler - The handler to invoke when the user selects the save button.
11068
11412
  */
11069
11413
  function registerOnSaveHandler(handler) {
11070
- pages.config.registerOnSaveHandlerHelper(handler);
11414
+ pages.config.registerOnSaveHandlerHelper(getApiVersionTag(settingsTelemetryVersionNumber, ApiName.Settings_RegisterOnSaveHandler), handler);
11071
11415
  }
11072
11416
  settings.registerOnSaveHandler = registerOnSaveHandler;
11073
11417
  /**
@@ -11082,7 +11426,7 @@ var settings;
11082
11426
  * @param handler - The handler to invoke when the user selects the remove button.
11083
11427
  */
11084
11428
  function registerOnRemoveHandler(handler) {
11085
- pages.config.registerOnRemoveHandlerHelper(handler);
11429
+ pages.config.registerOnRemoveHandlerHelper(getApiVersionTag(settingsTelemetryVersionNumber, ApiName.Settings_RegisterOnRemoveHandler), handler);
11086
11430
  }
11087
11431
  settings.registerOnRemoveHandler = registerOnRemoveHandler;
11088
11432
  })(settings || (settings = {}));
@@ -12329,7 +12673,9 @@ var files;
12329
12673
  * @hidden
12330
12674
  * Hide from docs
12331
12675
  *
12332
- * Gets a list of cloud storage folders added to the channel
12676
+ * Gets a list of cloud storage folders added to the channel. This function will not timeout;
12677
+ * the callback will only return when the host responds with a list of folders or error.
12678
+ *
12333
12679
  * @param channelId - ID of the channel whose cloud storage folders should be retrieved
12334
12680
  * @param callback - Callback that will be triggered post folders load
12335
12681
  *
@@ -13498,7 +13844,7 @@ var videoEffectsEx;
13498
13844
  videoEffectsEx.frameProcessingTimeoutInMs = 2000;
13499
13845
  const videoPerformanceMonitor = inServerSideRenderingEnvironment()
13500
13846
  ? undefined
13501
- : new VideoPerformanceMonitor(sendMessageToParent);
13847
+ : new VideoPerformanceMonitor(sendMessageToParentWithVersion);
13502
13848
  /**
13503
13849
  * @hidden
13504
13850
  * Error level when notifying errors to the host, the host will decide what to do acording to the error level.