@microsoft/teams-js 2.35.0 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +4 -4
  2. package/dist/esm/packages/teams-js/dts/internal/childCommunication.d.ts +1 -1
  3. package/dist/esm/packages/teams-js/dts/internal/communication.d.ts +1 -1
  4. package/dist/esm/packages/teams-js/dts/internal/globalVars.d.ts +1 -0
  5. package/dist/esm/packages/teams-js/dts/internal/{appIdValidation.d.ts → idValidation.d.ts} +12 -1
  6. package/dist/esm/packages/teams-js/dts/internal/messageObjects.d.ts +1 -0
  7. package/dist/esm/packages/teams-js/dts/internal/nestedAppAuthUtils.d.ts +3 -1
  8. package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +3 -0
  9. package/dist/esm/packages/teams-js/dts/private/externalAppCardActionsForDA.d.ts +75 -0
  10. package/dist/esm/packages/teams-js/dts/private/externalAppErrorHandling.d.ts +19 -0
  11. package/dist/esm/packages/teams-js/dts/private/index.d.ts +2 -0
  12. package/dist/esm/packages/teams-js/dts/private/nestedAppAuth/nestedAppAuthBridge.d.ts +32 -0
  13. package/dist/esm/packages/teams-js/dts/public/appId.d.ts +6 -11
  14. package/dist/esm/packages/teams-js/dts/public/featureFlags.d.ts +44 -0
  15. package/dist/esm/packages/teams-js/dts/public/index.d.ts +2 -0
  16. package/dist/esm/packages/teams-js/dts/public/nestedAppAuth.d.ts +56 -5
  17. package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +3 -0
  18. package/dist/esm/packages/teams-js/dts/public/uuidObject.d.ts +15 -1
  19. package/dist/esm/packages/teams-js/dts/public/validatedSafeString.d.ts +25 -0
  20. package/dist/esm/packages/teams-js/src/index.js +1 -1
  21. package/dist/esm/packages/teams-js/src/internal/childCommunication.js +1 -1
  22. package/dist/esm/packages/teams-js/src/internal/communication.js +1 -1
  23. package/dist/esm/packages/teams-js/src/internal/globalVars.js +1 -1
  24. package/dist/esm/packages/teams-js/src/internal/idValidation.js +1 -0
  25. package/dist/esm/packages/teams-js/src/internal/nestedAppAuthUtils.js +1 -1
  26. package/dist/esm/packages/teams-js/src/private/constants.js +1 -0
  27. package/dist/esm/packages/teams-js/src/private/externalAppAuthenticationForCEA.js +1 -1
  28. package/dist/esm/packages/teams-js/src/private/externalAppCardActionsForDA.js +1 -0
  29. package/dist/esm/packages/teams-js/src/private/externalAppErrorHandling.js +1 -0
  30. package/dist/esm/packages/teams-js/src/private/nestedAppAuth/nestedAppAuthBridge.js +1 -0
  31. package/dist/esm/packages/teams-js/src/public/appId.js +1 -1
  32. package/dist/esm/packages/teams-js/src/public/featureFlags.js +1 -0
  33. package/dist/esm/packages/teams-js/src/public/nestedAppAuth.js +1 -1
  34. package/dist/esm/packages/teams-js/src/public/runtime.js +1 -1
  35. package/dist/esm/packages/teams-js/src/public/uuidObject.js +1 -1
  36. package/dist/esm/packages/teams-js/src/public/validatedSafeString.js +1 -0
  37. package/dist/esm/packages/teams-js/src/public/version.js +1 -1
  38. package/dist/umd/MicrosoftTeams.js +769 -48
  39. package/dist/umd/MicrosoftTeams.js.map +1 -1
  40. package/dist/umd/MicrosoftTeams.min.js +1 -1
  41. package/dist/umd/MicrosoftTeams.min.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/esm/packages/teams-js/src/internal/appIdValidation.js +0 -1
@@ -1011,7 +1011,9 @@ __webpack_require__.d(__webpack_exports__, {
1011
1011
  UUID: () => (/* reexport */ UUID),
1012
1012
  UserSettingTypes: () => (/* reexport */ UserSettingTypes),
1013
1013
  UserTeamRole: () => (/* reexport */ UserTeamRole),
1014
+ ValidatedSafeString: () => (/* reexport */ validatedSafeString_ValidatedSafeString),
1014
1015
  ViewerActionTypes: () => (/* reexport */ ViewerActionTypes),
1016
+ activateChildProxyingCommunication: () => (/* reexport */ activateChildProxyingCommunication),
1015
1017
  app: () => (/* reexport */ app_namespaceObject),
1016
1018
  appEntity: () => (/* reexport */ appEntity_namespaceObject),
1017
1019
  appInitialization: () => (/* reexport */ appInitialization_namespaceObject),
@@ -1031,11 +1033,13 @@ __webpack_require__.d(__webpack_exports__, {
1031
1033
  externalAppAuthenticationForCEA: () => (/* reexport */ externalAppAuthenticationForCEA_namespaceObject),
1032
1034
  externalAppCardActions: () => (/* reexport */ externalAppCardActions_namespaceObject),
1033
1035
  externalAppCardActionsForCEA: () => (/* reexport */ externalAppCardActionsForCEA_namespaceObject),
1036
+ externalAppCardActionsForDA: () => (/* reexport */ externalAppCardActionsForDA_namespaceObject),
1034
1037
  externalAppCommands: () => (/* reexport */ externalAppCommands_namespaceObject),
1035
1038
  files: () => (/* reexport */ files_namespaceObject),
1036
1039
  geoLocation: () => (/* reexport */ geoLocation_namespaceObject),
1037
1040
  getAdaptiveCardSchemaVersion: () => (/* reexport */ getAdaptiveCardSchemaVersion),
1038
1041
  getContext: () => (/* reexport */ publicAPIs_getContext),
1042
+ getCurrentFeatureFlagsState: () => (/* reexport */ getCurrentFeatureFlagsState),
1039
1043
  getMruTabInstances: () => (/* reexport */ publicAPIs_getMruTabInstances),
1040
1044
  getTabInstances: () => (/* reexport */ publicAPIs_getTabInstances),
1041
1045
  hostEntity: () => (/* reexport */ hostEntity_namespaceObject),
@@ -1056,9 +1060,11 @@ __webpack_require__.d(__webpack_exports__, {
1056
1060
  navigateCrossDomain: () => (/* reexport */ navigation_navigateCrossDomain),
1057
1061
  navigateToTab: () => (/* reexport */ navigation_navigateToTab),
1058
1062
  nestedAppAuth: () => (/* reexport */ nestedAppAuth_namespaceObject),
1063
+ nestedAppAuthBridge: () => (/* reexport */ nestedAppAuthBridge_namespaceObject),
1059
1064
  notifications: () => (/* reexport */ notifications_namespaceObject),
1060
1065
  openFilePreview: () => (/* reexport */ openFilePreview),
1061
1066
  otherAppStateChange: () => (/* reexport */ otherAppStateChange_namespaceObject),
1067
+ overwriteFeatureFlagsState: () => (/* reexport */ overwriteFeatureFlagsState),
1062
1068
  pages: () => (/* reexport */ pages_namespaceObject),
1063
1069
  people: () => (/* reexport */ people_namespaceObject),
1064
1070
  print: () => (/* reexport */ publicAPIs_print),
@@ -1081,6 +1087,7 @@ __webpack_require__.d(__webpack_exports__, {
1081
1087
  secondaryBrowser: () => (/* reexport */ secondaryBrowser_namespaceObject),
1082
1088
  sendCustomEvent: () => (/* reexport */ sendCustomEvent),
1083
1089
  sendCustomMessage: () => (/* reexport */ sendCustomMessage),
1090
+ setFeatureFlagsState: () => (/* reexport */ setFeatureFlagsState),
1084
1091
  setFrameContext: () => (/* reexport */ setFrameContext),
1085
1092
  settings: () => (/* reexport */ settings_namespaceObject),
1086
1093
  shareDeepLink: () => (/* reexport */ publicAPIs_shareDeepLink),
@@ -1412,6 +1419,15 @@ __webpack_require__.d(externalAppCardActionsForCEA_namespaceObject, {
1412
1419
  processActionSubmit: () => (externalAppCardActionsForCEA_processActionSubmit)
1413
1420
  });
1414
1421
 
1422
+ // NAMESPACE OBJECT: ./src/private/externalAppCardActionsForDA.ts
1423
+ var externalAppCardActionsForDA_namespaceObject = {};
1424
+ __webpack_require__.r(externalAppCardActionsForDA_namespaceObject);
1425
+ __webpack_require__.d(externalAppCardActionsForDA_namespaceObject, {
1426
+ SerializableActionOpenUrlDialogInfo: () => (SerializableActionOpenUrlDialogInfo),
1427
+ isSupported: () => (externalAppCardActionsForDA_isSupported),
1428
+ processActionOpenUrlDialog: () => (processActionOpenUrlDialog)
1429
+ });
1430
+
1415
1431
  // NAMESPACE OBJECT: ./src/private/externalAppCommands.ts
1416
1432
  var externalAppCommands_namespaceObject = {};
1417
1433
  __webpack_require__.r(externalAppCommands_namespaceObject);
@@ -1470,6 +1486,14 @@ __webpack_require__.d(messageChannels_namespaceObject, {
1470
1486
  telemetry: () => (messageChannels_telemetry_namespaceObject)
1471
1487
  });
1472
1488
 
1489
+ // NAMESPACE OBJECT: ./src/private/nestedAppAuth/nestedAppAuthBridge.ts
1490
+ var nestedAppAuthBridge_namespaceObject = {};
1491
+ __webpack_require__.r(nestedAppAuthBridge_namespaceObject);
1492
+ __webpack_require__.d(nestedAppAuthBridge_namespaceObject, {
1493
+ initialize: () => (nestedAppAuthBridge_initialize),
1494
+ version: () => (nestedAppAuthBridge_version)
1495
+ });
1496
+
1473
1497
  // NAMESPACE OBJECT: ./src/private/notifications.ts
1474
1498
  var notifications_namespaceObject = {};
1475
1499
  __webpack_require__.r(notifications_namespaceObject);
@@ -1676,6 +1700,11 @@ __webpack_require__.d(clipboard_namespaceObject, {
1676
1700
  var nestedAppAuth_namespaceObject = {};
1677
1701
  __webpack_require__.r(nestedAppAuth_namespaceObject);
1678
1702
  __webpack_require__.d(nestedAppAuth_namespaceObject, {
1703
+ addNAATrustedOrigins: () => (addNAATrustedOrigins),
1704
+ canParentManageNAATrustedOrigins: () => (canParentManageNAATrustedOrigins),
1705
+ deleteNAATrustedOrigins: () => (deleteNAATrustedOrigins),
1706
+ getParentOrigin: () => (getParentOrigin),
1707
+ isDeeplyNestedAuthSupported: () => (isDeeplyNestedAuthSupported),
1679
1708
  isNAAChannelRecommended: () => (isNAAChannelRecommended)
1680
1709
  });
1681
1710
 
@@ -2343,20 +2372,6 @@ const errorRuntimeNotSupported = 'The runtime version is not supported';
2343
2372
  /** @hidden */
2344
2373
  const errorCallNotStarted = 'The call was not properly started';
2345
2374
 
2346
- ;// ./src/internal/globalVars.ts
2347
- class GlobalVars {
2348
- }
2349
- GlobalVars.initializeCalled = false;
2350
- GlobalVars.initializeCompleted = false;
2351
- GlobalVars.additionalValidOrigins = [];
2352
- GlobalVars.initializePromise = undefined;
2353
- GlobalVars.isFramelessWindow = false;
2354
- GlobalVars.frameContext = undefined;
2355
- GlobalVars.hostClientType = undefined;
2356
- GlobalVars.printCapabilityEnabled = false;
2357
-
2358
- // EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js
2359
- var browser = __webpack_require__(815);
2360
2375
  // EXTERNAL MODULE: ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
2361
2376
  var base64_js = __webpack_require__(933);
2362
2377
  ;// ../../node_modules/.pnpm/skeleton-buffer@file+skeleton-buffer/node_modules/skeleton-buffer/index.js
@@ -4026,8 +4041,43 @@ class UUID {
4026
4041
  toString() {
4027
4042
  return this.uuid;
4028
4043
  }
4044
+ /**
4045
+ * @returns A serializable representation of an uuid, used for passing uuids to the host.
4046
+ */
4047
+ serialize() {
4048
+ return this.toString();
4049
+ }
4029
4050
  }
4051
+ /**
4052
+ * @hidden
4053
+ * Checks if the incoming id is an instance of ValidatedSafeString
4054
+ * @param id An object to check if it's an instance of ValidatedSafeString
4055
+ * @throws Error with a message describing the violation
4056
+ * @internal
4057
+ * Limited to Microsoft-internal use
4058
+ */
4059
+ function validateUuidInstance(id) {
4060
+ if (!(id instanceof UUID)) {
4061
+ throw new Error(`Potential id (${JSON.stringify(id)}) is invalid; it is not an instance of UUID class.`);
4062
+ }
4063
+ }
4064
+
4065
+ ;// ./src/internal/globalVars.ts
4066
+
4067
+ class GlobalVars {
4068
+ }
4069
+ GlobalVars.initializeCalled = false;
4070
+ GlobalVars.initializeCompleted = false;
4071
+ GlobalVars.additionalValidOrigins = [];
4072
+ GlobalVars.initializePromise = undefined;
4073
+ GlobalVars.isFramelessWindow = false;
4074
+ GlobalVars.frameContext = undefined;
4075
+ GlobalVars.hostClientType = undefined;
4076
+ GlobalVars.printCapabilityEnabled = false;
4077
+ GlobalVars.teamsJsInstanceId = new UUID().toString();
4030
4078
 
4079
+ // EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js
4080
+ var browser = __webpack_require__(815);
4031
4081
  ;// ./src/internal/telemetry.ts
4032
4082
  // We are directly referencing the browser implementation of `debug` to resolve an issue with polyfilling. For a full write-up on the bug please see ADO Bug #9619161
4033
4083
 
@@ -4148,6 +4198,7 @@ let runtime = _uninitializedRuntime;
4148
4198
  const versionAndPlatformAgnosticTeamsRuntimeConfig = {
4149
4199
  apiVersion: 4,
4150
4200
  isNAAChannelRecommended: false,
4201
+ isDeeplyNestedAuthSupported: false,
4151
4202
  hostVersionsInfo: teamsMinAdaptiveCardVersion,
4152
4203
  isLegacyTeams: true,
4153
4204
  supports: {
@@ -4484,7 +4535,65 @@ function isSerializable(arg) {
4484
4535
  * @hidden
4485
4536
  * Package version.
4486
4537
  */
4487
- const version = "2.35.0";
4538
+ const version = "2.36.0";
4539
+
4540
+ ;// ./src/public/featureFlags.ts
4541
+ // All build feature flags are defined inside this object. Any build feature flag must have its own unique getter and setter function. This pattern allows for client apps to treeshake unused code and avoid including code guarded by this feature flags in the final bundle. If this property isn't desired, use the below runtime feature flags object.
4542
+ const buildFeatureFlags = {
4543
+ childProxyingCommunication: false,
4544
+ };
4545
+ /**
4546
+ * This function enables child proxying communication for apps that still needs it.
4547
+ *
4548
+ * @deprecated Child proxying is considered an insecure feature and will be removed in future releases.
4549
+ */
4550
+ function activateChildProxyingCommunication() {
4551
+ buildFeatureFlags.childProxyingCommunication = true;
4552
+ }
4553
+ /**
4554
+ * @hidden
4555
+ * @internal
4556
+ * Limited to Microsoft-internal use.
4557
+ */
4558
+ function isChildProxyingEnabled() {
4559
+ return buildFeatureFlags.childProxyingCommunication;
4560
+ }
4561
+ /**
4562
+ * @hidden
4563
+ * @internal
4564
+ * Limited to Microsoft-internal use.
4565
+ */
4566
+ function resetBuildFeatureFlags() {
4567
+ buildFeatureFlags.childProxyingCommunication = false;
4568
+ }
4569
+ // Default runtime feature flags
4570
+ const defaultFeatureFlags = {
4571
+ disableEnforceOriginMatchForChildResponses: false,
4572
+ };
4573
+ // Object that stores the current runtime feature flag state
4574
+ let runtimeFeatureFlags = defaultFeatureFlags;
4575
+ /**
4576
+ * @returns The current state of the runtime feature flags.
4577
+ */
4578
+ function getCurrentFeatureFlagsState() {
4579
+ return runtimeFeatureFlags;
4580
+ }
4581
+ /**
4582
+ * It sets the runtime feature flags to the new feature flags provided.
4583
+ * @param featureFlags The new feature flags to set.
4584
+ */
4585
+ function setFeatureFlagsState(featureFlags) {
4586
+ runtimeFeatureFlags = featureFlags;
4587
+ }
4588
+ /**
4589
+ * It overwrites all the feature flags in the runtime feature flags object with the new feature flags provided.
4590
+ * @param newFeatureFlags The new feature flags to set.
4591
+ * @returns The current state of the runtime feature flags.
4592
+ */
4593
+ function overwriteFeatureFlagsState(newFeatureFlags) {
4594
+ setFeatureFlagsState(Object.assign(Object.assign({}, runtimeFeatureFlags), newFeatureFlags));
4595
+ return getCurrentFeatureFlagsState();
4596
+ }
4488
4597
 
4489
4598
  ;// ./src/internal/messageObjects.ts
4490
4599
  var messageObjects_rest = (undefined && undefined.__rest) || function (s, e) {
@@ -4689,7 +4798,8 @@ function processAdditionalValidOrigins(validMessageOrigins) {
4689
4798
  GlobalVars.additionalValidOrigins = combinedOriginUrls;
4690
4799
  }
4691
4800
 
4692
- ;// ./src/internal/appIdValidation.ts
4801
+ ;// ./src/internal/idValidation.ts
4802
+
4693
4803
 
4694
4804
 
4695
4805
  /**
@@ -4703,13 +4813,15 @@ function processAdditionalValidOrigins(validMessageOrigins) {
4703
4813
  * @param potentialAppId A string to check if it's a "valid" app id
4704
4814
  * @throws Error with a message describing the exact validation violation
4705
4815
  */
4706
- function validateStringAsAppId(potentialAppId) {
4707
- if (hasScriptTags(potentialAppId)) {
4708
- throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains script tags.`);
4709
- }
4816
+ function validateStringLength(potentialAppId) {
4710
4817
  if (!isStringWithinAppIdLengthLimits(potentialAppId)) {
4711
4818
  throw new Error(`Potential app id (${potentialAppId}) is invalid; its length ${potentialAppId.length} is not within the length limits (${minimumValidAppIdLength}-${maximumValidAppIdLength}).`);
4712
4819
  }
4820
+ }
4821
+ function validateSafeContent(potentialAppId) {
4822
+ if (hasScriptTags(potentialAppId)) {
4823
+ throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains script tags.`);
4824
+ }
4713
4825
  if (doesStringContainNonPrintableCharacters(potentialAppId)) {
4714
4826
  throw new Error(`Potential app id (${potentialAppId}) is invalid; it contains non-printable characters.`);
4715
4827
  }
@@ -4738,9 +4850,56 @@ function validateAppIdInstance(potentialAppId) {
4738
4850
  throw new Error(`Potential app id (${potentialAppId}) is invalid; it is not an instance of AppId class.`);
4739
4851
  }
4740
4852
  }
4853
+ /**
4854
+ * @hidden
4855
+ * Checks if the incoming string is an instance of ValidatedSafeString
4856
+ * @param incomingString An object to check if it's an instance of ValidatedSafeString
4857
+ * @throws Error with a message describing the violation
4858
+ * @internal
4859
+ * Limited to Microsoft-internal use
4860
+ */
4861
+ function validateSafeStringInstance(incomingString) {
4862
+ if (!(incomingString instanceof ValidatedSafeString)) {
4863
+ throw new Error(`The string (${incomingString}) is invalid; it is not an instance of ValidatedSafeString class.`);
4864
+ }
4865
+ }
4866
+
4867
+ ;// ./src/public/validatedSafeString.ts
4868
+
4869
+ /**
4870
+ * A strongly typed class used to represent a "valid" string id.
4871
+ */
4872
+ class validatedSafeString_ValidatedSafeString {
4873
+ /**
4874
+ * Creates a strongly-typed Id from a string
4875
+ *
4876
+ * @param idAsString An id represented as a string
4877
+ * @throws Error with a message describing the exact validation violation
4878
+ */
4879
+ constructor(idAsString) {
4880
+ this.idAsString = idAsString;
4881
+ validateSafeContent(idAsString);
4882
+ }
4883
+ /**
4884
+ * @hidden
4885
+ * @internal
4886
+ *
4887
+ * @returns A serializable representation of an AppId, used for passing AppIds to the host.
4888
+ */
4889
+ serialize() {
4890
+ return this.toString();
4891
+ }
4892
+ /**
4893
+ * Returns the app id as a string
4894
+ */
4895
+ toString() {
4896
+ return this.idAsString;
4897
+ }
4898
+ }
4741
4899
 
4742
4900
  ;// ./src/public/appId.ts
4743
4901
 
4902
+
4744
4903
  /**
4745
4904
  * A strongly-typed class used to represent a "valid" app id.
4746
4905
  *
@@ -4752,7 +4911,7 @@ function validateAppIdInstance(potentialAppId) {
4752
4911
  * for script tags, length, and non-printable characters. Validation will be updated in the future to ensure
4753
4912
  * the app id is a valid UUID as legacy apps update.
4754
4913
  */
4755
- class AppId {
4914
+ class AppId extends validatedSafeString_ValidatedSafeString {
4756
4915
  /**
4757
4916
  * Creates a strongly-typed AppId from a string
4758
4917
  *
@@ -4760,23 +4919,17 @@ class AppId {
4760
4919
  * @throws Error with a message describing the exact validation violation
4761
4920
  */
4762
4921
  constructor(appIdAsString) {
4763
- this.appIdAsString = appIdAsString;
4764
- validateStringAsAppId(appIdAsString);
4922
+ super(appIdAsString);
4923
+ validateStringLength(appIdAsString);
4765
4924
  }
4766
4925
  /**
4767
- * @hidden
4768
- * @internal
4926
+ * Returns a JSON representation of the AppId object
4927
+ * @returns A JSON representation of the AppId object
4769
4928
  *
4770
- * @returns A serializable representation of an AppId, used for passing AppIds to the host.
4929
+ * note: this method maintains backward compatibility for JSON serialization
4771
4930
  */
4772
- serialize() {
4773
- return this.toString();
4774
- }
4775
- /**
4776
- * Returns the app id as a string
4777
- */
4778
- toString() {
4779
- return this.appIdAsString;
4931
+ toJSON() {
4932
+ return { appIdAsString: this.toString() };
4780
4933
  }
4781
4934
  }
4782
4935
 
@@ -7522,6 +7675,7 @@ var childCommunication_awaiter = (undefined && undefined.__awaiter) || function
7522
7675
 
7523
7676
 
7524
7677
 
7678
+
7525
7679
  const communicationLogger = getLogger('childProxyingCommunication');
7526
7680
  /**
7527
7681
  * @internal
@@ -7545,6 +7699,9 @@ function uninitializeChildCommunication() {
7545
7699
  * Limited to Microsoft-internal use
7546
7700
  */
7547
7701
  function shouldEventBeRelayedToChild() {
7702
+ if (!isChildProxyingEnabled()) {
7703
+ return false;
7704
+ }
7548
7705
  return !!ChildCommunication.window;
7549
7706
  }
7550
7707
  /**
@@ -7553,6 +7710,9 @@ function shouldEventBeRelayedToChild() {
7553
7710
  * Limited to Microsoft-internal use
7554
7711
  */
7555
7712
  function shouldProcessChildMessage(messageSource, messageOrigin) {
7713
+ if (!isChildProxyingEnabled()) {
7714
+ return false;
7715
+ }
7556
7716
  if (!ChildCommunication.window || ChildCommunication.window.closed || messageSource === ChildCommunication.window) {
7557
7717
  ChildCommunication.window = messageSource;
7558
7718
  ChildCommunication.origin = messageOrigin;
@@ -7609,15 +7769,24 @@ function handleIncomingMessage(evt, sendMessageToParentHelper, setCallbackForReq
7609
7769
  * Limited to Microsoft-internal use
7610
7770
  */
7611
7771
  function sendChildMessageToParent(message, sendMessageToParentHelper, setCallbackForRequest) {
7612
- const request = sendMessageToParentHelper(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "tasks.startTask" /* ApiName.Tasks_StartTask */), message.func, message.args, true);
7772
+ const request = sendMessageToParentHelper(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "tasks.startTask" /* ApiName.Tasks_StartTask */), message.func, message.args, true, // Tags message as proxied from child
7773
+ message.teamsJsInstanceId);
7774
+ // Copy variable to new pointer
7775
+ const requestChildWindowOrigin = ChildCommunication.origin;
7613
7776
  setCallbackForRequest(request.uuid, (...args) => {
7614
- if (ChildCommunication.window) {
7615
- const isPartialResponse = args.pop();
7616
- handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
7617
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7618
- // @ts-ignore
7619
- sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
7777
+ if (!ChildCommunication.window) {
7778
+ return;
7779
+ }
7780
+ if (!getCurrentFeatureFlagsState().disableEnforceOriginMatchForChildResponses &&
7781
+ requestChildWindowOrigin !== ChildCommunication.origin) {
7782
+ handleIncomingMessageFromChildLogger('Origin of child window has changed, not sending response back to child window');
7783
+ return;
7620
7784
  }
7785
+ const isPartialResponse = args.pop();
7786
+ handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
7787
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7788
+ // @ts-ignore
7789
+ sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
7621
7790
  });
7622
7791
  }
7623
7792
  /**
@@ -7769,6 +7938,7 @@ HostToAppMessageDelayTelemetry.callbackInformation = new Map();
7769
7938
 
7770
7939
  const nestedAppAuthLogger = getLogger('nestedAppAuthUtils');
7771
7940
  const tryPolyfillWithNestedAppAuthBridgeLogger = nestedAppAuthLogger.extend('tryPolyfillWithNestedAppAuthBridge');
7941
+ const nestedAppAuthTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
7772
7942
  /**
7773
7943
  * @hidden
7774
7944
  * Attempt to polyfill the nestedAppAuthBridge object on the given window
@@ -7787,6 +7957,11 @@ function tryPolyfillWithNestedAppAuthBridge(clientSupportedSDKVersion, window, h
7787
7957
  logger('Cannot polyfill nestedAppAuthBridge as current window does not exist');
7788
7958
  return;
7789
7959
  }
7960
+ // Skip injection if this is a nested iframe (i.e., not the top-most app)
7961
+ if (window.parent !== window.top) {
7962
+ logger('Default NAA bridge injection not supported in nested iframe. Use standalone NAA bridge instead.');
7963
+ return;
7964
+ }
7790
7965
  const parsedClientSupportedSDKVersion = (() => {
7791
7966
  try {
7792
7967
  return JSON.parse(clientSupportedSDKVersion);
@@ -7857,8 +8032,9 @@ function createNestedAppAuthBridge(window, bridgeHandlers) {
7857
8032
  logger('Unrecognized data format received by app, message being ignored. Message: %o', message);
7858
8033
  return;
7859
8034
  }
8035
+ const apiVersionTag = getApiVersionTag(nestedAppAuthTelemetryVersionNumber, "nestedAppAuth.execute" /* ApiName.NestedAppAuth_Execute */);
7860
8036
  // Post the message to the top window
7861
- sendPostMessage(message);
8037
+ sendPostMessage(message, apiVersionTag);
7862
8038
  },
7863
8039
  removeEventListener: (eventName, callback) => {
7864
8040
  window.removeEventListener(eventName, nestedAppAuthBridgeHandler(callback));
@@ -8199,10 +8375,10 @@ const sendNestedAuthRequestToTopWindowLogger = communication_communicationLogger
8199
8375
  * @internal
8200
8376
  * Limited to Microsoft-internal use
8201
8377
  */
8202
- function sendNestedAuthRequestToTopWindow(message) {
8378
+ function sendNestedAuthRequestToTopWindow(message, apiVersionTag) {
8203
8379
  const logger = sendNestedAuthRequestToTopWindowLogger;
8204
8380
  const targetWindow = Communication.topWindow;
8205
- const request = createNestedAppAuthRequest(message);
8381
+ const request = createNestedAppAuthRequest(message, apiVersionTag);
8206
8382
  logger('Message %s information: %o', getMessageIdsAsLogString(request), {
8207
8383
  actionName: request.func,
8208
8384
  });
@@ -8243,10 +8419,10 @@ const sendMessageToParentHelperLogger = communication_communicationLogger.extend
8243
8419
  * @internal
8244
8420
  * Limited to Microsoft-internal use
8245
8421
  */
8246
- function sendMessageToParentHelper(apiVersionTag, actionName, args, isProxiedFromChild) {
8422
+ function sendMessageToParentHelper(apiVersionTag, actionName, args, isProxiedFromChild, teamsJsInstanceId) {
8247
8423
  const logger = sendMessageToParentHelperLogger;
8248
8424
  const targetWindow = Communication.parentWindow;
8249
- const request = createMessageRequest(apiVersionTag, actionName, args, isProxiedFromChild);
8425
+ const request = createMessageRequest(apiVersionTag, actionName, args, isProxiedFromChild, teamsJsInstanceId);
8250
8426
  HostToAppMessageDelayTelemetry.storeCallbackInformation(request.uuid, {
8251
8427
  name: actionName,
8252
8428
  calledAt: request.timestamp,
@@ -8621,10 +8797,16 @@ function waitForMessageQueue(targetWindow, callback) {
8621
8797
  * @internal
8622
8798
  * Limited to Microsoft-internal use
8623
8799
  */
8624
- function createMessageRequest(apiVersionTag, func, args, isProxiedFromChild) {
8800
+ function createMessageRequest(apiVersionTag, func, args, isProxiedFromChild, teamsJsInstanceId) {
8625
8801
  const messageId = CommunicationPrivate.nextMessageId++;
8626
8802
  const messageUuid = new UUID();
8627
8803
  CommunicationPrivate.legacyMessageIdsToUuidMap[messageId] = messageUuid;
8804
+ /**
8805
+ * Only when `isProxiedFromChild` is explicitly set to be true, the message request is created and relayed for child app
8806
+ * Parent app needs to create and relay message request with whatever child app sent to it,
8807
+ * and parent app's TeamsJS instance ID can NOT be used in this case.
8808
+ */
8809
+ const tjsInstanceIdToAttach = isProxiedFromChild === true ? teamsJsInstanceId : GlobalVars.teamsJsInstanceId;
8628
8810
  return {
8629
8811
  id: messageId,
8630
8812
  uuid: messageUuid,
@@ -8634,6 +8816,7 @@ function createMessageRequest(apiVersionTag, func, args, isProxiedFromChild) {
8634
8816
  args: args || [],
8635
8817
  apiVersionTag: apiVersionTag,
8636
8818
  isProxiedFromChild: isProxiedFromChild !== null && isProxiedFromChild !== void 0 ? isProxiedFromChild : false,
8819
+ teamsJsInstanceId: tjsInstanceIdToAttach,
8637
8820
  };
8638
8821
  }
8639
8822
  /**
@@ -8647,7 +8830,7 @@ function createMessageRequest(apiVersionTag, func, args, isProxiedFromChild) {
8647
8830
  *
8648
8831
  * @returns {NestedAppAuthRequest} Returns a NestedAppAuthRequest object with a unique id, the function name set to 'nestedAppAuthRequest', the current timestamp, an empty args array, and the provided message as data.
8649
8832
  */
8650
- function createNestedAppAuthRequest(message) {
8833
+ function createNestedAppAuthRequest(message, apiVersionTag) {
8651
8834
  const messageId = CommunicationPrivate.nextMessageId++;
8652
8835
  const messageUuid = new UUID();
8653
8836
  CommunicationPrivate.legacyMessageIdsToUuidMap[messageId] = messageUuid;
@@ -8657,6 +8840,7 @@ function createNestedAppAuthRequest(message) {
8657
8840
  func: 'nestedAppAuth.execute',
8658
8841
  timestamp: Date.now(),
8659
8842
  monotonicTimestamp: getCurrentTimestamp(),
8843
+ apiVersionTag: apiVersionTag,
8660
8844
  // Since this is a nested app auth request, we don't need to send any args.
8661
8845
  // We avoid overloading the args array with the message to avoid potential issues processing of these messages on the hubSDK.
8662
8846
  args: [],
@@ -9896,6 +10080,138 @@ function externalAppCardActionsForCEA_isSupported() {
9896
10080
  return ensureInitialized(runtime) && runtime.supports.externalAppCardActionsForCEA ? true : false;
9897
10081
  }
9898
10082
 
10083
+ ;// ./src/private/constants.ts
10084
+ /**
10085
+ * @hidden
10086
+ * Error codes that can be thrown from externalAppCommands and externalAppCardCommands Action Submit specifically
10087
+ * @internal
10088
+ * Limited to Microsoft-internal use
10089
+ */
10090
+ var ExternalAppErrorCode;
10091
+ (function (ExternalAppErrorCode) {
10092
+ ExternalAppErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
10093
+ })(ExternalAppErrorCode || (ExternalAppErrorCode = {}));
10094
+
10095
+ ;// ./src/private/externalAppErrorHandling.ts
10096
+
10097
+ /**
10098
+ * @hidden
10099
+ * Determines if the provided error object is an instance of ExternalAppError
10100
+ * @internal
10101
+ * Limited to Microsoft-internal use
10102
+ * @param err The error object to check whether it is of ExternalAppError type
10103
+ */
10104
+ function isExternalAppError(err) {
10105
+ if (typeof err !== 'object' || err === null) {
10106
+ return false;
10107
+ }
10108
+ const error = err;
10109
+ return (Object.values(ExternalAppErrorCode).includes(error.errorCode) &&
10110
+ (error.message === undefined || typeof error.message === 'string'));
10111
+ }
10112
+
10113
+ ;// ./src/private/externalAppCardActionsForDA.ts
10114
+ /**
10115
+ * @beta
10116
+ * @hidden
10117
+ * Module to delegate adaptive card action for Declarative Agents execution to the host
10118
+ * @internal
10119
+ * Limited to Microsoft-internal use
10120
+ * @module
10121
+ */
10122
+ var externalAppCardActionsForDA_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
10123
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10124
+ return new (P || (P = Promise))(function (resolve, reject) {
10125
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10126
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10127
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10128
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10129
+ });
10130
+ };
10131
+
10132
+
10133
+
10134
+
10135
+
10136
+
10137
+
10138
+
10139
+ /**
10140
+ * All of APIs in this capability file should send out API version v2 ONLY
10141
+ */
10142
+ const externalAppCardActionsForDATelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
10143
+ /**
10144
+ * @beta
10145
+ * @hidden
10146
+ * Delegates an Adaptive Card Action.OpenUrlDialog request to the host for the application with the provided app ID
10147
+ * @internal
10148
+ * Limited to Microsoft-internal use
10149
+ * @param appId ID of the application the request is intended for. This must be a UUID
10150
+ * @param actionOpenUrlDialogInfo Information required to open the URL dialog
10151
+ * @param traceId The trace identifier used for monitoring and live site investigations
10152
+ * @returns Promise that resolves when the request is completed and rejects with ExternalAppError if the request fails
10153
+ */
10154
+ function processActionOpenUrlDialog(appId, actionOpenUrlDialogInfo, traceId) {
10155
+ return externalAppCardActionsForDA_awaiter(this, void 0, void 0, function* () {
10156
+ ensureInitialized(runtime, FrameContexts.content);
10157
+ if (!externalAppCardActionsForDA_isSupported()) {
10158
+ throw errorNotSupportedOnPlatform;
10159
+ }
10160
+ externalAppCardActionsForDA_validateInput(appId, traceId);
10161
+ return callFunctionInHost("externalAppCardActionsForDA.processActionOpenUrlDialog" /* ApiName.ExternalAppCardActionsForDA_ProcessActionOpenUrlDialog */, [appId, new SerializableActionOpenUrlDialogInfo(actionOpenUrlDialogInfo), traceId], getApiVersionTag(externalAppCardActionsForDATelemetryVersionNumber, "externalAppCardActionsForDA.processActionOpenUrlDialog" /* ApiName.ExternalAppCardActionsForDA_ProcessActionOpenUrlDialog */), isExternalAppError);
10162
+ });
10163
+ }
10164
+ /**
10165
+ * @beta
10166
+ * @hidden
10167
+ * Checks if the externalAppCardActions capability is supported by the host
10168
+ * @returns boolean to represent whether externalAppCardActions capability is supported
10169
+ *
10170
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
10171
+ *
10172
+ * @internal
10173
+ * Limited to Microsoft-internal use
10174
+ */
10175
+ function externalAppCardActionsForDA_isSupported() {
10176
+ return ensureInitialized(runtime) && runtime.supports.externalAppCardActionsForDA ? true : false;
10177
+ }
10178
+ /**
10179
+ * @beta
10180
+ * @hidden
10181
+ * Checks if the externalAppCardActions capability is supported by the host
10182
+ * @returns boolean to represent whether externalAppCardActions capability is supported
10183
+ *
10184
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
10185
+ *
10186
+ * @internal
10187
+ * Limited to Microsoft-internal use
10188
+ */
10189
+ function externalAppCardActionsForDA_validateInput(appId, traceId) {
10190
+ validateAppIdInstance(appId);
10191
+ validateUuidInstance(traceId);
10192
+ }
10193
+ /**
10194
+ * @beta
10195
+ * @hidden
10196
+ * Serializable class for ActionOpenUrlDialogInfo to send info to the host
10197
+ *
10198
+ * @internal
10199
+ * Limited to Microsoft-internal use
10200
+ */
10201
+ class SerializableActionOpenUrlDialogInfo {
10202
+ constructor(info) {
10203
+ this.info = info;
10204
+ }
10205
+ serialize() {
10206
+ const { url, title, size } = this.info;
10207
+ return {
10208
+ url: url.href,
10209
+ title,
10210
+ size,
10211
+ };
10212
+ }
10213
+ }
10214
+
9899
10215
  ;// ./src/private/externalAppCommands.ts
9900
10216
  /**
9901
10217
  * @hidden
@@ -10658,6 +10974,240 @@ function messageChannels_isSupported() {
10658
10974
  }
10659
10975
 
10660
10976
 
10977
+ ;// ./src/private/nestedAppAuth/nestedAppAuthBridge.ts
10978
+
10979
+ /**
10980
+ * @beta
10981
+ * @hidden
10982
+ * Local version of the Nested App Auth Bridge module.
10983
+ *
10984
+ * This version is specific to this standalone module and is not tied to the overall TeamsJS SDK version.
10985
+ * It allows developers to track changes within this module and handle version-based compatibility if needed.
10986
+ *
10987
+ * While not strictly required today, having a version provides flexibility for future updates,
10988
+ * especially if breaking changes are introduced later.
10989
+ *
10990
+ * Example:
10991
+ * if (nestedAppAuthBridge.version.startsWith('1.')) {
10992
+ * // Safe to use with current logic
10993
+ * }
10994
+ *
10995
+ * @internal
10996
+ * Limited to Microsoft-internal use
10997
+ */
10998
+ const nestedAppAuthBridge_version = '1.0.0';
10999
+ /**
11000
+ * Bridge handlers used for processing messages.
11001
+ */
11002
+ const bridgeHandlers = {
11003
+ onMessage: nestedAppAuthBridge_processAuthBridgeMessage,
11004
+ };
11005
+ let topOriginForNAA = null;
11006
+ let isNAALoggerEnabled = false;
11007
+ /**
11008
+ * @beta
11009
+ * @hidden
11010
+ * Initializes the Nested App Auth Bridge.
11011
+ * @param window The window object where the bridge will be attached.
11012
+ * @param topOrigin The origin of the top-level frame.
11013
+ * @param enableLogging - Optional flag to enable internal debug and error logging. Defaults to false.
11014
+ *
11015
+ * @internal
11016
+ * Limited to Microsoft-internal use
11017
+ */
11018
+ function nestedAppAuthBridge_initialize(window, topOrigin, enableLogging = false) {
11019
+ isNAALoggerEnabled = enableLogging;
11020
+ if (!window) {
11021
+ throw new Error('Cannot polyfill nestedAppAuthBridge as the current window does not exist');
11022
+ }
11023
+ if (!topOrigin) {
11024
+ throw new Error('Top origin is required to initialize the Nested App Auth Bridge');
11025
+ }
11026
+ try {
11027
+ const parsedOrigin = new URL(topOrigin);
11028
+ if (parsedOrigin.protocol !== 'https:') {
11029
+ throw new Error(`Invalid top origin: ${topOrigin}. Only HTTPS origins are allowed.`);
11030
+ }
11031
+ topOriginForNAA = parsedOrigin.origin;
11032
+ }
11033
+ catch (error) {
11034
+ throw new Error(`Failed to initialize bridge: invalid top origin: ${topOrigin}`);
11035
+ }
11036
+ const extendedWindow = window;
11037
+ // If the bridge is already present, return.
11038
+ if (extendedWindow.nestedAppAuthBridge) {
11039
+ log('Nested App Auth Bridge is already present');
11040
+ return;
11041
+ }
11042
+ // Create and assign the bridge to the window.
11043
+ const nestedAppAuthBridge = nestedAppAuthBridge_createNestedAppAuthBridge(extendedWindow);
11044
+ if (nestedAppAuthBridge) {
11045
+ extendedWindow.nestedAppAuthBridge = nestedAppAuthBridge;
11046
+ }
11047
+ }
11048
+ /**
11049
+ * Creates the Nested App Auth Bridge.
11050
+ * @param window The window object where the bridge is being injected.
11051
+ * @returns A NestedAppAuthBridge instance.
11052
+ */
11053
+ function nestedAppAuthBridge_createNestedAppAuthBridge(window) {
11054
+ const messageHandlers = new WeakMap();
11055
+ const { onMessage } = bridgeHandlers;
11056
+ const nestedAppAuthBridgeHandler = (callback) => (evt) => onMessage(evt, callback);
11057
+ return {
11058
+ /**
11059
+ * Adds an event listener for message events.
11060
+ */
11061
+ addEventListener: (eventName, callback) => {
11062
+ if (eventName === 'message') {
11063
+ const handler = nestedAppAuthBridgeHandler(callback);
11064
+ messageHandlers.set(callback, handler);
11065
+ window.addEventListener(eventName, handler);
11066
+ }
11067
+ else {
11068
+ log(`Event ${eventName} is not supported by nestedAppAuthBridge`);
11069
+ }
11070
+ },
11071
+ /**
11072
+ * Sends a message using postMessage.
11073
+ */
11074
+ postMessage: (message) => {
11075
+ if (window.top) {
11076
+ try {
11077
+ const parsedMessage = JSON.parse(message);
11078
+ if (typeof parsedMessage === 'object' &&
11079
+ parsedMessage.messageType === "NestedAppAuthRequest" /* NestedAppAuthMessageEventNames.Request */) {
11080
+ const request = nestedAppAuthBridge_createNestedAppAuthRequest(message);
11081
+ if (window !== window.top && topOriginForNAA) {
11082
+ window.top.postMessage(request, topOriginForNAA);
11083
+ }
11084
+ else {
11085
+ logError('Not in an embedded iframe; skipping postMessage.');
11086
+ return;
11087
+ }
11088
+ }
11089
+ }
11090
+ catch (error) {
11091
+ logError('Failed to parse message:', error, 'Original message:', message);
11092
+ return;
11093
+ }
11094
+ }
11095
+ else {
11096
+ throw new Error('window.top is not available for posting messages');
11097
+ }
11098
+ },
11099
+ /**
11100
+ * Removes a previously attached event listener.
11101
+ */
11102
+ removeEventListener: (eventName, callback) => {
11103
+ const handler = messageHandlers.get(callback);
11104
+ if (handler) {
11105
+ window.removeEventListener(eventName, handler);
11106
+ messageHandlers.delete(callback);
11107
+ }
11108
+ },
11109
+ };
11110
+ }
11111
+ /**
11112
+ * Processes messages received through the auth bridge.
11113
+ * @param evt The message event containing the response.
11114
+ * @param onMessageReceived Callback function to handle the received message.
11115
+ */
11116
+ function nestedAppAuthBridge_processAuthBridgeMessage(evt, onMessageReceived) {
11117
+ if (!evt || !evt.data || typeof evt.data !== 'object' || evt.data === null) {
11118
+ log('Invalid message format, ignoring. Message: %o', evt);
11119
+ return;
11120
+ }
11121
+ // Validate message source before processing
11122
+ if (!nestedAppAuthBridge_shouldProcessIncomingMessage(evt.source, evt.origin)) {
11123
+ log('Message source/origin not allowed, ignoring.');
11124
+ return;
11125
+ }
11126
+ const { args } = evt.data;
11127
+ const [, message] = args !== null && args !== void 0 ? args : [];
11128
+ const parsedData = (() => {
11129
+ try {
11130
+ return JSON.parse(message);
11131
+ }
11132
+ catch (error) {
11133
+ logError('Failed to parse response message:', error);
11134
+ return null;
11135
+ }
11136
+ })();
11137
+ if (!parsedData || parsedData.messageType !== "NestedAppAuthResponse" /* NestedAppAuthMessageEventNames.Response */) {
11138
+ log('Invalid response format, ignoring. Message: %o', evt);
11139
+ return;
11140
+ }
11141
+ onMessageReceived(message);
11142
+ }
11143
+ function nestedAppAuthBridge_shouldProcessIncomingMessage(messageSource, messageOrigin) {
11144
+ // Reject messages if they are not from the top window
11145
+ if (messageSource && messageSource !== window.top) {
11146
+ log('Should not process message because it is not coming from the top window');
11147
+ return false;
11148
+ }
11149
+ // Check if messageOrigin matches topOriginForNAA
11150
+ if (messageOrigin === topOriginForNAA) {
11151
+ try {
11152
+ return new URL(messageOrigin).protocol === 'https:';
11153
+ }
11154
+ catch (error) {
11155
+ logError('Invalid message origin URL:', error);
11156
+ return false;
11157
+ }
11158
+ }
11159
+ return false;
11160
+ }
11161
+ /**
11162
+ * Creates a NAA request with a unique ID and timestamp.
11163
+ * @param data The data to be included in the request.
11164
+ * @returns A stringified JSON request object.
11165
+ */
11166
+ function nestedAppAuthBridge_createNestedAppAuthRequest(data) {
11167
+ const timestamp = Date.now();
11168
+ return {
11169
+ id: generateUniqueId(),
11170
+ uuid: esm_browser_v4(),
11171
+ func: 'nestedAppAuth.execute',
11172
+ timestamp: timestamp,
11173
+ apiVersionTag: 'v2_nestedAppAuth.execute',
11174
+ monotonicTimestamp: timestamp,
11175
+ args: [],
11176
+ data,
11177
+ };
11178
+ }
11179
+ /**
11180
+ * Generates a unique ID for NAA auth requests.
11181
+ * @returns A randomly generated unique string.
11182
+ */
11183
+ function generateUniqueId() {
11184
+ return typeof crypto !== 'undefined' && crypto.randomUUID
11185
+ ? crypto.randomUUID()
11186
+ : Math.random().toString(36).substring(2, 11);
11187
+ }
11188
+ /**
11189
+ * Logs informational messages to the console if logging is enabled.
11190
+ * Used internally for non-critical debug output.
11191
+ *
11192
+ * @param args - The data to be logged.
11193
+ */
11194
+ function log(...args) {
11195
+ if (isNAALoggerEnabled) {
11196
+ console.log(...args);
11197
+ }
11198
+ }
11199
+ /**
11200
+ * Logs error messages to the console if logging is enabled.
11201
+ * Used internally for debugging and error tracing.
11202
+ *
11203
+ * @param args - The error data to be logged.
11204
+ */
11205
+ function logError(...args) {
11206
+ if (isNAALoggerEnabled) {
11207
+ console.error(...args);
11208
+ }
11209
+ }
11210
+
10661
11211
  ;// ./src/private/notifications.ts
10662
11212
  /**
10663
11213
  * @hidden
@@ -12947,6 +13497,10 @@ function serializeValidSize(size) {
12947
13497
 
12948
13498
 
12949
13499
 
13500
+
13501
+
13502
+
13503
+
12950
13504
 
12951
13505
 
12952
13506
 
@@ -14311,6 +14865,15 @@ function clipboard_isSupported() {
14311
14865
  }
14312
14866
 
14313
14867
  ;// ./src/public/nestedAppAuth.ts
14868
+ var nestedAppAuth_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
14869
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14870
+ return new (P || (P = Promise))(function (resolve, reject) {
14871
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14872
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14873
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14874
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14875
+ });
14876
+ };
14314
14877
  /**
14315
14878
  * @beta
14316
14879
  * Nested app auth capabilities
@@ -14320,6 +14883,24 @@ function clipboard_isSupported() {
14320
14883
 
14321
14884
 
14322
14885
 
14886
+
14887
+
14888
+ /**
14889
+ * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
14890
+ */
14891
+ const nestedAppAuth_hostEntityTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
14892
+ /**
14893
+ * Response handler for managing NAA Trusted Origins.
14894
+ */
14895
+ const trustedOriginResponseHandler = {
14896
+ validate: (response) => Array.isArray(response) || typeof response === 'object',
14897
+ deserialize: (response) => response,
14898
+ };
14899
+ var TrustedOriginAction;
14900
+ (function (TrustedOriginAction) {
14901
+ TrustedOriginAction["ADD"] = "ADD";
14902
+ TrustedOriginAction["DELETE"] = "DELETE";
14903
+ })(TrustedOriginAction || (TrustedOriginAction = {}));
14323
14904
  /**
14324
14905
  * Checks if MSAL-NAA channel recommended by the host
14325
14906
  * @returns true if host is recommending NAA channel and false otherwise
@@ -14333,6 +14914,47 @@ function isNAAChannelRecommended() {
14333
14914
  return ((_a = (ensureInitialized(runtime) &&
14334
14915
  (runtime.isNAAChannelRecommended || isNAAChannelRecommendedForLegacyTeamsMobile()))) !== null && _a !== void 0 ? _a : false);
14335
14916
  }
14917
+ /**
14918
+ * Gets the origin of the parent window if available.
14919
+ * This will be the top-level origin in the case of a parent app.
14920
+ * It is used to pass to the embedded child app to initialize the Nested App Auth bridge.
14921
+
14922
+ * @returns The origin string if available, otherwise null
14923
+ *
14924
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
14925
+ *
14926
+ * @beta
14927
+ */
14928
+ function getParentOrigin() {
14929
+ ensureInitialized(runtime);
14930
+ return Communication.parentOrigin;
14931
+ }
14932
+ /**
14933
+ * Checks if the parent has the capability to manage its list of trusted child origins
14934
+ * for Nested App Auth (NAA).
14935
+ *
14936
+ * @returns true if parent can manage NAA TrustedOrigins, false otherwise
14937
+ *
14938
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
14939
+ *
14940
+ * @beta
14941
+ */
14942
+ function canParentManageNAATrustedOrigins() {
14943
+ var _a;
14944
+ return (_a = (ensureInitialized(runtime) && runtime.canParentManageNAATrustedOrigins)) !== null && _a !== void 0 ? _a : false;
14945
+ }
14946
+ /**
14947
+ * Checks if NAA deeply nested scenario supported by the host
14948
+ * @returns true if host supports
14949
+ *
14950
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
14951
+ *
14952
+ * @beta
14953
+ */
14954
+ function isDeeplyNestedAuthSupported() {
14955
+ var _a;
14956
+ return (_a = (ensureInitialized(runtime) && runtime.isDeeplyNestedAuthSupported)) !== null && _a !== void 0 ? _a : false;
14957
+ }
14336
14958
  function isNAAChannelRecommendedForLegacyTeamsMobile() {
14337
14959
  return ensureInitialized(runtime) &&
14338
14960
  isHostAndroidOrIOSOrIPadOSOrVisionOS() &&
@@ -14347,6 +14969,103 @@ function isHostAndroidOrIOSOrIPadOSOrVisionOS() {
14347
14969
  GlobalVars.hostClientType === HostClientType.ipados ||
14348
14970
  GlobalVars.hostClientType === HostClientType.visionOS);
14349
14971
  }
14972
+ /**
14973
+ * Registers the origins of child apps as trusted for Nested App Auth (NAA).
14974
+ *
14975
+ * This allows a top-level parent app to specify which child app origins are considered trusted
14976
+ *
14977
+ * @param appOrigins - An array of child app origins to trust (must be a non-empty array).
14978
+ * @returns A Promise resolving with the result of the action.
14979
+ * @throws Error if called from a non-top-level parent or if parameters are invalid.
14980
+ *
14981
+ * @beta
14982
+ */
14983
+ function addNAATrustedOrigins(appOrigins) {
14984
+ return nestedAppAuth_awaiter(this, void 0, void 0, function* () {
14985
+ if (!canParentManageNAATrustedOrigins()) {
14986
+ throw errorNotSupportedOnPlatform;
14987
+ }
14988
+ const normalizedOrigins = appOrigins.map(normalizeOrigin);
14989
+ return manageNAATrustedOrigins(TrustedOriginAction.ADD, normalizedOrigins);
14990
+ });
14991
+ }
14992
+ /**
14993
+ * Removes previously trusted child app origins from Nested App Auth (NAA).
14994
+ *
14995
+ * The specified origins will no longer be considered trusted.
14996
+ *
14997
+ * @param appOrigins - An array of child app origins to remove from the trusted list (must be a non-empty array).
14998
+ * @returns A Promise resolving with the result of the action.
14999
+ * @throws Error if called from a non-top-level parent or if parameters are invalid.
15000
+ *
15001
+ * @beta
15002
+ */
15003
+ function deleteNAATrustedOrigins(appOrigins) {
15004
+ return nestedAppAuth_awaiter(this, void 0, void 0, function* () {
15005
+ if (!canParentManageNAATrustedOrigins()) {
15006
+ throw errorNotSupportedOnPlatform;
15007
+ }
15008
+ const normalizedOrigins = appOrigins.map(normalizeOrigin);
15009
+ return manageNAATrustedOrigins(TrustedOriginAction.DELETE, normalizedOrigins);
15010
+ });
15011
+ }
15012
+ /**
15013
+ * Performs the specified action (add or delete) on the list of trusted child app origins for Nested App Auth (NAA).
15014
+ *
15015
+ * This function is intended to be called by a top-level parent app to manage which child app origins are considered trusted.
15016
+ *
15017
+ * @param action - The action to perform: 'ADD' or 'DELETE'.
15018
+ * @param appOrigins - An array of origins to add or remove (must be a non-empty array).
15019
+ * @returns A Promise resolving with the result of the action.
15020
+ * @throws Error if called from a non-top-level parent or if parameters are invalid.
15021
+ */
15022
+ function manageNAATrustedOrigins(action, appOrigins) {
15023
+ return nestedAppAuth_awaiter(this, void 0, void 0, function* () {
15024
+ if (window.parent !== window.top) {
15025
+ throw new Error('This API is only available in the top-level parent.');
15026
+ }
15027
+ if (!Array.isArray(appOrigins) || appOrigins.length === 0) {
15028
+ throw new Error(`The '${appOrigins}' parameter is required and must be a non-empty array.`);
15029
+ }
15030
+ const args = [new SerializableManageNAATrustedOriginArgs(action, appOrigins)];
15031
+ return callFunctionInHostAndHandleResponse('nestedAppAuth.manageNAATrustedOrigins', args, trustedOriginResponseHandler, getApiVersionTag(nestedAppAuth_hostEntityTelemetryVersionNumber, "nestedAppAuth.manageNAATrustedOrigins" /* ApiName.NestedAppAuth_ManageNAATrustedOrigins */));
15032
+ });
15033
+ }
15034
+ /**
15035
+ * Normalizes a given origin string by converting it to lowercase and extracting only the origin part.
15036
+ *
15037
+ * @param origin - A string representing a full URL.
15038
+ * @returns The normalized origin (scheme + host + port) in lowercase.
15039
+ * @throws Error if the input is not a valid URL.
15040
+ */
15041
+ function normalizeOrigin(origin) {
15042
+ try {
15043
+ const url = new URL(origin);
15044
+ return url.origin.toLowerCase(); // Normalize and return only the origin part
15045
+ }
15046
+ catch (error) {
15047
+ throw new Error(`Invalid origin provided: ${origin}`);
15048
+ }
15049
+ }
15050
+ /**
15051
+ * Serializable arguments for manageNAATrustedOrigins.
15052
+ */
15053
+ class SerializableManageNAATrustedOriginArgs {
15054
+ constructor(action, appOrigins) {
15055
+ this.action = action;
15056
+ this.appOrigins = appOrigins;
15057
+ }
15058
+ /**
15059
+ * Serializes the object to a JSON-compliant format.
15060
+ * @returns JSON representation of the arguments.
15061
+ */
15062
+ serialize() {
15063
+ return {
15064
+ action: this.action,
15065
+ appOrigins: this.appOrigins, // No need for conditional check, always included
15066
+ };
15067
+ }
15068
+ }
14350
15069
 
14351
15070
  ;// ./src/public/geoLocation/map.ts
14352
15071
  /**
@@ -18349,6 +19068,8 @@ function marketplace_isSupported() {
18349
19068
 
18350
19069
 
18351
19070
 
19071
+
19072
+
18352
19073
 
18353
19074
 
18354
19075