@microsoft/teams-js 2.28.1-beta.0 → 2.29.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/esm/_virtual/__polyfill-node.tty.js +1 -0
  2. package/dist/esm/_virtual/__polyfill-node.util.js +1 -0
  3. package/dist/esm/_virtual/_commonjsHelpers.js +1 -0
  4. package/dist/esm/_virtual/_polyfill-node._inherits.js +1 -0
  5. package/dist/esm/_virtual/_polyfill-node.buffer.js +1 -0
  6. package/dist/esm/_virtual/_polyfill-node.global.js +1 -0
  7. package/dist/esm/_virtual/_polyfill-node.process.js +1 -0
  8. package/dist/esm/_virtual/_polyfill-node.tty.js +1 -0
  9. package/dist/esm/_virtual/_polyfill-node.util.js +1 -0
  10. package/dist/esm/_virtual/browser.js +1 -0
  11. package/dist/esm/_virtual/index.js +1 -0
  12. package/dist/esm/_virtual/node.js +1 -0
  13. package/dist/esm/node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.22.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js +1 -0
  14. package/dist/esm/node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js +1 -0
  15. package/dist/esm/node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/common.js +1 -0
  16. package/dist/esm/node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/index.js +1 -0
  17. package/dist/esm/node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/node.js +1 -0
  18. package/dist/esm/node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js +1 -0
  19. package/dist/esm/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/browser.js +1 -0
  20. package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js +1 -0
  21. package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  22. package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js +1 -0
  23. package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js +1 -0
  24. package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js +1 -0
  25. package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/validate.js +1 -0
  26. package/dist/esm/packages/teams-js/src/artifactsForCDN/validDomains.json.js +1 -0
  27. package/dist/esm/packages/teams-js/src/index.js +1 -0
  28. package/dist/esm/packages/teams-js/src/internal/appIdValidation.js +1 -0
  29. package/dist/esm/packages/teams-js/src/internal/communication.js +1 -0
  30. package/dist/esm/packages/teams-js/src/internal/constants.js +1 -0
  31. package/dist/esm/packages/teams-js/src/internal/deepLinkConstants.js +1 -0
  32. package/dist/esm/packages/teams-js/src/internal/deepLinkUtilities.js +1 -0
  33. package/dist/esm/packages/teams-js/src/internal/globalVars.js +1 -0
  34. package/dist/esm/packages/teams-js/src/internal/handlers.js +1 -0
  35. package/dist/esm/packages/teams-js/src/internal/internalAPIs.js +1 -0
  36. package/dist/esm/packages/teams-js/src/internal/marketplaceUtils.js +1 -0
  37. package/dist/esm/packages/teams-js/src/internal/mediaUtil.js +1 -0
  38. package/dist/esm/packages/teams-js/src/internal/messageObjects.js +1 -0
  39. package/dist/esm/packages/teams-js/src/internal/nestedAppAuthUtils.js +1 -0
  40. package/dist/esm/packages/teams-js/src/internal/profileUtil.js +1 -0
  41. package/dist/esm/packages/teams-js/src/internal/telemetry.js +1 -0
  42. package/dist/esm/packages/teams-js/src/internal/typeCheckUtilities.js +1 -0
  43. package/dist/esm/packages/teams-js/src/internal/utils.js +1 -0
  44. package/dist/esm/packages/teams-js/src/internal/uuidObject.js +1 -0
  45. package/dist/esm/packages/teams-js/src/internal/validOrigins.js +1 -0
  46. package/dist/esm/packages/teams-js/src/internal/videoEffectsUtils.js +1 -0
  47. package/dist/esm/packages/teams-js/src/internal/videoFrameTick.js +1 -0
  48. package/dist/esm/packages/teams-js/src/internal/videoPerformanceMonitor.js +1 -0
  49. package/dist/esm/packages/teams-js/src/internal/videoPerformanceStatistics.js +1 -0
  50. package/dist/esm/packages/teams-js/src/private/appEntity.js +1 -0
  51. package/dist/esm/packages/teams-js/src/private/conversations.js +1 -0
  52. package/dist/esm/packages/teams-js/src/private/copilot.js +1 -0
  53. package/dist/esm/packages/teams-js/src/private/externalAppAuthentication.js +1 -0
  54. package/dist/esm/packages/teams-js/src/private/externalAppCardActions.js +1 -0
  55. package/dist/esm/packages/teams-js/src/private/externalAppCardActionsForCEA.js +1 -0
  56. package/dist/esm/packages/teams-js/src/private/externalAppCommands.js +1 -0
  57. package/dist/esm/packages/teams-js/src/private/files.js +1 -0
  58. package/dist/esm/packages/teams-js/src/private/hostEntity.js +1 -0
  59. package/dist/esm/packages/teams-js/src/private/interfaces.js +1 -0
  60. package/dist/esm/packages/teams-js/src/private/logs.js +1 -0
  61. package/dist/esm/packages/teams-js/src/private/meetingRoom.js +1 -0
  62. package/dist/esm/packages/teams-js/src/private/messageChannels.js +1 -0
  63. package/dist/esm/packages/teams-js/src/private/notifications.js +1 -0
  64. package/dist/esm/packages/teams-js/src/private/otherAppStateChange.js +1 -0
  65. package/dist/esm/packages/teams-js/src/private/privateAPIs.js +1 -0
  66. package/dist/esm/packages/teams-js/src/private/remoteCamera.js +1 -0
  67. package/dist/esm/packages/teams-js/src/private/teams.js +1 -0
  68. package/dist/esm/packages/teams-js/src/private/videoEffectsEx.js +1 -0
  69. package/dist/esm/packages/teams-js/src/public/adaptiveCards.js +1 -0
  70. package/dist/esm/packages/teams-js/src/public/app.js +1 -0
  71. package/dist/esm/packages/teams-js/src/public/appId.js +1 -0
  72. package/dist/esm/packages/teams-js/src/public/appInitialization.js +1 -0
  73. package/dist/esm/packages/teams-js/src/public/appInstallDialog.js +1 -0
  74. package/dist/esm/packages/teams-js/src/public/appWindow.js +1 -0
  75. package/dist/esm/packages/teams-js/src/public/authentication.js +1 -0
  76. package/dist/esm/packages/teams-js/src/public/barCode.js +1 -0
  77. package/dist/esm/packages/teams-js/src/public/calendar.js +1 -0
  78. package/dist/esm/packages/teams-js/src/public/call.js +1 -0
  79. package/dist/esm/packages/teams-js/src/public/chat.js +1 -0
  80. package/dist/esm/packages/teams-js/src/public/clipboard.js +1 -0
  81. package/dist/esm/packages/teams-js/src/public/constants.js +1 -0
  82. package/dist/esm/packages/teams-js/src/public/dialog.js +1 -0
  83. package/dist/esm/packages/teams-js/src/public/geoLocation.js +1 -0
  84. package/dist/esm/packages/teams-js/src/public/interfaces.js +1 -0
  85. package/dist/esm/packages/teams-js/src/public/liveShareHost.js +1 -0
  86. package/dist/esm/packages/teams-js/src/public/location.js +1 -0
  87. package/dist/esm/packages/teams-js/src/public/mail.js +1 -0
  88. package/dist/esm/packages/teams-js/src/public/marketplace.js +1 -0
  89. package/dist/esm/packages/teams-js/src/public/media.js +1 -0
  90. package/dist/esm/packages/teams-js/src/public/meeting.js +1 -0
  91. package/dist/esm/packages/teams-js/src/public/menus.js +1 -0
  92. package/dist/esm/packages/teams-js/src/public/monetization.js +1 -0
  93. package/dist/esm/packages/teams-js/src/public/navigation.js +1 -0
  94. package/dist/esm/packages/teams-js/src/public/nestedAppAuth.js +1 -0
  95. package/dist/esm/packages/teams-js/src/public/pages.js +1 -0
  96. package/dist/esm/packages/teams-js/src/public/people.js +1 -0
  97. package/dist/esm/packages/teams-js/src/public/profile.js +1 -0
  98. package/dist/esm/packages/teams-js/src/public/publicAPIs.js +1 -0
  99. package/dist/esm/packages/teams-js/src/public/runtime.js +1 -0
  100. package/dist/esm/packages/teams-js/src/public/search.js +1 -0
  101. package/dist/esm/packages/teams-js/src/public/secondaryBrowser.js +1 -0
  102. package/dist/esm/packages/teams-js/src/public/settings.js +1 -0
  103. package/dist/esm/packages/teams-js/src/public/sharing.js +1 -0
  104. package/dist/esm/packages/teams-js/src/public/stageView.js +1 -0
  105. package/dist/esm/packages/teams-js/src/public/tasks.js +1 -0
  106. package/dist/esm/packages/teams-js/src/public/teamsAPIs.js +1 -0
  107. package/dist/esm/packages/teams-js/src/public/thirdPartyCloudStorage.js +1 -0
  108. package/dist/esm/packages/teams-js/src/public/version.js +1 -0
  109. package/dist/esm/packages/teams-js/src/public/videoEffects.js +1 -0
  110. package/dist/esm/packages/teams-js/src/public/visualMedia.js +1 -0
  111. package/dist/esm/packages/teams-js/src/public/webStorage.js +1 -0
  112. package/dist/{MicrosoftTeams.d.ts → umd/MicrosoftTeams.d.ts} +155 -45
  113. package/dist/{MicrosoftTeams.js → umd/MicrosoftTeams.js} +1048 -913
  114. package/dist/umd/MicrosoftTeams.js.map +1 -0
  115. package/dist/umd/MicrosoftTeams.min.js +2 -0
  116. package/dist/umd/MicrosoftTeams.min.js.map +1 -0
  117. package/package.json +1 -1
  118. package/dist/MicrosoftTeams.js.map +0 -1
  119. package/dist/MicrosoftTeams.min.js +0 -2
  120. package/dist/MicrosoftTeams.min.js.map +0 -1
@@ -1026,6 +1026,7 @@ __webpack_require__.d(__webpack_exports__, {
1026
1026
  executeDeepLink: () => (/* reexport */ executeDeepLink),
1027
1027
  externalAppAuthentication: () => (/* reexport */ externalAppAuthentication),
1028
1028
  externalAppCardActions: () => (/* reexport */ externalAppCardActions),
1029
+ externalAppCardActionsForCEA: () => (/* reexport */ externalAppCardActionsForCEA),
1029
1030
  externalAppCommands: () => (/* reexport */ externalAppCommands),
1030
1031
  files: () => (/* reexport */ files),
1031
1032
  geoLocation: () => (/* reexport */ geoLocation),
@@ -1095,215 +1096,6 @@ __webpack_require__.d(__webpack_exports__, {
1095
1096
 
1096
1097
  // EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js
1097
1098
  var browser = __webpack_require__(815);
1098
- ;// CONCATENATED MODULE: ./src/internal/telemetry.ts
1099
-
1100
- const topLevelLogger = (0,browser.debug)('teamsJs');
1101
- /**
1102
- * @internal
1103
- * Limited to Microsoft-internal use
1104
- *
1105
- * Returns a logger for a given namespace, within the pre-defined top-level teamsJs namespace
1106
- */
1107
- function getLogger(namespace) {
1108
- return topLevelLogger.extend(namespace);
1109
- }
1110
- /**
1111
- * @hidden
1112
- * Creates a string tag for labeling apiVersionTag, which is used for API function call to create message request
1113
- * sent to host(s).
1114
- *
1115
- * @internal
1116
- * Limited to Microsoft-internal use
1117
- */
1118
- function getApiVersionTag(apiVersionNumber, functionName) {
1119
- return `${apiVersionNumber}_${functionName}`;
1120
- }
1121
- /**
1122
- * @hidden
1123
- * Check if apiVersionTag developer sends follows the pattern starting with a lowercase 'v', then
1124
- * followed by one or more digits, then concatenated with underscore and some characters to indicate api name.
1125
- * For example, 'v2_app.getContext'. If yes, return true. Otherwise, return false.
1126
- *
1127
- * @internal
1128
- * Limited to Microsoft-internal use
1129
- */
1130
- function isFollowingApiVersionTagFormat(apiVersionTag) {
1131
- const pattern = /^v\d+_[\w.]+$/;
1132
- return pattern.test(apiVersionTag);
1133
- }
1134
-
1135
- ;// CONCATENATED MODULE: ./src/artifactsForCDN/validDomains.json
1136
- const validDomains_namespaceObject = /*#__PURE__*/JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.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","*.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","*.cloud.microsoft","*.m365.cloud.microsoft","edgeapi.svc.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net","fa000000136.resources.office.net"]}');
1137
- var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
1138
- ;// CONCATENATED MODULE: ./src/internal/constants.ts
1139
-
1140
- /**
1141
- * @hidden
1142
- * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
1143
- * Modified to 2.0.1 which is hightest till now so that if any client doesn't pass version in initialize function, it will be set to highest.
1144
- * Mobile clients are passing versions, hence will be applicable to web and desktop clients only.
1145
- *
1146
- * @internal
1147
- * Limited to Microsoft-internal use
1148
- */
1149
- const defaultSDKVersionForCompatCheck = '2.0.1';
1150
- /**
1151
- * @hidden
1152
- * This is the client version when selectMedia API - VideoAndImage is supported on mobile.
1153
- *
1154
- * @internal
1155
- * Limited to Microsoft-internal use
1156
- */
1157
- const videoAndImageMediaAPISupportVersion = '2.0.2';
1158
- /**
1159
- * @hidden
1160
- * This is the client version when selectMedia API - Video with non-full screen mode is supported on mobile.
1161
- *
1162
- * @internal
1163
- * Limited to Microsoft-internal use
1164
- */
1165
- const nonFullScreenVideoModeAPISupportVersion = '2.0.3';
1166
- /**
1167
- * @hidden
1168
- * This is the client version when selectMedia API - ImageOutputFormats is supported on mobile.
1169
- *
1170
- * @internal
1171
- * Limited to Microsoft-internal use
1172
- */
1173
- const imageOutputFormatsAPISupportVersion = '2.0.4';
1174
- /**
1175
- * @hidden
1176
- * Minimum required client supported version for {@link getUserJoinedTeams} to be supported on {@link HostClientType.android}
1177
- *
1178
- * @internal
1179
- * Limited to Microsoft-internal use
1180
- */
1181
- const getUserJoinedTeamsSupportedAndroidClientVersion = '2.0.1';
1182
- /**
1183
- * @hidden
1184
- * This is the client version when location APIs (getLocation and showLocation) are supported.
1185
- *
1186
- * @internal
1187
- * Limited to Microsoft-internal use
1188
- */
1189
- const locationAPIsRequiredVersion = '1.9.0';
1190
- /**
1191
- * @hidden
1192
- * This is the client version when permisisons are supported
1193
- *
1194
- * @internal
1195
- * Limited to Microsoft-internal use
1196
- */
1197
- const permissionsAPIsRequiredVersion = '2.0.1';
1198
- /**
1199
- * @hidden
1200
- * This is the client version when people picker API is supported on mobile.
1201
- *
1202
- * @internal
1203
- * Limited to Microsoft-internal use
1204
- */
1205
- const peoplePickerRequiredVersion = '2.0.0';
1206
- /**
1207
- * @hidden
1208
- * This is the client version when captureImage API is supported on mobile.
1209
- *
1210
- * @internal
1211
- * Limited to Microsoft-internal use
1212
- */
1213
- const captureImageMobileSupportVersion = '1.7.0';
1214
- /**
1215
- * @hidden
1216
- * This is the client version when media APIs are supported on all three platforms ios, android and web.
1217
- *
1218
- * @internal
1219
- * Limited to Microsoft-internal use
1220
- */
1221
- const mediaAPISupportVersion = '1.8.0';
1222
- /**
1223
- * @hidden
1224
- * This is the client version when getMedia API is supported via Callbacks on all three platforms ios, android and web.
1225
- *
1226
- * @internal
1227
- * Limited to Microsoft-internal use
1228
- */
1229
- const getMediaCallbackSupportVersion = '2.0.0';
1230
- /**
1231
- * @hidden
1232
- * This is the client version when scanBarCode API is supported on mobile.
1233
- *
1234
- * @internal
1235
- * Limited to Microsoft-internal use
1236
- */
1237
- const scanBarCodeAPIMobileSupportVersion = '1.9.0';
1238
- /**
1239
- * @hidden
1240
- * Fallback list of valid origins in JSON format
1241
- *
1242
- * @internal
1243
- * Limited to Microsoft-internal use
1244
- */
1245
- const validOriginsLocal = artifactsForCDN_validDomains_namespaceObject;
1246
- /**
1247
- * @hidden
1248
- * Fallback list of valid origins
1249
- *
1250
- * @internal
1251
- * Limited to Microsoft-internal use
1252
- */
1253
- const validOriginsFallback = validOriginsLocal.validOrigins;
1254
- /**
1255
- * @hidden
1256
- * CDN endpoint of the list of valid origins
1257
- *
1258
- * @internal
1259
- * Limited to Microsoft-internal use
1260
- */
1261
- const validOriginsCdnEndpoint = new URL('https://res.cdn.office.net/teams-js/validDomains/json/validDomains.json');
1262
- /**
1263
- * @hidden
1264
- * USer specified message origins should satisfy this test
1265
- *
1266
- * @internal
1267
- * Limited to Microsoft-internal use
1268
- */
1269
- const userOriginUrlValidationRegExp = /^https:\/\//;
1270
- /**
1271
- * @hidden
1272
- * The protocol used for deep links into Teams
1273
- *
1274
- * @internal
1275
- * Limited to Microsoft-internal use
1276
- */
1277
- const teamsDeepLinkProtocol = 'https';
1278
- /**
1279
- * @hidden
1280
- * The host used for deep links into Teams
1281
- *
1282
- * @internal
1283
- * Limited to Microsoft-internal use
1284
- */
1285
- const teamsDeepLinkHost = 'teams.microsoft.com';
1286
- /** @hidden */
1287
- const errorLibraryNotInitialized = 'The library has not yet been initialized';
1288
- /** @hidden */
1289
- const errorRuntimeNotInitialized = 'The runtime has not yet been initialized';
1290
- /** @hidden */
1291
- const errorRuntimeNotSupported = 'The runtime version is not supported';
1292
- /** @hidden */
1293
- const errorCallNotStarted = 'The call was not properly started';
1294
-
1295
- ;// CONCATENATED MODULE: ./src/internal/globalVars.ts
1296
- class GlobalVars {
1297
- }
1298
- GlobalVars.initializeCalled = false;
1299
- GlobalVars.initializeCompleted = false;
1300
- GlobalVars.additionalValidOrigins = [];
1301
- GlobalVars.initializePromise = undefined;
1302
- GlobalVars.isFramelessWindow = false;
1303
- GlobalVars.frameContext = undefined;
1304
- GlobalVars.hostClientType = undefined;
1305
- GlobalVars.printCapabilityEnabled = false;
1306
-
1307
1099
  // EXTERNAL MODULE: ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1308
1100
  var base64_js = __webpack_require__(933);
1309
1101
  ;// CONCATENATED MODULE: ../../node_modules/.pnpm/skeleton-buffer@file+skeleton-buffer/node_modules/skeleton-buffer/index.js
@@ -2893,11 +2685,11 @@ function runWithTimeout(action, timeoutInMs, timeoutError) {
2893
2685
  */
2894
2686
  function createTeamsAppLink(params) {
2895
2687
  const url = new URL('https://teams.microsoft.com/l/entity/' +
2896
- encodeURIComponent(params.appId) +
2688
+ encodeURIComponent(params.appId.toString()) +
2897
2689
  '/' +
2898
2690
  encodeURIComponent(params.pageId));
2899
2691
  if (params.webUrl) {
2900
- url.searchParams.append('webUrl', params.webUrl);
2692
+ url.searchParams.append('webUrl', params.webUrl.toString());
2901
2693
  }
2902
2694
  if (params.chatId || params.channelId || params.subPageId) {
2903
2695
  url.searchParams.append('context', JSON.stringify({ chatId: params.chatId, channelId: params.channelId, subEntityId: params.subPageId }));
@@ -3060,43 +2852,15 @@ function fullyQualifyUrlString(fullOrRelativePath) {
3060
2852
  return new URL(link.href);
3061
2853
  }
3062
2854
  /**
3063
- * The hasScriptTags function first decodes any HTML entities in the input string using the decodeHTMLEntities function.
3064
- * It then tries to decode the result as a URI component. If the URI decoding fails (which would throw an error), it assumes that the input was not encoded and uses the original input.
3065
- * Next, it defines a regular expression scriptRegex that matches any string that starts with <script (followed by any characters), then has any characters (including newlines),
3066
- * and ends with </script> (preceded by any characters).
3067
- * Finally, it uses the test method to check if the decoded input matches this regular expression. The function returns true if a match is found and false otherwise.
3068
- * @param input URL converted to string to pattern match
2855
+ * Detects if there are any script tags in a given string, even if they are Uri encoded or encoded as HTML entities.
2856
+ * @param input string to test for script tags
3069
2857
  * @returns true if the input string contains a script tag, false otherwise
3070
2858
  */
3071
2859
  function hasScriptTags(input) {
3072
- let decodedInput;
3073
- try {
3074
- const decodedHTMLInput = decodeHTMLEntities(input);
3075
- decodedInput = decodeURIComponent(decodedHTMLInput);
3076
- }
3077
- catch (e) {
3078
- // input was not encoded, use it as is
3079
- decodedInput = input;
3080
- }
3081
- const scriptRegex = /<script[^>]*>[\s\S]*?<\/script[^>]*>/gi;
3082
- return scriptRegex.test(decodedInput);
3083
- }
3084
- /**
3085
- * The decodeHTMLEntities function replaces HTML entities in the input string with their corresponding characters.
3086
- */
3087
- function decodeHTMLEntities(input) {
3088
- const entityMap = new Map([
3089
- ['&lt;', '<'],
3090
- ['&gt;', '>'],
3091
- ['&amp;', '&'],
3092
- ['&quot;', '"'],
3093
- ['&#39;', "'"],
3094
- ['&#x2F;', '/'],
3095
- ]);
3096
- entityMap.forEach((value, key) => {
3097
- input = input.replace(new RegExp(key, 'gi'), value);
3098
- });
3099
- return input;
2860
+ const openingScriptTagRegex = /<script[^>]*>|&lt;script[^&]*&gt;|%3Cscript[^%]*%3E/gi;
2861
+ const closingScriptTagRegex = /<\/script[^>]*>|&lt;\/script[^&]*&gt;|%3C\/script[^%]*%3E/gi;
2862
+ const openingOrClosingScriptTagRegex = new RegExp(`${openingScriptTagRegex.source}|${closingScriptTagRegex.source}`, 'gi');
2863
+ return openingOrClosingScriptTagRegex.test(input);
3100
2864
  }
3101
2865
  function isIdLengthValid(id) {
3102
2866
  return id.length < 256 && id.length > 4;
@@ -3126,46 +2890,282 @@ function validateUuid(id) {
3126
2890
  }
3127
2891
  }
3128
2892
 
3129
- ;// CONCATENATED MODULE: ./src/public/runtime.ts
3130
- /* eslint-disable @typescript-eslint/ban-types */
3131
- var __rest = (undefined && undefined.__rest) || function (s, e) {
3132
- var t = {};
3133
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3134
- t[p] = s[p];
3135
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
3136
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3137
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3138
- t[p[i]] = s[p[i]];
3139
- }
3140
- return t;
3141
- };
3142
-
3143
-
3144
-
3145
-
2893
+ ;// CONCATENATED MODULE: ./src/internal/uuidObject.ts
3146
2894
 
3147
- const runtimeLogger = getLogger('runtime');
3148
- const latestRuntimeApiVersion = 4;
3149
- function isLatestRuntimeVersion(runtime) {
3150
- return runtime.apiVersion === latestRuntimeApiVersion;
3151
- }
3152
- // Constant used to set the runtime configuration
3153
- const _uninitializedRuntime = {
3154
- apiVersion: -1,
3155
- supports: {},
3156
- };
3157
2895
  /**
3158
- * @hidden
3159
- * Ensures that the runtime has been initialized
3160
-
3161
- * @returns True if the runtime has been initialized
3162
- * @throws Error if the runtime has not been initialized
3163
- *
3164
2896
  * @internal
3165
2897
  * Limited to Microsoft-internal use
2898
+ *
2899
+ * UUID object
3166
2900
  */
3167
- function isRuntimeInitialized(runtime) {
3168
- if (isLatestRuntimeVersion(runtime)) {
2901
+ class UUID {
2902
+ constructor(uuid = generateGUID()) {
2903
+ this.uuid = uuid;
2904
+ validateUuid(uuid);
2905
+ }
2906
+ toString() {
2907
+ return this.uuid;
2908
+ }
2909
+ }
2910
+
2911
+ ;// CONCATENATED MODULE: ./src/internal/telemetry.ts
2912
+
2913
+
2914
+ // Each teamsjs instance gets a unique identifier that will be prepended to every log statement
2915
+ const teamsJsInstanceIdentifier = new UUID();
2916
+ // Every log statement will get prepended with the teamsJsInstanceIdentifier and a timestamp
2917
+ const originalFormatArgsFunction = browser.debug.formatArgs;
2918
+ browser.debug.formatArgs = function (args) {
2919
+ args[0] = `(${new Date().toISOString()}): ${args[0]} [${teamsJsInstanceIdentifier.toString()}]`;
2920
+ originalFormatArgsFunction.call(this, args);
2921
+ };
2922
+ const topLevelLogger = (0,browser.debug)('teamsJs');
2923
+ /**
2924
+ * @internal
2925
+ * Limited to Microsoft-internal use
2926
+ *
2927
+ * Returns a logger for a given namespace, within the pre-defined top-level teamsJs namespace
2928
+ */
2929
+ function getLogger(namespace) {
2930
+ return topLevelLogger.extend(namespace);
2931
+ }
2932
+ /**
2933
+ * @hidden
2934
+ * Creates a string tag for labeling apiVersionTag, which is used for API function call to create message request
2935
+ * sent to host(s).
2936
+ *
2937
+ * @internal
2938
+ * Limited to Microsoft-internal use
2939
+ */
2940
+ function getApiVersionTag(apiVersionNumber, functionName) {
2941
+ return `${apiVersionNumber}_${functionName}`;
2942
+ }
2943
+ /**
2944
+ * @hidden
2945
+ * Check if apiVersionTag developer sends follows the pattern starting with a lowercase 'v', then
2946
+ * followed by one or more digits, then concatenated with underscore and some characters to indicate api name.
2947
+ * For example, 'v2_app.getContext'. If yes, return true. Otherwise, return false.
2948
+ *
2949
+ * @internal
2950
+ * Limited to Microsoft-internal use
2951
+ */
2952
+ function isFollowingApiVersionTagFormat(apiVersionTag) {
2953
+ const pattern = /^v\d+_[\w.]+$/;
2954
+ return pattern.test(apiVersionTag);
2955
+ }
2956
+
2957
+ ;// CONCATENATED MODULE: ./src/artifactsForCDN/validDomains.json
2958
+ const validDomains_namespaceObject = /*#__PURE__*/JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.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","*.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","*.cloud.microsoft","*.m365.cloud.microsoft","edgeapi.svc.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net","fa000000136.resources.office.net"]}');
2959
+ var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
2960
+ ;// CONCATENATED MODULE: ./src/internal/constants.ts
2961
+
2962
+ /**
2963
+ * @hidden
2964
+ * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
2965
+ * Modified to 2.0.1 which is hightest till now so that if any client doesn't pass version in initialize function, it will be set to highest.
2966
+ * Mobile clients are passing versions, hence will be applicable to web and desktop clients only.
2967
+ *
2968
+ * @internal
2969
+ * Limited to Microsoft-internal use
2970
+ */
2971
+ const defaultSDKVersionForCompatCheck = '2.0.1';
2972
+ /**
2973
+ * @hidden
2974
+ * This is the client version when selectMedia API - VideoAndImage is supported on mobile.
2975
+ *
2976
+ * @internal
2977
+ * Limited to Microsoft-internal use
2978
+ */
2979
+ const videoAndImageMediaAPISupportVersion = '2.0.2';
2980
+ /**
2981
+ * @hidden
2982
+ * This is the client version when selectMedia API - Video with non-full screen mode is supported on mobile.
2983
+ *
2984
+ * @internal
2985
+ * Limited to Microsoft-internal use
2986
+ */
2987
+ const nonFullScreenVideoModeAPISupportVersion = '2.0.3';
2988
+ /**
2989
+ * @hidden
2990
+ * This is the client version when selectMedia API - ImageOutputFormats is supported on mobile.
2991
+ *
2992
+ * @internal
2993
+ * Limited to Microsoft-internal use
2994
+ */
2995
+ const imageOutputFormatsAPISupportVersion = '2.0.4';
2996
+ /**
2997
+ * @hidden
2998
+ * Minimum required client supported version for {@link getUserJoinedTeams} to be supported on {@link HostClientType.android}
2999
+ *
3000
+ * @internal
3001
+ * Limited to Microsoft-internal use
3002
+ */
3003
+ const getUserJoinedTeamsSupportedAndroidClientVersion = '2.0.1';
3004
+ /**
3005
+ * @hidden
3006
+ * This is the client version when location APIs (getLocation and showLocation) are supported.
3007
+ *
3008
+ * @internal
3009
+ * Limited to Microsoft-internal use
3010
+ */
3011
+ const locationAPIsRequiredVersion = '1.9.0';
3012
+ /**
3013
+ * @hidden
3014
+ * This is the client version when permisisons are supported
3015
+ *
3016
+ * @internal
3017
+ * Limited to Microsoft-internal use
3018
+ */
3019
+ const permissionsAPIsRequiredVersion = '2.0.1';
3020
+ /**
3021
+ * @hidden
3022
+ * This is the client version when people picker API is supported on mobile.
3023
+ *
3024
+ * @internal
3025
+ * Limited to Microsoft-internal use
3026
+ */
3027
+ const peoplePickerRequiredVersion = '2.0.0';
3028
+ /**
3029
+ * @hidden
3030
+ * This is the client version when captureImage API is supported on mobile.
3031
+ *
3032
+ * @internal
3033
+ * Limited to Microsoft-internal use
3034
+ */
3035
+ const captureImageMobileSupportVersion = '1.7.0';
3036
+ /**
3037
+ * @hidden
3038
+ * This is the client version when media APIs are supported on all three platforms ios, android and web.
3039
+ *
3040
+ * @internal
3041
+ * Limited to Microsoft-internal use
3042
+ */
3043
+ const mediaAPISupportVersion = '1.8.0';
3044
+ /**
3045
+ * @hidden
3046
+ * This is the client version when getMedia API is supported via Callbacks on all three platforms ios, android and web.
3047
+ *
3048
+ * @internal
3049
+ * Limited to Microsoft-internal use
3050
+ */
3051
+ const getMediaCallbackSupportVersion = '2.0.0';
3052
+ /**
3053
+ * @hidden
3054
+ * This is the client version when scanBarCode API is supported on mobile.
3055
+ *
3056
+ * @internal
3057
+ * Limited to Microsoft-internal use
3058
+ */
3059
+ const scanBarCodeAPIMobileSupportVersion = '1.9.0';
3060
+ /**
3061
+ * @hidden
3062
+ * Fallback list of valid origins in JSON format
3063
+ *
3064
+ * @internal
3065
+ * Limited to Microsoft-internal use
3066
+ */
3067
+ const validOriginsLocal = artifactsForCDN_validDomains_namespaceObject;
3068
+ /**
3069
+ * @hidden
3070
+ * Fallback list of valid origins
3071
+ *
3072
+ * @internal
3073
+ * Limited to Microsoft-internal use
3074
+ */
3075
+ const validOriginsFallback = validOriginsLocal.validOrigins;
3076
+ /**
3077
+ * @hidden
3078
+ * CDN endpoint of the list of valid origins
3079
+ *
3080
+ * @internal
3081
+ * Limited to Microsoft-internal use
3082
+ */
3083
+ const validOriginsCdnEndpoint = new URL('https://res.cdn.office.net/teams-js/validDomains/json/validDomains.json');
3084
+ /**
3085
+ * @hidden
3086
+ * USer specified message origins should satisfy this test
3087
+ *
3088
+ * @internal
3089
+ * Limited to Microsoft-internal use
3090
+ */
3091
+ const userOriginUrlValidationRegExp = /^https:\/\//;
3092
+ /**
3093
+ * @hidden
3094
+ * The protocol used for deep links into Teams
3095
+ *
3096
+ * @internal
3097
+ * Limited to Microsoft-internal use
3098
+ */
3099
+ const teamsDeepLinkProtocol = 'https';
3100
+ /**
3101
+ * @hidden
3102
+ * The host used for deep links into Teams
3103
+ *
3104
+ * @internal
3105
+ * Limited to Microsoft-internal use
3106
+ */
3107
+ const teamsDeepLinkHost = 'teams.microsoft.com';
3108
+ /** @hidden */
3109
+ const errorLibraryNotInitialized = 'The library has not yet been initialized';
3110
+ /** @hidden */
3111
+ const errorRuntimeNotInitialized = 'The runtime has not yet been initialized';
3112
+ /** @hidden */
3113
+ const errorRuntimeNotSupported = 'The runtime version is not supported';
3114
+ /** @hidden */
3115
+ const errorCallNotStarted = 'The call was not properly started';
3116
+
3117
+ ;// CONCATENATED MODULE: ./src/internal/globalVars.ts
3118
+ class GlobalVars {
3119
+ }
3120
+ GlobalVars.initializeCalled = false;
3121
+ GlobalVars.initializeCompleted = false;
3122
+ GlobalVars.additionalValidOrigins = [];
3123
+ GlobalVars.initializePromise = undefined;
3124
+ GlobalVars.isFramelessWindow = false;
3125
+ GlobalVars.frameContext = undefined;
3126
+ GlobalVars.hostClientType = undefined;
3127
+ GlobalVars.printCapabilityEnabled = false;
3128
+
3129
+ ;// CONCATENATED MODULE: ./src/public/runtime.ts
3130
+ /* eslint-disable @typescript-eslint/ban-types */
3131
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
3132
+ var t = {};
3133
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3134
+ t[p] = s[p];
3135
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3136
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3137
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3138
+ t[p[i]] = s[p[i]];
3139
+ }
3140
+ return t;
3141
+ };
3142
+
3143
+
3144
+
3145
+
3146
+
3147
+ const runtimeLogger = getLogger('runtime');
3148
+ const latestRuntimeApiVersion = 4;
3149
+ function isLatestRuntimeVersion(runtime) {
3150
+ return runtime.apiVersion === latestRuntimeApiVersion;
3151
+ }
3152
+ // Constant used to set the runtime configuration
3153
+ const _uninitializedRuntime = {
3154
+ apiVersion: -1,
3155
+ supports: {},
3156
+ };
3157
+ /**
3158
+ * @hidden
3159
+ * Ensures that the runtime has been initialized
3160
+
3161
+ * @returns True if the runtime has been initialized
3162
+ * @throws Error if the runtime has not been initialized
3163
+ *
3164
+ * @internal
3165
+ * Limited to Microsoft-internal use
3166
+ */
3167
+ function isRuntimeInitialized(runtime) {
3168
+ if (isLatestRuntimeVersion(runtime)) {
3169
3169
  return true;
3170
3170
  }
3171
3171
  else if (runtime.apiVersion === -1) {
@@ -3509,7 +3509,7 @@ const _minRuntimeConfigToUninitialize = {
3509
3509
  * @hidden
3510
3510
  * Package version.
3511
3511
  */
3512
- const version = "2.28.1-beta.0";
3512
+ const version = "2.29.0-beta.1";
3513
3513
 
3514
3514
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
3515
3515
 
@@ -3776,6 +3776,74 @@ function validateOrigin(messageOrigin) {
3776
3776
  });
3777
3777
  }
3778
3778
 
3779
+ ;// CONCATENATED MODULE: ./src/internal/appIdValidation.ts
3780
+
3781
+ /**
3782
+ * This function can be used to validate if a string is a "valid" app id.
3783
+ * Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema:
3784
+ * https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id
3785
+ * However, there are some older internal/hard-coded apps which violate this schema and use names like com.microsoft.teamspace.tab.youtube.
3786
+ * For compatibility with these legacy apps, we unfortunately cannot securely and completely validate app ids as UUIDs. Based
3787
+ * on this, the validation is limited to checking for script tags, length, and non-printable characters.
3788
+ *
3789
+ * @param potentialAppId A string to check if it's a "valid" app id
3790
+ * @throws Error with a message describing the exact validation violation
3791
+ */
3792
+ function validateStringAsAppId(potentialAppId) {
3793
+ if (hasScriptTags(potentialAppId)) {
3794
+ throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains script tags.`);
3795
+ }
3796
+ if (!isStringWithinAppIdLengthLimits(potentialAppId)) {
3797
+ throw new Error(`Potential app id (${potentialAppId}) is invalid; its length ${potentialAppId.length} is not within the length limits (${minimumValidAppIdLength}-${maximumValidAppIdLength}).`);
3798
+ }
3799
+ if (doesStringContainNonPrintableCharacters(potentialAppId)) {
3800
+ throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains non-printable characters.`);
3801
+ }
3802
+ }
3803
+ const minimumValidAppIdLength = 4;
3804
+ const maximumValidAppIdLength = 256;
3805
+ function isStringWithinAppIdLengthLimits(potentialAppId) {
3806
+ return potentialAppId.length < maximumValidAppIdLength && potentialAppId.length > minimumValidAppIdLength;
3807
+ }
3808
+ function doesStringContainNonPrintableCharacters(str) {
3809
+ return [...str].some((char) => {
3810
+ const charCode = char.charCodeAt(0);
3811
+ return charCode < 32 || charCode > 126;
3812
+ });
3813
+ }
3814
+
3815
+ ;// CONCATENATED MODULE: ./src/public/appId.ts
3816
+
3817
+ /**
3818
+ * A strongly-typed class used to represent a "valid" app id.
3819
+ *
3820
+ * Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema:
3821
+ * https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id
3822
+ * However, there are some older internal/hard-coded apps which violate this schema and use names like
3823
+ * com.microsoft.teamspace.tab.youtube. For compatibility with these legacy apps, we unfortunately cannot
3824
+ * securely and completely validate app ids as UUIDs. Based on this, the validation is limited to checking
3825
+ * for script tags, length, and non-printable characters. Validation will be updated in the future to ensure
3826
+ * the app id is a valid UUID as legacy apps update.
3827
+ */
3828
+ class AppId {
3829
+ /**
3830
+ * Creates a strongly-typed AppId from a string
3831
+ *
3832
+ * @param appIdAsString An app id represented as a string
3833
+ * @throws Error with a message describing the exact validation violation
3834
+ */
3835
+ constructor(appIdAsString) {
3836
+ this.appIdAsString = appIdAsString;
3837
+ validateStringAsAppId(appIdAsString);
3838
+ }
3839
+ /**
3840
+ * Returns the app id as a string
3841
+ */
3842
+ toString() {
3843
+ return this.appIdAsString;
3844
+ }
3845
+ }
3846
+
3779
3847
  ;// CONCATENATED MODULE: ./src/private/messageChannels.ts
3780
3848
  var messageChannels_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
3781
3849
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -5227,7 +5295,8 @@ var app;
5227
5295
  appLogger('teamsjs is being used from %s. %s', currentScriptSrc, scriptUsageWarning);
5228
5296
  }
5229
5297
  }
5230
- // This is called right away to make sure that we capture which script is being executed correctly
5298
+ // This is called right away to make sure that we capture which script is being executed and important stats about the current teamsjs instance
5299
+ appLogger('teamsjs instance is version %s, starting at %s UTC (%s local)', version, new Date().toISOString(), new Date().toLocaleString());
5231
5300
  logWhereTeamsJsIsBeingUsed();
5232
5301
  /**
5233
5302
  * Initializes the library.
@@ -5537,6 +5606,7 @@ function transformLegacyContextToAppContext(legacyContext) {
5537
5606
 
5538
5607
 
5539
5608
 
5609
+
5540
5610
  /**
5541
5611
  * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
5542
5612
  */
@@ -5796,6 +5866,7 @@ var pages;
5796
5866
  *
5797
5867
  * @param params Parameters for the navigation
5798
5868
  * @returns a `Promise` that will resolve if the navigation was successful or reject if it was not
5869
+ * @throws `Error` if the app ID is not valid or `params.webUrl` is defined but not a valid URL
5799
5870
  */
5800
5871
  function navigateToApp(params) {
5801
5872
  return new Promise((resolve) => {
@@ -5805,10 +5876,16 @@ var pages;
5805
5876
  }
5806
5877
  const apiVersionTag = getApiVersionTag(pagesTelemetryVersionNumber, "pages.navigateToApp" /* ApiName.Pages_NavigateToApp */);
5807
5878
  if (runtime.isLegacyTeams) {
5808
- resolve(sendAndHandleStatusAndReason(apiVersionTag, 'executeDeepLink', createTeamsAppLink(params)));
5879
+ const typeSafeParameters = !isAppNavigationParametersObject(params)
5880
+ ? convertNavigateToAppParamsToAppNavigationParameters(params)
5881
+ : params;
5882
+ resolve(sendAndHandleStatusAndReason(apiVersionTag, 'executeDeepLink', createTeamsAppLink(typeSafeParameters)));
5809
5883
  }
5810
5884
  else {
5811
- resolve(sendAndHandleStatusAndReason(apiVersionTag, 'pages.navigateToApp', params));
5885
+ const serializedParameters = isAppNavigationParametersObject(params)
5886
+ ? convertAppNavigationParametersToNavigateToAppParams(params)
5887
+ : params;
5888
+ resolve(sendAndHandleStatusAndReason(apiVersionTag, 'pages.navigateToApp', serializedParameters));
5812
5889
  }
5813
5890
  });
5814
5891
  }
@@ -6371,6 +6448,15 @@ var pages;
6371
6448
  currentApp.isSupported = isSupported;
6372
6449
  })(currentApp = pages.currentApp || (pages.currentApp = {}));
6373
6450
  })(pages || (pages = {}));
6451
+ function isAppNavigationParametersObject(obj) {
6452
+ return obj.appId instanceof AppId;
6453
+ }
6454
+ function convertNavigateToAppParamsToAppNavigationParameters(params) {
6455
+ return Object.assign(Object.assign({}, params), { appId: new AppId(params.appId), webUrl: params.webUrl ? new URL(params.webUrl) : undefined });
6456
+ }
6457
+ function convertAppNavigationParametersToNavigateToAppParams(params) {
6458
+ return Object.assign(Object.assign({}, params), { appId: params.appId.toString(), webUrl: params.webUrl ? params.webUrl.toString() : undefined });
6459
+ }
6374
6460
 
6375
6461
  ;// CONCATENATED MODULE: ./src/internal/handlers.ts
6376
6462
  /* eslint-disable @typescript-eslint/ban-types */
@@ -6635,24 +6721,6 @@ function handlers_registerOnResumeHandler(handler) {
6635
6721
  ]);
6636
6722
  }
6637
6723
 
6638
- ;// CONCATENATED MODULE: ./src/internal/uuidObject.ts
6639
-
6640
- /**
6641
- * @internal
6642
- * Limited to Microsoft-internal use
6643
- *
6644
- * UUID object
6645
- */
6646
- class UUID {
6647
- constructor(uuid = generateGUID()) {
6648
- this.uuid = uuid;
6649
- validateUuid(uuid);
6650
- }
6651
- toString() {
6652
- return this.uuid;
6653
- }
6654
- }
6655
-
6656
6724
  ;// CONCATENATED MODULE: ./src/internal/messageObjects.ts
6657
6725
  var messageObjects_rest = (undefined && undefined.__rest) || function (s, e) {
6658
6726
  var t = {};
@@ -6842,7 +6910,7 @@ CommunicationPrivate.legacyMessageIdsToUuidMap = {};
6842
6910
  */
6843
6911
  function initializeCommunication(validMessageOrigins, apiVersionTag) {
6844
6912
  // Listen for messages post to our window
6845
- CommunicationPrivate.messageListener = (evt) => communication_awaiter(this, void 0, void 0, function* () { return yield processMessage(evt); });
6913
+ CommunicationPrivate.messageListener = (evt) => processIncomingMessage(evt);
6846
6914
  // If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,
6847
6915
  // it's the window that opened us (i.e., window.opener)
6848
6916
  Communication.currentWindow = Communication.currentWindow || ssrSafeWindow();
@@ -6860,7 +6928,7 @@ function initializeCommunication(validMessageOrigins, apiVersionTag) {
6860
6928
  const extendedWindow = Communication.currentWindow;
6861
6929
  if (extendedWindow.nativeInterface) {
6862
6930
  GlobalVars.isFramelessWindow = true;
6863
- extendedWindow.onNativeMessage = handleParentMessage;
6931
+ extendedWindow.onNativeMessage = handleIncomingMessageFromParent;
6864
6932
  }
6865
6933
  else {
6866
6934
  // at this point we weren't able to find a parent to talk to, no way initialization will succeed
@@ -7055,7 +7123,9 @@ function sendNestedAuthRequestToTopWindow(message) {
7055
7123
  const logger = sendNestedAuthRequestToTopWindowLogger;
7056
7124
  const targetWindow = Communication.topWindow;
7057
7125
  const request = createNestedAppAuthRequest(message);
7058
- logger('Message %i information: %o', request.uuid, { actionName: request.func });
7126
+ logger('Message %s information: %o', getMessageIdsAsLogString(request), {
7127
+ actionName: request.func,
7128
+ });
7059
7129
  return sendRequestToTargetWindowHelper(targetWindow, request);
7060
7130
  }
7061
7131
  const sendRequestToTargetWindowHelperLogger = communicationLogger.extend('sendRequestToTargetWindowHelper');
@@ -7069,7 +7139,7 @@ function sendRequestToTargetWindowHelper(targetWindow, messageRequest) {
7069
7139
  const request = serializeMessageRequest(messageRequest);
7070
7140
  if (GlobalVars.isFramelessWindow) {
7071
7141
  if (Communication.currentWindow && Communication.currentWindow.nativeInterface) {
7072
- logger(`Sending message %i to ${targetWindowName} via framelessPostMessage interface`, request.uuidAsString);
7142
+ logger('Sending message %s to %s via framelessPostMessage interface', getMessageIdsAsLogString(request), targetWindowName);
7073
7143
  Communication.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(request));
7074
7144
  }
7075
7145
  }
@@ -7078,11 +7148,11 @@ function sendRequestToTargetWindowHelper(targetWindow, messageRequest) {
7078
7148
  // If the target window isn't closed and we already know its origin, send the message right away; otherwise,
7079
7149
  // queue the message and send it after the origin is established
7080
7150
  if (targetWindow && targetOrigin) {
7081
- logger(`Sending message %i to ${targetWindowName} via postMessage`, request.uuidAsString);
7151
+ logger('Sending message %s to %s via postMessage', getMessageIdsAsLogString(request), targetWindowName);
7082
7152
  targetWindow.postMessage(request, targetOrigin);
7083
7153
  }
7084
7154
  else {
7085
- logger(`Adding message %i to ${targetWindowName} message queue`, request.uuidAsString);
7155
+ logger('Adding message %s to %s message queue', getMessageIdsAsLogString(request), targetWindowName);
7086
7156
  getTargetMessageQueue(targetWindow).push(messageRequest);
7087
7157
  }
7088
7158
  }
@@ -7097,19 +7167,19 @@ function sendMessageToParentHelper(apiVersionTag, actionName, args) {
7097
7167
  const logger = sendMessageToParentHelperLogger;
7098
7168
  const targetWindow = Communication.parentWindow;
7099
7169
  const request = createMessageRequest(apiVersionTag, actionName, args);
7100
- logger('Message %i information: %o', request.uuid, { actionName, args });
7170
+ logger('Message %s information: %o', getMessageIdsAsLogString(request), { actionName, args });
7101
7171
  return sendRequestToTargetWindowHelper(targetWindow, request);
7102
7172
  }
7103
- const processMessageLogger = communicationLogger.extend('processMessage');
7173
+ const processIncomingMessageLogger = communicationLogger.extend('processIncomingMessage');
7104
7174
  /**
7105
7175
  * @internal
7106
7176
  * Limited to Microsoft-internal use
7107
7177
  */
7108
- function processMessage(evt) {
7178
+ function processIncomingMessage(evt) {
7109
7179
  return communication_awaiter(this, void 0, void 0, function* () {
7110
7180
  // Process only if we received a valid message
7111
7181
  if (!evt || !evt.data || typeof evt.data !== 'object') {
7112
- processMessageLogger('Unrecognized message format received by app, message being ignored. Message: %o', evt);
7182
+ processIncomingMessageLogger('Unrecognized message format received by app, message being ignored. Message: %o', evt);
7113
7183
  return;
7114
7184
  }
7115
7185
  // Process only if the message is coming from a different window and a valid origin
@@ -7117,19 +7187,19 @@ function processMessage(evt) {
7117
7187
  // in their call to app.initialize
7118
7188
  const messageSource = evt.source || (evt.originalEvent && evt.originalEvent.source);
7119
7189
  const messageOrigin = evt.origin || (evt.originalEvent && evt.originalEvent.origin);
7120
- return shouldProcessMessage(messageSource, messageOrigin).then((result) => {
7190
+ return shouldProcessIncomingMessage(messageSource, messageOrigin).then((result) => {
7121
7191
  if (!result) {
7122
- processMessageLogger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
7192
+ processIncomingMessageLogger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o', evt, messageSource, messageOrigin);
7123
7193
  return;
7124
7194
  }
7125
7195
  // Update our parent and child relationships based on this message
7126
7196
  updateRelationships(messageSource, messageOrigin);
7127
7197
  // Handle the message
7128
7198
  if (messageSource === Communication.parentWindow) {
7129
- handleParentMessage(evt);
7199
+ handleIncomingMessageFromParent(evt);
7130
7200
  }
7131
7201
  else if (messageSource === Communication.childWindow) {
7132
- handleChildMessage(evt);
7202
+ handleIncomingMessageFromChild(evt);
7133
7203
  }
7134
7204
  });
7135
7205
  });
@@ -7173,7 +7243,7 @@ function processAuthBridgeMessage(evt, onMessageReceived) {
7173
7243
  logger('Message being ignored by app because it is coming for a target that is null');
7174
7244
  return;
7175
7245
  }
7176
- if (!shouldProcessMessage(messageSource, messageOrigin)) {
7246
+ if (!shouldProcessIncomingMessage(messageSource, messageOrigin)) {
7177
7247
  logger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
7178
7248
  return;
7179
7249
  }
@@ -7197,7 +7267,7 @@ function processAuthBridgeMessage(evt, onMessageReceived) {
7197
7267
  // Return the response to the registered callback
7198
7268
  onMessageReceived(message);
7199
7269
  }
7200
- const shouldProcessMessageLogger = communicationLogger.extend('shouldProcessMessage');
7270
+ const shouldProcessIncomingMessageLogger = communicationLogger.extend('shouldProcessIncomingMessage');
7201
7271
  /**
7202
7272
  * @hidden
7203
7273
  * Validates the message source and origin, if it should be processed
@@ -7205,12 +7275,12 @@ const shouldProcessMessageLogger = communicationLogger.extend('shouldProcessMess
7205
7275
  * @internal
7206
7276
  * Limited to Microsoft-internal use
7207
7277
  */
7208
- function shouldProcessMessage(messageSource, messageOrigin) {
7278
+ function shouldProcessIncomingMessage(messageSource, messageOrigin) {
7209
7279
  return communication_awaiter(this, void 0, void 0, function* () {
7210
7280
  // Process if message source is a different window and if origin is either in
7211
7281
  // Teams' pre-known whitelist or supplied as valid origin by user during initialization
7212
7282
  if (Communication.currentWindow && messageSource === Communication.currentWindow) {
7213
- shouldProcessMessageLogger('Should not process message because it is coming from the current window');
7283
+ shouldProcessIncomingMessageLogger('Should not process message because it is coming from the current window');
7214
7284
  return false;
7215
7285
  }
7216
7286
  else if (Communication.currentWindow &&
@@ -7225,12 +7295,12 @@ function shouldProcessMessage(messageSource, messageOrigin) {
7225
7295
  messageOriginURL = new URL(messageOrigin);
7226
7296
  }
7227
7297
  catch (_) {
7228
- shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
7298
+ shouldProcessIncomingMessageLogger('Message has an invalid origin of %s', messageOrigin);
7229
7299
  return false;
7230
7300
  }
7231
7301
  const isOriginValid = yield validateOrigin(messageOriginURL);
7232
7302
  if (!isOriginValid) {
7233
- shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
7303
+ shouldProcessIncomingMessageLogger('Message has an invalid origin of %s', messageOrigin);
7234
7304
  }
7235
7305
  return isOriginValid;
7236
7306
  }
@@ -7268,14 +7338,13 @@ function updateRelationships(messageSource, messageOrigin) {
7268
7338
  flushMessageQueue(Communication.parentWindow);
7269
7339
  flushMessageQueue(Communication.childWindow);
7270
7340
  }
7271
- const handleParentMessageLogger = communicationLogger.extend('handleParentMessage');
7341
+ const handleIncomingMessageFromParentLogger = communicationLogger.extend('handleIncomingMessageFromParent');
7272
7342
  /**
7273
7343
  * @internal
7274
7344
  * Limited to Microsoft-internal use
7275
7345
  */
7276
7346
  function retrieveMessageUUIDFromResponse(response) {
7277
- var _a;
7278
- const logger = handleParentMessageLogger;
7347
+ const logger = handleIncomingMessageFromParentLogger;
7279
7348
  if (response.uuid) {
7280
7349
  const responseUUID = response.uuid;
7281
7350
  const callbackUUID = retrieveMessageUUIDFromCallback(CommunicationPrivate.callbacks, responseUUID);
@@ -7294,7 +7363,7 @@ function retrieveMessageUUIDFromResponse(response) {
7294
7363
  else {
7295
7364
  return CommunicationPrivate.legacyMessageIdsToUuidMap[response.id];
7296
7365
  }
7297
- logger(`Received a message with uuid: ${(_a = response.uuid) === null || _a === void 0 ? void 0 : _a.toString()} and legacyId: %i that failed to produce a callbackId`, response.id);
7366
+ logger('Received message %s that failed to produce a callbackId', getMessageIdsAsLogString(response));
7298
7367
  return undefined;
7299
7368
  }
7300
7369
  /**
@@ -7303,7 +7372,7 @@ function retrieveMessageUUIDFromResponse(response) {
7303
7372
  *
7304
7373
  * This function is used to compare a new MessageUUID object value to the key values in the specified callback and retrieving that key
7305
7374
  * We use this because two objects with the same value are not considered equivalent therefore we can't use the new MessageUUID object
7306
- * as a key to retrieve the value assosciated with it and should use this function instead.
7375
+ * as a key to retrieve the value associated with it and should use this function instead.
7307
7376
  */
7308
7377
  function retrieveMessageUUIDFromCallback(map, responseUUID) {
7309
7378
  if (responseUUID) {
@@ -7337,8 +7406,8 @@ function removeMessageHandlers(message, map) {
7337
7406
  * @internal
7338
7407
  * Limited to Microsoft-internal use
7339
7408
  */
7340
- function handleParentMessage(evt) {
7341
- const logger = handleParentMessageLogger;
7409
+ function handleIncomingMessageFromParent(evt) {
7410
+ const logger = handleIncomingMessageFromParentLogger;
7342
7411
  if ('id' in evt.data && typeof evt.data.id === 'number') {
7343
7412
  // Call any associated Communication.callbacks
7344
7413
  const serializedResponse = evt.data;
@@ -7346,34 +7415,34 @@ function handleParentMessage(evt) {
7346
7415
  const callbackId = retrieveMessageUUIDFromResponse(message);
7347
7416
  if (callbackId) {
7348
7417
  const callback = CommunicationPrivate.callbacks.get(callbackId);
7349
- logger('Received a response from parent for message %i', callbackId);
7418
+ logger('Received a response from parent for message %s', callbackId.toString());
7350
7419
  if (callback) {
7351
- logger('Invoking the registered callback for message %i with arguments %o', callbackId, message.args);
7420
+ logger('Invoking the registered callback for message %s with arguments %o', callbackId.toString(), message.args);
7352
7421
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7353
7422
  // @ts-ignore
7354
7423
  callback.apply(null, [...message.args, message.isPartialResponse]);
7355
7424
  // Remove the callback to ensure that the callback is called only once and to free up memory if response is a complete response
7356
7425
  if (!isPartialResponse(evt)) {
7357
- logger('Removing registered callback for message %i', callbackId);
7426
+ logger('Removing registered callback for message %s', callbackId.toString());
7358
7427
  removeMessageHandlers(message, CommunicationPrivate.callbacks);
7359
7428
  }
7360
7429
  }
7361
7430
  const promiseCallback = CommunicationPrivate.promiseCallbacks.get(callbackId);
7362
7431
  if (promiseCallback) {
7363
- logger('Invoking the registered promise callback for message %i with arguments %o', callbackId, message.args);
7432
+ logger('Invoking the registered promise callback for message %s with arguments %o', callbackId.toString(), message.args);
7364
7433
  promiseCallback(message.args);
7365
- logger('Removing registered promise callback for message %i', callbackId);
7434
+ logger('Removing registered promise callback for message %s', callbackId.toString());
7366
7435
  removeMessageHandlers(message, CommunicationPrivate.promiseCallbacks);
7367
7436
  }
7368
7437
  const portCallback = CommunicationPrivate.portCallbacks.get(callbackId);
7369
7438
  if (portCallback) {
7370
- logger('Invoking the registered port callback for message %i with arguments %o', callbackId, message.args);
7439
+ logger('Invoking the registered port callback for message %s with arguments %o', callbackId.toString(), message.args);
7371
7440
  let port;
7372
7441
  if (evt.ports && evt.ports[0] instanceof MessagePort) {
7373
7442
  port = evt.ports[0];
7374
7443
  }
7375
7444
  portCallback(port, message.args);
7376
- logger('Removing registered port callback for message %i', callbackId);
7445
+ logger('Removing registered port callback for message %s', callbackId.toString());
7377
7446
  removeMessageHandlers(message, CommunicationPrivate.portCallbacks);
7378
7447
  }
7379
7448
  if (message.uuid) {
@@ -7384,7 +7453,7 @@ function handleParentMessage(evt) {
7384
7453
  else if ('func' in evt.data && typeof evt.data.func === 'string') {
7385
7454
  // Delegate the request to the proper handler
7386
7455
  const message = evt.data;
7387
- logger('Received an action message %s from parent', message.func);
7456
+ logger('Received a message from parent %s, action: "%s"', getMessageIdsAsLogString(message), message.func);
7388
7457
  callHandler(message.func, message.args);
7389
7458
  }
7390
7459
  else {
@@ -7398,25 +7467,29 @@ function handleParentMessage(evt) {
7398
7467
  function isPartialResponse(evt) {
7399
7468
  return evt.data.isPartialResponse === true;
7400
7469
  }
7470
+ const handleIncomingMessageFromChildLogger = communicationLogger.extend('handleIncomingMessageFromChild');
7401
7471
  /**
7402
7472
  * @internal
7403
7473
  * Limited to Microsoft-internal use
7404
7474
  */
7405
- function handleChildMessage(evt) {
7475
+ function handleIncomingMessageFromChild(evt) {
7406
7476
  if ('id' in evt.data && 'func' in evt.data) {
7407
7477
  // Try to delegate the request to the proper handler, if defined
7408
7478
  const message = deserializeMessageRequest(evt.data);
7409
7479
  const [called, result] = callHandler(message.func, message.args);
7410
7480
  if (called && typeof result !== 'undefined') {
7481
+ handleIncomingMessageFromChildLogger('Returning message %s from child back to child, action: %s.', getMessageIdsAsLogString(message), message.func);
7411
7482
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7412
7483
  // @ts-ignore
7413
7484
  sendMessageResponseToChild(message.id, message.uuid, Array.isArray(result) ? result : [result]);
7414
7485
  }
7415
7486
  else {
7416
7487
  // No handler, proxy to parent
7488
+ handleIncomingMessageFromChildLogger('Relaying message %s from child to parent, action: %s. Relayed message will have a new id.', getMessageIdsAsLogString(message), message.func);
7417
7489
  sendMessageToParent(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "tasks.startTask" /* ApiName.Tasks_StartTask */), message.func, message.args, (...args) => {
7418
7490
  if (Communication.childWindow) {
7419
7491
  const isPartialResponse = args.pop();
7492
+ handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
7420
7493
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7421
7494
  // @ts-ignore
7422
7495
  sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
@@ -7504,7 +7577,7 @@ function flushMessageQueue(targetWindow) {
7504
7577
  if (messageRequest) {
7505
7578
  const request = serializeMessageRequest(messageRequest);
7506
7579
  /* eslint-disable-next-line strict-null-checks/all */ /* Fix tracked by 5730662 */
7507
- flushMessageQueueLogger('Flushing message %i from ' + target + ' message queue via postMessage.', request === null || request === void 0 ? void 0 : request.uuidAsString);
7580
+ flushMessageQueueLogger('Flushing message %s from %s message queue via postMessage.', getMessageIdsAsLogString(request), target);
7508
7581
  targetWindow.postMessage(request, targetOrigin);
7509
7582
  }
7510
7583
  }
@@ -7631,6 +7704,17 @@ function createMessageEvent(func, args) {
7631
7704
  args: args || [],
7632
7705
  };
7633
7706
  }
7707
+ function getMessageIdsAsLogString(message) {
7708
+ if ('uuidAsString' in message) {
7709
+ return `${message.uuidAsString} (legacy id: ${message.id})`;
7710
+ }
7711
+ else if ('uuid' in message && message.uuid !== undefined) {
7712
+ return `${message.uuid.toString()} (legacy id: ${message.id})`;
7713
+ }
7714
+ else {
7715
+ return `legacy id: ${message.id} (no uuid)`;
7716
+ }
7717
+ }
7634
7718
 
7635
7719
  ;// CONCATENATED MODULE: ./src/private/logs.ts
7636
7720
 
@@ -7745,6 +7829,36 @@ var UserSettingTypes;
7745
7829
  */
7746
7830
  UserSettingTypes["theme"] = "theme";
7747
7831
  })(UserSettingTypes || (UserSettingTypes = {}));
7832
+ /**
7833
+ * @beta
7834
+ * @hidden
7835
+ * The types for ActionOpenUrl
7836
+ *
7837
+ * @internal
7838
+ * Limited to Microsoft-internal use
7839
+ */
7840
+ var ActionOpenUrlType;
7841
+ (function (ActionOpenUrlType) {
7842
+ ActionOpenUrlType["DeepLinkDialog"] = "DeepLinkDialog";
7843
+ ActionOpenUrlType["DeepLinkOther"] = "DeepLinkOther";
7844
+ ActionOpenUrlType["DeepLinkStageView"] = "DeepLinkStageView";
7845
+ ActionOpenUrlType["GenericUrl"] = "GenericUrl";
7846
+ })(ActionOpenUrlType || (ActionOpenUrlType = {}));
7847
+ /**
7848
+ * @beta
7849
+ * @hidden
7850
+ * Error codes that can be thrown from IExternalAppCardActionService.handleActionOpenUrl
7851
+ * and IExternalAppCardActionForCEAService.handleActionOpenUrl
7852
+ *
7853
+ * @internal
7854
+ * Limited to Microsoft-internal use
7855
+ */
7856
+ var ActionOpenUrlErrorCode;
7857
+ (function (ActionOpenUrlErrorCode) {
7858
+ ActionOpenUrlErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
7859
+ ActionOpenUrlErrorCode["INVALID_LINK"] = "INVALID_LINK";
7860
+ ActionOpenUrlErrorCode["NOT_SUPPORTED"] = "NOT_SUPPORTED";
7861
+ })(ActionOpenUrlErrorCode || (ActionOpenUrlErrorCode = {}));
7748
7862
 
7749
7863
  ;// CONCATENATED MODULE: ./src/private/privateAPIs.ts
7750
7864
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -8061,6 +8175,7 @@ var copilot;
8061
8175
 
8062
8176
 
8063
8177
 
8178
+
8064
8179
  /**
8065
8180
  * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
8066
8181
  */
@@ -8162,11 +8277,11 @@ var externalAppAuthentication;
8162
8277
  if (!isSupported()) {
8163
8278
  throw errorNotSupportedOnPlatform;
8164
8279
  }
8165
- validateId(appId, new Error('App id is not valid.'));
8280
+ const typeSafeAppId = new AppId(appId);
8166
8281
  validateOriginalRequestInfo(originalRequestInfo);
8167
8282
  // Ask the parent window to open an authentication window with the parameters provided by the caller.
8168
8283
  return sendMessageToParentAsync(getApiVersionTag(externalAppAuthenticationTelemetryVersionNumber, "externalAppAuthentication.authenticateAndResendRequest" /* ApiName.ExternalAppAuthentication_AuthenticateAndResendRequest */), 'externalAppAuthentication.authenticateAndResendRequest', [
8169
- appId,
8284
+ typeSafeAppId.toString(),
8170
8285
  originalRequestInfo,
8171
8286
  authenticateParameters.url.href,
8172
8287
  authenticateParameters.width,
@@ -8198,8 +8313,8 @@ var externalAppAuthentication;
8198
8313
  if (!isSupported()) {
8199
8314
  throw errorNotSupportedOnPlatform;
8200
8315
  }
8201
- validateId(appId, new Error('App id is not valid.'));
8202
- return sendMessageToParentAsync(getApiVersionTag(externalAppAuthenticationTelemetryVersionNumber, "externalAppAuthentication.authenticateWithSSO" /* ApiName.ExternalAppAuthentication_AuthenticateWithSSO */), 'externalAppAuthentication.authenticateWithSSO', [appId, authTokenRequest.claims, authTokenRequest.silent]).then(([wasSuccessful, error]) => {
8316
+ const typeSafeAppId = new AppId(appId);
8317
+ return sendMessageToParentAsync(getApiVersionTag(externalAppAuthenticationTelemetryVersionNumber, "externalAppAuthentication.authenticateWithSSO" /* ApiName.ExternalAppAuthentication_AuthenticateWithSSO */), 'externalAppAuthentication.authenticateWithSSO', [typeSafeAppId.toString(), authTokenRequest.claims, authTokenRequest.silent]).then(([wasSuccessful, error]) => {
8203
8318
  if (!wasSuccessful) {
8204
8319
  throw error;
8205
8320
  }
@@ -8222,9 +8337,9 @@ var externalAppAuthentication;
8222
8337
  if (!isSupported()) {
8223
8338
  throw errorNotSupportedOnPlatform;
8224
8339
  }
8225
- validateId(appId, new Error('App id is not valid.'));
8340
+ const typeSafeAppId = new AppId(appId);
8226
8341
  validateOriginalRequestInfo(originalRequestInfo);
8227
- return sendMessageToParentAsync(getApiVersionTag(externalAppAuthenticationTelemetryVersionNumber, "externalAppAuthentication.authenticateWithSSOAndResendRequest" /* ApiName.ExternalAppAuthentication_AuthenticateWithSSOAndResendRequest */), 'externalAppAuthentication.authenticateWithSSOAndResendRequest', [appId, originalRequestInfo, authTokenRequest.claims, authTokenRequest.silent]).then(([wasSuccessful, response]) => {
8342
+ return sendMessageToParentAsync(getApiVersionTag(externalAppAuthenticationTelemetryVersionNumber, "externalAppAuthentication.authenticateWithSSOAndResendRequest" /* ApiName.ExternalAppAuthentication_AuthenticateWithSSOAndResendRequest */), 'externalAppAuthentication.authenticateWithSSOAndResendRequest', [typeSafeAppId.toString(), originalRequestInfo, authTokenRequest.claims, authTokenRequest.silent]).then(([wasSuccessful, response]) => {
8228
8343
  if (wasSuccessful && response.responseType != null) {
8229
8344
  return response;
8230
8345
  }
@@ -8347,18 +8462,6 @@ var externalAppCardActions;
8347
8462
  ActionOpenUrlType["DeepLinkStageView"] = "DeepLinkStageView";
8348
8463
  ActionOpenUrlType["GenericUrl"] = "GenericUrl";
8349
8464
  })(ActionOpenUrlType = externalAppCardActions.ActionOpenUrlType || (externalAppCardActions.ActionOpenUrlType = {}));
8350
- /**
8351
- * @hidden
8352
- * Error codes that can be thrown from IExternalAppCardActionService.handleActionOpenUrl
8353
- * @internal
8354
- * Limited to Microsoft-internal use
8355
- */
8356
- let ActionOpenUrlErrorCode;
8357
- (function (ActionOpenUrlErrorCode) {
8358
- ActionOpenUrlErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
8359
- ActionOpenUrlErrorCode["INVALID_LINK"] = "INVALID_LINK";
8360
- ActionOpenUrlErrorCode["NOT_SUPPORTED"] = "NOT_SUPPORTED";
8361
- })(ActionOpenUrlErrorCode = externalAppCardActions.ActionOpenUrlErrorCode || (externalAppCardActions.ActionOpenUrlErrorCode = {}));
8362
8465
  /**
8363
8466
  * @beta
8364
8467
  * @hidden
@@ -8375,8 +8478,8 @@ var externalAppCardActions;
8375
8478
  if (!isSupported()) {
8376
8479
  throw errorNotSupportedOnPlatform;
8377
8480
  }
8378
- validateId(appId, new Error('App id is not valid.'));
8379
- return sendMessageToParentAsync(getApiVersionTag(externalAppCardActionsTelemetryVersionNumber, "externalAppCardActions.processActionSubmit" /* ApiName.ExternalAppCardActions_ProcessActionSubmit */), 'externalAppCardActions.processActionSubmit', [appId, actionSubmitPayload]).then(([wasSuccessful, error]) => {
8481
+ const typeSafeAppId = new AppId(appId);
8482
+ return sendMessageToParentAsync(getApiVersionTag(externalAppCardActionsTelemetryVersionNumber, "externalAppCardActions.processActionSubmit" /* ApiName.ExternalAppCardActions_ProcessActionSubmit */), 'externalAppCardActions.processActionSubmit', [typeSafeAppId.toString(), actionSubmitPayload]).then(([wasSuccessful, error]) => {
8380
8483
  if (!wasSuccessful) {
8381
8484
  throw error;
8382
8485
  }
@@ -8401,8 +8504,8 @@ var externalAppCardActions;
8401
8504
  if (!isSupported()) {
8402
8505
  throw errorNotSupportedOnPlatform;
8403
8506
  }
8404
- validateId(appId, new Error('App id is not valid.'));
8405
- return sendMessageToParentAsync(getApiVersionTag(externalAppCardActionsTelemetryVersionNumber, "externalAppCardActions.processActionOpenUrl" /* ApiName.ExternalAppCardActions_ProcessActionOpenUrl */), 'externalAppCardActions.processActionOpenUrl', [appId, url.href, fromElement]).then(([error, response]) => {
8507
+ const typeSafeAppId = new AppId(appId);
8508
+ return sendMessageToParentAsync(getApiVersionTag(externalAppCardActionsTelemetryVersionNumber, "externalAppCardActions.processActionOpenUrl" /* ApiName.ExternalAppCardActions_ProcessActionOpenUrl */), 'externalAppCardActions.processActionOpenUrl', [typeSafeAppId.toString(), url.href, fromElement]).then(([error, response]) => {
8406
8509
  if (error) {
8407
8510
  throw error;
8408
8511
  }
@@ -8411,10 +8514,111 @@ var externalAppCardActions;
8411
8514
  }
8412
8515
  });
8413
8516
  }
8414
- externalAppCardActions.processActionOpenUrl = processActionOpenUrl;
8517
+ externalAppCardActions.processActionOpenUrl = processActionOpenUrl;
8518
+ /**
8519
+ * @hidden
8520
+ * Checks if the externalAppCardActions capability is supported by the host
8521
+ * @returns boolean to represent whether externalAppCardActions capability is supported
8522
+ *
8523
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
8524
+ *
8525
+ * @internal
8526
+ * Limited to Microsoft-internal use
8527
+ */
8528
+ function isSupported() {
8529
+ return ensureInitialized(runtime) && runtime.supports.externalAppCardActions ? true : false;
8530
+ }
8531
+ externalAppCardActions.isSupported = isSupported;
8532
+ })(externalAppCardActions || (externalAppCardActions = {}));
8533
+
8534
+ ;// CONCATENATED MODULE: ./src/private/externalAppCardActionsForCEA.ts
8535
+ var externalAppCardActionsForCEA_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
8536
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8537
+ return new (P || (P = Promise))(function (resolve, reject) {
8538
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8539
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8540
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8541
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8542
+ });
8543
+ };
8544
+
8545
+
8546
+
8547
+
8548
+
8549
+
8550
+ /**
8551
+ * All of APIs in this capability file should send out API version v2 ONLY
8552
+ */
8553
+ const externalAppCardActionsForCEA_externalAppCardActionsTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
8554
+ /**
8555
+ * @beta
8556
+ * @hidden
8557
+ * Namespace to delegate adaptive card action for Custom Engine Agent execution to the host
8558
+ * @internal
8559
+ * Limited to Microsoft-internal use
8560
+ */
8561
+ var externalAppCardActionsForCEA;
8562
+ (function (externalAppCardActionsForCEA) {
8563
+ /**
8564
+ * @beta
8565
+ * @hidden
8566
+ * Delegates an Adaptive Card Action.OpenUrl request to the host for the application with the provided app ID.
8567
+ * @internal
8568
+ * Limited to Microsoft-internal use
8569
+ * @param appId ID of the application the request is intended for. This must be a UUID
8570
+ * @param conversationId To tell the bot what conversation the calls are coming from
8571
+ * @param url The URL to open
8572
+ * @throws Error if the response has not successfully completed
8573
+ * @returns Promise that resolves to ActionOpenUrlType indicating the type of URL that was opened on success and rejects with ActionOpenUrlError if the request fails
8574
+ */
8575
+ function processActionOpenUrl(appId, conversationId, url) {
8576
+ return externalAppCardActionsForCEA_awaiter(this, void 0, void 0, function* () {
8577
+ ensureInitialized(runtime, FrameContexts.content);
8578
+ if (!isSupported()) {
8579
+ throw errorNotSupportedOnPlatform;
8580
+ }
8581
+ validateId(conversationId, new Error('conversation id is not valid.'));
8582
+ const [error, response] = yield sendMessageToParentAsync(getApiVersionTag(externalAppCardActionsForCEA_externalAppCardActionsTelemetryVersionNumber, "externalAppCardActionsForCEA.processActionOpenUrl" /* ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl */), "externalAppCardActionsForCEA.processActionOpenUrl" /* ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl */, [appId, url.href, conversationId]);
8583
+ if (error) {
8584
+ throw error;
8585
+ }
8586
+ else {
8587
+ return response;
8588
+ }
8589
+ });
8590
+ }
8591
+ externalAppCardActionsForCEA.processActionOpenUrl = processActionOpenUrl;
8592
+ /**
8593
+ * @beta
8594
+ * @hidden
8595
+ * Delegates an Adaptive Card Action.Submit request to the host for the application with the provided app ID
8596
+ * @internal
8597
+ * Limited to Microsoft-internal use
8598
+ * @param appId ID of the application the request is intended for. This must be a UUID
8599
+ * @param conversationId To tell the bot what conversation the calls are coming from
8600
+ * @param actionSubmitPayload The Adaptive Card Action.Submit payload
8601
+ * @throws Error if host notifies of an error
8602
+ * @returns Promise that resolves when the request is completed and rejects with ActionSubmitError if the request fails
8603
+ */
8604
+ function processActionSubmit(appId, conversationId, actionSubmitPayload) {
8605
+ return externalAppCardActionsForCEA_awaiter(this, void 0, void 0, function* () {
8606
+ ensureInitialized(runtime, FrameContexts.content);
8607
+ if (!isSupported()) {
8608
+ throw errorNotSupportedOnPlatform;
8609
+ }
8610
+ validateId(conversationId, new Error('conversation id is not valid.'));
8611
+ const error = yield sendAndUnwrap(getApiVersionTag(externalAppCardActionsForCEA_externalAppCardActionsTelemetryVersionNumber, "externalAppCardActionsForCEA.processActionSubmit" /* ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit */), "externalAppCardActionsForCEA.processActionSubmit" /* ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit */, [appId, conversationId, actionSubmitPayload]);
8612
+ if (error) {
8613
+ throw error;
8614
+ }
8615
+ });
8616
+ }
8617
+ externalAppCardActionsForCEA.processActionSubmit = processActionSubmit;
8415
8618
  /**
8619
+ * @beta
8416
8620
  * @hidden
8417
- * Checks if the externalAppCardActions capability is supported by the host
8621
+ * Checks if the externalAppCardActionsForCEA capability is supported by the host
8418
8622
  * @returns boolean to represent whether externalAppCardActions capability is supported
8419
8623
  *
8420
8624
  * @throws Error if {@linkcode app.initialize} has not successfully completed
@@ -8423,10 +8627,10 @@ var externalAppCardActions;
8423
8627
  * Limited to Microsoft-internal use
8424
8628
  */
8425
8629
  function isSupported() {
8426
- return ensureInitialized(runtime) && runtime.supports.externalAppCardActions ? true : false;
8630
+ return ensureInitialized(runtime) && runtime.supports.externalAppCardActionsForCEA ? true : false;
8427
8631
  }
8428
- externalAppCardActions.isSupported = isSupported;
8429
- })(externalAppCardActions || (externalAppCardActions = {}));
8632
+ externalAppCardActionsForCEA.isSupported = isSupported;
8633
+ })(externalAppCardActionsForCEA || (externalAppCardActionsForCEA = {}));
8430
8634
 
8431
8635
  ;// CONCATENATED MODULE: ./src/private/externalAppCommands.ts
8432
8636
  var externalAppCommands_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -8478,8 +8682,8 @@ var externalAppCommands;
8478
8682
  if (!isSupported()) {
8479
8683
  throw errorNotSupportedOnPlatform;
8480
8684
  }
8481
- validateId(appId, new Error('App id is not valid.'));
8482
- const [error, response] = yield sendMessageToParentAsync(getApiVersionTag(externalAppCommandsTelemetryVersionNumber, "externalAppCommands.processActionCommand" /* ApiName.ExternalAppCommands_ProcessActionCommands */), "externalAppCommands.processActionCommand" /* ApiName.ExternalAppCommands_ProcessActionCommands */, [appId, commandId, extractedParameters]);
8685
+ const typeSafeAppId = new AppId(appId);
8686
+ const [error, response] = yield sendMessageToParentAsync(getApiVersionTag(externalAppCommandsTelemetryVersionNumber, "externalAppCommands.processActionCommand" /* ApiName.ExternalAppCommands_ProcessActionCommands */), "externalAppCommands.processActionCommand" /* ApiName.ExternalAppCommands_ProcessActionCommands */, [typeSafeAppId.toString(), commandId, extractedParameters]);
8483
8687
  if (error) {
8484
8688
  throw error;
8485
8689
  }
@@ -11031,75 +11235,288 @@ var videoEffectsEx;
11031
11235
  videoEffectsEx.notifyFatalError = notifyFatalError;
11032
11236
  })(videoEffectsEx || (videoEffectsEx = {}));
11033
11237
 
11034
- ;// CONCATENATED MODULE: ./src/internal/appIdValidation.ts
11238
+ ;// CONCATENATED MODULE: ./src/private/hostEntity.ts
11239
+
11240
+
11241
+
11242
+
11243
+
11244
+
11035
11245
  /**
11036
- * This function can be used to validate if a string is a "valid" app id.
11037
- * Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema:
11038
- * https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id
11039
- * However, there are some older internal/hard-coded apps which violate this schema and use names like com.microsoft.teamspace.tab.youtube.
11040
- * For compatibility with these legacy apps, we unfortunately cannot securely and completely validate app ids as UUIDs. Based
11041
- * on this, the validation is limited to checking for script tags, length, and non-printable characters.
11042
- *
11043
- * @param potentialAppId A string to check if it's a "valid" app id
11044
- * @throws Error with a message describing the exact validation violation
11246
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
11045
11247
  */
11046
- function validateStringAsAppId(potentialAppId) {
11047
- if (doesStringContainScriptTags(potentialAppId)) {
11048
- throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains script tags.`);
11049
- }
11050
- if (!isStringWithinAppIdLengthLimits(potentialAppId)) {
11051
- throw new Error(`Potential app id (${potentialAppId}) is invalid; its length ${potentialAppId.length} is not within the length limits (${minimumValidAppIdLength}-${maximumValidAppIdLength}).`);
11052
- }
11053
- if (doesStringContainNonPrintableCharacters(potentialAppId)) {
11054
- throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains non-printable characters.`);
11055
- }
11056
- }
11057
- function doesStringContainScriptTags(str) {
11058
- const scriptRegex = /<script[^>]*>[\s\S]*?<\/script[^>]*>/gi;
11059
- return scriptRegex.test(str);
11060
- }
11061
- const minimumValidAppIdLength = 4;
11062
- const maximumValidAppIdLength = 256;
11063
- function isStringWithinAppIdLengthLimits(potentialAppId) {
11064
- return potentialAppId.length < maximumValidAppIdLength && potentialAppId.length > minimumValidAppIdLength;
11065
- }
11066
- function doesStringContainNonPrintableCharacters(str) {
11067
- return [...str].some((char) => {
11068
- const charCode = char.charCodeAt(0);
11069
- return charCode < 32 || charCode > 126;
11070
- });
11071
- }
11072
-
11073
- ;// CONCATENATED MODULE: ./src/public/appId.ts
11074
-
11248
+ const hostEntityTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
11075
11249
  /**
11076
- * A strongly-typed class used to represent a "valid" app id.
11250
+ * @hidden
11251
+ * @internal
11252
+ * @beta
11253
+ * Limited to Microsoft-internal use
11077
11254
  *
11078
- * Valid is a relative term, in this case. Truly valid app ids are UUIDs as documented in the schema:
11079
- * https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#id
11080
- * However, there are some older internal/hard-coded apps which violate this schema and use names like
11081
- * com.microsoft.teamspace.tab.youtube. For compatibility with these legacy apps, we unfortunately cannot
11082
- * securely and completely validate app ids as UUIDs. Based on this, the validation is limited to checking
11083
- * for script tags, length, and non-printable characters.
11255
+ * This capability allows an app to associate apps with a host entity, such as a Teams channel or chat, and configure them as needed.
11084
11256
  */
11085
- class AppId {
11257
+ var hostEntity;
11258
+ (function (hostEntity) {
11259
+ let AppTypes;
11260
+ (function (AppTypes) {
11261
+ AppTypes["edu"] = "EDU";
11262
+ })(AppTypes = hostEntity.AppTypes || (hostEntity.AppTypes = {}));
11263
+ /**
11264
+ * @hidden
11265
+ * @internal
11266
+ * @beta
11267
+ * Limited to Microsoft-internal use
11268
+ *
11269
+ * CRUD operations for tabs associated with apps
11270
+ */
11271
+ let tab;
11272
+ (function (tab_1) {
11273
+ /**
11274
+ * @hidden
11275
+ * @internal
11276
+ * @beta
11277
+ * Limited to Microsoft-internal use
11278
+ *
11279
+ * Launches host-owned UI that lets a user select an app, installs it if required,
11280
+ * runs through app configuration if required, and then associates the app with the threadId provided
11281
+ *
11282
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
11283
+ *
11284
+ * @param appTypes What type of applications to show the user. If EDU is passed as appType, only apps supported by EDU tenant are shown.
11285
+ * If no value is passed, all apps are shown.
11286
+ *
11287
+ * @returns The HostEntityTabInstance of the newly associated app
11288
+ *
11289
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation or installing
11290
+ * or configuring or adding tab fails
11291
+ */
11292
+ function addAndConfigure(hostEntityIds, appTypes) {
11293
+ ensureInitialized(runtime);
11294
+ if (!isSupported()) {
11295
+ throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
11296
+ }
11297
+ validateThreadId(hostEntityIds.threadId);
11298
+ if (appTypes && appTypes.length === 0) {
11299
+ throw new Error(`Error code: ${ErrorCode.INVALID_ARGUMENTS}, message: App types cannot be an empty array`);
11300
+ }
11301
+ return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.addAndConfigure" /* ApiName.HostEntity_Tab_addAndConfigureApp */), 'hostEntity.tab.addAndConfigure', [hostEntityIds, appTypes]).then(([response]) => {
11302
+ var _a;
11303
+ if (isSdkError(response)) {
11304
+ throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
11305
+ }
11306
+ return response;
11307
+ });
11308
+ }
11309
+ tab_1.addAndConfigure = addAndConfigure;
11310
+ /**
11311
+ * @hidden
11312
+ * @internal
11313
+ * @beta
11314
+ * Limited to Microsoft-internal use
11315
+ *
11316
+ * Returns all tab instances associated with a host entity
11317
+ *
11318
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
11319
+ *
11320
+ * @returns Object with array of HostEntityTabInstance's associated with a host entity
11321
+ *
11322
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid or fetching tabs fails
11323
+ */
11324
+ function getAll(hostEntityIds) {
11325
+ ensureInitialized(runtime);
11326
+ if (!isSupported()) {
11327
+ throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
11328
+ }
11329
+ validateThreadId(hostEntityIds.threadId);
11330
+ return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.getAll" /* ApiName.HostEntity_Tab_getAll */), 'hostEntity.tab.getAll', [hostEntityIds]).then(([response]) => {
11331
+ var _a;
11332
+ if (isSdkError(response)) {
11333
+ throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
11334
+ }
11335
+ return response;
11336
+ });
11337
+ }
11338
+ tab_1.getAll = getAll;
11339
+ /**
11340
+ * @hidden
11341
+ * @internal
11342
+ * @beta
11343
+ * Limited to Microsoft-internal use
11344
+ *
11345
+ * Launches host-owned UI that lets a user re-configure the contentUrl of the tab
11346
+ *
11347
+ * @param tab Configurable tab instance that needs to be updated
11348
+ *
11349
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
11350
+ *
11351
+ * @returns The HostEntityTabInstance of the updated tab
11352
+ *
11353
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation,
11354
+ * re-configuring tab fails or if tab is a static tab
11355
+ */
11356
+ function reconfigure(tab, hostEntityIds) {
11357
+ ensureInitialized(runtime);
11358
+ if (!isSupported()) {
11359
+ throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
11360
+ }
11361
+ validateTab(tab);
11362
+ validateThreadId(hostEntityIds.threadId);
11363
+ return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.reconfigure" /* ApiName.HostEntity_Tab_reconfigure */), 'hostEntity.tab.reconfigure', [tab, hostEntityIds]).then(([response]) => {
11364
+ var _a;
11365
+ if (isSdkError(response)) {
11366
+ throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
11367
+ }
11368
+ return response;
11369
+ });
11370
+ }
11371
+ tab_1.reconfigure = reconfigure;
11372
+ /**
11373
+ * @hidden
11374
+ * @internal
11375
+ * @beta
11376
+ * Limited to Microsoft-internal use
11377
+ *
11378
+ * Launches host-owned UI that lets a user rename the tab
11379
+ *
11380
+ * @param tab Configurable tab instance that needs to be updated
11381
+ *
11382
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
11383
+ *
11384
+ * @returns The HostEntityTabInstance of the updated tab
11385
+ *
11386
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation,
11387
+ * re-naming tab fails or if tab is a static tab
11388
+ */
11389
+ function rename(tab, hostEntityIds) {
11390
+ ensureInitialized(runtime);
11391
+ if (!isSupported()) {
11392
+ throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
11393
+ }
11394
+ validateTab(tab);
11395
+ validateThreadId(hostEntityIds.threadId);
11396
+ return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.rename" /* ApiName.HostEntity_Tab_rename */), 'hostEntity.tab.rename', [tab, hostEntityIds]).then(([response]) => {
11397
+ var _a;
11398
+ if (isSdkError(response)) {
11399
+ throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
11400
+ }
11401
+ return response;
11402
+ });
11403
+ }
11404
+ tab_1.rename = rename;
11405
+ /**
11406
+ * @hidden
11407
+ * @internal
11408
+ * @beta
11409
+ * Limited to Microsoft-internal use
11410
+ *
11411
+ * Launches host-owned UI that lets a user remove the tab
11412
+ *
11413
+ * @param tab tab instance that needs to be updated. Can be static tab or configurable tab.
11414
+ *
11415
+ * @param hostEntityIds Ids of the host entity like channel, chat or meeting
11416
+ *
11417
+ * @returns Boolean. Returns true if removing tab was successful
11418
+ *
11419
+ * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation or
11420
+ * removing tab fails
11421
+ */
11422
+ function remove(tab, hostEntityIds) {
11423
+ ensureInitialized(runtime);
11424
+ if (!isSupported()) {
11425
+ throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
11426
+ }
11427
+ validateThreadId(hostEntityIds.threadId);
11428
+ validateTab(tab);
11429
+ return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.remove" /* ApiName.HostEntity_Tab_remove */), 'hostEntity.tab.remove', [tab, hostEntityIds]).then(([response]) => {
11430
+ var _a;
11431
+ if (isSdkError(response)) {
11432
+ throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
11433
+ }
11434
+ return true;
11435
+ });
11436
+ }
11437
+ tab_1.remove = remove;
11438
+ /**
11439
+ * @hidden
11440
+ * @internal
11441
+ * @beta
11442
+ * Limited to Microsoft-internal use
11443
+ *
11444
+ * Checks if the hostEntity.tab capability is supported by the host
11445
+ * @returns boolean to represent whether the histEntity and hostEntity.tab capability is supported
11446
+ *
11447
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
11448
+ */
11449
+ function isSupported() {
11450
+ var _a;
11451
+ return ensureInitialized(runtime) && hostEntity.isSupported() && ((_a = runtime.supports.hostEntity) === null || _a === void 0 ? void 0 : _a.tab) ? true : false;
11452
+ }
11453
+ tab_1.isSupported = isSupported;
11454
+ /**
11455
+ * @hidden
11456
+ * @internal
11457
+ * @beta
11458
+ * Limited to Microsoft-internal use
11459
+ *
11460
+ * Checks if the threadId is defined
11461
+ * @throws Error if threadId is null, undefined or empty
11462
+ */
11463
+ function validateThreadId(threadId) {
11464
+ if (!threadId || threadId.length == 0) {
11465
+ throw new Error(`Error code: ${ErrorCode.INVALID_ARGUMENTS}, message: ThreadId cannot be null or empty`);
11466
+ }
11467
+ }
11468
+ /**
11469
+ * @hidden
11470
+ * @internal
11471
+ * @beta
11472
+ * Limited to Microsoft-internal use
11473
+ *
11474
+ * Checks if the tabId is defined
11475
+ * @throws Error if tabId is null, undefined or empty
11476
+ */
11477
+ function validateTab(tab) {
11478
+ if (!(tab === null || tab === void 0 ? void 0 : tab.internalTabInstanceId) || tab.internalTabInstanceId.length === 0) {
11479
+ throw new Error(`Error code: ${ErrorCode.INVALID_ARGUMENTS}, message: TabId cannot be null or empty`);
11480
+ }
11481
+ }
11482
+ })(tab = hostEntity.tab || (hostEntity.tab = {}));
11086
11483
  /**
11087
- * Creates a strongly-typed AppId from a string
11484
+ * @hidden
11485
+ * @internal
11486
+ * @beta
11487
+ * Limited to Microsoft-internal use
11088
11488
  *
11089
- * @param appIdAsString An app id represented as a string
11090
- * @throws Error with a message describing the exact validation violation
11091
- */
11092
- constructor(appIdAsString) {
11093
- this.appIdAsString = appIdAsString;
11094
- validateStringAsAppId(appIdAsString);
11095
- }
11096
- /**
11097
- * Returns the app id as a string
11489
+ * Checks if the hostEntity capability is supported by the host
11490
+ * @returns boolean to represent whether the hostEntity capability is supported
11491
+ *
11492
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
11098
11493
  */
11099
- toString() {
11100
- return this.appIdAsString;
11494
+ function isSupported() {
11495
+ return ensureInitialized(runtime) && runtime.supports.hostEntity ? true : false;
11101
11496
  }
11102
- }
11497
+ hostEntity.isSupported = isSupported;
11498
+ })(hostEntity || (hostEntity = {}));
11499
+
11500
+ ;// CONCATENATED MODULE: ./src/private/index.ts
11501
+
11502
+
11503
+
11504
+
11505
+
11506
+
11507
+
11508
+
11509
+
11510
+
11511
+
11512
+
11513
+
11514
+
11515
+
11516
+
11517
+
11518
+
11519
+
11103
11520
 
11104
11521
  ;// CONCATENATED MODULE: ./src/internal/deepLinkConstants.ts
11105
11522
  /**
@@ -15909,284 +16326,53 @@ function marketplaceUtils_validateUuid(id) {
15909
16326
  throw new Error('id must not be empty');
15910
16327
  }
15911
16328
  if (esm_browser_validate(id) === false) {
15912
- throw new Error('id must be a valid UUID');
15913
- }
15914
- }
15915
- /**
15916
- * @hidden
15917
- * Validate the cart item properties are valid
15918
- * @param price The price to be validated
15919
- *
15920
- * @internal
15921
- * Limited to Microsoft-internal use
15922
- */
15923
- function validatePrice(price) {
15924
- if (typeof price !== 'number' || price < 0) {
15925
- throw new Error(`price ${price} must be a number not less than 0`);
15926
- }
15927
- if (parseFloat(price.toFixed(3)) !== price) {
15928
- throw new Error(`price ${price} must have at most 3 decimal places`);
15929
- }
15930
- }
15931
- /**
15932
- * @hidden
15933
- * Validate quantity
15934
- * @param quantity The quantity to be validated
15935
- *
15936
- * @internal
15937
- * Limited to Microsoft-internal use
15938
- */
15939
- function validateQuantity(quantity) {
15940
- if (typeof quantity !== 'number' || quantity <= 0 || parseInt(quantity.toString()) !== quantity) {
15941
- throw new Error(`quantity ${quantity} must be an integer greater than 0`);
15942
- }
15943
- }
15944
- /**
15945
- * @hidden
15946
- * Validate cart status
15947
- * @param cartStatus The cartStatus to be validated
15948
- *
15949
- * @internal
15950
- * Limited to Microsoft-internal use
15951
- */
15952
- function validateCartStatus(cartStatus) {
15953
- if (!Object.values(marketplace.CartStatus).includes(cartStatus)) {
15954
- throw new Error(`cartStatus ${cartStatus} is not valid`);
15955
- }
15956
- }
15957
-
15958
- ;// CONCATENATED MODULE: ./src/public/marketplace.ts
15959
-
15960
-
15961
-
15962
-
15963
-
15964
-
15965
- /**
15966
- * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
15967
- */
15968
- const marketplaceTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
15969
- /**
15970
- * @hidden
15971
- * Namespace for an app to support a checkout flow by interacting with the marketplace cart in the host.
15972
- * @beta
15973
- */
15974
- var marketplace;
15975
- (function (marketplace) {
15976
- /**
15977
- * @hidden
15978
- * the version of the current cart interface
15979
- * which is forced to send to the host in the calls.
15980
- * @internal
15981
- * Limited to Microsoft-internal use
15982
- * @beta
15983
- */
15984
- marketplace.cartVersion = {
15985
- /**
15986
- * @hidden
15987
- * Represents the major version of the current cart interface,
15988
- * it is increased when incompatible interface update happens.
15989
- */
15990
- majorVersion: 1,
15991
- /**
15992
- * @hidden
15993
- * The minor version of the current cart interface, which is compatible
15994
- * with the previous minor version in the same major version.
15995
- */
15996
- minorVersion: 1,
15997
- };
15998
- /**
15999
- * @hidden
16000
- * Represents the persona creating the cart.
16001
- * @beta
16002
- */
16003
- let Intent;
16004
- (function (Intent) {
16005
- /**
16006
- * @hidden
16007
- * The cart is created by admin of an organization in Teams Admin Center.
16008
- */
16009
- Intent["TACAdminUser"] = "TACAdminUser";
16010
- /**
16011
- * @hidden
16012
- * The cart is created by admin of an organization in Teams.
16013
- */
16014
- Intent["TeamsAdminUser"] = "TeamsAdminUser";
16015
- /**
16016
- * @hidden
16017
- * The cart is created by end user of an organization in Teams.
16018
- */
16019
- Intent["TeamsEndUser"] = "TeamsEndUser";
16020
- })(Intent = marketplace.Intent || (marketplace.Intent = {}));
16021
- /**
16022
- * @hidden
16023
- * Represents the status of the cart.
16024
- * @beta
16025
- */
16026
- let CartStatus;
16027
- (function (CartStatus) {
16028
- /**
16029
- * @hidden
16030
- * Cart is created but not checked out yet.
16031
- */
16032
- CartStatus["Open"] = "Open";
16033
- /**
16034
- * @hidden
16035
- * Cart is checked out but not completed yet.
16036
- */
16037
- CartStatus["Processing"] = "Processing";
16038
- /**
16039
- * @hidden
16040
- * Indicate checking out is completed and the host should
16041
- * return a new cart in the next getCart call.
16042
- */
16043
- CartStatus["Processed"] = "Processed";
16044
- /**
16045
- * @hidden
16046
- * Indicate checking out process is manually cancelled by the user
16047
- */
16048
- CartStatus["Closed"] = "Closed";
16049
- /**
16050
- * @hidden
16051
- * Indicate checking out is failed and the host should
16052
- * return a new cart in the next getCart call.
16053
- */
16054
- CartStatus["Error"] = "Error";
16055
- })(CartStatus = marketplace.CartStatus || (marketplace.CartStatus = {}));
16056
- /**
16057
- * @hidden
16058
- * Get the cart object owned by the host to checkout.
16059
- * @returns A promise of the cart object in the cartVersion.
16060
- * @beta
16061
- */
16062
- function getCart() {
16063
- ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16064
- if (!isSupported()) {
16065
- throw errorNotSupportedOnPlatform;
16066
- }
16067
- return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.getCart" /* ApiName.Marketplace_GetCart */), 'marketplace.getCart', marketplace.cartVersion).then(deserializeCart);
16068
- }
16069
- marketplace.getCart = getCart;
16070
- /**
16071
- * @hidden
16072
- * Add or update cart items in the cart owned by the host.
16073
- * @param addOrUpdateCartItemsParams Represents the parameters to update the cart items.
16074
- * @returns A promise of the updated cart object in the cartVersion.
16075
- * @beta
16076
- */
16077
- function addOrUpdateCartItems(addOrUpdateCartItemsParams) {
16078
- ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16079
- if (!isSupported()) {
16080
- throw errorNotSupportedOnPlatform;
16081
- }
16082
- if (!addOrUpdateCartItemsParams) {
16083
- throw new Error('addOrUpdateCartItemsParams must be provided');
16084
- }
16085
- marketplaceUtils_validateUuid(addOrUpdateCartItemsParams === null || addOrUpdateCartItemsParams === void 0 ? void 0 : addOrUpdateCartItemsParams.cartId);
16086
- validateCartItems(addOrUpdateCartItemsParams === null || addOrUpdateCartItemsParams === void 0 ? void 0 : addOrUpdateCartItemsParams.cartItems);
16087
- return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.addOrUpdateCartItems" /* ApiName.Marketplace_AddOrUpdateCartItems */), 'marketplace.addOrUpdateCartItems', Object.assign(Object.assign({}, addOrUpdateCartItemsParams), { cartItems: serializeCartItems(addOrUpdateCartItemsParams.cartItems), cartVersion: marketplace.cartVersion })).then(deserializeCart);
16329
+ throw new Error('id must be a valid UUID');
16088
16330
  }
16089
- marketplace.addOrUpdateCartItems = addOrUpdateCartItems;
16090
- /**
16091
- * @hidden
16092
- * Remove cart items from the cart owned by the host.
16093
- * @param removeCartItemsParams The parameters to remove the cart items.
16094
- * @returns A promise of the updated cart object in the cartVersion.
16095
- * @beta
16096
- */
16097
- function removeCartItems(removeCartItemsParams) {
16098
- ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16099
- if (!isSupported()) {
16100
- throw errorNotSupportedOnPlatform;
16101
- }
16102
- if (!removeCartItemsParams) {
16103
- throw new Error('removeCartItemsParams must be provided');
16104
- }
16105
- marketplaceUtils_validateUuid(removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartId);
16106
- if (!Array.isArray(removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartItemIds) || (removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartItemIds.length) === 0) {
16107
- throw new Error('cartItemIds must be a non-empty array');
16108
- }
16109
- return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.removeCartItems" /* ApiName.Marketplace_RemoveCardItems */), 'marketplace.removeCartItems', Object.assign(Object.assign({}, removeCartItemsParams), { cartVersion: marketplace.cartVersion })).then(deserializeCart);
16331
+ }
16332
+ /**
16333
+ * @hidden
16334
+ * Validate the cart item properties are valid
16335
+ * @param price The price to be validated
16336
+ *
16337
+ * @internal
16338
+ * Limited to Microsoft-internal use
16339
+ */
16340
+ function validatePrice(price) {
16341
+ if (typeof price !== 'number' || price < 0) {
16342
+ throw new Error(`price ${price} must be a number not less than 0`);
16110
16343
  }
16111
- marketplace.removeCartItems = removeCartItems;
16112
- /**
16113
- * @hidden
16114
- * Update cart status in the cart owned by the host.
16115
- * @param updateCartStatusParams The parameters to update the cart status.
16116
- * @returns A promise of the updated cart object in the cartVersion.
16117
- * @beta
16118
- */
16119
- function updateCartStatus(updateCartStatusParams) {
16120
- ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16121
- if (!isSupported()) {
16122
- throw errorNotSupportedOnPlatform;
16123
- }
16124
- if (!updateCartStatusParams) {
16125
- throw new Error('updateCartStatusParams must be provided');
16126
- }
16127
- marketplaceUtils_validateUuid(updateCartStatusParams === null || updateCartStatusParams === void 0 ? void 0 : updateCartStatusParams.cartId);
16128
- validateCartStatus(updateCartStatusParams === null || updateCartStatusParams === void 0 ? void 0 : updateCartStatusParams.cartStatus);
16129
- return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.updateCartStatus" /* ApiName.Marketplace_UpdateCartStatus */), 'marketplace.updateCartStatus', Object.assign(Object.assign({}, updateCartStatusParams), { cartVersion: marketplace.cartVersion })).then(deserializeCart);
16344
+ if (parseFloat(price.toFixed(3)) !== price) {
16345
+ throw new Error(`price ${price} must have at most 3 decimal places`);
16130
16346
  }
16131
- marketplace.updateCartStatus = updateCartStatus;
16132
- /**
16133
- * @hidden
16134
- * Checks if the marketplace capability is supported by the host.
16135
- * @returns Boolean to represent whether the marketplace capability is supported.
16136
- * @throws Error if {@linkcode app.initialize} has not successfully completed.
16137
- * @beta
16138
- */
16139
- function isSupported() {
16140
- return ensureInitialized(runtime) && runtime.supports.marketplace ? true : false;
16347
+ }
16348
+ /**
16349
+ * @hidden
16350
+ * Validate quantity
16351
+ * @param quantity The quantity to be validated
16352
+ *
16353
+ * @internal
16354
+ * Limited to Microsoft-internal use
16355
+ */
16356
+ function validateQuantity(quantity) {
16357
+ if (typeof quantity !== 'number' || quantity <= 0 || parseInt(quantity.toString()) !== quantity) {
16358
+ throw new Error(`quantity ${quantity} must be an integer greater than 0`);
16141
16359
  }
16142
- marketplace.isSupported = isSupported;
16143
- })(marketplace || (marketplace = {}));
16144
-
16145
- ;// CONCATENATED MODULE: ./src/public/index.ts
16146
-
16147
-
16148
-
16149
-
16150
-
16151
-
16152
-
16153
-
16154
-
16155
-
16156
-
16157
-
16158
-
16159
-
16160
-
16161
-
16162
-
16163
-
16164
-
16165
-
16166
-
16167
-
16168
-
16169
-
16170
-
16171
-
16172
-
16173
-
16174
-
16175
-
16176
-
16177
-
16178
-
16179
-
16180
-
16181
-
16182
-
16183
-
16184
-
16185
-
16186
-
16187
-
16360
+ }
16361
+ /**
16362
+ * @hidden
16363
+ * Validate cart status
16364
+ * @param cartStatus The cartStatus to be validated
16365
+ *
16366
+ * @internal
16367
+ * Limited to Microsoft-internal use
16368
+ */
16369
+ function validateCartStatus(cartStatus) {
16370
+ if (!Object.values(marketplace.CartStatus).includes(cartStatus)) {
16371
+ throw new Error(`cartStatus ${cartStatus} is not valid`);
16372
+ }
16373
+ }
16188
16374
 
16189
- ;// CONCATENATED MODULE: ./src/private/hostEntity.ts
16375
+ ;// CONCATENATED MODULE: ./src/public/marketplace.ts
16190
16376
 
16191
16377
 
16192
16378
 
@@ -16196,259 +16382,208 @@ var marketplace;
16196
16382
  /**
16197
16383
  * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
16198
16384
  */
16199
- const hostEntityTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
16385
+ const marketplaceTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
16200
16386
  /**
16201
16387
  * @hidden
16202
- * @internal
16388
+ * Namespace for an app to support a checkout flow by interacting with the marketplace cart in the host.
16203
16389
  * @beta
16204
- * Limited to Microsoft-internal use
16205
- *
16206
- * This capability allows an app to associate apps with a host entity, such as a Teams channel or chat, and configure them as needed.
16207
16390
  */
16208
- var hostEntity;
16209
- (function (hostEntity) {
16210
- let AppTypes;
16211
- (function (AppTypes) {
16212
- AppTypes["edu"] = "EDU";
16213
- })(AppTypes = hostEntity.AppTypes || (hostEntity.AppTypes = {}));
16391
+ var marketplace;
16392
+ (function (marketplace) {
16214
16393
  /**
16215
16394
  * @hidden
16395
+ * the version of the current cart interface
16396
+ * which is forced to send to the host in the calls.
16216
16397
  * @internal
16217
- * @beta
16218
16398
  * Limited to Microsoft-internal use
16219
- *
16220
- * CRUD operations for tabs associated with apps
16399
+ * @beta
16221
16400
  */
16222
- let tab;
16223
- (function (tab_1) {
16401
+ marketplace.cartVersion = {
16224
16402
  /**
16225
16403
  * @hidden
16226
- * @internal
16227
- * @beta
16228
- * Limited to Microsoft-internal use
16229
- *
16230
- * Launches host-owned UI that lets a user select an app, installs it if required,
16231
- * runs through app configuration if required, and then associates the app with the threadId provided
16232
- *
16233
- * @param hostEntityIds Ids of the host entity like channel, chat or meeting
16234
- *
16235
- * @param appTypes What type of applications to show the user. If EDU is passed as appType, only apps supported by EDU tenant are shown.
16236
- * If no value is passed, all apps are shown.
16237
- *
16238
- * @returns The HostEntityTabInstance of the newly associated app
16239
- *
16240
- * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation or installing
16241
- * or configuring or adding tab fails
16404
+ * Represents the major version of the current cart interface,
16405
+ * it is increased when incompatible interface update happens.
16242
16406
  */
16243
- function addAndConfigure(hostEntityIds, appTypes) {
16244
- ensureInitialized(runtime);
16245
- if (!isSupported()) {
16246
- throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
16247
- }
16248
- validateThreadId(hostEntityIds.threadId);
16249
- if (appTypes && appTypes.length === 0) {
16250
- throw new Error(`Error code: ${ErrorCode.INVALID_ARGUMENTS}, message: App types cannot be an empty array`);
16251
- }
16252
- return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.addAndConfigure" /* ApiName.HostEntity_Tab_addAndConfigureApp */), 'hostEntity.tab.addAndConfigure', [hostEntityIds, appTypes]).then(([response]) => {
16253
- var _a;
16254
- if (isSdkError(response)) {
16255
- throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
16256
- }
16257
- return response;
16258
- });
16259
- }
16260
- tab_1.addAndConfigure = addAndConfigure;
16407
+ majorVersion: 1,
16261
16408
  /**
16262
16409
  * @hidden
16263
- * @internal
16264
- * @beta
16265
- * Limited to Microsoft-internal use
16266
- *
16267
- * Returns all tab instances associated with a host entity
16268
- *
16269
- * @param hostEntityIds Ids of the host entity like channel, chat or meeting
16270
- *
16271
- * @returns Object with array of HostEntityTabInstance's associated with a host entity
16272
- *
16273
- * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid or fetching tabs fails
16410
+ * The minor version of the current cart interface, which is compatible
16411
+ * with the previous minor version in the same major version.
16274
16412
  */
16275
- function getAll(hostEntityIds) {
16276
- ensureInitialized(runtime);
16277
- if (!isSupported()) {
16278
- throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
16279
- }
16280
- validateThreadId(hostEntityIds.threadId);
16281
- return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.getAll" /* ApiName.HostEntity_Tab_getAll */), 'hostEntity.tab.getAll', [hostEntityIds]).then(([response]) => {
16282
- var _a;
16283
- if (isSdkError(response)) {
16284
- throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
16285
- }
16286
- return response;
16287
- });
16288
- }
16289
- tab_1.getAll = getAll;
16413
+ minorVersion: 1,
16414
+ };
16415
+ /**
16416
+ * @hidden
16417
+ * Represents the persona creating the cart.
16418
+ * @beta
16419
+ */
16420
+ let Intent;
16421
+ (function (Intent) {
16290
16422
  /**
16291
16423
  * @hidden
16292
- * @internal
16293
- * @beta
16294
- * Limited to Microsoft-internal use
16295
- *
16296
- * Launches host-owned UI that lets a user re-configure the contentUrl of the tab
16297
- *
16298
- * @param tab Configurable tab instance that needs to be updated
16299
- *
16300
- * @param hostEntityIds Ids of the host entity like channel, chat or meeting
16301
- *
16302
- * @returns The HostEntityTabInstance of the updated tab
16303
- *
16304
- * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation,
16305
- * re-configuring tab fails or if tab is a static tab
16424
+ * The cart is created by admin of an organization in Teams Admin Center.
16425
+ */
16426
+ Intent["TACAdminUser"] = "TACAdminUser";
16427
+ /**
16428
+ * @hidden
16429
+ * The cart is created by admin of an organization in Teams.
16306
16430
  */
16307
- function reconfigure(tab, hostEntityIds) {
16308
- ensureInitialized(runtime);
16309
- if (!isSupported()) {
16310
- throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
16311
- }
16312
- validateTab(tab);
16313
- validateThreadId(hostEntityIds.threadId);
16314
- return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.reconfigure" /* ApiName.HostEntity_Tab_reconfigure */), 'hostEntity.tab.reconfigure', [tab, hostEntityIds]).then(([response]) => {
16315
- var _a;
16316
- if (isSdkError(response)) {
16317
- throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
16318
- }
16319
- return response;
16320
- });
16321
- }
16322
- tab_1.reconfigure = reconfigure;
16431
+ Intent["TeamsAdminUser"] = "TeamsAdminUser";
16323
16432
  /**
16324
16433
  * @hidden
16325
- * @internal
16326
- * @beta
16327
- * Limited to Microsoft-internal use
16328
- *
16329
- * Launches host-owned UI that lets a user rename the tab
16330
- *
16331
- * @param tab Configurable tab instance that needs to be updated
16332
- *
16333
- * @param hostEntityIds Ids of the host entity like channel, chat or meeting
16334
- *
16335
- * @returns The HostEntityTabInstance of the updated tab
16336
- *
16337
- * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation,
16338
- * re-naming tab fails or if tab is a static tab
16434
+ * The cart is created by end user of an organization in Teams.
16339
16435
  */
16340
- function rename(tab, hostEntityIds) {
16341
- ensureInitialized(runtime);
16342
- if (!isSupported()) {
16343
- throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
16344
- }
16345
- validateTab(tab);
16346
- validateThreadId(hostEntityIds.threadId);
16347
- return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.rename" /* ApiName.HostEntity_Tab_rename */), 'hostEntity.tab.rename', [tab, hostEntityIds]).then(([response]) => {
16348
- var _a;
16349
- if (isSdkError(response)) {
16350
- throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
16351
- }
16352
- return response;
16353
- });
16354
- }
16355
- tab_1.rename = rename;
16436
+ Intent["TeamsEndUser"] = "TeamsEndUser";
16437
+ })(Intent = marketplace.Intent || (marketplace.Intent = {}));
16438
+ /**
16439
+ * @hidden
16440
+ * Represents the status of the cart.
16441
+ * @beta
16442
+ */
16443
+ let CartStatus;
16444
+ (function (CartStatus) {
16356
16445
  /**
16357
16446
  * @hidden
16358
- * @internal
16359
- * @beta
16360
- * Limited to Microsoft-internal use
16361
- *
16362
- * Launches host-owned UI that lets a user remove the tab
16363
- *
16364
- * @param tab tab instance that needs to be updated. Can be static tab or configurable tab.
16365
- *
16366
- * @param hostEntityIds Ids of the host entity like channel, chat or meeting
16367
- *
16368
- * @returns Boolean. Returns true if removing tab was successful
16369
- *
16370
- * @throws Error if host does not support this capability, library as not been initialized successfully, input parameters are invalid, user cancels operation or
16371
- * removing tab fails
16447
+ * Cart is created but not checked out yet.
16372
16448
  */
16373
- function remove(tab, hostEntityIds) {
16374
- ensureInitialized(runtime);
16375
- if (!isSupported()) {
16376
- throw new Error(`Error code: ${ErrorCode.NOT_SUPPORTED_ON_PLATFORM}, message: Not supported on platform`);
16377
- }
16378
- validateThreadId(hostEntityIds.threadId);
16379
- validateTab(tab);
16380
- return sendMessageToParentAsync(getApiVersionTag(hostEntityTelemetryVersionNumber, "hostEntity.tab.remove" /* ApiName.HostEntity_Tab_remove */), 'hostEntity.tab.remove', [tab, hostEntityIds]).then(([response]) => {
16381
- var _a;
16382
- if (isSdkError(response)) {
16383
- throw new Error(`Error code: ${response.errorCode}, message: ${(_a = response.message) !== null && _a !== void 0 ? _a : 'None'}`);
16384
- }
16385
- return true;
16386
- });
16387
- }
16388
- tab_1.remove = remove;
16449
+ CartStatus["Open"] = "Open";
16389
16450
  /**
16390
16451
  * @hidden
16391
- * @internal
16392
- * @beta
16393
- * Limited to Microsoft-internal use
16394
- *
16395
- * Checks if the hostEntity.tab capability is supported by the host
16396
- * @returns boolean to represent whether the histEntity and hostEntity.tab capability is supported
16397
- *
16398
- * @throws Error if {@linkcode app.initialize} has not successfully completed
16452
+ * Cart is checked out but not completed yet.
16399
16453
  */
16400
- function isSupported() {
16401
- var _a;
16402
- return ensureInitialized(runtime) && hostEntity.isSupported() && ((_a = runtime.supports.hostEntity) === null || _a === void 0 ? void 0 : _a.tab) ? true : false;
16403
- }
16404
- tab_1.isSupported = isSupported;
16454
+ CartStatus["Processing"] = "Processing";
16405
16455
  /**
16406
16456
  * @hidden
16407
- * @internal
16408
- * @beta
16409
- * Limited to Microsoft-internal use
16410
- *
16411
- * Checks if the threadId is defined
16412
- * @throws Error if threadId is null, undefined or empty
16457
+ * Indicate checking out is completed and the host should
16458
+ * return a new cart in the next getCart call.
16413
16459
  */
16414
- function validateThreadId(threadId) {
16415
- if (!threadId || threadId.length == 0) {
16416
- throw new Error(`Error code: ${ErrorCode.INVALID_ARGUMENTS}, message: ThreadId cannot be null or empty`);
16417
- }
16418
- }
16460
+ CartStatus["Processed"] = "Processed";
16419
16461
  /**
16420
16462
  * @hidden
16421
- * @internal
16422
- * @beta
16423
- * Limited to Microsoft-internal use
16424
- *
16425
- * Checks if the tabId is defined
16426
- * @throws Error if tabId is null, undefined or empty
16463
+ * Indicate checking out process is manually cancelled by the user
16427
16464
  */
16428
- function validateTab(tab) {
16429
- if (!(tab === null || tab === void 0 ? void 0 : tab.internalTabInstanceId) || tab.internalTabInstanceId.length === 0) {
16430
- throw new Error(`Error code: ${ErrorCode.INVALID_ARGUMENTS}, message: TabId cannot be null or empty`);
16431
- }
16465
+ CartStatus["Closed"] = "Closed";
16466
+ /**
16467
+ * @hidden
16468
+ * Indicate checking out is failed and the host should
16469
+ * return a new cart in the next getCart call.
16470
+ */
16471
+ CartStatus["Error"] = "Error";
16472
+ })(CartStatus = marketplace.CartStatus || (marketplace.CartStatus = {}));
16473
+ /**
16474
+ * @hidden
16475
+ * Get the cart object owned by the host to checkout.
16476
+ * @returns A promise of the cart object in the cartVersion.
16477
+ * @beta
16478
+ */
16479
+ function getCart() {
16480
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16481
+ if (!isSupported()) {
16482
+ throw errorNotSupportedOnPlatform;
16432
16483
  }
16433
- })(tab = hostEntity.tab || (hostEntity.tab = {}));
16484
+ return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.getCart" /* ApiName.Marketplace_GetCart */), 'marketplace.getCart', marketplace.cartVersion).then(deserializeCart);
16485
+ }
16486
+ marketplace.getCart = getCart;
16434
16487
  /**
16435
16488
  * @hidden
16436
- * @internal
16489
+ * Add or update cart items in the cart owned by the host.
16490
+ * @param addOrUpdateCartItemsParams Represents the parameters to update the cart items.
16491
+ * @returns A promise of the updated cart object in the cartVersion.
16492
+ * @beta
16493
+ */
16494
+ function addOrUpdateCartItems(addOrUpdateCartItemsParams) {
16495
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16496
+ if (!isSupported()) {
16497
+ throw errorNotSupportedOnPlatform;
16498
+ }
16499
+ if (!addOrUpdateCartItemsParams) {
16500
+ throw new Error('addOrUpdateCartItemsParams must be provided');
16501
+ }
16502
+ marketplaceUtils_validateUuid(addOrUpdateCartItemsParams === null || addOrUpdateCartItemsParams === void 0 ? void 0 : addOrUpdateCartItemsParams.cartId);
16503
+ validateCartItems(addOrUpdateCartItemsParams === null || addOrUpdateCartItemsParams === void 0 ? void 0 : addOrUpdateCartItemsParams.cartItems);
16504
+ return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.addOrUpdateCartItems" /* ApiName.Marketplace_AddOrUpdateCartItems */), 'marketplace.addOrUpdateCartItems', Object.assign(Object.assign({}, addOrUpdateCartItemsParams), { cartItems: serializeCartItems(addOrUpdateCartItemsParams.cartItems), cartVersion: marketplace.cartVersion })).then(deserializeCart);
16505
+ }
16506
+ marketplace.addOrUpdateCartItems = addOrUpdateCartItems;
16507
+ /**
16508
+ * @hidden
16509
+ * Remove cart items from the cart owned by the host.
16510
+ * @param removeCartItemsParams The parameters to remove the cart items.
16511
+ * @returns A promise of the updated cart object in the cartVersion.
16512
+ * @beta
16513
+ */
16514
+ function removeCartItems(removeCartItemsParams) {
16515
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16516
+ if (!isSupported()) {
16517
+ throw errorNotSupportedOnPlatform;
16518
+ }
16519
+ if (!removeCartItemsParams) {
16520
+ throw new Error('removeCartItemsParams must be provided');
16521
+ }
16522
+ marketplaceUtils_validateUuid(removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartId);
16523
+ if (!Array.isArray(removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartItemIds) || (removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartItemIds.length) === 0) {
16524
+ throw new Error('cartItemIds must be a non-empty array');
16525
+ }
16526
+ return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.removeCartItems" /* ApiName.Marketplace_RemoveCardItems */), 'marketplace.removeCartItems', Object.assign(Object.assign({}, removeCartItemsParams), { cartVersion: marketplace.cartVersion })).then(deserializeCart);
16527
+ }
16528
+ marketplace.removeCartItems = removeCartItems;
16529
+ /**
16530
+ * @hidden
16531
+ * Update cart status in the cart owned by the host.
16532
+ * @param updateCartStatusParams The parameters to update the cart status.
16533
+ * @returns A promise of the updated cart object in the cartVersion.
16534
+ * @beta
16535
+ */
16536
+ function updateCartStatus(updateCartStatusParams) {
16537
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
16538
+ if (!isSupported()) {
16539
+ throw errorNotSupportedOnPlatform;
16540
+ }
16541
+ if (!updateCartStatusParams) {
16542
+ throw new Error('updateCartStatusParams must be provided');
16543
+ }
16544
+ marketplaceUtils_validateUuid(updateCartStatusParams === null || updateCartStatusParams === void 0 ? void 0 : updateCartStatusParams.cartId);
16545
+ validateCartStatus(updateCartStatusParams === null || updateCartStatusParams === void 0 ? void 0 : updateCartStatusParams.cartStatus);
16546
+ return sendAndHandleSdkError(getApiVersionTag(marketplaceTelemetryVersionNumber, "marketplace.updateCartStatus" /* ApiName.Marketplace_UpdateCartStatus */), 'marketplace.updateCartStatus', Object.assign(Object.assign({}, updateCartStatusParams), { cartVersion: marketplace.cartVersion })).then(deserializeCart);
16547
+ }
16548
+ marketplace.updateCartStatus = updateCartStatus;
16549
+ /**
16550
+ * @hidden
16551
+ * Checks if the marketplace capability is supported by the host.
16552
+ * @returns Boolean to represent whether the marketplace capability is supported.
16553
+ * @throws Error if {@linkcode app.initialize} has not successfully completed.
16437
16554
  * @beta
16438
- * Limited to Microsoft-internal use
16439
- *
16440
- * Checks if the hostEntity capability is supported by the host
16441
- * @returns boolean to represent whether the hostEntity capability is supported
16442
- *
16443
- * @throws Error if {@linkcode app.initialize} has not successfully completed
16444
16555
  */
16445
16556
  function isSupported() {
16446
- return ensureInitialized(runtime) && runtime.supports.hostEntity ? true : false;
16557
+ return ensureInitialized(runtime) && runtime.supports.marketplace ? true : false;
16447
16558
  }
16448
- hostEntity.isSupported = isSupported;
16449
- })(hostEntity || (hostEntity = {}));
16559
+ marketplace.isSupported = isSupported;
16560
+ })(marketplace || (marketplace = {}));
16450
16561
 
16451
- ;// CONCATENATED MODULE: ./src/private/index.ts
16562
+ ;// CONCATENATED MODULE: ./src/public/index.ts
16563
+
16564
+
16565
+
16566
+
16567
+
16568
+
16569
+
16570
+
16571
+
16572
+
16573
+
16574
+
16575
+
16576
+
16577
+
16578
+
16579
+
16580
+
16581
+
16582
+
16583
+
16584
+
16585
+
16586
+
16452
16587
 
16453
16588
 
16454
16589