@microsoft/teams-js 2.19.0-beta.2 → 2.19.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7587,7 +7587,7 @@ export namespace teamsCore {
7587
7587
  /**
7588
7588
  * Registers a handler to be called when the page has been requested to load.
7589
7589
  *
7590
- * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/build-tabs-for-meeting?tabs=desktop%2Cmeeting-chat-view-desktop%2Cmeeting-stage-view-desktop%2Cchannel-meeting-desktop#app-caching)
7590
+ * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/app-caching)
7591
7591
  * for a more detailed explanation about using this API.
7592
7592
  *
7593
7593
  * @param handler - The handler to invoke when the page is loaded.
@@ -7611,7 +7611,7 @@ export namespace teamsCore {
7611
7611
  /**
7612
7612
  * Registers a handler to be called before the page is unloaded.
7613
7613
  *
7614
- * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/build-tabs-for-meeting?tabs=desktop%2Cmeeting-chat-view-desktop%2Cmeeting-stage-view-desktop%2Cchannel-meeting-desktop#app-caching)
7614
+ * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/app-caching)
7615
7615
  * for a more detailed explanation about using this API.
7616
7616
  *
7617
7617
  * @param handler - The handler to invoke before the page is unloaded. If this handler returns true the page should
@@ -764,6 +764,36 @@ function plural(ms, msAbs, n, name) {
764
764
  /******/ }
765
765
  /******/
766
766
  /************************************************************************/
767
+ /******/ /* webpack/runtime/create fake namespace object */
768
+ /******/ (() => {
769
+ /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
770
+ /******/ var leafPrototypes;
771
+ /******/ // create a fake namespace object
772
+ /******/ // mode & 1: value is a module id, require it
773
+ /******/ // mode & 2: merge all properties of value into the ns
774
+ /******/ // mode & 4: return value when already ns object
775
+ /******/ // mode & 16: return value when it's Promise-like
776
+ /******/ // mode & 8|1: behave like require
777
+ /******/ __webpack_require__.t = function(value, mode) {
778
+ /******/ if(mode & 1) value = this(value);
779
+ /******/ if(mode & 8) return value;
780
+ /******/ if(typeof value === 'object' && value) {
781
+ /******/ if((mode & 4) && value.__esModule) return value;
782
+ /******/ if((mode & 16) && typeof value.then === 'function') return value;
783
+ /******/ }
784
+ /******/ var ns = Object.create(null);
785
+ /******/ __webpack_require__.r(ns);
786
+ /******/ var def = {};
787
+ /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
788
+ /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
789
+ /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
790
+ /******/ }
791
+ /******/ def['default'] = () => (value);
792
+ /******/ __webpack_require__.d(ns, def);
793
+ /******/ return ns;
794
+ /******/ };
795
+ /******/ })();
796
+ /******/
767
797
  /******/ /* webpack/runtime/define property getters */
768
798
  /******/ (() => {
769
799
  /******/ // define getter functions for harmony exports
@@ -1054,7 +1084,11 @@ var ApiName;
1054
1084
  ApiName["Tasks_UpdateTask"] = "tasks.updateTask";
1055
1085
  })(ApiName || (ApiName = {}));
1056
1086
 
1087
+ ;// CONCATENATED MODULE: ./src/artifactsForCDN/validDomains.json
1088
+ const validDomains_namespaceObject = JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","teams.live.com","devspaces.skype.com","ssauth.skype.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.live.com","outlook-sdf.live.com","*.teams.microsoft.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","www.bing.com","www.staging-bing-int.com","teams.cloud.microsoft","outlook.cloud.microsoft","m365.cloud.microsoft","copilot.microsoft.com"]}');
1089
+ var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
1057
1090
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1091
+
1058
1092
  /**
1059
1093
  * @hidden
1060
1094
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -1155,48 +1189,28 @@ const getMediaCallbackSupportVersion = '2.0.0';
1155
1189
  const scanBarCodeAPIMobileSupportVersion = '1.9.0';
1156
1190
  /**
1157
1191
  * @hidden
1158
- * List of supported Host origins
1159
- *
1160
- * @internal
1161
- * Limited to Microsoft-internal use
1162
- */
1163
- const validOrigins = [
1164
- 'teams.microsoft.com',
1165
- 'teams.microsoft.us',
1166
- 'gov.teams.microsoft.us',
1167
- 'dod.teams.microsoft.us',
1168
- 'int.teams.microsoft.com',
1169
- 'teams.live.com',
1170
- 'devspaces.skype.com',
1171
- 'ssauth.skype.com',
1172
- 'local.teams.live.com',
1173
- 'local.teams.live.com:8080',
1174
- 'local.teams.office.com',
1175
- 'local.teams.office.com:8080',
1176
- 'outlook.office.com',
1177
- 'outlook-sdf.office.com',
1178
- 'outlook.office365.com',
1179
- 'outlook-sdf.office365.com',
1180
- 'outlook.live.com',
1181
- 'outlook-sdf.live.com',
1182
- '*.teams.microsoft.com',
1183
- '*.www.office.com',
1184
- 'www.office.com',
1185
- 'word.office.com',
1186
- 'excel.office.com',
1187
- 'powerpoint.office.com',
1188
- 'www.officeppe.com',
1189
- '*.www.microsoft365.com',
1190
- 'www.microsoft365.com',
1191
- 'bing.com',
1192
- 'edgeservices.bing.com',
1193
- 'www.bing.com',
1194
- 'www.staging-bing-int.com',
1195
- 'teams.cloud.microsoft',
1196
- 'outlook.cloud.microsoft',
1197
- 'm365.cloud.microsoft',
1198
- 'copilot.microsoft.com',
1199
- ];
1192
+ * Fallback list of valid origins in JSON format
1193
+ *
1194
+ * @internal
1195
+ * Limited to Microsoft-internal use
1196
+ */
1197
+ const validOriginsLocal = artifactsForCDN_validDomains_namespaceObject;
1198
+ /**
1199
+ * @hidden
1200
+ * Fallback list of valid origins
1201
+ *
1202
+ * @internal
1203
+ * Limited to Microsoft-internal use
1204
+ */
1205
+ const validOriginsFallback = validOriginsLocal.validOrigins;
1206
+ /**
1207
+ * @hidden
1208
+ * CDN endpoint of the list of valid origins
1209
+ *
1210
+ * @internal
1211
+ * Limited to Microsoft-internal use
1212
+ */
1213
+ const validOriginsCdnEndpoint = new URL('https://res.cdn.office.net/teams-js/validDomains/json/validDomains.json');
1200
1214
  /**
1201
1215
  * @hidden
1202
1216
  * USer specified message origins should satisfy this test
@@ -1649,59 +1663,6 @@ const errorInvalidResponse = new Error('Invalid response: Received more images t
1649
1663
  /* eslint-disable @typescript-eslint/no-unused-vars */
1650
1664
 
1651
1665
 
1652
-
1653
-
1654
-
1655
- /**
1656
- * @param pattern - reference pattern
1657
- * @param host - candidate string
1658
- * @returns returns true if host matches pre-know valid pattern
1659
- *
1660
- * @example
1661
- * validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
1662
- * validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
1663
- *
1664
- * @internal
1665
- * Limited to Microsoft-internal use
1666
- */
1667
- function validateHostAgainstPattern(pattern, host) {
1668
- if (pattern.substring(0, 2) === '*.') {
1669
- const suffix = pattern.substring(1);
1670
- if (host.length > suffix.length &&
1671
- host.split('.').length === suffix.split('.').length &&
1672
- host.substring(host.length - suffix.length) === suffix) {
1673
- return true;
1674
- }
1675
- }
1676
- else if (pattern === host) {
1677
- return true;
1678
- }
1679
- return false;
1680
- }
1681
- const validateOriginLogger = getLogger('validateOrigin');
1682
- /**
1683
- * @internal
1684
- * Limited to Microsoft-internal use
1685
- */
1686
- function validateOrigin(messageOrigin) {
1687
- // Check whether the url is in the pre-known allowlist or supplied by user
1688
- if (!isValidHttpsURL(messageOrigin)) {
1689
- validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
1690
- return false;
1691
- }
1692
- const messageOriginHost = messageOrigin.host;
1693
- if (validOrigins.some((pattern) => validateHostAgainstPattern(pattern, messageOriginHost))) {
1694
- return true;
1695
- }
1696
- for (const domainOrPattern of GlobalVars.additionalValidOrigins) {
1697
- const pattern = domainOrPattern.substring(0, 8) === 'https://' ? domainOrPattern.substring(8) : domainOrPattern;
1698
- if (validateHostAgainstPattern(pattern, messageOriginHost)) {
1699
- return true;
1700
- }
1701
- }
1702
- validateOriginLogger('Origin %s is invalid because it is not an origin approved by this library or included in the call to app.initialize.\nOrigins approved by this library: %o\nOrigins included in app.initialize: %o', messageOrigin, validOrigins, GlobalVars.additionalValidOrigins);
1703
- return false;
1704
- }
1705
1666
  /**
1706
1667
  * @internal
1707
1668
  * Limited to Microsoft-internal use
@@ -2262,7 +2223,13 @@ const mapTeamsVersionToSupportedCapabilities = {
2262
2223
  '2.0.5': [
2263
2224
  {
2264
2225
  capability: { webStorage: {} },
2265
- hostClientTypes: [HostClientType.android, HostClientType.desktop, HostClientType.ios],
2226
+ hostClientTypes: [HostClientType.android, HostClientType.ios],
2227
+ },
2228
+ ],
2229
+ '2.0.8': [
2230
+ {
2231
+ capability: { sharing: {} },
2232
+ hostClientTypes: [HostClientType.android, HostClientType.ios],
2266
2233
  },
2267
2234
  ],
2268
2235
  };
@@ -2379,7 +2346,7 @@ const _minRuntimeConfigToUninitialize = {
2379
2346
  * @hidden
2380
2347
  * Package version.
2381
2348
  */
2382
- const version = "2.19.0-beta.2";
2349
+ const version = "2.19.0-beta.3";
2383
2350
 
2384
2351
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2385
2352
 
@@ -2515,6 +2482,137 @@ function isNullOrUndefined(value) {
2515
2482
  return value === null || value === undefined;
2516
2483
  }
2517
2484
 
2485
+ ;// CONCATENATED MODULE: ./src/internal/validOrigins.ts
2486
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
2487
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2488
+ return new (P || (P = Promise))(function (resolve, reject) {
2489
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2490
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2491
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2492
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2493
+ });
2494
+ };
2495
+
2496
+
2497
+
2498
+
2499
+ let validOriginsCache = [];
2500
+ const validateOriginLogger = getLogger('validateOrigin');
2501
+ function prefetchOriginsFromCDN() {
2502
+ return __awaiter(this, void 0, void 0, function* () {
2503
+ yield getValidOriginsListFromCDN();
2504
+ });
2505
+ }
2506
+ function isValidOriginsCacheEmpty() {
2507
+ return validOriginsCache.length !== 0;
2508
+ }
2509
+ function getValidOriginsListFromCDN() {
2510
+ return __awaiter(this, void 0, void 0, function* () {
2511
+ if (isValidOriginsCacheEmpty()) {
2512
+ return validOriginsCache;
2513
+ }
2514
+ if (!inServerSideRenderingEnvironment()) {
2515
+ return fetch(validOriginsCdnEndpoint)
2516
+ .then((response) => {
2517
+ if (!response.ok) {
2518
+ throw new Error('Invalid Response from Fetch Call');
2519
+ }
2520
+ return response.json().then((validOriginsCDN) => {
2521
+ if (isValidOriginsJSONValid(JSON.stringify(validOriginsCDN))) {
2522
+ validOriginsCache = validOriginsCDN.validOrigins;
2523
+ return validOriginsCache;
2524
+ }
2525
+ else {
2526
+ throw new Error('Valid Origins List Is Invalid');
2527
+ }
2528
+ });
2529
+ })
2530
+ .catch((e) => {
2531
+ validateOriginLogger('validOrigins fetch call to CDN failed with error: %s. Defaulting to fallback list', e);
2532
+ validOriginsCache = validOriginsFallback;
2533
+ return validOriginsCache;
2534
+ });
2535
+ }
2536
+ else {
2537
+ validOriginsCache = validOriginsFallback;
2538
+ return validOriginsFallback;
2539
+ }
2540
+ });
2541
+ }
2542
+ function isValidOriginsJSONValid(validOriginsJSON) {
2543
+ let validOriginsCDN = JSON.parse(validOriginsJSON);
2544
+ try {
2545
+ validOriginsCDN = JSON.parse(validOriginsJSON);
2546
+ }
2547
+ catch (_) {
2548
+ return false;
2549
+ }
2550
+ if (!validOriginsCDN.validOrigins) {
2551
+ return false;
2552
+ }
2553
+ for (const validOrigin of validOriginsCDN.validOrigins) {
2554
+ try {
2555
+ new URL('https://' + validOrigin);
2556
+ }
2557
+ catch (_) {
2558
+ validateOriginLogger('isValidOriginsFromCDN call failed to validate origin: %s', validOrigin);
2559
+ return false;
2560
+ }
2561
+ }
2562
+ return true;
2563
+ }
2564
+ /**
2565
+ * @param pattern - reference pattern
2566
+ * @param host - candidate string
2567
+ * @returns returns true if host matches pre-know valid pattern
2568
+ *
2569
+ * @example
2570
+ * validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
2571
+ * validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
2572
+ *
2573
+ * @internal
2574
+ * Limited to Microsoft-internal use
2575
+ */
2576
+ function validateHostAgainstPattern(pattern, host) {
2577
+ if (pattern.substring(0, 2) === '*.') {
2578
+ const suffix = pattern.substring(1);
2579
+ if (host.length > suffix.length &&
2580
+ host.split('.').length === suffix.split('.').length &&
2581
+ host.substring(host.length - suffix.length) === suffix) {
2582
+ return true;
2583
+ }
2584
+ }
2585
+ else if (pattern === host) {
2586
+ return true;
2587
+ }
2588
+ return false;
2589
+ }
2590
+ /**
2591
+ * @internal
2592
+ * Limited to Microsoft-internal use
2593
+ */
2594
+ function validateOrigin(messageOrigin) {
2595
+ return getValidOriginsListFromCDN().then((validOriginsList) => {
2596
+ // Check whether the url is in the pre-known allowlist or supplied by user
2597
+ if (!isValidHttpsURL(messageOrigin)) {
2598
+ validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
2599
+ return false;
2600
+ }
2601
+ const messageOriginHost = messageOrigin.host;
2602
+ if (validOriginsList.some((pattern) => validateHostAgainstPattern(pattern, messageOriginHost))) {
2603
+ return true;
2604
+ }
2605
+ for (const domainOrPattern of GlobalVars.additionalValidOrigins) {
2606
+ const pattern = domainOrPattern.substring(0, 8) === 'https://' ? domainOrPattern.substring(8) : domainOrPattern;
2607
+ if (validateHostAgainstPattern(pattern, messageOriginHost)) {
2608
+ return true;
2609
+ }
2610
+ }
2611
+ validateOriginLogger('Origin %s is invalid because it is not an origin approved by this library or included in the call to app.initialize.\nOrigins approved by this library: %o\nOrigins included in app.initialize: %o', messageOrigin, validOriginsList, GlobalVars.additionalValidOrigins);
2612
+ return false;
2613
+ });
2614
+ }
2615
+
2518
2616
  ;// CONCATENATED MODULE: ./src/public/authentication.ts
2519
2617
 
2520
2618
 
@@ -3565,6 +3663,7 @@ var menus;
3565
3663
 
3566
3664
 
3567
3665
 
3666
+
3568
3667
  /**
3569
3668
  * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
3570
3669
  */
@@ -3789,6 +3888,7 @@ var app;
3789
3888
  * @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
3790
3889
  */
3791
3890
  function initialize(validMessageOrigins) {
3891
+ prefetchOriginsFromCDN();
3792
3892
  return appInitializeHelper(getApiVersionTag(appTelemetryVersionNumber, ApiName.App_Initialize), validMessageOrigins);
3793
3893
  }
3794
3894
  app.initialize = initialize;
@@ -5089,6 +5189,16 @@ function handlers_registerOnResumeHandler(handler) {
5089
5189
  /* eslint-disable @typescript-eslint/ban-types */
5090
5190
  /* eslint-disable @typescript-eslint/no-explicit-any */
5091
5191
  /* eslint-disable strict-null-checks/all */
5192
+ var communication_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
5193
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5194
+ return new (P || (P = Promise))(function (resolve, reject) {
5195
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5196
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5197
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5198
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5199
+ });
5200
+ };
5201
+
5092
5202
 
5093
5203
 
5094
5204
 
@@ -5120,7 +5230,7 @@ CommunicationPrivate.promiseCallbacks = {};
5120
5230
  */
5121
5231
  function initializeCommunication(validMessageOrigins, apiVersionTag) {
5122
5232
  // Listen for messages post to our window
5123
- CommunicationPrivate.messageListener = (evt) => processMessage(evt);
5233
+ CommunicationPrivate.messageListener = (evt) => communication_awaiter(this, void 0, void 0, function* () { return yield processMessage(evt); });
5124
5234
  // If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,
5125
5235
  // it's the window that opened us (i.e., window.opener)
5126
5236
  Communication.currentWindow = Communication.currentWindow || ssrSafeWindow();
@@ -5404,29 +5514,33 @@ const processMessageLogger = communicationLogger.extend('processMessage');
5404
5514
  * Limited to Microsoft-internal use
5405
5515
  */
5406
5516
  function processMessage(evt) {
5407
- // Process only if we received a valid message
5408
- if (!evt || !evt.data || typeof evt.data !== 'object') {
5409
- processMessageLogger('Unrecognized message format received by app, message being ignored. Message: %o', evt);
5410
- return;
5411
- }
5412
- // Process only if the message is coming from a different window and a valid origin
5413
- // valid origins are either a pre-known origin or one specified by the app developer
5414
- // in their call to app.initialize
5415
- const messageSource = evt.source || (evt.originalEvent && evt.originalEvent.source);
5416
- const messageOrigin = evt.origin || (evt.originalEvent && evt.originalEvent.origin);
5417
- if (!shouldProcessMessage(messageSource, messageOrigin)) {
5418
- processMessageLogger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
5419
- return;
5420
- }
5421
- // Update our parent and child relationships based on this message
5422
- updateRelationships(messageSource, messageOrigin);
5423
- // Handle the message
5424
- if (messageSource === Communication.parentWindow) {
5425
- handleParentMessage(evt);
5426
- }
5427
- else if (messageSource === Communication.childWindow) {
5428
- handleChildMessage(evt);
5429
- }
5517
+ return communication_awaiter(this, void 0, void 0, function* () {
5518
+ // Process only if we received a valid message
5519
+ if (!evt || !evt.data || typeof evt.data !== 'object') {
5520
+ processMessageLogger('Unrecognized message format received by app, message being ignored. Message: %o', evt);
5521
+ return;
5522
+ }
5523
+ // Process only if the message is coming from a different window and a valid origin
5524
+ // valid origins are either a pre-known origin or one specified by the app developer
5525
+ // in their call to app.initialize
5526
+ const messageSource = evt.source || (evt.originalEvent && evt.originalEvent.source);
5527
+ const messageOrigin = evt.origin || (evt.originalEvent && evt.originalEvent.origin);
5528
+ return shouldProcessMessage(messageSource, messageOrigin).then((result) => {
5529
+ if (!result) {
5530
+ processMessageLogger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
5531
+ return;
5532
+ }
5533
+ // Update our parent and child relationships based on this message
5534
+ updateRelationships(messageSource, messageOrigin);
5535
+ // Handle the message
5536
+ if (messageSource === Communication.parentWindow) {
5537
+ handleParentMessage(evt);
5538
+ }
5539
+ else if (messageSource === Communication.childWindow) {
5540
+ handleChildMessage(evt);
5541
+ }
5542
+ });
5543
+ });
5430
5544
  }
5431
5545
  const shouldProcessMessageLogger = communicationLogger.extend('shouldProcessMessage');
5432
5546
  /**
@@ -5437,25 +5551,27 @@ const shouldProcessMessageLogger = communicationLogger.extend('shouldProcessMess
5437
5551
  * Limited to Microsoft-internal use
5438
5552
  */
5439
5553
  function shouldProcessMessage(messageSource, messageOrigin) {
5440
- // Process if message source is a different window and if origin is either in
5441
- // Teams' pre-known whitelist or supplied as valid origin by user during initialization
5442
- if (Communication.currentWindow && messageSource === Communication.currentWindow) {
5443
- shouldProcessMessageLogger('Should not process message because it is coming from the current window');
5444
- return false;
5445
- }
5446
- else if (Communication.currentWindow &&
5447
- Communication.currentWindow.location &&
5448
- messageOrigin &&
5449
- messageOrigin === Communication.currentWindow.location.origin) {
5450
- return true;
5451
- }
5452
- else {
5453
- const isOriginValid = validateOrigin(new URL(messageOrigin));
5454
- if (!isOriginValid) {
5455
- shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
5554
+ return communication_awaiter(this, void 0, void 0, function* () {
5555
+ // Process if message source is a different window and if origin is either in
5556
+ // Teams' pre-known whitelist or supplied as valid origin by user during initialization
5557
+ if (Communication.currentWindow && messageSource === Communication.currentWindow) {
5558
+ shouldProcessMessageLogger('Should not process message because it is coming from the current window');
5559
+ return false;
5456
5560
  }
5457
- return isOriginValid;
5458
- }
5561
+ else if (Communication.currentWindow &&
5562
+ Communication.currentWindow.location &&
5563
+ messageOrigin &&
5564
+ messageOrigin === Communication.currentWindow.location.origin) {
5565
+ return true;
5566
+ }
5567
+ else {
5568
+ const isOriginValid = yield validateOrigin(new URL(messageOrigin));
5569
+ if (!isOriginValid) {
5570
+ shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
5571
+ }
5572
+ return isOriginValid;
5573
+ }
5574
+ });
5459
5575
  }
5460
5576
  /**
5461
5577
  * @internal
@@ -7061,7 +7177,7 @@ var chat;
7061
7177
  })(chat || (chat = {}));
7062
7178
 
7063
7179
  ;// CONCATENATED MODULE: ./src/public/clipboard.ts
7064
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
7180
+ var clipboard_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
7065
7181
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7066
7182
  return new (P || (P = Promise))(function (resolve, reject) {
7067
7183
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -7101,7 +7217,7 @@ var clipboard;
7101
7217
  * rejects with error stating the reason for failure.
7102
7218
  */
7103
7219
  function write(blob) {
7104
- return __awaiter(this, void 0, void 0, function* () {
7220
+ return clipboard_awaiter(this, void 0, void 0, function* () {
7105
7221
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.meetingStage, FrameContexts.task, FrameContexts.settings, FrameContexts.stage, FrameContexts.sidePanel);
7106
7222
  if (!isSupported()) {
7107
7223
  throw errorNotSupportedOnPlatform;
@@ -7126,7 +7242,7 @@ var clipboard;
7126
7242
  * Note: Returned blob type will contain one of the MIME type `image/png`, `text/plain` or `text/html`.
7127
7243
  */
7128
7244
  function read() {
7129
- return __awaiter(this, void 0, void 0, function* () {
7245
+ return clipboard_awaiter(this, void 0, void 0, function* () {
7130
7246
  internalAPIs_ensureInitialized(runtime_runtime, FrameContexts.content, FrameContexts.meetingStage, FrameContexts.task, FrameContexts.settings, FrameContexts.stage, FrameContexts.sidePanel);
7131
7247
  if (!isSupported()) {
7132
7248
  throw errorNotSupportedOnPlatform;
@@ -8413,7 +8529,7 @@ var teamsCore;
8413
8529
  /**
8414
8530
  * Registers a handler to be called when the page has been requested to load.
8415
8531
  *
8416
- * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/build-tabs-for-meeting?tabs=desktop%2Cmeeting-chat-view-desktop%2Cmeeting-stage-view-desktop%2Cchannel-meeting-desktop#app-caching)
8532
+ * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/app-caching)
8417
8533
  * for a more detailed explanation about using this API.
8418
8534
  *
8419
8535
  * @param handler - The handler to invoke when the page is loaded.
@@ -8452,7 +8568,7 @@ var teamsCore;
8452
8568
  /**
8453
8569
  * Registers a handler to be called before the page is unloaded.
8454
8570
  *
8455
- * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/build-tabs-for-meeting?tabs=desktop%2Cmeeting-chat-view-desktop%2Cmeeting-stage-view-desktop%2Cchannel-meeting-desktop#app-caching)
8571
+ * @remarks Check out [App Caching in Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/app-caching)
8456
8572
  * for a more detailed explanation about using this API.
8457
8573
  *
8458
8574
  * @param handler - The handler to invoke before the page is unloaded. If this handler returns true the page should