@microsoft/teams-js 2.20.0-beta.3 → 2.20.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
package/README.md
CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
|
|
24
24
|
|
25
25
|
### Production
|
26
26
|
|
27
|
-
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.
|
27
|
+
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.20.0/js/MicrosoftTeams.min.js) or point your package manager at them.
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
|
|
45
45
|
```html
|
46
46
|
<!-- Microsoft Teams JavaScript API (via CDN) -->
|
47
47
|
<script
|
48
|
-
src="https://res.cdn.office.net/teams-js/2.
|
49
|
-
integrity="sha384-
|
48
|
+
src="https://res.cdn.office.net/teams-js/2.20.0/js/MicrosoftTeams.min.js"
|
49
|
+
integrity="sha384-wBC2cOp5ArjIyhxoK1NtXvJb98SbNojaoD6hXpvxWil+g4O1M2rXNtywEcAoQ8bl"
|
50
50
|
crossorigin="anonymous"
|
51
51
|
></script>
|
52
52
|
|
53
53
|
<!-- Microsoft Teams JavaScript API (via npm) -->
|
54
|
-
<script src="node_modules/@microsoft/teams-js@2.
|
54
|
+
<script src="node_modules/@microsoft/teams-js@2.20.0/dist/MicrosoftTeams.min.js"></script>
|
55
55
|
|
56
56
|
<!-- Microsoft Teams JavaScript API (via local) -->
|
57
57
|
<script src="MicrosoftTeams.min.js"></script>
|
package/dist/MicrosoftTeams.d.ts
CHANGED
@@ -1829,6 +1829,57 @@ export namespace meetingRoom {
|
|
1829
1829
|
export {};
|
1830
1830
|
}
|
1831
1831
|
|
1832
|
+
/**
|
1833
|
+
* @hidden
|
1834
|
+
* Namespace to request message ports from the host application.
|
1835
|
+
*
|
1836
|
+
* @beta
|
1837
|
+
*
|
1838
|
+
* @internal
|
1839
|
+
* Limited to Microsoft-internal use
|
1840
|
+
*/
|
1841
|
+
export namespace messageChannels {
|
1842
|
+
/**
|
1843
|
+
* @hidden
|
1844
|
+
* @beta
|
1845
|
+
*
|
1846
|
+
* Fetches a MessagePort to batch telemetry through the host's telemetry worker.
|
1847
|
+
* The port is cached once received, so subsequent calls return the same port.
|
1848
|
+
* @returns MessagePort.
|
1849
|
+
*
|
1850
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed,
|
1851
|
+
* if the host does not support the feature, or if the port request is rejected.
|
1852
|
+
*
|
1853
|
+
* @internal
|
1854
|
+
* Limited to Microsoft-internal use
|
1855
|
+
*/
|
1856
|
+
function getTelemetryPort(): Promise<MessagePort>;
|
1857
|
+
/**
|
1858
|
+
* @hidden
|
1859
|
+
*
|
1860
|
+
* @beta
|
1861
|
+
*
|
1862
|
+
* Checks if the messageChannels capability is supported by the host
|
1863
|
+
* @returns boolean to represent whether the messageChannels capability is supported
|
1864
|
+
*
|
1865
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
1866
|
+
*
|
1867
|
+
* @internal
|
1868
|
+
* Limited to Microsoft-internal use
|
1869
|
+
*/
|
1870
|
+
function isSupported(): boolean;
|
1871
|
+
/**
|
1872
|
+
* @hidden
|
1873
|
+
* Undocumented function used to clear state between unit tests
|
1874
|
+
*
|
1875
|
+
* @beta
|
1876
|
+
*
|
1877
|
+
* @internal
|
1878
|
+
* Limited to Microsoft-internal use
|
1879
|
+
*/
|
1880
|
+
function _clearTelemetryPort(): void;
|
1881
|
+
}
|
1882
|
+
|
1832
1883
|
export namespace notifications {
|
1833
1884
|
/**
|
1834
1885
|
* @hidden
|
package/dist/MicrosoftTeams.js
CHANGED
@@ -883,6 +883,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
883
883
|
meeting: () => (/* reexport */ meeting),
|
884
884
|
meetingRoom: () => (/* reexport */ meetingRoom),
|
885
885
|
menus: () => (/* reexport */ menus),
|
886
|
+
messageChannels: () => (/* reexport */ messageChannels),
|
886
887
|
monetization: () => (/* reexport */ monetization),
|
887
888
|
navigateBack: () => (/* reexport */ navigateBack),
|
888
889
|
navigateCrossDomain: () => (/* reexport */ navigateCrossDomain),
|
@@ -1105,6 +1106,7 @@ var ApiName;
|
|
1105
1106
|
ApiName["Menus_SetNavBarMenu"] = "menus.setNavBarMenu";
|
1106
1107
|
ApiName["Menus_SetUpViews"] = "menus.setUpViews";
|
1107
1108
|
ApiName["Menus_ShowActionMenu"] = "menus.showActionMenu";
|
1109
|
+
ApiName["MessageChannels_GetTelemetryPort"] = "messageChannels.getTelemetryPort";
|
1108
1110
|
ApiName["Monetization_OpenPurchaseExperience"] = "monetization.openPurchaseExperience";
|
1109
1111
|
ApiName["Navigation_NavigateBack"] = "navigation.navigateBack";
|
1110
1112
|
ApiName["Navigation_NavigateCrossDomain"] = "navigation.navigateCrossDomain";
|
@@ -1776,7 +1778,9 @@ var ChannelType;
|
|
1776
1778
|
/** An error object indicating that the requested operation or feature is not supported on the current platform or device.
|
1777
1779
|
* @typedef {Object} SdkError
|
1778
1780
|
*/
|
1779
|
-
const errorNotSupportedOnPlatform = {
|
1781
|
+
const errorNotSupportedOnPlatform = {
|
1782
|
+
errorCode: ErrorCode.NOT_SUPPORTED_ON_PLATFORM,
|
1783
|
+
};
|
1780
1784
|
/**
|
1781
1785
|
* @hidden
|
1782
1786
|
*
|
@@ -2516,7 +2520,7 @@ const _minRuntimeConfigToUninitialize = {
|
|
2516
2520
|
* @hidden
|
2517
2521
|
* Package version.
|
2518
2522
|
*/
|
2519
|
-
const version = "2.20.0-beta.
|
2523
|
+
const version = "2.20.0-beta.4";
|
2520
2524
|
|
2521
2525
|
;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
|
2522
2526
|
|
@@ -5514,6 +5518,7 @@ CommunicationPrivate.topMessageQueue = [];
|
|
5514
5518
|
CommunicationPrivate.nextMessageId = 0;
|
5515
5519
|
CommunicationPrivate.callbacks = {};
|
5516
5520
|
CommunicationPrivate.promiseCallbacks = {};
|
5521
|
+
CommunicationPrivate.portCallbacks = {};
|
5517
5522
|
/**
|
5518
5523
|
* @internal
|
5519
5524
|
* Limited to Microsoft-internal use
|
@@ -5582,6 +5587,7 @@ function uninitializeCommunication() {
|
|
5582
5587
|
CommunicationPrivate.nextMessageId = 0;
|
5583
5588
|
CommunicationPrivate.callbacks = {};
|
5584
5589
|
CommunicationPrivate.promiseCallbacks = {};
|
5590
|
+
CommunicationPrivate.portCallbacks = {};
|
5585
5591
|
}
|
5586
5592
|
/**
|
5587
5593
|
* @hidden
|
@@ -5716,6 +5722,36 @@ function sendMessageToParentAsync(actionName, args = undefined) {
|
|
5716
5722
|
resolve(waitForResponse(request.id));
|
5717
5723
|
});
|
5718
5724
|
}
|
5725
|
+
/**
|
5726
|
+
* @hidden
|
5727
|
+
* Send a message to parent requesting a MessageChannel Port.
|
5728
|
+
* @internal
|
5729
|
+
* Limited to Microsoft-internal use
|
5730
|
+
*/
|
5731
|
+
function requestPortFromParentWithVersion(apiVersionTag, actionName, args = undefined) {
|
5732
|
+
if (!isFollowingApiVersionTagFormat(apiVersionTag)) {
|
5733
|
+
throw Error(`apiVersionTag: ${apiVersionTag} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);
|
5734
|
+
}
|
5735
|
+
const request = sendMessageToParentHelper(apiVersionTag, actionName, args);
|
5736
|
+
return waitForPort(request.id);
|
5737
|
+
}
|
5738
|
+
/**
|
5739
|
+
* @internal
|
5740
|
+
* Limited to Microsoft-internal use
|
5741
|
+
*/
|
5742
|
+
function waitForPort(requestId) {
|
5743
|
+
return new Promise((resolve, reject) => {
|
5744
|
+
CommunicationPrivate.portCallbacks[requestId] = (port, args) => {
|
5745
|
+
if (port instanceof MessagePort) {
|
5746
|
+
resolve(port);
|
5747
|
+
}
|
5748
|
+
else {
|
5749
|
+
// First arg is the error message, if present
|
5750
|
+
reject(args && args.length > 0 ? args[0] : new Error('Host responded without port or error details.'));
|
5751
|
+
}
|
5752
|
+
};
|
5753
|
+
});
|
5754
|
+
}
|
5719
5755
|
/**
|
5720
5756
|
* @internal
|
5721
5757
|
* Limited to Microsoft-internal use
|
@@ -6016,6 +6052,17 @@ function handleParentMessage(evt) {
|
|
6016
6052
|
logger('Removing registered promise callback for message %i', message.id);
|
6017
6053
|
delete CommunicationPrivate.promiseCallbacks[message.id];
|
6018
6054
|
}
|
6055
|
+
const portCallback = CommunicationPrivate.portCallbacks[message.id];
|
6056
|
+
if (portCallback) {
|
6057
|
+
logger('Invoking the registered port callback for message %i with arguments %o', message.id, message.args);
|
6058
|
+
let port;
|
6059
|
+
if (evt.ports && evt.ports[0] instanceof MessagePort) {
|
6060
|
+
port = evt.ports[0];
|
6061
|
+
}
|
6062
|
+
portCallback(port, message.args);
|
6063
|
+
logger('Removing registered port callback for message %i', message.id);
|
6064
|
+
delete CommunicationPrivate.portCallbacks[message.id];
|
6065
|
+
}
|
6019
6066
|
}
|
6020
6067
|
else if ('func' in evt.data && typeof evt.data.func === 'string') {
|
6021
6068
|
// Delegate the request to the proper handler
|
@@ -13332,6 +13379,97 @@ var meetingRoom;
|
|
13332
13379
|
meetingRoom.isSupported = isSupported;
|
13333
13380
|
})(meetingRoom || (meetingRoom = {}));
|
13334
13381
|
|
13382
|
+
;// CONCATENATED MODULE: ./src/private/messageChannels.ts
|
13383
|
+
var messageChannels_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
13384
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13385
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
13386
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
13387
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
13388
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
13389
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
13390
|
+
});
|
13391
|
+
};
|
13392
|
+
|
13393
|
+
|
13394
|
+
|
13395
|
+
|
13396
|
+
|
13397
|
+
/**
|
13398
|
+
* @hidden
|
13399
|
+
* Namespace to request message ports from the host application.
|
13400
|
+
*
|
13401
|
+
* @beta
|
13402
|
+
*
|
13403
|
+
* @internal
|
13404
|
+
* Limited to Microsoft-internal use
|
13405
|
+
*/
|
13406
|
+
var messageChannels;
|
13407
|
+
(function (messageChannels) {
|
13408
|
+
let telemetryPort;
|
13409
|
+
const messageChannelsTelemetryVersionNumber = ApiVersionNumber.V_1;
|
13410
|
+
const logger = getLogger('messageChannels');
|
13411
|
+
/**
|
13412
|
+
* @hidden
|
13413
|
+
* @beta
|
13414
|
+
*
|
13415
|
+
* Fetches a MessagePort to batch telemetry through the host's telemetry worker.
|
13416
|
+
* The port is cached once received, so subsequent calls return the same port.
|
13417
|
+
* @returns MessagePort.
|
13418
|
+
*
|
13419
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed,
|
13420
|
+
* if the host does not support the feature, or if the port request is rejected.
|
13421
|
+
*
|
13422
|
+
* @internal
|
13423
|
+
* Limited to Microsoft-internal use
|
13424
|
+
*/
|
13425
|
+
function getTelemetryPort() {
|
13426
|
+
return messageChannels_awaiter(this, void 0, void 0, function* () {
|
13427
|
+
// If the port has already been initialized, return it.
|
13428
|
+
if (telemetryPort) {
|
13429
|
+
logger('Returning telemetry port from cache');
|
13430
|
+
return telemetryPort;
|
13431
|
+
}
|
13432
|
+
if (!isSupported()) {
|
13433
|
+
throw errorNotSupportedOnPlatform;
|
13434
|
+
}
|
13435
|
+
// Send request for telemetry port, will throw if the request is rejected
|
13436
|
+
telemetryPort = yield requestPortFromParentWithVersion(getApiVersionTag(messageChannelsTelemetryVersionNumber, ApiName.MessageChannels_GetTelemetryPort), 'messageChannels.getTelemetryPort');
|
13437
|
+
return telemetryPort;
|
13438
|
+
});
|
13439
|
+
}
|
13440
|
+
messageChannels.getTelemetryPort = getTelemetryPort;
|
13441
|
+
/**
|
13442
|
+
* @hidden
|
13443
|
+
*
|
13444
|
+
* @beta
|
13445
|
+
*
|
13446
|
+
* Checks if the messageChannels capability is supported by the host
|
13447
|
+
* @returns boolean to represent whether the messageChannels capability is supported
|
13448
|
+
*
|
13449
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
13450
|
+
*
|
13451
|
+
* @internal
|
13452
|
+
* Limited to Microsoft-internal use
|
13453
|
+
*/
|
13454
|
+
function isSupported() {
|
13455
|
+
return internalAPIs_ensureInitialized(runtime_runtime) && runtime_runtime.supports.messageChannels ? true : false;
|
13456
|
+
}
|
13457
|
+
messageChannels.isSupported = isSupported;
|
13458
|
+
/**
|
13459
|
+
* @hidden
|
13460
|
+
* Undocumented function used to clear state between unit tests
|
13461
|
+
*
|
13462
|
+
* @beta
|
13463
|
+
*
|
13464
|
+
* @internal
|
13465
|
+
* Limited to Microsoft-internal use
|
13466
|
+
*/
|
13467
|
+
function _clearTelemetryPort() {
|
13468
|
+
telemetryPort = undefined;
|
13469
|
+
}
|
13470
|
+
messageChannels._clearTelemetryPort = _clearTelemetryPort;
|
13471
|
+
})(messageChannels || (messageChannels = {}));
|
13472
|
+
|
13335
13473
|
;// CONCATENATED MODULE: ./src/private/notifications.ts
|
13336
13474
|
|
13337
13475
|
|
@@ -14183,6 +14321,7 @@ var videoEffectsEx;
|
|
14183
14321
|
|
14184
14322
|
|
14185
14323
|
|
14324
|
+
|
14186
14325
|
|
14187
14326
|
;// CONCATENATED MODULE: ./src/index.ts
|
14188
14327
|
|