@microsoft/teams-js 2.23.0-beta.1 → 2.23.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8978,19 +8978,21 @@ export namespace visualMedia {
8978
8978
  }
8979
8979
 
8980
8980
  /**
8981
- * Contains functionality to allow web apps to store data in webview cache
8981
+ * Contains functionality enabling apps to query properties about how the host manages web storage (`Window.LocalStorage`)
8982
8982
  *
8983
8983
  * @beta
8984
8984
  */
8985
8985
  export namespace webStorage {
8986
8986
  /**
8987
- * Checks if web storage gets cleared when a user logs out from host client
8987
+ * Checks if web storage (`Window.LocalStorage`) gets cleared when a user logs out from host
8988
8988
  *
8989
- * @returns true is web storage gets cleared on logout and false if it does not
8989
+ * @returns `true` if web storage gets cleared on logout and `false` if not
8990
+ *
8991
+ * @throws `Error` if {@linkcode app.initialize} has not successfully completed
8990
8992
  *
8991
8993
  * @beta
8992
8994
  */
8993
- function isWebStorageClearedOnUserLogOut(): boolean;
8995
+ function isWebStorageClearedOnUserLogOut(): Promise<boolean>;
8994
8996
  /**
8995
8997
  * Checks if webStorage capability is supported by the host
8996
8998
  * @returns boolean to represent whether the webStorage capability is supported
@@ -1130,7 +1130,7 @@ function isFollowingApiVersionTagFormat(apiVersionTag) {
1130
1130
  }
1131
1131
 
1132
1132
  ;// CONCATENATED MODULE: ./src/artifactsForCDN/validDomains.json
1133
- 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","teams.cloud.microsoft","outlook.cloud.microsoft","m365.cloud.microsoft","copilot.microsoft.com","windows.msn.com"]}');
1133
+ 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","teams.cloud.microsoft","outlook.cloud.microsoft","m365.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net"]}');
1134
1134
  var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
1135
1135
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1136
1136
 
@@ -1303,7 +1303,7 @@ GlobalVars.printCapabilityEnabled = false;
1303
1303
 
1304
1304
  // EXTERNAL MODULE: ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1305
1305
  var base64_js = __webpack_require__(933);
1306
- ;// CONCATENATED MODULE: ../../node_modules/.pnpm/file+skeleton-buffer/node_modules/skeleton-buffer/index.js
1306
+ ;// CONCATENATED MODULE: ../../node_modules/.pnpm/skeleton-buffer@file+skeleton-buffer/node_modules/skeleton-buffer/index.js
1307
1307
 
1308
1308
 
1309
1309
  const _Buffer = Buffer;
@@ -2947,6 +2947,29 @@ function validateUrl(url, errorToThrow) {
2947
2947
  throw errorToThrow || new Error('Url should be a valid https url');
2948
2948
  }
2949
2949
  }
2950
+ /**
2951
+ * This function takes in a string that represents a full or relative path and returns a
2952
+ * fully qualified URL object.
2953
+ *
2954
+ * Currently this is accomplished by assigning the input string to an a tag and then retrieving
2955
+ * the a tag's href value. A side effect of doing this is that the string becomes a fully qualified
2956
+ * URL. This is probably not how I would choose to do this, but in order to not unintentionally
2957
+ * break something I've preseved the functionality here and just isolated the code to make it
2958
+ * easier to mock.
2959
+ *
2960
+ * @example
2961
+ * `fullyQualifyUrlString('https://example.com')` returns `new URL('https://example.com')`
2962
+ * `fullyQualifyUrlString('helloWorld')` returns `new URL('https://example.com/helloWorld')`
2963
+ * `fullyQualifyUrlString('hello%20World')` returns `new URL('https://example.com/hello%20World')`
2964
+ *
2965
+ * @param fullOrRelativePath A string representing a full or relative URL.
2966
+ * @returns A fully qualified URL representing the input string.
2967
+ */
2968
+ function fullyQualifyUrlString(fullOrRelativePath) {
2969
+ const link = document.createElement('a');
2970
+ link.href = fullOrRelativePath;
2971
+ return new URL(link.href);
2972
+ }
2950
2973
  /**
2951
2974
  * The hasScriptTags function first decodes any HTML entities in the input string using the decodeHTMLEntities function.
2952
2975
  * 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.
@@ -3372,7 +3395,7 @@ const _minRuntimeConfigToUninitialize = {
3372
3395
  * @hidden
3373
3396
  * Package version.
3374
3397
  */
3375
- const version = "2.23.0-beta.1";
3398
+ const version = "2.23.0-beta.3";
3376
3399
 
3377
3400
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
3378
3401
 
@@ -3647,6 +3670,7 @@ function validateOrigin(messageOrigin) {
3647
3670
 
3648
3671
 
3649
3672
 
3673
+
3650
3674
  /**
3651
3675
  * Namespace to interact with the authentication-specific part of the SDK.
3652
3676
  *
@@ -3729,23 +3753,13 @@ var authentication;
3729
3753
  authentication.authenticate = authenticate;
3730
3754
  function authenticateHelper(apiVersionTag, authenticateParameters) {
3731
3755
  return new Promise((resolve, reject) => {
3732
- if (GlobalVars.hostClientType === HostClientType.desktop ||
3733
- GlobalVars.hostClientType === HostClientType.android ||
3734
- GlobalVars.hostClientType === HostClientType.ios ||
3735
- GlobalVars.hostClientType === HostClientType.ipados ||
3736
- GlobalVars.hostClientType === HostClientType.macos ||
3737
- GlobalVars.hostClientType === HostClientType.rigel ||
3738
- GlobalVars.hostClientType === HostClientType.teamsRoomsWindows ||
3739
- GlobalVars.hostClientType === HostClientType.teamsRoomsAndroid ||
3740
- GlobalVars.hostClientType === HostClientType.teamsPhones ||
3741
- GlobalVars.hostClientType === HostClientType.teamsDisplays ||
3742
- GlobalVars.hostClientType === HostClientType.surfaceHub) {
3756
+ if (GlobalVars.hostClientType !== HostClientType.web) {
3743
3757
  // Convert any relative URLs into absolute URLs before sending them over to the parent window.
3744
- const link = document.createElement('a');
3745
- link.href = authenticateParameters.url;
3758
+ const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url);
3759
+ validateUrl(fullyQualifiedURL);
3746
3760
  // Ask the parent window to open an authentication window with the parameters provided by the caller.
3747
3761
  resolve(sendMessageToParentAsync(apiVersionTag, 'authentication.authenticate', [
3748
- link.href,
3762
+ fullyQualifiedURL.href,
3749
3763
  authenticateParameters.width,
3750
3764
  authenticateParameters.height,
3751
3765
  authenticateParameters.isExternal,
@@ -3873,8 +3887,8 @@ var authentication;
3873
3887
  width = Math.min(width, Communication.currentWindow.outerWidth - 400);
3874
3888
  height = Math.min(height, Communication.currentWindow.outerHeight - 200);
3875
3889
  // Convert any relative URLs into absolute URLs before sending them over to the parent window
3876
- const link = document.createElement('a');
3877
- link.href = authenticateParameters.url.replace('{oauthRedirectMethod}', 'web');
3890
+ const fullyQualifiedURL = fullyQualifyUrlString(authenticateParameters.url.replace('{oauthRedirectMethod}', 'web'));
3891
+ validateUrl(fullyQualifiedURL);
3878
3892
  // We are running in the browser, so we need to center the new window ourselves
3879
3893
  let left = typeof Communication.currentWindow.screenLeft !== 'undefined'
3880
3894
  ? Communication.currentWindow.screenLeft
@@ -3885,7 +3899,7 @@ var authentication;
3885
3899
  left += Communication.currentWindow.outerWidth / 2 - width / 2;
3886
3900
  top += Communication.currentWindow.outerHeight / 2 - height / 2;
3887
3901
  // Open a child window with a desired set of standard browser features
3888
- Communication.childWindow = Communication.currentWindow.open(link.href, '_blank', 'toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=' +
3902
+ Communication.childWindow = Communication.currentWindow.open(fullyQualifiedURL.href, '_blank', 'toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=' +
3889
3903
  top +
3890
3904
  ', left=' +
3891
3905
  left +
@@ -5404,7 +5418,7 @@ var pages;
5404
5418
  if (!isSupported()) {
5405
5419
  throw errorNotSupportedOnPlatform;
5406
5420
  }
5407
- const apiVersionTag = getApiVersionTag(pagesTelemetryVersionNumber, "pages.navigateCrossDomain" /* ApiName.Pages_NavigateCrossDomain */);
5421
+ const apiVersionTag = getApiVersionTag(pagesTelemetryVersionNumber, "pages.navigateToApp" /* ApiName.Pages_NavigateToApp */);
5408
5422
  if (runtime.isLegacyTeams) {
5409
5423
  resolve(sendAndHandleStatusAndReason(apiVersionTag, 'executeDeepLink', createTeamsAppLink(params)));
5410
5424
  }
@@ -6385,6 +6399,7 @@ function initializeCommunication(validMessageOrigins, apiVersionTag) {
6385
6399
  return sendMessageToParentAsync(apiVersionTag, 'initialize', [
6386
6400
  version,
6387
6401
  latestRuntimeApiVersion,
6402
+ validMessageOrigins,
6388
6403
  ]).then(([context, clientType, runtimeConfig, clientSupportedSDKVersion]) => {
6389
6404
  tryPolyfillWithNestedAppAuthBridge(clientSupportedSDKVersion, Communication.currentWindow, {
6390
6405
  onMessage: processAuthBridgeMessage,
@@ -11670,25 +11685,44 @@ var visualMedia;
11670
11685
  })(visualMedia || (visualMedia = {}));
11671
11686
 
11672
11687
  ;// CONCATENATED MODULE: ./src/public/webStorage.ts
11688
+ var webStorage_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
11689
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11690
+ return new (P || (P = Promise))(function (resolve, reject) {
11691
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11692
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11693
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11694
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11695
+ });
11696
+ };
11697
+
11698
+
11699
+
11673
11700
 
11674
11701
 
11675
11702
  /**
11676
- * Contains functionality to allow web apps to store data in webview cache
11703
+ * Contains functionality enabling apps to query properties about how the host manages web storage (`Window.LocalStorage`)
11677
11704
  *
11678
11705
  * @beta
11679
11706
  */
11680
11707
  var webStorage;
11681
11708
  (function (webStorage) {
11682
11709
  /**
11683
- * Checks if web storage gets cleared when a user logs out from host client
11710
+ * Checks if web storage (`Window.LocalStorage`) gets cleared when a user logs out from host
11711
+ *
11712
+ * @returns `true` if web storage gets cleared on logout and `false` if not
11684
11713
  *
11685
- * @returns true is web storage gets cleared on logout and false if it does not
11714
+ * @throws `Error` if {@linkcode app.initialize} has not successfully completed
11686
11715
  *
11687
11716
  * @beta
11688
11717
  */
11689
11718
  function isWebStorageClearedOnUserLogOut() {
11690
- ensureInitialized(runtime);
11691
- return isSupported();
11719
+ return webStorage_awaiter(this, void 0, void 0, function* () {
11720
+ ensureInitialized(runtime);
11721
+ if (!isSupported()) {
11722
+ throw errorNotSupportedOnPlatform;
11723
+ }
11724
+ return yield sendAndUnwrap(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "webStorage.isWebStorageClearedOnUserLogOut" /* ApiName.WebStorage_IsWebStorageClearedOnUserLogOut */), "webStorage.isWebStorageClearedOnUserLogOut" /* ApiName.WebStorage_IsWebStorageClearedOnUserLogOut */);
11725
+ });
11692
11726
  }
11693
11727
  webStorage.isWebStorageClearedOnUserLogOut = isWebStorageClearedOnUserLogOut;
11694
11728
  /**
@@ -11700,7 +11734,7 @@ var webStorage;
11700
11734
  * @beta
11701
11735
  */
11702
11736
  function isSupported() {
11703
- return ensureInitialized(runtime) && runtime.supports.webStorage ? true : false;
11737
+ return ensureInitialized(runtime) && runtime.supports.webStorage !== undefined;
11704
11738
  }
11705
11739
  webStorage.isSupported = isSupported;
11706
11740
  })(webStorage || (webStorage = {}));