@microsoft/teams-js 2.9.0-beta.0 → 2.9.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.
- package/README.md +4 -4
- package/dist/MicrosoftTeams.d.ts +128 -31
- package/dist/MicrosoftTeams.js +238 -13
- package/dist/MicrosoftTeams.js.map +1 -1
- package/dist/MicrosoftTeams.min.js +1 -1
- package/dist/MicrosoftTeams.min.js.map +1 -1
- package/package.json +36 -1
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.9.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.9.0/js/MicrosoftTeams.min.js"
|
49
|
+
integrity="sha384-wh4L8gn9alg8jFXiHwEw/IgcfK7aT/6Pyby/p5B7zHM+a0Jek5MxzO7AvSlRFvsC"
|
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.9.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
@@ -2075,7 +2075,7 @@ export namespace videoEx {
|
|
2075
2075
|
* @internal
|
2076
2076
|
* Limited to Microsoft-internal use
|
2077
2077
|
*/
|
2078
|
-
interface VideoFrame extends video.
|
2078
|
+
interface VideoFrame extends video.VideoFrameData {
|
2079
2079
|
/**
|
2080
2080
|
* @hidden
|
2081
2081
|
* The model output if you passed in an {@linkcode VideoFrameConfig.audioInferenceModel}
|
@@ -2208,26 +2208,45 @@ export namespace videoEx {
|
|
2208
2208
|
* This object is used for starting or completing authentication flows.
|
2209
2209
|
*/
|
2210
2210
|
export namespace authentication {
|
2211
|
+
/**
|
2212
|
+
* @hidden
|
2213
|
+
* @internal
|
2214
|
+
* Limited to Microsoft-internal use; automatically called when library is initialized
|
2215
|
+
*/
|
2211
2216
|
function initialize(): void;
|
2212
2217
|
/**
|
2213
2218
|
* @deprecated
|
2214
|
-
* As of 2.0.0, this function has been deprecated in favor of a Promise-based pattern.
|
2215
|
-
*
|
2219
|
+
* As of 2.0.0, this function has been deprecated in favor of a Promise-based pattern using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
|
2220
|
+
*
|
2221
|
+
* Registers handlers to be called with the result of an authentication flow triggered using {@link authentication.authenticate authentication.authenticate(authenticateParameters?: AuthenticateParameters): void}
|
2216
2222
|
*
|
2217
|
-
* @param authenticateParameters -
|
2223
|
+
* @param authenticateParameters - Configuration for authentication flow pop-up result communication
|
2218
2224
|
*/
|
2219
2225
|
function registerAuthenticationHandlers(authenticateParameters: AuthenticateParameters): void;
|
2220
2226
|
/**
|
2221
|
-
* Initiates an authentication
|
2227
|
+
* Initiates an authentication flow which requires a new window.
|
2228
|
+
* There are two primary uses for this function:
|
2229
|
+
* 1. When your app needs to authenticate using a 3rd-party identity provider (not Azure Active Directory)
|
2230
|
+
* 2. When your app needs to show authentication UI that is blocked from being shown in an iframe (e.g., Azure Active Directory consent prompts)
|
2231
|
+
*
|
2232
|
+
* For more details, see [Enable authentication using third-party OAuth provider](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/authentication/auth-flow-tab)
|
2233
|
+
*
|
2234
|
+
* This function is *not* needed for "standard" Azure SSO usage. Using {@link getAuthToken} is usually sufficient in that case. For more, see
|
2235
|
+
* [Enable SSO for tab apps](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/authentication/tab-sso-overview))
|
2222
2236
|
*
|
2223
2237
|
* @remarks
|
2224
2238
|
* The authentication flow must start and end from the same domain, otherwise success and failure messages won't be returned to the window that initiated the call.
|
2239
|
+
* The [Teams authentication flow](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/authentication/auth-flow-tab) starts and ends at an endpoint on
|
2240
|
+
* your own service (with a redirect round-trip to the 3rd party identity provider in the middle).
|
2225
2241
|
*
|
2226
|
-
* @param authenticateParameters -
|
2242
|
+
* @param authenticateParameters - Parameters describing the authentication window used for executing the authentication flow
|
2227
2243
|
*
|
2228
|
-
* @returns Promise that will be fulfilled with the result from the authentication pop-up if successful.
|
2244
|
+
* @returns `Promise` that will be fulfilled with the result from the authentication pop-up, if successful. The string in this result is provided in the parameter
|
2245
|
+
* passed by your app when it calls {@link notifySuccess} in the pop-up window after returning from the identity provider redirect.
|
2229
2246
|
*
|
2230
|
-
* @throws Error if the authentication request fails or is canceled by the user.
|
2247
|
+
* @throws `Error` if the authentication request fails or is canceled by the user. This error is provided in the parameter passed by your app when it calls
|
2248
|
+
* {@link notifyFailure} in the pop-up window after returning from the identity provider redirect. However, in some cases it can also be provided by
|
2249
|
+
* the infrastructure depending on the failure (e.g., a user cancelation)
|
2231
2250
|
*
|
2232
2251
|
*/
|
2233
2252
|
function authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise<string>;
|
@@ -2235,30 +2254,36 @@ export namespace authentication {
|
|
2235
2254
|
* @deprecated
|
2236
2255
|
* As of 2.0.0, please use {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} instead.
|
2237
2256
|
*
|
2238
|
-
*
|
2257
|
+
* The documentation for {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} applies
|
2258
|
+
* to this function.
|
2259
|
+
* The one difference is that instead of the result being returned via the `Promise`, the result is returned to the callback functions provided in the
|
2260
|
+
* `authenticateParameters` parameter.
|
2239
2261
|
*
|
2240
|
-
* @
|
2241
|
-
* The authentication flow must start and end from the same domain, otherwise success and failure messages won't be returned to the window that initiated the call.
|
2242
|
-
*
|
2243
|
-
* @param authenticateParameters - The parameters for the authentication request.
|
2262
|
+
* @param authenticateParameters - Parameters describing the authentication window used for executing the authentication flow and callbacks used for indicating the result
|
2244
2263
|
*
|
2245
2264
|
*/
|
2246
2265
|
function authenticate(authenticateParameters?: AuthenticateParameters): void;
|
2247
2266
|
/**
|
2248
|
-
* Requests an Azure AD token to be issued on behalf of
|
2249
|
-
* if it is not expired. Otherwise a request is sent to Azure AD to
|
2267
|
+
* Requests an Azure AD token to be issued on behalf of your app in an SSO flow.
|
2268
|
+
* The token is acquired from the cache if it is not expired. Otherwise a request is sent to Azure AD to
|
2269
|
+
* obtain a new token.
|
2270
|
+
* This function is used to enable SSO scenarios. See [Enable SSO for tab apps](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/authentication/tab-sso-overview)
|
2271
|
+
* for more details.
|
2250
2272
|
*
|
2251
2273
|
* @param authTokenRequest - An optional set of values that configure the token request.
|
2252
2274
|
*
|
2253
|
-
* @returns Promise that will be
|
2275
|
+
* @returns `Promise` that will be resolved with the token, if successful.
|
2276
|
+
*
|
2277
|
+
* @throws `Error` if the request fails in some way
|
2254
2278
|
*/
|
2255
2279
|
function getAuthToken(authTokenRequest?: AuthTokenRequestParameters): Promise<string>;
|
2256
2280
|
/**
|
2257
2281
|
* @deprecated
|
2258
2282
|
* As of 2.0.0, please use {@link authentication.getAuthToken authentication.getAuthToken(authTokenRequest: AuthTokenRequestParameters): Promise\<string\>} instead.
|
2259
2283
|
*
|
2260
|
-
*
|
2261
|
-
*
|
2284
|
+
* The documentation {@link authentication.getAuthToken authentication.getAuthToken(authTokenRequest: AuthTokenRequestParameters): Promise\<string\>} applies to this
|
2285
|
+
* function as well. The one difference when using this function is that the result is provided in the callbacks in the `authTokenRequest` parameter
|
2286
|
+
* instead of as a `Promise`.
|
2262
2287
|
*
|
2263
2288
|
* @param authTokenRequest - An optional set of values that configure the token request.
|
2264
2289
|
* It contains callbacks to call in case of success/failure
|
@@ -2287,30 +2312,39 @@ export namespace authentication {
|
|
2287
2312
|
*/
|
2288
2313
|
function getUser(userRequest: UserRequest): void;
|
2289
2314
|
/**
|
2290
|
-
*
|
2315
|
+
* When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
|
2316
|
+
* window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
|
2317
|
+
* {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
|
2318
|
+
* authentication request was successful.
|
2291
2319
|
*
|
2292
2320
|
* @remarks
|
2293
|
-
* This function is usable only
|
2321
|
+
* This function is usable only from the authentication window.
|
2294
2322
|
* This call causes the authentication window to be closed.
|
2295
2323
|
*
|
2296
|
-
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2324
|
+
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2325
|
+
* this value in its callback or via the `Promise` return value
|
2297
2326
|
* @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
|
2298
2327
|
*/
|
2299
2328
|
function notifySuccess(result?: string, callbackUrl?: string): void;
|
2300
2329
|
/**
|
2301
|
-
*
|
2330
|
+
* When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
|
2331
|
+
* window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
|
2332
|
+
* {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
|
2333
|
+
* authentication request failed.
|
2334
|
+
|
2302
2335
|
*
|
2303
2336
|
* @remarks
|
2304
2337
|
* This function is usable only on the authentication window.
|
2305
2338
|
* This call causes the authentication window to be closed.
|
2306
2339
|
*
|
2307
|
-
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2340
|
+
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2341
|
+
* this value in its callback or via the `Promise` return value
|
2308
2342
|
* @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
|
2309
2343
|
*/
|
2310
2344
|
function notifyFailure(reason?: string, callbackUrl?: string): void;
|
2311
2345
|
/**
|
2312
2346
|
* @deprecated
|
2313
|
-
* As of 2.0.0, this interface has been deprecated in favor of
|
2347
|
+
* As of 2.0.0, this interface has been deprecated in favor of leveraging the `Promise` returned from {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
|
2314
2348
|
*-------------------------
|
2315
2349
|
* Used in {@link AuthenticateParameters} and {@link AuthTokenRequest}
|
2316
2350
|
*/
|
@@ -2318,12 +2352,14 @@ export namespace authentication {
|
|
2318
2352
|
/**
|
2319
2353
|
* @deprecated
|
2320
2354
|
* As of 2.0.0, this property has been deprecated in favor of a Promise-based pattern.
|
2355
|
+
*
|
2321
2356
|
* A function that is called if the request succeeds.
|
2322
2357
|
*/
|
2323
2358
|
successCallback?: (result: string) => void;
|
2324
2359
|
/**
|
2325
2360
|
* @deprecated
|
2326
2361
|
* As of 2.0.0, this property has been deprecated in favor of a Promise-based pattern.
|
2362
|
+
*
|
2327
2363
|
* A function that is called if the request fails, with the reason for the failure.
|
2328
2364
|
*/
|
2329
2365
|
failureCallback?: (reason: string) => void;
|
@@ -2345,13 +2381,22 @@ export namespace authentication {
|
|
2345
2381
|
*/
|
2346
2382
|
height?: number;
|
2347
2383
|
/**
|
2348
|
-
*
|
2384
|
+
* Some identity providers restrict their authentication pages from being displayed in embedded browsers (e.g., a web view inside of a native application)
|
2385
|
+
* If the identity provider you are using prevents embedded browser usage, this flag should be set to `true` to enable the authentication page specified in
|
2386
|
+
* the {@link url} property to be opened in an external browser.
|
2387
|
+
* If this flag is `false`, the page will be opened directly within the current hosting application.
|
2388
|
+
*
|
2389
|
+
* This flag is ignored when the host for the application is a web app (as opposed to a native application) as the behavior is unnecessary in a web-only
|
2390
|
+
* environment without an embedded browser.
|
2349
2391
|
*/
|
2350
2392
|
isExternal?: boolean;
|
2351
2393
|
}
|
2352
2394
|
/**
|
2353
2395
|
* @deprecated
|
2354
|
-
* As of 2.0.0, please use {@link AuthenticatePopUpParameters}
|
2396
|
+
* As of 2.0.0, please use {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} and
|
2397
|
+
* the associated {@link AuthenticatePopUpParameters} instead.
|
2398
|
+
*
|
2399
|
+
* @see {@link LegacyCallBacks}
|
2355
2400
|
*/
|
2356
2401
|
type AuthenticateParameters = AuthenticatePopUpParameters & LegacyCallBacks;
|
2357
2402
|
/**
|
@@ -2359,7 +2404,9 @@ export namespace authentication {
|
|
2359
2404
|
*/
|
2360
2405
|
interface AuthTokenRequestParameters {
|
2361
2406
|
/**
|
2362
|
-
*
|
2407
|
+
* @hidden
|
2408
|
+
* @internal
|
2409
|
+
* An list of resources for which to acquire the access token; only for internal Microsoft usage
|
2363
2410
|
*/
|
2364
2411
|
resources?: string[];
|
2365
2412
|
/**
|
@@ -6624,7 +6671,7 @@ export namespace video {
|
|
6624
6671
|
* Represents a video frame
|
6625
6672
|
* @beta
|
6626
6673
|
*/
|
6627
|
-
interface
|
6674
|
+
interface VideoFrameData {
|
6628
6675
|
/**
|
6629
6676
|
* Video frame width
|
6630
6677
|
*/
|
@@ -6636,7 +6683,7 @@ export namespace video {
|
|
6636
6683
|
/**
|
6637
6684
|
* Video frame buffer
|
6638
6685
|
*/
|
6639
|
-
|
6686
|
+
videoFrameBuffer: Uint8ClampedArray;
|
6640
6687
|
/**
|
6641
6688
|
* NV12 luma stride, valid only when video frame format is NV12
|
6642
6689
|
*/
|
@@ -6659,7 +6706,7 @@ export namespace video {
|
|
6659
6706
|
* @beta
|
6660
6707
|
*/
|
6661
6708
|
enum VideoFrameFormat {
|
6662
|
-
NV12 =
|
6709
|
+
NV12 = "NV12"
|
6663
6710
|
}
|
6664
6711
|
/**
|
6665
6712
|
* Video frame configuration supplied to the host to customize the generated video frame parameters, like format
|
@@ -6689,7 +6736,7 @@ export namespace video {
|
|
6689
6736
|
* Video frame call back function definition
|
6690
6737
|
* @beta
|
6691
6738
|
*/
|
6692
|
-
type VideoFrameCallback = (frame:
|
6739
|
+
type VideoFrameCallback = (frame: VideoFrameData, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void;
|
6693
6740
|
/**
|
6694
6741
|
* Predefined failure reasons for preparing the selected video effect
|
6695
6742
|
* @beta
|
@@ -6742,6 +6789,56 @@ export namespace video {
|
|
6742
6789
|
*
|
6743
6790
|
*/
|
6744
6791
|
function isSupported(): boolean;
|
6792
|
+
/**
|
6793
|
+
* @beta
|
6794
|
+
* Namespace to get video frames from a media stream.
|
6795
|
+
* When the host supports this capability, developer should call {@link mediaStream.registerForVideoFrame} to get the video frames instead of {@link registerForVideoFrame} to get the video frames, callback of {@link registerForVideoFrame} will be ignored when the host supports this capability.
|
6796
|
+
*/
|
6797
|
+
namespace mediaStream {
|
6798
|
+
/**
|
6799
|
+
* @beta
|
6800
|
+
* Checks if video.mediaStream capability is supported by the host
|
6801
|
+
* @returns boolean to represent whether the video.medisStream capability is supported
|
6802
|
+
*
|
6803
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
6804
|
+
*
|
6805
|
+
*/
|
6806
|
+
function isSupported(): boolean;
|
6807
|
+
/**
|
6808
|
+
* @beta
|
6809
|
+
* Video frame data extracted from the media stream. More properties may be added in the future.
|
6810
|
+
*/
|
6811
|
+
type MediaStreamFrameData = {
|
6812
|
+
/**
|
6813
|
+
* The video frame from the media stream.
|
6814
|
+
*/
|
6815
|
+
videoFrame: VideoFrame;
|
6816
|
+
};
|
6817
|
+
/**
|
6818
|
+
* @beta
|
6819
|
+
* Video effect change call back function definition.
|
6820
|
+
* The video app should resolve the promise to notify a successfully processed video frame.
|
6821
|
+
* The video app should reject the promise to notify a failure.
|
6822
|
+
*/
|
6823
|
+
type VideoFrameCallback = (receivedVideoFrame: MediaStreamFrameData) => Promise<VideoFrame>;
|
6824
|
+
/**
|
6825
|
+
* @beta
|
6826
|
+
* Register to read the video frames from the media stream provided by the host.
|
6827
|
+
* @param frameCallback - The callback to invoke when recieve a video frame from the media stream.
|
6828
|
+
* @example
|
6829
|
+
* ```typescript
|
6830
|
+
* video.mediaStream.registerForVideoFrame(async (receivedVideoFrame) => {
|
6831
|
+
* const { videoFrame } = receivedVideoFrame;
|
6832
|
+
* try {
|
6833
|
+
* return await processVideoFrame(videoFrame);
|
6834
|
+
* } catch (error) {
|
6835
|
+
* throw error;
|
6836
|
+
* }
|
6837
|
+
* });
|
6838
|
+
* ```
|
6839
|
+
*/
|
6840
|
+
function registerForVideoFrame(frameCallback: VideoFrameCallback): void;
|
6841
|
+
}
|
6745
6842
|
}
|
6746
6843
|
|
6747
6844
|
/**
|
package/dist/MicrosoftTeams.js
CHANGED
@@ -2151,7 +2151,7 @@ var _minRuntimeConfigToUninitialize = {
|
|
2151
2151
|
};
|
2152
2152
|
|
2153
2153
|
;// CONCATENATED MODULE: ./src/public/version.ts
|
2154
|
-
var version = "2.9.0
|
2154
|
+
var version = "2.9.0";
|
2155
2155
|
|
2156
2156
|
;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
|
2157
2157
|
|
@@ -2302,6 +2302,11 @@ var authentication;
|
|
2302
2302
|
(function (authentication) {
|
2303
2303
|
var authHandlers;
|
2304
2304
|
var authWindowMonitor;
|
2305
|
+
/**
|
2306
|
+
* @hidden
|
2307
|
+
* @internal
|
2308
|
+
* Limited to Microsoft-internal use; automatically called when library is initialized
|
2309
|
+
*/
|
2305
2310
|
function initialize() {
|
2306
2311
|
registerHandler('authentication.authenticate.success', handleSuccess, false);
|
2307
2312
|
registerHandler('authentication.authenticate.failure', handleFailure, false);
|
@@ -2310,10 +2315,11 @@ var authentication;
|
|
2310
2315
|
var authParams;
|
2311
2316
|
/**
|
2312
2317
|
* @deprecated
|
2313
|
-
* As of 2.0.0, this function has been deprecated in favor of a Promise-based pattern.
|
2314
|
-
*
|
2318
|
+
* As of 2.0.0, this function has been deprecated in favor of a Promise-based pattern using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}
|
2319
|
+
*
|
2320
|
+
* Registers handlers to be called with the result of an authentication flow triggered using {@link authentication.authenticate authentication.authenticate(authenticateParameters?: AuthenticateParameters): void}
|
2315
2321
|
*
|
2316
|
-
* @param authenticateParameters -
|
2322
|
+
* @param authenticateParameters - Configuration for authentication flow pop-up result communication
|
2317
2323
|
*/
|
2318
2324
|
function registerAuthenticationHandlers(authenticateParameters) {
|
2319
2325
|
authParams = authenticateParameters;
|
@@ -2563,13 +2569,17 @@ var authentication;
|
|
2563
2569
|
});
|
2564
2570
|
}
|
2565
2571
|
/**
|
2566
|
-
*
|
2572
|
+
* When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
|
2573
|
+
* window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
|
2574
|
+
* {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
|
2575
|
+
* authentication request was successful.
|
2567
2576
|
*
|
2568
2577
|
* @remarks
|
2569
|
-
* This function is usable only
|
2578
|
+
* This function is usable only from the authentication window.
|
2570
2579
|
* This call causes the authentication window to be closed.
|
2571
2580
|
*
|
2572
|
-
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2581
|
+
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2582
|
+
* this value in its callback or via the `Promise` return value
|
2573
2583
|
* @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
|
2574
2584
|
*/
|
2575
2585
|
function notifySuccess(result, callbackUrl) {
|
@@ -2581,13 +2591,18 @@ var authentication;
|
|
2581
2591
|
}
|
2582
2592
|
authentication.notifySuccess = notifySuccess;
|
2583
2593
|
/**
|
2584
|
-
*
|
2594
|
+
* When using {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>}, the
|
2595
|
+
* window that was opened to execute the authentication flow should call this method after authentiction to notify the caller of
|
2596
|
+
* {@link authentication.authenticate authentication.authenticate(authenticateParameters: AuthenticatePopUpParameters): Promise\<string\>} that the
|
2597
|
+
* authentication request failed.
|
2598
|
+
|
2585
2599
|
*
|
2586
2600
|
* @remarks
|
2587
2601
|
* This function is usable only on the authentication window.
|
2588
2602
|
* This call causes the authentication window to be closed.
|
2589
2603
|
*
|
2590
|
-
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2604
|
+
* @param result - Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives
|
2605
|
+
* this value in its callback or via the `Promise` return value
|
2591
2606
|
* @param callbackUrl - Specifies the url to redirect back to if the client is Win32 Outlook.
|
2592
2607
|
*/
|
2593
2608
|
function notifyFailure(reason, callbackUrl) {
|
@@ -7766,6 +7781,53 @@ var profile;
|
|
7766
7781
|
})(profile || (profile = {}));
|
7767
7782
|
|
7768
7783
|
;// CONCATENATED MODULE: ./src/public/video.ts
|
7784
|
+
var video_assign = (undefined && undefined.__assign) || function () {
|
7785
|
+
video_assign = Object.assign || function(t) {
|
7786
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
7787
|
+
s = arguments[i];
|
7788
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7789
|
+
t[p] = s[p];
|
7790
|
+
}
|
7791
|
+
return t;
|
7792
|
+
};
|
7793
|
+
return video_assign.apply(this, arguments);
|
7794
|
+
};
|
7795
|
+
var video_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
7796
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
7797
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
7798
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
7799
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7800
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7801
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
7802
|
+
});
|
7803
|
+
};
|
7804
|
+
var video_generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
7805
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
7806
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
7807
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
7808
|
+
function step(op) {
|
7809
|
+
if (f) throw new TypeError("Generator is already executing.");
|
7810
|
+
while (_) try {
|
7811
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
7812
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
7813
|
+
switch (op[0]) {
|
7814
|
+
case 0: case 1: t = op; break;
|
7815
|
+
case 4: _.label++; return { value: op[1], done: false };
|
7816
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
7817
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
7818
|
+
default:
|
7819
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
7820
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
7821
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
7822
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
7823
|
+
if (t[2]) _.ops.pop();
|
7824
|
+
_.trys.pop(); continue;
|
7825
|
+
}
|
7826
|
+
op = body.call(thisArg, _);
|
7827
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
7828
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
7829
|
+
}
|
7830
|
+
};
|
7769
7831
|
|
7770
7832
|
|
7771
7833
|
|
@@ -7783,7 +7845,7 @@ var video;
|
|
7783
7845
|
*/
|
7784
7846
|
var VideoFrameFormat;
|
7785
7847
|
(function (VideoFrameFormat) {
|
7786
|
-
VideoFrameFormat[
|
7848
|
+
VideoFrameFormat["NV12"] = "NV12";
|
7787
7849
|
})(VideoFrameFormat = video.VideoFrameFormat || (video.VideoFrameFormat = {}));
|
7788
7850
|
/**
|
7789
7851
|
* Video effect change type enum
|
@@ -7827,10 +7889,14 @@ var video;
|
|
7827
7889
|
if (!isSupported()) {
|
7828
7890
|
throw errorNotSupportedOnPlatform;
|
7829
7891
|
}
|
7830
|
-
registerHandler('video.newVideoFrame',
|
7892
|
+
registerHandler('video.newVideoFrame',
|
7893
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
7894
|
+
function (videoFrame) {
|
7831
7895
|
if (videoFrame) {
|
7832
|
-
|
7833
|
-
|
7896
|
+
// The host may pass the VideoFrame with the old definition which has `data` instead of `videoFrameBuffer`
|
7897
|
+
var videoFrameData = video_assign(video_assign({}, videoFrame), { videoFrameBuffer: videoFrame.videoFrameBuffer || videoFrame.data });
|
7898
|
+
var timestamp_1 = videoFrameData.timestamp;
|
7899
|
+
frameCallback(videoFrameData, function () {
|
7834
7900
|
notifyVideoFrameProcessed(timestamp_1);
|
7835
7901
|
}, notifyError);
|
7836
7902
|
}
|
@@ -7906,6 +7972,165 @@ var video;
|
|
7906
7972
|
return ensureInitialized(runtime) && runtime.supports.video ? true : false;
|
7907
7973
|
}
|
7908
7974
|
video.isSupported = isSupported;
|
7975
|
+
/**
|
7976
|
+
* @beta
|
7977
|
+
* Namespace to get video frames from a media stream.
|
7978
|
+
* When the host supports this capability, developer should call {@link mediaStream.registerForVideoFrame} to get the video frames instead of {@link registerForVideoFrame} to get the video frames, callback of {@link registerForVideoFrame} will be ignored when the host supports this capability.
|
7979
|
+
*/
|
7980
|
+
var mediaStream;
|
7981
|
+
(function (mediaStream_1) {
|
7982
|
+
/**
|
7983
|
+
* @beta
|
7984
|
+
* Checks if video.mediaStream capability is supported by the host
|
7985
|
+
* @returns boolean to represent whether the video.medisStream capability is supported
|
7986
|
+
*
|
7987
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
7988
|
+
*
|
7989
|
+
*/
|
7990
|
+
function isSupported() {
|
7991
|
+
var _a;
|
7992
|
+
return ensureInitialized(runtime) && isTextureStreamAvailable() && !!((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.mediaStream);
|
7993
|
+
}
|
7994
|
+
mediaStream_1.isSupported = isSupported;
|
7995
|
+
function isTextureStreamAvailable() {
|
7996
|
+
var _a, _b, _c, _d;
|
7997
|
+
return (typeof window !== 'undefined' &&
|
7998
|
+
!!(((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.getTextureStream) && ((_d = (_c = window['chrome']) === null || _c === void 0 ? void 0 : _c.webview) === null || _d === void 0 ? void 0 : _d.registerTextureStream)));
|
7999
|
+
}
|
8000
|
+
/**
|
8001
|
+
* @beta
|
8002
|
+
* Register to read the video frames from the media stream provided by the host.
|
8003
|
+
* @param frameCallback - The callback to invoke when recieve a video frame from the media stream.
|
8004
|
+
* @example
|
8005
|
+
* ```typescript
|
8006
|
+
* video.mediaStream.registerForVideoFrame(async (receivedVideoFrame) => {
|
8007
|
+
* const { videoFrame } = receivedVideoFrame;
|
8008
|
+
* try {
|
8009
|
+
* return await processVideoFrame(videoFrame);
|
8010
|
+
* } catch (error) {
|
8011
|
+
* throw error;
|
8012
|
+
* }
|
8013
|
+
* });
|
8014
|
+
* ```
|
8015
|
+
*/
|
8016
|
+
function registerForVideoFrame(frameCallback) {
|
8017
|
+
var _this = this;
|
8018
|
+
ensureInitialized(runtime, FrameContexts.sidePanel);
|
8019
|
+
if (!isSupported()) {
|
8020
|
+
throw errorNotSupportedOnPlatform;
|
8021
|
+
}
|
8022
|
+
registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return video_awaiter(_this, void 0, void 0, function () {
|
8023
|
+
var streamId, videoTrack, generator;
|
8024
|
+
var _a, _b;
|
8025
|
+
return video_generator(this, function (_c) {
|
8026
|
+
switch (_c.label) {
|
8027
|
+
case 0:
|
8028
|
+
streamId = mediaStreamInfo.streamId;
|
8029
|
+
return [4 /*yield*/, getInputVideoTrack(streamId)];
|
8030
|
+
case 1:
|
8031
|
+
videoTrack = _c.sent();
|
8032
|
+
generator = createProcessedStreamGenerator(videoTrack, frameCallback);
|
8033
|
+
// register the video track with processed frames back to the stream:
|
8034
|
+
typeof window !== 'undefined' && ((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.registerTextureStream(streamId, generator));
|
8035
|
+
return [2 /*return*/];
|
8036
|
+
}
|
8037
|
+
});
|
8038
|
+
}); });
|
8039
|
+
sendMessageToParent('video.registerForVideoFrame', [
|
8040
|
+
{
|
8041
|
+
format: VideoFrameFormat.NV12,
|
8042
|
+
},
|
8043
|
+
]);
|
8044
|
+
}
|
8045
|
+
mediaStream_1.registerForVideoFrame = registerForVideoFrame;
|
8046
|
+
/**
|
8047
|
+
* Get the video track from the media stream gotten from chrome.webview.getTextureStream(streamId).
|
8048
|
+
*/
|
8049
|
+
function getInputVideoTrack(streamId) {
|
8050
|
+
return video_awaiter(this, void 0, void 0, function () {
|
8051
|
+
var chrome, mediaStream_2, tracks, error_1, errorMsg;
|
8052
|
+
return video_generator(this, function (_a) {
|
8053
|
+
switch (_a.label) {
|
8054
|
+
case 0:
|
8055
|
+
if (typeof window === 'undefined') {
|
8056
|
+
throw errorNotSupportedOnPlatform;
|
8057
|
+
}
|
8058
|
+
chrome = window['chrome'];
|
8059
|
+
_a.label = 1;
|
8060
|
+
case 1:
|
8061
|
+
_a.trys.push([1, 3, , 4]);
|
8062
|
+
return [4 /*yield*/, chrome.webview.getTextureStream(streamId)];
|
8063
|
+
case 2:
|
8064
|
+
mediaStream_2 = _a.sent();
|
8065
|
+
tracks = mediaStream_2.getVideoTracks();
|
8066
|
+
if (tracks.length === 0) {
|
8067
|
+
throw new Error("No video track in stream ".concat(streamId));
|
8068
|
+
}
|
8069
|
+
return [2 /*return*/, tracks[0]];
|
8070
|
+
case 3:
|
8071
|
+
error_1 = _a.sent();
|
8072
|
+
errorMsg = "Failed to get video track from stream ".concat(streamId, ", error: ").concat(error_1);
|
8073
|
+
notifyError(errorMsg);
|
8074
|
+
throw new Error(errorMsg);
|
8075
|
+
case 4: return [2 /*return*/];
|
8076
|
+
}
|
8077
|
+
});
|
8078
|
+
});
|
8079
|
+
}
|
8080
|
+
/**
|
8081
|
+
* The function to create a processed video track from the original video track.
|
8082
|
+
* It reads frames from the video track and pipes them to the video frame callback to process the frames.
|
8083
|
+
* The processed frames are then enqueued to the generator.
|
8084
|
+
* The generator can be registered back to the media stream so that the host can get the processed frames.
|
8085
|
+
*/
|
8086
|
+
function createProcessedStreamGenerator(videoTrack, videoFrameCallback) {
|
8087
|
+
var processor = new MediaStreamTrackProcessor({ track: videoTrack });
|
8088
|
+
var source = processor.readable;
|
8089
|
+
var generator = new MediaStreamTrackGenerator({ kind: 'video' });
|
8090
|
+
var sink = generator.writable;
|
8091
|
+
source
|
8092
|
+
.pipeThrough(new TransformStream({
|
8093
|
+
transform: function (originalFrame, controller) {
|
8094
|
+
return video_awaiter(this, void 0, void 0, function () {
|
8095
|
+
var timestamp, frameProcessedByApp, processedFrame, error_2;
|
8096
|
+
return video_generator(this, function (_a) {
|
8097
|
+
switch (_a.label) {
|
8098
|
+
case 0:
|
8099
|
+
timestamp = originalFrame.timestamp;
|
8100
|
+
if (!(timestamp !== null)) return [3 /*break*/, 5];
|
8101
|
+
_a.label = 1;
|
8102
|
+
case 1:
|
8103
|
+
_a.trys.push([1, 3, , 4]);
|
8104
|
+
return [4 /*yield*/, videoFrameCallback({ videoFrame: originalFrame })];
|
8105
|
+
case 2:
|
8106
|
+
frameProcessedByApp = _a.sent();
|
8107
|
+
processedFrame = new VideoFrame(frameProcessedByApp, {
|
8108
|
+
// we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
|
8109
|
+
timestamp: timestamp,
|
8110
|
+
});
|
8111
|
+
controller.enqueue(processedFrame);
|
8112
|
+
originalFrame.close();
|
8113
|
+
frameProcessedByApp.close();
|
8114
|
+
return [3 /*break*/, 4];
|
8115
|
+
case 3:
|
8116
|
+
error_2 = _a.sent();
|
8117
|
+
originalFrame.close();
|
8118
|
+
notifyError(error_2);
|
8119
|
+
return [3 /*break*/, 4];
|
8120
|
+
case 4: return [3 /*break*/, 6];
|
8121
|
+
case 5:
|
8122
|
+
notifyError('timestamp of the original video frame is null');
|
8123
|
+
_a.label = 6;
|
8124
|
+
case 6: return [2 /*return*/];
|
8125
|
+
}
|
8126
|
+
});
|
8127
|
+
});
|
8128
|
+
},
|
8129
|
+
}))
|
8130
|
+
.pipeTo(sink);
|
8131
|
+
return generator;
|
8132
|
+
}
|
8133
|
+
})(mediaStream = video.mediaStream || (video.mediaStream = {}));
|
7909
8134
|
})(video || (video = {})); //end of video namespace
|
7910
8135
|
|
7911
8136
|
;// CONCATENATED MODULE: ./src/public/search.ts
|