@microsoft/teams-js 2.34.0-beta.0 → 2.34.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/dist/esm/_virtual/_polyfill-node.buffer.js +1 -0
- package/dist/esm/_virtual/_polyfill-node.global.js +1 -0
- package/dist/esm/packages/teams-js/dts/internal/constants.d.ts +8 -0
- package/dist/esm/packages/teams-js/dts/internal/internalAPIs.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/internal/messageObjects.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/internal/validOrigins.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/private/copilot/customTelemetry.d.ts +10 -0
- package/dist/esm/packages/teams-js/dts/public/app/app.d.ts +9 -0
- package/dist/esm/packages/teams-js/dts/public/authentication.d.ts +12 -4
- package/dist/esm/packages/teams-js/dts/public/constants.d.ts +2 -0
- package/dist/esm/packages/teams-js/dts/public/index.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/public/interfaces.d.ts +14 -0
- package/dist/esm/packages/teams-js/dts/public/mail/handoff.d.ts +48 -0
- package/dist/esm/packages/teams-js/dts/public/{mail.d.ts → mail/mail.d.ts} +4 -1
- package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +3 -1
- package/dist/esm/packages/teams-js/src/index.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/communication.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/constants.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/internalAPIs.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/utils.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/validOrigins.js +1 -1
- package/dist/esm/packages/teams-js/src/private/copilot/customTelemetry.js +1 -1
- package/dist/esm/packages/teams-js/src/public/app/app.js +1 -1
- package/dist/esm/packages/teams-js/src/public/constants.js +1 -1
- package/dist/esm/packages/teams-js/src/public/mail/handoff.js +1 -0
- package/dist/esm/packages/teams-js/src/public/mail/mail.js +1 -0
- package/dist/esm/packages/teams-js/src/public/nestedAppAuth.js +1 -1
- package/dist/esm/packages/teams-js/src/public/runtime.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/esm/packages/teams-js/src/public/webStorage.js +1 -1
- package/dist/umd/MicrosoftTeams.js +318 -159
- package/dist/umd/MicrosoftTeams.js.map +1 -1
- package/dist/umd/MicrosoftTeams.min.js +1 -1
- package/dist/umd/MicrosoftTeams.min.js.map +1 -1
- package/package.json +53 -1
- package/dist/esm/node_modules/.pnpm/rollup-plugin-node-polyfills@0.2.1/node_modules/rollup-plugin-node-polyfills/polyfills/buffer-es6.js +0 -1
- package/dist/esm/packages/teams-js/src/public/mail.js +0 -1
@@ -1353,6 +1353,7 @@ __webpack_require__.d(conversations_namespaceObject, {
|
|
1353
1353
|
var customTelemetry_namespaceObject = {};
|
1354
1354
|
__webpack_require__.r(customTelemetry_namespaceObject);
|
1355
1355
|
__webpack_require__.d(customTelemetry_namespaceObject, {
|
1356
|
+
isSupported: () => (customTelemetry_isSupported),
|
1356
1357
|
sendCustomTelemetryData: () => (sendCustomTelemetryData)
|
1357
1358
|
});
|
1358
1359
|
|
@@ -1771,12 +1772,21 @@ __webpack_require__.d(calendar_namespaceObject, {
|
|
1771
1772
|
openCalendarItem: () => (openCalendarItem)
|
1772
1773
|
});
|
1773
1774
|
|
1774
|
-
// NAMESPACE OBJECT: ./src/public/mail.ts
|
1775
|
+
// NAMESPACE OBJECT: ./src/public/mail/handoff.ts
|
1776
|
+
var handoff_namespaceObject = {};
|
1777
|
+
__webpack_require__.r(handoff_namespaceObject);
|
1778
|
+
__webpack_require__.d(handoff_namespaceObject, {
|
1779
|
+
composeMailWithHandoff: () => (composeMailWithHandoff),
|
1780
|
+
isSupported: () => (handoff_isSupported)
|
1781
|
+
});
|
1782
|
+
|
1783
|
+
// NAMESPACE OBJECT: ./src/public/mail/mail.ts
|
1775
1784
|
var mail_namespaceObject = {};
|
1776
1785
|
__webpack_require__.r(mail_namespaceObject);
|
1777
1786
|
__webpack_require__.d(mail_namespaceObject, {
|
1778
1787
|
ComposeMailType: () => (ComposeMailType),
|
1779
1788
|
composeMail: () => (composeMail),
|
1789
|
+
handoff: () => (handoff_namespaceObject),
|
1780
1790
|
isSupported: () => (mail_isSupported),
|
1781
1791
|
openMailItem: () => (openMailItem)
|
1782
1792
|
});
|
@@ -3146,6 +3156,8 @@ var HostClientType;
|
|
3146
3156
|
HostClientType["ipados"] = "ipados";
|
3147
3157
|
/** The host is running on a macOS client, which runs on devices such as MacBooks. */
|
3148
3158
|
HostClientType["macos"] = "macos";
|
3159
|
+
/** The host is running on a visionOS client, which runs on devices such as Apple Vision. */
|
3160
|
+
HostClientType["visionOS"] = "visionOS";
|
3149
3161
|
/**
|
3150
3162
|
* @deprecated
|
3151
3163
|
* As of TeamsJS v2.0.0, please use {@link teamsRoomsWindows} instead.
|
@@ -4003,6 +4015,14 @@ const validOriginsLocal = artifactsForCDN_validDomains_namespaceObject;
|
|
4003
4015
|
* Limited to Microsoft-internal use
|
4004
4016
|
*/
|
4005
4017
|
const validOriginsFallback = validOriginsLocal.validOrigins;
|
4018
|
+
/**
|
4019
|
+
* @hidden
|
4020
|
+
* Timeout length for Fetch Call for Valid Origins
|
4021
|
+
*
|
4022
|
+
* @internal
|
4023
|
+
* Limited to Microsoft-internal use
|
4024
|
+
*/
|
4025
|
+
const ORIGIN_LIST_FETCH_TIMEOUT_IN_MS = 1500;
|
4006
4026
|
/**
|
4007
4027
|
* @hidden
|
4008
4028
|
* CDN endpoint of the list of valid origins
|
@@ -4178,7 +4198,12 @@ const v1NonMobileHostClientTypes = [
|
|
4178
4198
|
HostClientType.teamsPhones,
|
4179
4199
|
HostClientType.teamsDisplays,
|
4180
4200
|
];
|
4181
|
-
const v1MobileHostClientTypes = [
|
4201
|
+
const v1MobileHostClientTypes = [
|
4202
|
+
HostClientType.android,
|
4203
|
+
HostClientType.ios,
|
4204
|
+
HostClientType.ipados,
|
4205
|
+
HostClientType.visionOS,
|
4206
|
+
];
|
4182
4207
|
const v1HostClientTypes = [...v1NonMobileHostClientTypes, ...v1MobileHostClientTypes];
|
4183
4208
|
/**
|
4184
4209
|
* @hidden
|
@@ -4328,7 +4353,7 @@ const mapTeamsVersionToSupportedCapabilities = {
|
|
4328
4353
|
'2.1.1': [
|
4329
4354
|
{
|
4330
4355
|
capability: { nestedAppAuth: {} },
|
4331
|
-
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados],
|
4356
|
+
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados, HostClientType.visionOS],
|
4332
4357
|
},
|
4333
4358
|
],
|
4334
4359
|
};
|
@@ -4460,7 +4485,7 @@ function isSerializable(arg) {
|
|
4460
4485
|
* @hidden
|
4461
4486
|
* Package version.
|
4462
4487
|
*/
|
4463
|
-
const version = "2.34.0
|
4488
|
+
const version = "2.34.0";
|
4464
4489
|
|
4465
4490
|
;// ./src/internal/internalAPIs.ts
|
4466
4491
|
|
@@ -4539,7 +4564,7 @@ function isCurrentSDKVersionAtLeast(requiredVersion = defaultSDKVersionForCompat
|
|
4539
4564
|
}
|
4540
4565
|
/**
|
4541
4566
|
* @hidden
|
4542
|
-
* Helper function to identify if host client is either android, ios, or
|
4567
|
+
* Helper function to identify if host client is either android, ios, ipados, or visionOS
|
4543
4568
|
*
|
4544
4569
|
* @internal
|
4545
4570
|
* Limited to Microsoft-internal use
|
@@ -4547,7 +4572,8 @@ function isCurrentSDKVersionAtLeast(requiredVersion = defaultSDKVersionForCompat
|
|
4547
4572
|
function isHostClientMobile() {
|
4548
4573
|
return (GlobalVars.hostClientType == HostClientType.android ||
|
4549
4574
|
GlobalVars.hostClientType == HostClientType.ios ||
|
4550
|
-
GlobalVars.hostClientType == HostClientType.ipados
|
4575
|
+
GlobalVars.hostClientType == HostClientType.ipados ||
|
4576
|
+
GlobalVars.hostClientType == HostClientType.visionOS);
|
4551
4577
|
}
|
4552
4578
|
/**
|
4553
4579
|
* @hidden
|
@@ -4687,139 +4713,8 @@ function isNullOrUndefined(value) {
|
|
4687
4713
|
return value === null || value === undefined;
|
4688
4714
|
}
|
4689
4715
|
|
4690
|
-
;// ./src/internal/validOrigins.ts
|
4691
|
-
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
4692
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4693
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4694
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
4695
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
4696
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
4697
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
4698
|
-
});
|
4699
|
-
};
|
4700
|
-
|
4701
|
-
|
4702
|
-
|
4703
|
-
|
4704
|
-
let validOriginsCache = [];
|
4705
|
-
const validateOriginLogger = getLogger('validateOrigin');
|
4706
|
-
function prefetchOriginsFromCDN() {
|
4707
|
-
return __awaiter(this, void 0, void 0, function* () {
|
4708
|
-
yield getValidOriginsListFromCDN();
|
4709
|
-
});
|
4710
|
-
}
|
4711
|
-
function isValidOriginsCacheEmpty() {
|
4712
|
-
return validOriginsCache.length === 0;
|
4713
|
-
}
|
4714
|
-
function getValidOriginsListFromCDN() {
|
4715
|
-
return __awaiter(this, void 0, void 0, function* () {
|
4716
|
-
if (!isValidOriginsCacheEmpty()) {
|
4717
|
-
return validOriginsCache;
|
4718
|
-
}
|
4719
|
-
if (!inServerSideRenderingEnvironment()) {
|
4720
|
-
return fetch(validOriginsCdnEndpoint)
|
4721
|
-
.then((response) => {
|
4722
|
-
if (!response.ok) {
|
4723
|
-
throw new Error('Invalid Response from Fetch Call');
|
4724
|
-
}
|
4725
|
-
return response.json().then((validOriginsCDN) => {
|
4726
|
-
if (isValidOriginsJSONValid(JSON.stringify(validOriginsCDN))) {
|
4727
|
-
validOriginsCache = validOriginsCDN.validOrigins;
|
4728
|
-
return validOriginsCache;
|
4729
|
-
}
|
4730
|
-
else {
|
4731
|
-
throw new Error('Valid Origins List Is Invalid');
|
4732
|
-
}
|
4733
|
-
});
|
4734
|
-
})
|
4735
|
-
.catch((e) => {
|
4736
|
-
validateOriginLogger('validOrigins fetch call to CDN failed with error: %s. Defaulting to fallback list', e);
|
4737
|
-
validOriginsCache = validOriginsFallback;
|
4738
|
-
return validOriginsCache;
|
4739
|
-
});
|
4740
|
-
}
|
4741
|
-
else {
|
4742
|
-
validOriginsCache = validOriginsFallback;
|
4743
|
-
return validOriginsFallback;
|
4744
|
-
}
|
4745
|
-
});
|
4746
|
-
}
|
4747
|
-
function isValidOriginsJSONValid(validOriginsJSON) {
|
4748
|
-
let validOriginsCDN = JSON.parse(validOriginsJSON);
|
4749
|
-
try {
|
4750
|
-
validOriginsCDN = JSON.parse(validOriginsJSON);
|
4751
|
-
}
|
4752
|
-
catch (_) {
|
4753
|
-
return false;
|
4754
|
-
}
|
4755
|
-
if (!validOriginsCDN.validOrigins) {
|
4756
|
-
return false;
|
4757
|
-
}
|
4758
|
-
for (const validOrigin of validOriginsCDN.validOrigins) {
|
4759
|
-
try {
|
4760
|
-
new URL('https://' + validOrigin);
|
4761
|
-
}
|
4762
|
-
catch (_) {
|
4763
|
-
validateOriginLogger('isValidOriginsFromCDN call failed to validate origin: %s', validOrigin);
|
4764
|
-
return false;
|
4765
|
-
}
|
4766
|
-
}
|
4767
|
-
return true;
|
4768
|
-
}
|
4769
|
-
/**
|
4770
|
-
* @param pattern - reference pattern
|
4771
|
-
* @param host - candidate string
|
4772
|
-
* @returns returns true if host matches pre-know valid pattern
|
4773
|
-
*
|
4774
|
-
* @example
|
4775
|
-
* validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
|
4776
|
-
* validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
|
4777
|
-
*
|
4778
|
-
* @internal
|
4779
|
-
* Limited to Microsoft-internal use
|
4780
|
-
*/
|
4781
|
-
function validateHostAgainstPattern(pattern, host) {
|
4782
|
-
if (pattern.substring(0, 2) === '*.') {
|
4783
|
-
const suffix = pattern.substring(1);
|
4784
|
-
if (host.length > suffix.length &&
|
4785
|
-
host.split('.').length === suffix.split('.').length &&
|
4786
|
-
host.substring(host.length - suffix.length) === suffix) {
|
4787
|
-
return true;
|
4788
|
-
}
|
4789
|
-
}
|
4790
|
-
else if (pattern === host) {
|
4791
|
-
return true;
|
4792
|
-
}
|
4793
|
-
return false;
|
4794
|
-
}
|
4795
|
-
/**
|
4796
|
-
* @internal
|
4797
|
-
* Limited to Microsoft-internal use
|
4798
|
-
*/
|
4799
|
-
function validateOrigin(messageOrigin) {
|
4800
|
-
return getValidOriginsListFromCDN().then((validOriginsList) => {
|
4801
|
-
// Check whether the url is in the pre-known allowlist or supplied by user
|
4802
|
-
if (!isValidHttpsURL(messageOrigin)) {
|
4803
|
-
validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
|
4804
|
-
return false;
|
4805
|
-
}
|
4806
|
-
const messageOriginHost = messageOrigin.host;
|
4807
|
-
if (validOriginsList.some((pattern) => validateHostAgainstPattern(pattern, messageOriginHost))) {
|
4808
|
-
return true;
|
4809
|
-
}
|
4810
|
-
for (const domainOrPattern of GlobalVars.additionalValidOrigins) {
|
4811
|
-
const pattern = domainOrPattern.substring(0, 8) === 'https://' ? domainOrPattern.substring(8) : domainOrPattern;
|
4812
|
-
if (validateHostAgainstPattern(pattern, messageOriginHost)) {
|
4813
|
-
return true;
|
4814
|
-
}
|
4815
|
-
}
|
4816
|
-
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);
|
4817
|
-
return false;
|
4818
|
-
});
|
4819
|
-
}
|
4820
|
-
|
4821
4716
|
;// ./src/private/messageChannels/telemetry.ts
|
4822
|
-
var
|
4717
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
4823
4718
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4824
4719
|
return new (P || (P = Promise))(function (resolve, reject) {
|
4825
4720
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
@@ -4851,7 +4746,7 @@ const logger = getLogger('messageChannels.telemetry');
|
|
4851
4746
|
* Limited to Microsoft-internal use
|
4852
4747
|
*/
|
4853
4748
|
function getTelemetryPort() {
|
4854
|
-
return
|
4749
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4855
4750
|
// If the port has already been initialized, return it.
|
4856
4751
|
if (telemetryPort) {
|
4857
4752
|
logger('Returning telemetry port from cache');
|
@@ -5145,7 +5040,6 @@ logWhereTeamsJsIsBeingUsed();
|
|
5145
5040
|
* @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
|
5146
5041
|
*/
|
5147
5042
|
function initialize(validMessageOrigins) {
|
5148
|
-
prefetchOriginsFromCDN();
|
5149
5043
|
return appInitializeHelper(getApiVersionTag(appTelemetryVersionNumber, "app.initialize" /* ApiName.App_Initialize */), validMessageOrigins);
|
5150
5044
|
}
|
5151
5045
|
/**
|
@@ -5309,6 +5203,8 @@ function transformLegacyContextToAppContext(legacyContext) {
|
|
5309
5203
|
ringId: legacyContext.ringId,
|
5310
5204
|
},
|
5311
5205
|
appLaunchId: legacyContext.appLaunchId,
|
5206
|
+
appId: legacyContext.appId ? new AppId(legacyContext.appId) : undefined,
|
5207
|
+
manifestVersion: legacyContext.manifestVersion,
|
5312
5208
|
},
|
5313
5209
|
page: {
|
5314
5210
|
id: legacyContext.entityId,
|
@@ -6808,6 +6704,148 @@ function openLinkHelper(apiVersionTag, deepLink) {
|
|
6808
6704
|
});
|
6809
6705
|
}
|
6810
6706
|
|
6707
|
+
;// ./src/internal/validOrigins.ts
|
6708
|
+
var validOrigins_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
6709
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
6710
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
6711
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6712
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6713
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
6714
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
6715
|
+
});
|
6716
|
+
};
|
6717
|
+
|
6718
|
+
|
6719
|
+
|
6720
|
+
|
6721
|
+
let validOriginsCache = [];
|
6722
|
+
const validateOriginLogger = getLogger('validateOrigin');
|
6723
|
+
function prefetchOriginsFromCDN() {
|
6724
|
+
return validOrigins_awaiter(this, void 0, void 0, function* () {
|
6725
|
+
yield getValidOriginsListFromCDN();
|
6726
|
+
});
|
6727
|
+
}
|
6728
|
+
function isValidOriginsCacheEmpty() {
|
6729
|
+
return validOriginsCache.length === 0;
|
6730
|
+
}
|
6731
|
+
function getValidOriginsListFromCDN(shouldDisableCache = false) {
|
6732
|
+
return validOrigins_awaiter(this, void 0, void 0, function* () {
|
6733
|
+
if (!isValidOriginsCacheEmpty() && !shouldDisableCache) {
|
6734
|
+
return validOriginsCache;
|
6735
|
+
}
|
6736
|
+
if (!inServerSideRenderingEnvironment()) {
|
6737
|
+
validateOriginLogger('Initiating fetch call to acquire valid origins list from CDN');
|
6738
|
+
const controller = new AbortController();
|
6739
|
+
const timeoutId = setTimeout(() => controller.abort(), ORIGIN_LIST_FETCH_TIMEOUT_IN_MS);
|
6740
|
+
return fetch(validOriginsCdnEndpoint, { signal: controller.signal })
|
6741
|
+
.then((response) => {
|
6742
|
+
clearTimeout(timeoutId);
|
6743
|
+
if (!response.ok) {
|
6744
|
+
throw new Error('Invalid Response from Fetch Call');
|
6745
|
+
}
|
6746
|
+
validateOriginLogger('Fetch call completed and retrieved valid origins list from CDN');
|
6747
|
+
return response.json().then((validOriginsCDN) => {
|
6748
|
+
if (isValidOriginsJSONValid(JSON.stringify(validOriginsCDN))) {
|
6749
|
+
validOriginsCache = validOriginsCDN.validOrigins;
|
6750
|
+
return validOriginsCache;
|
6751
|
+
}
|
6752
|
+
else {
|
6753
|
+
throw new Error('Valid origins list retrieved from CDN is invalid');
|
6754
|
+
}
|
6755
|
+
});
|
6756
|
+
})
|
6757
|
+
.catch((e) => {
|
6758
|
+
if (e.name === 'AbortError') {
|
6759
|
+
validateOriginLogger(`validOrigins fetch call to CDN failed due to Timeout of ${ORIGIN_LIST_FETCH_TIMEOUT_IN_MS} ms. Defaulting to fallback list`);
|
6760
|
+
}
|
6761
|
+
else {
|
6762
|
+
validateOriginLogger('validOrigins fetch call to CDN failed with error: %s. Defaulting to fallback list', e);
|
6763
|
+
}
|
6764
|
+
validOriginsCache = validOriginsFallback;
|
6765
|
+
return validOriginsCache;
|
6766
|
+
});
|
6767
|
+
}
|
6768
|
+
else {
|
6769
|
+
validOriginsCache = validOriginsFallback;
|
6770
|
+
return validOriginsFallback;
|
6771
|
+
}
|
6772
|
+
});
|
6773
|
+
}
|
6774
|
+
function isValidOriginsJSONValid(validOriginsJSON) {
|
6775
|
+
let validOriginsCDN = JSON.parse(validOriginsJSON);
|
6776
|
+
try {
|
6777
|
+
validOriginsCDN = JSON.parse(validOriginsJSON);
|
6778
|
+
}
|
6779
|
+
catch (_) {
|
6780
|
+
return false;
|
6781
|
+
}
|
6782
|
+
if (!validOriginsCDN.validOrigins) {
|
6783
|
+
return false;
|
6784
|
+
}
|
6785
|
+
for (const validOrigin of validOriginsCDN.validOrigins) {
|
6786
|
+
try {
|
6787
|
+
new URL('https://' + validOrigin);
|
6788
|
+
}
|
6789
|
+
catch (_) {
|
6790
|
+
validateOriginLogger('isValidOriginsFromCDN call failed to validate origin: %s', validOrigin);
|
6791
|
+
return false;
|
6792
|
+
}
|
6793
|
+
}
|
6794
|
+
return true;
|
6795
|
+
}
|
6796
|
+
/**
|
6797
|
+
* @param pattern - reference pattern
|
6798
|
+
* @param host - candidate string
|
6799
|
+
* @returns returns true if host matches pre-know valid pattern
|
6800
|
+
*
|
6801
|
+
* @example
|
6802
|
+
* validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
|
6803
|
+
* validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
|
6804
|
+
*
|
6805
|
+
* @internal
|
6806
|
+
* Limited to Microsoft-internal use
|
6807
|
+
*/
|
6808
|
+
function validateHostAgainstPattern(pattern, host) {
|
6809
|
+
if (pattern.substring(0, 2) === '*.') {
|
6810
|
+
const suffix = pattern.substring(1);
|
6811
|
+
if (host.length > suffix.length &&
|
6812
|
+
host.split('.').length === suffix.split('.').length &&
|
6813
|
+
host.substring(host.length - suffix.length) === suffix) {
|
6814
|
+
return true;
|
6815
|
+
}
|
6816
|
+
}
|
6817
|
+
else if (pattern === host) {
|
6818
|
+
return true;
|
6819
|
+
}
|
6820
|
+
return false;
|
6821
|
+
}
|
6822
|
+
/**
|
6823
|
+
* @internal
|
6824
|
+
* Limited to Microsoft-internal use
|
6825
|
+
*/
|
6826
|
+
function validateOrigin(messageOrigin, disableCache) {
|
6827
|
+
return getValidOriginsListFromCDN(disableCache).then((validOriginsList) => {
|
6828
|
+
// Check whether the url is in the pre-known allowlist or supplied by user
|
6829
|
+
if (!isValidHttpsURL(messageOrigin)) {
|
6830
|
+
validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
|
6831
|
+
return false;
|
6832
|
+
}
|
6833
|
+
const messageOriginHost = messageOrigin.host;
|
6834
|
+
if (validOriginsList.some((pattern) => validateHostAgainstPattern(pattern, messageOriginHost))) {
|
6835
|
+
return true;
|
6836
|
+
}
|
6837
|
+
for (const domainOrPattern of GlobalVars.additionalValidOrigins) {
|
6838
|
+
const pattern = domainOrPattern.substring(0, 8) === 'https://' ? domainOrPattern.substring(8) : domainOrPattern;
|
6839
|
+
if (validateHostAgainstPattern(pattern, messageOriginHost)) {
|
6840
|
+
return true;
|
6841
|
+
}
|
6842
|
+
}
|
6843
|
+
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);
|
6844
|
+
return false;
|
6845
|
+
});
|
6846
|
+
}
|
6847
|
+
prefetchOriginsFromCDN();
|
6848
|
+
|
6811
6849
|
;// ./src/public/pages/appButton.ts
|
6812
6850
|
/**
|
6813
6851
|
* Provides APIs to interact with the app button part of the SDK.
|
@@ -8344,10 +8382,10 @@ const sendMessageToParentHelperLogger = communicationLogger.extend('sendMessageT
|
|
8344
8382
|
* @internal
|
8345
8383
|
* Limited to Microsoft-internal use
|
8346
8384
|
*/
|
8347
|
-
function sendMessageToParentHelper(apiVersionTag, actionName, args) {
|
8385
|
+
function sendMessageToParentHelper(apiVersionTag, actionName, args, isProxiedFromChild) {
|
8348
8386
|
const logger = sendMessageToParentHelperLogger;
|
8349
8387
|
const targetWindow = Communication.parentWindow;
|
8350
|
-
const request = createMessageRequest(apiVersionTag, actionName, args);
|
8388
|
+
const request = createMessageRequest(apiVersionTag, actionName, args, isProxiedFromChild);
|
8351
8389
|
HostToAppMessageDelayTelemetry.storeCallbackInformation(request.uuid, {
|
8352
8390
|
name: actionName,
|
8353
8391
|
calledAt: request.timestamp,
|
@@ -8674,15 +8712,7 @@ function handleIncomingMessageFromChild(evt) {
|
|
8674
8712
|
else {
|
8675
8713
|
// No handler, proxy to parent
|
8676
8714
|
handleIncomingMessageFromChildLogger('No handler for message %s from child found; relaying message on to parent, action: %s. Relayed message will have a new id.', getMessageIdsAsLogString(message), message.func);
|
8677
|
-
|
8678
|
-
if (Communication.childWindow) {
|
8679
|
-
const isPartialResponse = args.pop();
|
8680
|
-
handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
|
8681
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
8682
|
-
// @ts-ignore
|
8683
|
-
sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
|
8684
|
-
}
|
8685
|
-
});
|
8715
|
+
proxyChildMessageToParent(message);
|
8686
8716
|
}
|
8687
8717
|
}
|
8688
8718
|
}
|
@@ -8829,7 +8859,7 @@ function sendMessageEventToChild(actionName, args) {
|
|
8829
8859
|
* @internal
|
8830
8860
|
* Limited to Microsoft-internal use
|
8831
8861
|
*/
|
8832
|
-
function createMessageRequest(apiVersionTag, func, args) {
|
8862
|
+
function createMessageRequest(apiVersionTag, func, args, isProxiedFromChild) {
|
8833
8863
|
const messageId = CommunicationPrivate.nextMessageId++;
|
8834
8864
|
const messageUuid = new UUID();
|
8835
8865
|
CommunicationPrivate.legacyMessageIdsToUuidMap[messageId] = messageUuid;
|
@@ -8841,6 +8871,7 @@ function createMessageRequest(apiVersionTag, func, args) {
|
|
8841
8871
|
monotonicTimestamp: getCurrentTimestamp(),
|
8842
8872
|
args: args || [],
|
8843
8873
|
apiVersionTag: apiVersionTag,
|
8874
|
+
isProxiedFromChild: isProxiedFromChild !== null && isProxiedFromChild !== void 0 ? isProxiedFromChild : false,
|
8844
8875
|
};
|
8845
8876
|
}
|
8846
8877
|
/**
|
@@ -8906,6 +8937,22 @@ function getMessageIdsAsLogString(message) {
|
|
8906
8937
|
return `legacy id: ${message.id} (no uuid)`;
|
8907
8938
|
}
|
8908
8939
|
}
|
8940
|
+
/**
|
8941
|
+
* @internal
|
8942
|
+
* Limited to Microsoft-internal use
|
8943
|
+
*/
|
8944
|
+
function proxyChildMessageToParent(message) {
|
8945
|
+
const request = sendMessageToParentHelper(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "tasks.startTask" /* ApiName.Tasks_StartTask */), message.func, message.args, true);
|
8946
|
+
CommunicationPrivate.callbacks.set(request.uuid, (...args) => {
|
8947
|
+
if (Communication.childWindow) {
|
8948
|
+
const isPartialResponse = args.pop();
|
8949
|
+
handleIncomingMessageFromChildLogger('Message from parent being relayed to child, id: %s', getMessageIdsAsLogString(message));
|
8950
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
8951
|
+
// @ts-ignore
|
8952
|
+
sendMessageResponseToChild(message.id, message.uuid, args, isPartialResponse);
|
8953
|
+
}
|
8954
|
+
});
|
8955
|
+
}
|
8909
8956
|
|
8910
8957
|
;// ./src/private/logs.ts
|
8911
8958
|
/**
|
@@ -9289,6 +9336,19 @@ var customTelemetry_awaiter = (undefined && undefined.__awaiter) || function (th
|
|
9289
9336
|
|
9290
9337
|
const copilotTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
|
9291
9338
|
const copilotLogger = getLogger('copilot');
|
9339
|
+
/**
|
9340
|
+
* @hidden
|
9341
|
+
* @internal
|
9342
|
+
* Limited to Microsoft-internal use
|
9343
|
+
* @beta
|
9344
|
+
* @returns boolean to represent whether copilot.customTelemetry capability is supported
|
9345
|
+
*
|
9346
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
9347
|
+
*/
|
9348
|
+
function customTelemetry_isSupported() {
|
9349
|
+
var _a;
|
9350
|
+
return ensureInitialized(runtime) && !!((_a = runtime.supports.copilot) === null || _a === void 0 ? void 0 : _a.customTelemetry);
|
9351
|
+
}
|
9292
9352
|
/**
|
9293
9353
|
* Sends custom telemetry data to the host.
|
9294
9354
|
*
|
@@ -14318,16 +14378,17 @@ function isNAAChannelRecommended() {
|
|
14318
14378
|
}
|
14319
14379
|
function isNAAChannelRecommendedForLegacyTeamsMobile() {
|
14320
14380
|
return ensureInitialized(runtime) &&
|
14321
|
-
|
14381
|
+
isHostAndroidOrIOSOrIPadOSOrVisionOS() &&
|
14322
14382
|
runtime.isLegacyTeams &&
|
14323
14383
|
runtime.supports.nestedAppAuth
|
14324
14384
|
? true
|
14325
14385
|
: false;
|
14326
14386
|
}
|
14327
|
-
function
|
14387
|
+
function isHostAndroidOrIOSOrIPadOSOrVisionOS() {
|
14328
14388
|
return (GlobalVars.hostClientType === HostClientType.android ||
|
14329
14389
|
GlobalVars.hostClientType === HostClientType.ios ||
|
14330
|
-
GlobalVars.hostClientType === HostClientType.ipados
|
14390
|
+
GlobalVars.hostClientType === HostClientType.ipados ||
|
14391
|
+
GlobalVars.hostClientType === HostClientType.visionOS);
|
14331
14392
|
}
|
14332
14393
|
|
14333
14394
|
;// ./src/public/geoLocation/map.ts
|
@@ -15559,20 +15620,116 @@ function calendar_isSupported() {
|
|
15559
15620
|
return ensureInitialized(runtime) && runtime.supports.calendar ? true : false;
|
15560
15621
|
}
|
15561
15622
|
|
15562
|
-
;// ./src/public/mail.ts
|
15623
|
+
;// ./src/public/mail/handoff.ts
|
15563
15624
|
/**
|
15564
15625
|
* Used to interact with mail capability, including opening and composing mail.
|
15565
15626
|
* @module
|
15627
|
+
*
|
15628
|
+
* @beta
|
15566
15629
|
*/
|
15567
15630
|
|
15568
15631
|
|
15569
15632
|
|
15570
15633
|
|
15571
15634
|
|
15635
|
+
|
15636
|
+
|
15572
15637
|
/**
|
15573
15638
|
* v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
|
15574
15639
|
*/
|
15575
15640
|
const mailTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
|
15641
|
+
/**
|
15642
|
+
* Validates an array of email addresses.
|
15643
|
+
* For ComposeMailType.New, it is valid to pass empty arrays for toRecipients, ccRecipients, and bccRecipients.
|
15644
|
+
* This will result in a new email with handed-off (pre-populated) body content but no pre-populated recipients.
|
15645
|
+
*
|
15646
|
+
* @param emails - An optional array of email addresses to validate.
|
15647
|
+
* @throws Error with a message describing if the email address is invalid.
|
15648
|
+
*
|
15649
|
+
* @beta
|
15650
|
+
*/
|
15651
|
+
function validateEmails(emails) {
|
15652
|
+
if (!emails || emails.length === 0) {
|
15653
|
+
return; // If the array is undefined or empty, consider it valid
|
15654
|
+
}
|
15655
|
+
// Use validateEmailAddress for each email in the param
|
15656
|
+
emails.forEach((email) => {
|
15657
|
+
validateEmailAddress(email); // This will throw an error if the email is invalid
|
15658
|
+
});
|
15659
|
+
}
|
15660
|
+
/**
|
15661
|
+
* Validates email addresses in the given ComposeMailParams object.
|
15662
|
+
* Validates `toRecipients`, `ccRecipients`, and `bccRecipients` for `ComposeNewParams`.
|
15663
|
+
*
|
15664
|
+
* @param params - The incoming ComposeMailParams object.
|
15665
|
+
* @throws Error with a message describing if the email address is invalid.
|
15666
|
+
*
|
15667
|
+
* @beta
|
15668
|
+
*/
|
15669
|
+
function validateHandoffComposeMailParams(param) {
|
15670
|
+
if (!param.handoffId || param.handoffId.trim().length == 0 || param.handoffId.trim() === '') {
|
15671
|
+
throw new Error('handoffId should not be null or empty string.');
|
15672
|
+
}
|
15673
|
+
const composeMailParams = param.composeMailParams;
|
15674
|
+
if (composeMailParams.type === ComposeMailType.New) {
|
15675
|
+
validateEmails(composeMailParams.toRecipients);
|
15676
|
+
validateEmails(composeMailParams.ccRecipients);
|
15677
|
+
validateEmails(composeMailParams.bccRecipients);
|
15678
|
+
}
|
15679
|
+
// For Reply, ReplyAll, and Forward types, no validation needed
|
15680
|
+
}
|
15681
|
+
/**
|
15682
|
+
* Compose a new email in the user's mailbox, opening it in the drafts UX instead of the standard email.
|
15683
|
+
*
|
15684
|
+
* @param composeMailParamsWithHandoff - Object that specifies the type of mail item to compose and the details of the mail item.
|
15685
|
+
* @returns { Promise<void> } - promise resolves after the compose window has opened successfully in host SDK.
|
15686
|
+
* @throws Error with a message describing whether the capability is not initialized or the input is invalid.
|
15687
|
+
*
|
15688
|
+
* @beta
|
15689
|
+
*/
|
15690
|
+
function composeMailWithHandoff(composeMailParamsWithHandoff) {
|
15691
|
+
ensureInitialized(runtime, FrameContexts.content);
|
15692
|
+
if (!handoff_isSupported()) {
|
15693
|
+
throw new Error('Not supported');
|
15694
|
+
}
|
15695
|
+
validateHandoffComposeMailParams(composeMailParamsWithHandoff);
|
15696
|
+
return callFunctionInHost("mail.handoff.composeMail" /* ApiName.Mail_Handoff_ComposeMail */, [new SerializableComposeMailParamsWithHandoff(composeMailParamsWithHandoff)], getApiVersionTag(mailTelemetryVersionNumber, "mail.handoff.composeMail" /* ApiName.Mail_Handoff_ComposeMail */));
|
15697
|
+
}
|
15698
|
+
/**
|
15699
|
+
* Checks if the mail capability and handoff sub-capability is supported by the host
|
15700
|
+
* @returns boolean to represent whether the handoff sub-capability is supported
|
15701
|
+
*
|
15702
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
15703
|
+
*
|
15704
|
+
* @beta
|
15705
|
+
*/
|
15706
|
+
function handoff_isSupported() {
|
15707
|
+
return ensureInitialized(runtime) && runtime.supports.mail && runtime.supports.mail.handoff ? true : false;
|
15708
|
+
}
|
15709
|
+
class SerializableComposeMailParamsWithHandoff {
|
15710
|
+
constructor(composeMailParamsWithHandoff) {
|
15711
|
+
this.composeMailParamsWithHandoff = composeMailParamsWithHandoff;
|
15712
|
+
}
|
15713
|
+
serialize() {
|
15714
|
+
return this.composeMailParamsWithHandoff;
|
15715
|
+
}
|
15716
|
+
}
|
15717
|
+
|
15718
|
+
;// ./src/public/mail/mail.ts
|
15719
|
+
/**
|
15720
|
+
* Used to interact with mail capability, including opening and composing mail.
|
15721
|
+
* @module
|
15722
|
+
*/
|
15723
|
+
|
15724
|
+
|
15725
|
+
|
15726
|
+
|
15727
|
+
|
15728
|
+
|
15729
|
+
/**
|
15730
|
+
* v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
|
15731
|
+
*/
|
15732
|
+
const mail_mailTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
|
15576
15733
|
/**
|
15577
15734
|
* Opens a mail message in the host.
|
15578
15735
|
*
|
@@ -15587,7 +15744,7 @@ function openMailItem(openMailItemParams) {
|
|
15587
15744
|
if (!openMailItemParams.itemId || !openMailItemParams.itemId.trim()) {
|
15588
15745
|
throw new Error('Must supply an itemId to openMailItem');
|
15589
15746
|
}
|
15590
|
-
resolve(sendAndHandleStatusAndReason(getApiVersionTag(
|
15747
|
+
resolve(sendAndHandleStatusAndReason(getApiVersionTag(mail_mailTelemetryVersionNumber, "mail.openMailItem" /* ApiName.Mail_OpenMailItem */), 'mail.openMailItem', openMailItemParams));
|
15591
15748
|
});
|
15592
15749
|
}
|
15593
15750
|
/**
|
@@ -15602,7 +15759,7 @@ function composeMail(composeMailParams) {
|
|
15602
15759
|
if (!mail_isSupported()) {
|
15603
15760
|
throw new Error('Not supported');
|
15604
15761
|
}
|
15605
|
-
resolve(sendAndHandleStatusAndReason(getApiVersionTag(
|
15762
|
+
resolve(sendAndHandleStatusAndReason(getApiVersionTag(mail_mailTelemetryVersionNumber, "mail.composeMail" /* ApiName.Mail_ComposeMail */), 'mail.composeMail', composeMailParams));
|
15606
15763
|
});
|
15607
15764
|
}
|
15608
15765
|
/**
|
@@ -15626,6 +15783,7 @@ var ComposeMailType;
|
|
15626
15783
|
/** Compose a new mail message with the content of an existing mail message forwarded to a new recipient. */
|
15627
15784
|
ComposeMailType["Forward"] = "forward";
|
15628
15785
|
})(ComposeMailType || (ComposeMailType = {}));
|
15786
|
+
|
15629
15787
|
|
15630
15788
|
;// ./src/public/teamsAPIs.ts
|
15631
15789
|
/**
|
@@ -16619,7 +16777,8 @@ function isWebStorageClearedOnUserLogOut() {
|
|
16619
16777
|
if (runtime.isLegacyTeams &&
|
16620
16778
|
(GlobalVars.hostClientType === HostClientType.android ||
|
16621
16779
|
GlobalVars.hostClientType === HostClientType.ios ||
|
16622
|
-
GlobalVars.hostClientType === HostClientType.ipados
|
16780
|
+
GlobalVars.hostClientType === HostClientType.ipados ||
|
16781
|
+
GlobalVars.hostClientType === HostClientType.visionOS) &&
|
16623
16782
|
(yield getHostName()) === HostName.teams) {
|
16624
16783
|
// On Teams Mobile, they haven't yet implemented this capability. However, for compatibility reasons, we need
|
16625
16784
|
// to act as if they do. If they did implement it, they would return true, so that's what we do here.
|