@microsoft/teams-js 2.20.0-beta.2 → 2.20.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
24
24
 
25
25
  ### Production
26
26
 
27
- You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.19.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.20.0/js/MicrosoftTeams.min.js) or point your package manager at them.
28
28
 
29
29
  ## Usage
30
30
 
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
45
45
  ```html
46
46
  <!-- Microsoft Teams JavaScript API (via CDN) -->
47
47
  <script
48
- src="https://res.cdn.office.net/teams-js/2.19.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-h+MoYshcGDPMLlXjHLt2dSgsgYyWQ+yHd4Ob13htDsu8trGPea8Vooa8+tLtRzU7"
48
+ src="https://res.cdn.office.net/teams-js/2.20.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-wBC2cOp5ArjIyhxoK1NtXvJb98SbNojaoD6hXpvxWil+g4O1M2rXNtywEcAoQ8bl"
50
50
  crossorigin="anonymous"
51
51
  ></script>
52
52
 
53
53
  <!-- Microsoft Teams JavaScript API (via npm) -->
54
- <script src="node_modules/@microsoft/teams-js@2.19.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.20.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -1829,6 +1829,57 @@ export namespace meetingRoom {
1829
1829
  export {};
1830
1830
  }
1831
1831
 
1832
+ /**
1833
+ * @hidden
1834
+ * Namespace to request message ports from the host application.
1835
+ *
1836
+ * @beta
1837
+ *
1838
+ * @internal
1839
+ * Limited to Microsoft-internal use
1840
+ */
1841
+ export namespace messageChannels {
1842
+ /**
1843
+ * @hidden
1844
+ * @beta
1845
+ *
1846
+ * Fetches a MessagePort to batch telemetry through the host's telemetry worker.
1847
+ * The port is cached once received, so subsequent calls return the same port.
1848
+ * @returns MessagePort.
1849
+ *
1850
+ * @throws Error if {@linkcode app.initialize} has not successfully completed,
1851
+ * if the host does not support the feature, or if the port request is rejected.
1852
+ *
1853
+ * @internal
1854
+ * Limited to Microsoft-internal use
1855
+ */
1856
+ function getTelemetryPort(): Promise<MessagePort>;
1857
+ /**
1858
+ * @hidden
1859
+ *
1860
+ * @beta
1861
+ *
1862
+ * Checks if the messageChannels capability is supported by the host
1863
+ * @returns boolean to represent whether the messageChannels capability is supported
1864
+ *
1865
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
1866
+ *
1867
+ * @internal
1868
+ * Limited to Microsoft-internal use
1869
+ */
1870
+ function isSupported(): boolean;
1871
+ /**
1872
+ * @hidden
1873
+ * Undocumented function used to clear state between unit tests
1874
+ *
1875
+ * @beta
1876
+ *
1877
+ * @internal
1878
+ * Limited to Microsoft-internal use
1879
+ */
1880
+ function _clearTelemetryPort(): void;
1881
+ }
1882
+
1832
1883
  export namespace notifications {
1833
1884
  /**
1834
1885
  * @hidden
@@ -4128,6 +4179,10 @@ export interface ClipboardParams {
4128
4179
  }
4129
4180
 
4130
4181
  export function appInitializeHelper(apiVersionTag: string, validMessageOrigins?: string[]): Promise<void>;
4182
+ export function notifyAppLoadedHelper(apiVersionTag: string): void;
4183
+ export function notifyExpectedFailureHelper(apiVersionTag: string, expectedFailureRequest: app.IExpectedFailureRequest): void;
4184
+ export function notifyFailureHelper(apiVersiontag: string, appInitializationFailedRequest: app.IFailedRequest): void;
4185
+ export function notifySuccessHelper(apiVersionTag: string): void;
4131
4186
  export function registerOnThemeChangeHandlerHelper(apiVersionTag: string, handler: app.themeHandler): void;
4132
4187
  export function openLinkHelper(apiVersionTag: string, deepLink: string): Promise<void>;
4133
4188
  /**
@@ -4224,7 +4279,7 @@ export namespace app {
4224
4279
  */
4225
4280
  locale: string;
4226
4281
  /**
4227
- * The current UI theme of the host. Possible values: "default", "dark", or "contrast".
4282
+ * The current UI theme of the host. Possible values: "default", "dark", "contrast" or "glass".
4228
4283
  */
4229
4284
  theme: string;
4230
4285
  /**
@@ -8546,10 +8601,6 @@ export namespace call {
8546
8601
  function isSupported(): boolean;
8547
8602
  }
8548
8603
 
8549
- /**
8550
- * @deprecated
8551
- * As of 2.0.0, please use {@link app} namespace instead.
8552
- */
8553
8604
  export namespace appInitialization {
8554
8605
  /**
8555
8606
  * @deprecated
@@ -883,6 +883,7 @@ __webpack_require__.d(__webpack_exports__, {
883
883
  meeting: () => (/* reexport */ meeting),
884
884
  meetingRoom: () => (/* reexport */ meetingRoom),
885
885
  menus: () => (/* reexport */ menus),
886
+ messageChannels: () => (/* reexport */ messageChannels),
886
887
  monetization: () => (/* reexport */ monetization),
887
888
  navigateBack: () => (/* reexport */ navigateBack),
888
889
  navigateCrossDomain: () => (/* reexport */ navigateCrossDomain),
@@ -990,7 +991,16 @@ var ApiName;
990
991
  ApiName["App_NotifySuccess"] = "app.notifySuccess";
991
992
  ApiName["App_OpenLink"] = "app.openLink";
992
993
  ApiName["App_RegisterOnThemeChangeHandler"] = "app.registerOnThemeChangeHandler";
994
+ ApiName["AppInitialization_NotifyAppLoaded"] = "appInitialization.notifyAppLoaded";
995
+ ApiName["AppInitialization_NotifyExpectedFailure"] = "appInitialization.notifyExpectedFailure";
996
+ ApiName["AppInitialization_NotifyFailure"] = "appInitialization.notifyFailure";
997
+ ApiName["AppInitialization_NotifySuccess"] = "appInitialization.notifySuccess";
993
998
  ApiName["AppEntity_SelectAppEntity"] = "appEntity.selectAppEntity";
999
+ ApiName["AppInstallDialog_OpenAppInstallDialog"] = "appInstallDialog.openAppInstallDialog";
1000
+ ApiName["AppWindow_ChildAppWindow_AddEventListener"] = "appWindow.childAppWindow.addEventListener";
1001
+ ApiName["AppWindow_ChildAppWindow_PostMessage"] = "appWindow.childAppWindow.postMessage";
1002
+ ApiName["AppWindow_ParentAppWindow_AddEventListener"] = "appWindow.parentAppWindow.addEventListener";
1003
+ ApiName["AppWindow_ParentAppWindow_PostMessage"] = "appWindow.parentAppWindow.postMessage";
994
1004
  ApiName["BarCode_HasPermission"] = "barCode.hasPermission";
995
1005
  ApiName["BarCode_RequestPermission"] = "barCode.requestPermission";
996
1006
  ApiName["BarCode_ScanBarCode"] = "barCode.scanBarCode";
@@ -1096,6 +1106,7 @@ var ApiName;
1096
1106
  ApiName["Menus_SetNavBarMenu"] = "menus.setNavBarMenu";
1097
1107
  ApiName["Menus_SetUpViews"] = "menus.setUpViews";
1098
1108
  ApiName["Menus_ShowActionMenu"] = "menus.showActionMenu";
1109
+ ApiName["MessageChannels_GetTelemetryPort"] = "messageChannels.getTelemetryPort";
1099
1110
  ApiName["Monetization_OpenPurchaseExperience"] = "monetization.openPurchaseExperience";
1100
1111
  ApiName["Navigation_NavigateBack"] = "navigation.navigateBack";
1101
1112
  ApiName["Navigation_NavigateCrossDomain"] = "navigation.navigateCrossDomain";
@@ -1155,6 +1166,8 @@ var ApiName;
1155
1166
  ApiName["PublicAPIs_SetFrameContext"] = "setFrameContext";
1156
1167
  ApiName["PublicAPIs_ShareDeepLink"] = "shareDeepLink";
1157
1168
  ApiName["RegisterHandler"] = "registerHandler";
1169
+ ApiName["RegisterBeforeUnloadHandler"] = "registerBeforeUnloadHandler";
1170
+ ApiName["RegisterLoadHandler"] = "registerLoadHandler";
1158
1171
  ApiName["RegisterOnThemeChangeHandler"] = "registerOnThemeChangeHandler";
1159
1172
  ApiName["RemoteCamera_GetCapableParticipants"] = "remoteCamera.getCapableParticipants";
1160
1173
  ApiName["RemoteCamera_RegisterOnCapableParticipantsChangeHandler"] = "remoteCamera.registerOnCapableParticipantsChangeHandler";
@@ -1208,6 +1221,9 @@ var ApiName;
1208
1221
  ApiName["VideoEffectsEx_RegisterSetFrameProcessTimeLimitHandler"] = "videoEffectsEX.registerSetFrameProcessTimeLimitHandler";
1209
1222
  ApiName["VideoEffectsEx_RegisterStartVideoExtensibilityVideoStreamHandler"] = "videoEffectsEX.registerStartVideoExtensibilityVideoStreamHandler";
1210
1223
  ApiName["VideoEffectsEx_UpdatePersonalizedEffects"] = "videoEffectsEx.updatePersonalizedEffects";
1224
+ ApiName["VideoEffectsUtils_EffectFailure"] = "videoEffectsUtils.effectFailure";
1225
+ ApiName["VideoEffectsUtils_ReportVideoEffectChanged"] = "videoEffectsUtils.reportVideoEffectChanged";
1226
+ ApiName["VideoEffectsUtils_TransformerWithMetadata_Constructor"] = "videoEffectsUtils.transformerWithMetadata.constructor";
1211
1227
  ApiName["VideoPerformanceMonitor_Constructor"] = "videoPerformanceMonitor.performanceDataGenerated";
1212
1228
  ApiName["VideoPerformanceMonitor_ReportFrameProcessed"] = "videoPerformanceMonitor.reportFrameProcessed";
1213
1229
  ApiName["VideoPerformanceMonitor_ReportTextureStreamAcquired"] = "videoPerformanceMonitor.reportTextureStreamAcquired";
@@ -1762,7 +1778,9 @@ var ChannelType;
1762
1778
  /** An error object indicating that the requested operation or feature is not supported on the current platform or device.
1763
1779
  * @typedef {Object} SdkError
1764
1780
  */
1765
- const errorNotSupportedOnPlatform = { errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
1781
+ const errorNotSupportedOnPlatform = {
1782
+ errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM,
1783
+ };
1766
1784
  /**
1767
1785
  * @hidden
1768
1786
  *
@@ -2502,7 +2520,7 @@ const _minRuntimeConfigToUninitialize = {
2502
2520
  * @hidden
2503
2521
  * Package version.
2504
2522
  */
2505
- const version = "2.20.0-beta.2";
2523
+ const version = "2.20.0";
2506
2524
 
2507
2525
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2508
2526
 
@@ -3808,6 +3826,24 @@ function appInitializeHelper(apiVersionTag, validMessageOrigins) {
3808
3826
  return Promise.resolve();
3809
3827
  }
3810
3828
  }
3829
+ function notifyAppLoadedHelper(apiVersionTag) {
3830
+ sendMessageToParentWithVersion(apiVersionTag, app.Messages.AppLoaded, [version]);
3831
+ }
3832
+ function notifyExpectedFailureHelper(apiVersionTag, expectedFailureRequest) {
3833
+ sendMessageToParentWithVersion(apiVersionTag, app.Messages.ExpectedFailure, [
3834
+ expectedFailureRequest.reason,
3835
+ expectedFailureRequest.message,
3836
+ ]);
3837
+ }
3838
+ function notifyFailureHelper(apiVersiontag, appInitializationFailedRequest) {
3839
+ sendMessageToParentWithVersion(apiVersiontag, app.Messages.Failure, [
3840
+ appInitializationFailedRequest.reason,
3841
+ appInitializationFailedRequest.message,
3842
+ ]);
3843
+ }
3844
+ function notifySuccessHelper(apiVersionTag) {
3845
+ sendMessageToParentWithVersion(apiVersionTag, app.Messages.Success, [version]);
3846
+ }
3811
3847
  const initializeHelperLogger = appLogger.extend('initializeHelper');
3812
3848
  function initializeHelper(apiVersionTag, validMessageOrigins) {
3813
3849
  return new Promise((resolve) => {
@@ -4065,7 +4101,7 @@ var app;
4065
4101
  */
4066
4102
  function notifyAppLoaded() {
4067
4103
  ensureInitializeCalled();
4068
- sendMessageToParentWithVersion(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifyAppLoaded), app.Messages.AppLoaded, [version]);
4104
+ notifyAppLoadedHelper(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifyAppLoaded));
4069
4105
  }
4070
4106
  app.notifyAppLoaded = notifyAppLoaded;
4071
4107
  /**
@@ -4073,7 +4109,7 @@ var app;
4073
4109
  */
4074
4110
  function notifySuccess() {
4075
4111
  ensureInitializeCalled();
4076
- sendMessageToParentWithVersion(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifySuccess), app.Messages.Success, [version]);
4112
+ notifySuccessHelper(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifySuccess));
4077
4113
  }
4078
4114
  app.notifySuccess = notifySuccess;
4079
4115
  /**
@@ -4084,7 +4120,7 @@ var app;
4084
4120
  */
4085
4121
  function notifyFailure(appInitializationFailedRequest) {
4086
4122
  ensureInitializeCalled();
4087
- sendMessageToParentWithVersion(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifyFailure), app.Messages.Failure, [appInitializationFailedRequest.reason, appInitializationFailedRequest.message]);
4123
+ notifyFailureHelper(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifyFailure), appInitializationFailedRequest);
4088
4124
  }
4089
4125
  app.notifyFailure = notifyFailure;
4090
4126
  /**
@@ -4094,7 +4130,7 @@ var app;
4094
4130
  */
4095
4131
  function notifyExpectedFailure(expectedFailureRequest) {
4096
4132
  ensureInitializeCalled();
4097
- sendMessageToParentWithVersion(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifyExpectedFailure), app.Messages.ExpectedFailure, [expectedFailureRequest.reason, expectedFailureRequest.message]);
4133
+ notifyExpectedFailureHelper(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_NotifyExpectedFailure), expectedFailureRequest);
4098
4134
  }
4099
4135
  app.notifyExpectedFailure = notifyExpectedFailure;
4100
4136
  /**
@@ -5309,7 +5345,8 @@ function handleBeforeUnload() {
5309
5345
  */
5310
5346
  function handlers_registerBeforeSuspendOrTerminateHandler(handler) {
5311
5347
  HandlersPrivate.beforeSuspendOrTerminateHandler = handler;
5312
- !isNullOrUndefined(handler) && sendMessageToParent('registerHandler', ['beforeUnload']);
5348
+ !isNullOrUndefined(handler) &&
5349
+ sendMessageToParentWithVersion(getApiVersionTag(ApiVersionNumber.V_2, ApiName.RegisterBeforeUnloadHandler), 'registerHandler', ['beforeUnload']);
5313
5350
  }
5314
5351
  /**
5315
5352
  * @internal
@@ -5317,7 +5354,8 @@ function handlers_registerBeforeSuspendOrTerminateHandler(handler) {
5317
5354
  */
5318
5355
  function handlers_registerOnResumeHandler(handler) {
5319
5356
  HandlersPrivate.resumeHandler = handler;
5320
- !isNullOrUndefined(handler) && sendMessageToParent('registerHandler', ['load']);
5357
+ !isNullOrUndefined(handler) &&
5358
+ sendMessageToParentWithVersion(getApiVersionTag(ApiVersionNumber.V_2, ApiName.RegisterLoadHandler), 'registerHandler', ['load']);
5321
5359
  }
5322
5360
 
5323
5361
  ;// CONCATENATED MODULE: ./src/internal/nestedAppAuth.ts
@@ -5480,6 +5518,7 @@ CommunicationPrivate.topMessageQueue = [];
5480
5518
  CommunicationPrivate.nextMessageId = 0;
5481
5519
  CommunicationPrivate.callbacks = {};
5482
5520
  CommunicationPrivate.promiseCallbacks = {};
5521
+ CommunicationPrivate.portCallbacks = {};
5483
5522
  /**
5484
5523
  * @internal
5485
5524
  * Limited to Microsoft-internal use
@@ -5548,6 +5587,7 @@ function uninitializeCommunication() {
5548
5587
  CommunicationPrivate.nextMessageId = 0;
5549
5588
  CommunicationPrivate.callbacks = {};
5550
5589
  CommunicationPrivate.promiseCallbacks = {};
5590
+ CommunicationPrivate.portCallbacks = {};
5551
5591
  }
5552
5592
  /**
5553
5593
  * @hidden
@@ -5682,6 +5722,36 @@ function sendMessageToParentAsync(actionName, args = undefined) {
5682
5722
  resolve(waitForResponse(request.id));
5683
5723
  });
5684
5724
  }
5725
+ /**
5726
+ * @hidden
5727
+ * Send a message to parent requesting a MessageChannel Port.
5728
+ * @internal
5729
+ * Limited to Microsoft-internal use
5730
+ */
5731
+ function requestPortFromParentWithVersion(apiVersionTag, actionName, args = undefined) {
5732
+ if (!isFollowingApiVersionTagFormat(apiVersionTag)) {
5733
+ throw Error(`apiVersionTag: ${apiVersionTag} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);
5734
+ }
5735
+ const request = sendMessageToParentHelper(apiVersionTag, actionName, args);
5736
+ return waitForPort(request.id);
5737
+ }
5738
+ /**
5739
+ * @internal
5740
+ * Limited to Microsoft-internal use
5741
+ */
5742
+ function waitForPort(requestId) {
5743
+ return new Promise((resolve, reject) => {
5744
+ CommunicationPrivate.portCallbacks[requestId] = (port, args) => {
5745
+ if (port instanceof MessagePort) {
5746
+ resolve(port);
5747
+ }
5748
+ else {
5749
+ // First arg is the error message, if present
5750
+ reject(args && args.length > 0 ? args[0] : new Error('Host responded without port or error details.'));
5751
+ }
5752
+ };
5753
+ });
5754
+ }
5685
5755
  /**
5686
5756
  * @internal
5687
5757
  * Limited to Microsoft-internal use
@@ -5982,6 +6052,17 @@ function handleParentMessage(evt) {
5982
6052
  logger('Removing registered promise callback for message %i', message.id);
5983
6053
  delete CommunicationPrivate.promiseCallbacks[message.id];
5984
6054
  }
6055
+ const portCallback = CommunicationPrivate.portCallbacks[message.id];
6056
+ if (portCallback) {
6057
+ logger('Invoking the registered port callback for message %i with arguments %o', message.id, message.args);
6058
+ let port;
6059
+ if (evt.ports && evt.ports[0] instanceof MessagePort) {
6060
+ port = evt.ports[0];
6061
+ }
6062
+ portCallback(port, message.args);
6063
+ logger('Removing registered port callback for message %i', message.id);
6064
+ delete CommunicationPrivate.portCallbacks[message.id];
6065
+ }
5985
6066
  }
5986
6067
  else if ('func' in evt.data && typeof evt.data.func === 'string') {
5987
6068
  // Delegate the request to the proper handler
@@ -6661,6 +6742,11 @@ function createTeamsDeepLinkForAppInstallDialog(appId) {
6661
6742
 
6662
6743
 
6663
6744
 
6745
+
6746
+ /**
6747
+ * v1 APIs telemetry file: All of APIs in this capability file should send out API version v1 ONLY
6748
+ */
6749
+ const appInstallDialogTelemetryVersionNumber = ApiVersionNumber.V_1;
6664
6750
  var appInstallDialog;
6665
6751
  (function (appInstallDialog) {
6666
6752
  /**
@@ -6674,11 +6760,14 @@ var appInstallDialog;
6674
6760
  if (!isSupported()) {
6675
6761
  throw new Error('Not supported');
6676
6762
  }
6763
+ const apiVersionTag = getApiVersionTag(appInstallDialogTelemetryVersionNumber, ApiName.AppInstallDialog_OpenAppInstallDialog);
6677
6764
  if (runtime_runtime.isLegacyTeams) {
6678
- resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForAppInstallDialog(openAPPInstallDialogParams.appId)));
6765
+ resolve(sendAndHandleStatusAndReasonWithVersion(apiVersionTag, 'executeDeepLink', createTeamsDeepLinkForAppInstallDialog(openAPPInstallDialogParams.appId)));
6679
6766
  }
6680
6767
  else {
6681
- sendMessageToParent('appInstallDialog.openAppInstallDialog', [openAPPInstallDialogParams]);
6768
+ sendMessageToParentWithVersion(apiVersionTag, 'appInstallDialog.openAppInstallDialog', [
6769
+ openAPPInstallDialogParams,
6770
+ ]);
6682
6771
  resolve();
6683
6772
  }
6684
6773
  });
@@ -7891,6 +7980,11 @@ function getAdaptiveCardSchemaVersion() {
7891
7980
 
7892
7981
 
7893
7982
 
7983
+
7984
+ /**
7985
+ * v1 APIs telemetry file: All of APIs in this capability file should send out API version v1 ONLY
7986
+ */
7987
+ const appWindowTelemetryVersionNumber = ApiVersionNumber.V_1;
7894
7988
  /**
7895
7989
  * An object that application can utilize to establish communication
7896
7990
  * with the child window it opened, which contains the corresponding task.
@@ -7904,7 +7998,7 @@ class ChildAppWindow {
7904
7998
  */
7905
7999
  postMessage(message, onComplete) {
7906
8000
  internalAPIs_ensureInitialized(runtime_runtime);
7907
- sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
8001
+ sendMessageToParentWithVersion(getApiVersionTag(appWindowTelemetryVersionNumber, ApiName.AppWindow_ChildAppWindow_PostMessage), 'messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
7908
8002
  }
7909
8003
  /**
7910
8004
  * Add a listener that will be called when an event is received from the ChildAppWindow.
@@ -7915,7 +8009,7 @@ class ChildAppWindow {
7915
8009
  addEventListener(type, listener) {
7916
8010
  internalAPIs_ensureInitialized(runtime_runtime);
7917
8011
  if (type === 'message') {
7918
- registerHandler('messageForParent', listener);
8012
+ registerHandlerWithVersion(getApiVersionTag(appWindowTelemetryVersionNumber, ApiName.AppWindow_ChildAppWindow_AddEventListener), 'messageForParent', listener);
7919
8013
  }
7920
8014
  }
7921
8015
  }
@@ -7938,7 +8032,7 @@ class ParentAppWindow {
7938
8032
  */
7939
8033
  postMessage(message, onComplete) {
7940
8034
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.task);
7941
- sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
8035
+ sendMessageToParentWithVersion(getApiVersionTag(appWindowTelemetryVersionNumber, ApiName.AppWindow_ParentAppWindow_PostMessage), 'messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
7942
8036
  }
7943
8037
  /**
7944
8038
  * Add a listener that will be called when an event is received from the ParentAppWindow.
@@ -7949,7 +8043,7 @@ class ParentAppWindow {
7949
8043
  addEventListener(type, listener) {
7950
8044
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.task);
7951
8045
  if (type === 'message') {
7952
- registerHandler('messageForChild', listener);
8046
+ registerHandlerWithVersion(getApiVersionTag(appWindowTelemetryVersionNumber, ApiName.AppWindow_ParentAppWindow_AddEventListener), 'messageForChild', listener);
7953
8047
  }
7954
8048
  }
7955
8049
  }
@@ -8854,11 +8948,12 @@ var calendar;
8854
8948
  if (!isSupported()) {
8855
8949
  throw new Error('Not supported');
8856
8950
  }
8951
+ const apiVersionTag = getApiVersionTag(calendarTelemetryVersionNumber, ApiName.Calendar_ComposeMeeting);
8857
8952
  if (runtime_runtime.isLegacyTeams) {
8858
- resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForCalendar(composeMeetingParams.attendees, composeMeetingParams.startTime, composeMeetingParams.endTime, composeMeetingParams.subject, composeMeetingParams.content)));
8953
+ resolve(sendAndHandleStatusAndReasonWithVersion(apiVersionTag, 'executeDeepLink', createTeamsDeepLinkForCalendar(composeMeetingParams.attendees, composeMeetingParams.startTime, composeMeetingParams.endTime, composeMeetingParams.subject, composeMeetingParams.content)));
8859
8954
  }
8860
8955
  else {
8861
- resolve(sendAndHandleStatusAndReasonWithVersion(getApiVersionTag(calendarTelemetryVersionNumber, ApiName.Calendar_ComposeMeeting), 'calendar.composeMeeting', composeMeetingParams));
8956
+ resolve(sendAndHandleStatusAndReasonWithVersion(apiVersionTag, 'calendar.composeMeeting', composeMeetingParams));
8862
8957
  }
8863
8958
  });
8864
8959
  }
@@ -9296,6 +9391,16 @@ var videoEffectsUtils_awaiter = (undefined && undefined.__awaiter) || function (
9296
9391
 
9297
9392
 
9298
9393
 
9394
+
9395
+ /**
9396
+ * @hidden
9397
+ * Align with the W3C spec: https://www.w3.org/TR/webcodecs/
9398
+ *
9399
+ * @internal
9400
+ * Limited to Microsoft-internal use
9401
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
9402
+ */
9403
+ const videoEffectsUtilTelemetryVersionNumber = ApiVersionNumber.V_2;
9299
9404
  /**
9300
9405
  * @hidden
9301
9406
  * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
@@ -9606,7 +9711,7 @@ class TransformerWithMetadata {
9606
9711
  },
9607
9712
  };
9608
9713
  });
9609
- registerHandler('video.mediaStream.audioInferenceDiscardStatusChange', ({ discardAudioInferenceResult }) => {
9714
+ registerHandlerWithVersion(getApiVersionTag(videoEffectsUtilTelemetryVersionNumber, ApiName.VideoEffectsUtils_TransformerWithMetadata_Constructor), 'video.mediaStream.audioInferenceDiscardStatusChange', ({ discardAudioInferenceResult }) => {
9610
9715
  this.shouldDiscardAudioInferenceResult = discardAudioInferenceResult;
9611
9716
  });
9612
9717
  }
@@ -9620,11 +9725,11 @@ function createEffectParameterChangeCallback(callback, videoPerformanceMonitor)
9620
9725
  callback(effectId, effectParam)
9621
9726
  .then(() => {
9622
9727
  videoPerformanceMonitor === null || videoPerformanceMonitor === void 0 ? void 0 : videoPerformanceMonitor.reportVideoEffectChanged(effectId || '', effectParam);
9623
- sendMessageToParent('video.videoEffectReadiness', [true, effectId, undefined, effectParam]);
9728
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsUtilTelemetryVersionNumber, ApiName.VideoEffectsUtils_ReportVideoEffectChanged), 'video.videoEffectReadiness', [true, effectId, undefined, effectParam]);
9624
9729
  })
9625
9730
  .catch((reason) => {
9626
9731
  const validReason = reason in videoEffects.EffectFailureReason ? reason : videoEffects.EffectFailureReason.InitializationFailure;
9627
- sendMessageToParent('video.videoEffectReadiness', [false, effectId, validReason, effectParam]);
9732
+ sendMessageToParentWithVersion(getApiVersionTag(videoEffectsUtilTelemetryVersionNumber, ApiName.VideoEffectsUtils_EffectFailure), 'video.videoEffectReadiness', [false, effectId, validReason, effectParam]);
9628
9733
  });
9629
9734
  };
9630
9735
  }
@@ -10776,10 +10881,14 @@ var call;
10776
10881
 
10777
10882
  ;// CONCATENATED MODULE: ./src/public/appInitialization.ts
10778
10883
 
10884
+
10779
10885
  /**
10780
10886
  * @deprecated
10781
10887
  * As of 2.0.0, please use {@link app} namespace instead.
10888
+ *
10889
+ * v1 APIs telemetry file: All of APIs in this capability file should send out API version v1 ONLY
10782
10890
  */
10891
+ const appInitializationTelemetryVersionNumber = ApiVersionNumber.V_1;
10783
10892
  var appInitialization;
10784
10893
  (function (appInitialization) {
10785
10894
  /**
@@ -10807,7 +10916,7 @@ var appInitialization;
10807
10916
  * Notifies the frame that app has loaded and to hide the loading indicator if one is shown.
10808
10917
  */
10809
10918
  function notifyAppLoaded() {
10810
- app.notifyAppLoaded();
10919
+ notifyAppLoadedHelper(getApiVersionTag(appInitializationTelemetryVersionNumber, ApiName.AppInitialization_NotifyAppLoaded));
10811
10920
  }
10812
10921
  appInitialization.notifyAppLoaded = notifyAppLoaded;
10813
10922
  /**
@@ -10817,7 +10926,7 @@ var appInitialization;
10817
10926
  * Notifies the frame that app initialization is successful and is ready for user interaction.
10818
10927
  */
10819
10928
  function notifySuccess() {
10820
- app.notifySuccess();
10929
+ notifySuccessHelper(getApiVersionTag(appInitializationTelemetryVersionNumber, ApiName.AppInitialization_NotifySuccess));
10821
10930
  }
10822
10931
  appInitialization.notifySuccess = notifySuccess;
10823
10932
  /**
@@ -10829,7 +10938,7 @@ var appInitialization;
10829
10938
  * during initialization as well as an optional message.
10830
10939
  */
10831
10940
  function notifyFailure(appInitializationFailedRequest) {
10832
- app.notifyFailure(appInitializationFailedRequest);
10941
+ notifyFailureHelper(getApiVersionTag(appInitializationTelemetryVersionNumber, ApiName.AppInitialization_NotifyFailure), appInitializationFailedRequest);
10833
10942
  }
10834
10943
  appInitialization.notifyFailure = notifyFailure;
10835
10944
  /**
@@ -10840,7 +10949,7 @@ var appInitialization;
10840
10949
  * @param expectedFailureRequest - The expected failure request containing the reason and an optional message
10841
10950
  */
10842
10951
  function notifyExpectedFailure(expectedFailureRequest) {
10843
- app.notifyExpectedFailure(expectedFailureRequest);
10952
+ notifyExpectedFailureHelper(getApiVersionTag(appInitializationTelemetryVersionNumber, ApiName.AppInitialization_NotifyExpectedFailure), expectedFailureRequest);
10844
10953
  }
10845
10954
  appInitialization.notifyExpectedFailure = notifyExpectedFailure;
10846
10955
  })(appInitialization || (appInitialization = {}));
@@ -13270,6 +13379,97 @@ var meetingRoom;
13270
13379
  meetingRoom.isSupported = isSupported;
13271
13380
  })(meetingRoom || (meetingRoom = {}));
13272
13381
 
13382
+ ;// CONCATENATED MODULE: ./src/private/messageChannels.ts
13383
+ var messageChannels_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
13384
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13385
+ return new (P || (P = Promise))(function (resolve, reject) {
13386
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13387
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13388
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13389
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13390
+ });
13391
+ };
13392
+
13393
+
13394
+
13395
+
13396
+
13397
+ /**
13398
+ * @hidden
13399
+ * Namespace to request message ports from the host application.
13400
+ *
13401
+ * @beta
13402
+ *
13403
+ * @internal
13404
+ * Limited to Microsoft-internal use
13405
+ */
13406
+ var messageChannels;
13407
+ (function (messageChannels) {
13408
+ let telemetryPort;
13409
+ const messageChannelsTelemetryVersionNumber = ApiVersionNumber.V_1;
13410
+ const logger = getLogger('messageChannels');
13411
+ /**
13412
+ * @hidden
13413
+ * @beta
13414
+ *
13415
+ * Fetches a MessagePort to batch telemetry through the host's telemetry worker.
13416
+ * The port is cached once received, so subsequent calls return the same port.
13417
+ * @returns MessagePort.
13418
+ *
13419
+ * @throws Error if {@linkcode app.initialize} has not successfully completed,
13420
+ * if the host does not support the feature, or if the port request is rejected.
13421
+ *
13422
+ * @internal
13423
+ * Limited to Microsoft-internal use
13424
+ */
13425
+ function getTelemetryPort() {
13426
+ return messageChannels_awaiter(this, void 0, void 0, function* () {
13427
+ // If the port has already been initialized, return it.
13428
+ if (telemetryPort) {
13429
+ logger('Returning telemetry port from cache');
13430
+ return telemetryPort;
13431
+ }
13432
+ if (!isSupported()) {
13433
+ throw errorNotSupportedOnPlatform;
13434
+ }
13435
+ // Send request for telemetry port, will throw if the request is rejected
13436
+ telemetryPort = yield requestPortFromParentWithVersion(getApiVersionTag(messageChannelsTelemetryVersionNumber, ApiName.MessageChannels_GetTelemetryPort), 'messageChannels.getTelemetryPort');
13437
+ return telemetryPort;
13438
+ });
13439
+ }
13440
+ messageChannels.getTelemetryPort = getTelemetryPort;
13441
+ /**
13442
+ * @hidden
13443
+ *
13444
+ * @beta
13445
+ *
13446
+ * Checks if the messageChannels capability is supported by the host
13447
+ * @returns boolean to represent whether the messageChannels capability is supported
13448
+ *
13449
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
13450
+ *
13451
+ * @internal
13452
+ * Limited to Microsoft-internal use
13453
+ */
13454
+ function isSupported() {
13455
+ return internalAPIs_ensureInitialized(runtime_runtime) && runtime_runtime.supports.messageChannels ? true : false;
13456
+ }
13457
+ messageChannels.isSupported = isSupported;
13458
+ /**
13459
+ * @hidden
13460
+ * Undocumented function used to clear state between unit tests
13461
+ *
13462
+ * @beta
13463
+ *
13464
+ * @internal
13465
+ * Limited to Microsoft-internal use
13466
+ */
13467
+ function _clearTelemetryPort() {
13468
+ telemetryPort = undefined;
13469
+ }
13470
+ messageChannels._clearTelemetryPort = _clearTelemetryPort;
13471
+ })(messageChannels || (messageChannels = {}));
13472
+
13273
13473
  ;// CONCATENATED MODULE: ./src/private/notifications.ts
13274
13474
 
13275
13475
 
@@ -14121,6 +14321,7 @@ var videoEffectsEx;
14121
14321
 
14122
14322
 
14123
14323
 
14324
+
14124
14325
 
14125
14326
  ;// CONCATENATED MODULE: ./src/index.ts
14126
14327