@microsoft/teams-js 2.13.0-beta.1 → 2.14.0-beta.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 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.12.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.13.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.12.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-H8/uiTqHq6b1eqm04U0wlhoD92qH4Ibgxrj4QLh8F5iomB4eqTdvi5dzPZkyKNxz"
48
+ src="https://res.cdn.office.net/teams-js/2.13.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-F9Iwc2j9qTKP1PITJeEV0OOS8NDzEUzrP//Fz0t2gzapTMPvNjhYdQjF0idJOuG3"
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.12.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.13.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -2088,13 +2088,47 @@ export namespace videoEx {
2088
2088
  }
2089
2089
  /**
2090
2090
  * @hidden
2091
- * Video frame call back function
2091
+ * The callback will be called on every frame when running on the supported host.
2092
+ * We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely.
2093
+ * The video app should call `notifyVideoFrameProcessed` to notify a successfully processed video frame.
2094
+ * The video app should call `notifyError` to notify a failure. When the failures accumulate to a certain number(determined by the host), the host will see the app is "frozen" and give the user the option to close the app.
2092
2095
  * @beta
2093
2096
  *
2094
2097
  * @internal
2095
2098
  * Limited to Microsoft-internal use
2096
2099
  */
2097
2100
  type VideoBufferHandler = (videoBufferData: VideoBufferData, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void;
2101
+ /**
2102
+ * @hidden
2103
+ * Video frame data extracted from the media stream. More properties may be added in the future.
2104
+ * @beta
2105
+ *
2106
+ * @internal
2107
+ * Limited to Microsoft-internal use
2108
+ */
2109
+ type VideoFrameData = video.VideoFrameData & {
2110
+ /**
2111
+ * @hidden
2112
+ * The model output if you passed in an {@linkcode VideoFrameConfig.audioInferenceModel}
2113
+ * @beta
2114
+ *
2115
+ * @internal
2116
+ * Limited to Microsoft-internal use
2117
+ */
2118
+ audioInferenceResult?: Uint8Array;
2119
+ };
2120
+ /**
2121
+ * @hidden
2122
+ * The callback will be called on every frame when running on the supported host.
2123
+ * We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely.
2124
+ * The video app should resolve the promise to notify a successfully processed video frame.
2125
+ * The video app should reject the promise to notify a failure. When the failures accumulate to a certain number(determined by the host), the host will see the app is "frozen" and give the user the option to close the app.
2126
+ * @beta
2127
+ *
2128
+ * @internal
2129
+ * Limited to Microsoft-internal use
2130
+ */
2131
+ type VideoFrameHandler = (receivedVideoFrame: VideoFrameData) => Promise<video.VideoFrame>;
2098
2132
  /**
2099
2133
  * @hidden
2100
2134
  * @beta
@@ -2103,6 +2137,10 @@ export namespace videoEx {
2103
2137
  * Limited to Microsoft-internal use
2104
2138
  */
2105
2139
  type RegisterForVideoFrameParameters = {
2140
+ /**
2141
+ * Callback function to process the video frames extracted from a media stream.
2142
+ */
2143
+ videoFrameHandler: VideoFrameHandler;
2106
2144
  /**
2107
2145
  * Callback function to process the video frames shared by the host.
2108
2146
  */
@@ -2117,8 +2155,9 @@ export namespace videoEx {
2117
2155
  * Register to process video frames
2118
2156
  * @beta
2119
2157
  *
2120
- * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
2121
- * @param config - VideoFrameConfig to customize generated video frame parameters
2158
+ * @param parameters - Callbacks and configuration to process the video frames. A host may support either {@link VideoFrameHandler} or {@link VideoBufferHandler}, but not both.
2159
+ * To ensure the video effect works on all supported hosts, the video app must provide both {@link VideoFrameHandler} and {@link VideoBufferHandler}.
2160
+ * The host will choose the appropriate callback based on the host's capability.
2122
2161
  *
2123
2162
  * @internal
2124
2163
  * Limited to Microsoft-internal use
@@ -5529,6 +5568,27 @@ export namespace media {
5529
5568
  *
5530
5569
  */
5531
5570
  export function captureImage(callback: captureImageCallbackFunctionType): void;
5571
+ /**
5572
+ * Checks whether or not media has user permission
5573
+ *
5574
+ * @returns Promise that will resolve with true if the user had granted the app permission to media information, or with false otherwise,
5575
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5576
+ */
5577
+ export function hasPermission(): Promise<boolean>;
5578
+ /**
5579
+ * Requests user permission for media
5580
+ *
5581
+ * @returns Promise that will resolve with true if the user consented permission for media, or with false otherwise,
5582
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5583
+ */
5584
+ export function requestPermission(): Promise<boolean>;
5585
+ /**
5586
+ * Checks if media capability is supported by the host
5587
+ * @returns boolean to represent whether media is supported
5588
+ *
5589
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
5590
+ */
5591
+ export function isSupported(): boolean;
5532
5592
  /**
5533
5593
  * Media object returned by the select Media API
5534
5594
  */
@@ -7420,7 +7480,7 @@ export namespace stageView {
7420
7480
  /**
7421
7481
  * The title to give the stage view.
7422
7482
  */
7423
- title: string;
7483
+ title?: string;
7424
7484
  /**
7425
7485
  * The Teams application website URL.
7426
7486
  */
@@ -8238,11 +8298,342 @@ export class LiveShareHost {
8238
8298
  static create(): LiveShareHost;
8239
8299
  }
8240
8300
 
8301
+ /**
8302
+ * @hidden
8303
+ * Namespace for an app to support a checkout flow by interacting with the marketplace cart in the host.
8304
+ * @beta
8305
+ */
8306
+ export namespace marketplace {
8307
+ /**
8308
+ * @hidden
8309
+ * the version of the current cart interface
8310
+ * which is forced to send to the host in the calls.
8311
+ * @internal
8312
+ * Limited to Microsoft-internal use
8313
+ * @beta
8314
+ */
8315
+ export const cartVersion: CartVersion;
8316
+ /**
8317
+ * @hidden
8318
+ * Represents the cart object for the app checkout flow.
8319
+ * @beta
8320
+ */
8321
+ export interface Cart {
8322
+ /**
8323
+ * @hidden
8324
+ * Version of the cart.
8325
+ */
8326
+ readonly version: CartVersion;
8327
+ /**
8328
+ * @hidden
8329
+ * The uuid of the cart.
8330
+ */
8331
+ readonly id: string;
8332
+ /**
8333
+ * @hidden
8334
+ * The cart info.
8335
+ */
8336
+ readonly cartInfo: CartInfo;
8337
+ /**
8338
+ * @hidden
8339
+ * The cart items.
8340
+ */
8341
+ readonly cartItems: CartItem[];
8342
+ }
8343
+ /**
8344
+ * @hidden
8345
+ * Version of the cart that is used by the app.
8346
+ * @internal
8347
+ * Limited to Microsoft-internal use
8348
+ * @beta
8349
+ */
8350
+ interface CartVersion {
8351
+ /**
8352
+ * @hidden
8353
+ * Represents the major version of a cart, it
8354
+ * not compatible with the previous major version.
8355
+ */
8356
+ readonly majorVersion: number;
8357
+ /**
8358
+ * @hidden
8359
+ * The minor version of a cart, which is compatible
8360
+ * with the previous minor version in the same major version.
8361
+ */
8362
+ readonly minorVersion: number;
8363
+ }
8364
+ /**
8365
+ * @hidden
8366
+ * Represents the cart information
8367
+ * @beta
8368
+ */
8369
+ interface CartInfo {
8370
+ /**
8371
+ * @hidden
8372
+ * The country market where the products are selling.
8373
+ * Should be country code in ISO 3166-1 alpha-2 format, e.g. CA for Canada.
8374
+ * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
8375
+ */
8376
+ readonly market: string;
8377
+ /**
8378
+ * @hidden
8379
+ * The identifier to tell the cart is checked out by admin or end user.
8380
+ */
8381
+ readonly intent: Intent;
8382
+ /**
8383
+ * @hidden
8384
+ * Locale the app should render for the user
8385
+ * Should be a BCP 47 language tag, e.g. en-US ([primary tag]-[ISO 3166-1 alpha-2 code]).
8386
+ * https://en.wikipedia.org/wiki/IETF_language_tag
8387
+ */
8388
+ readonly locale: string;
8389
+ /**
8390
+ * @hidden
8391
+ * The status of the cart.
8392
+ */
8393
+ readonly status: CartStatus;
8394
+ /**
8395
+ * @hidden
8396
+ * ISO 4217 currency code for the cart item price, e.g. USD for US Dollar.
8397
+ * https://en.wikipedia.org/wiki/ISO_4217
8398
+ */
8399
+ readonly currency: string;
8400
+ /**
8401
+ * @hidden
8402
+ * ISO 8601 timestamp string in UTC, indicates when the cart is created.
8403
+ * e.g. 2023-06-19T22:06:59Z
8404
+ * https://en.wikipedia.org/wiki/ISO_8601
8405
+ */
8406
+ readonly createdAt: string;
8407
+ /**
8408
+ * @hidden
8409
+ * ISO 8601 timestamp string in UTC, indicates when the cart is updated.
8410
+ * e.g. 2023-06-19T22:06:59Z
8411
+ * https://en.wikipedia.org/wiki/ISO_8601
8412
+ */
8413
+ readonly updatedAt: string;
8414
+ }
8415
+ /**
8416
+ * @hidden
8417
+ * Represents the basic cart item information.
8418
+ * @beta
8419
+ */
8420
+ export interface Item {
8421
+ /**
8422
+ * @hidden
8423
+ * The id of the cart item.
8424
+ */
8425
+ readonly id: string;
8426
+ /**
8427
+ * @hidden
8428
+ * The display name of the cart item.
8429
+ */
8430
+ readonly name: string;
8431
+ /**
8432
+ * @hidden
8433
+ * The quantity of the cart item.
8434
+ */
8435
+ readonly quantity: number;
8436
+ /**
8437
+ * @hidden
8438
+ * The price of the single cart item.
8439
+ */
8440
+ readonly price: number;
8441
+ /**
8442
+ * @hidden
8443
+ * The thumbnail imageURL of the cart item.
8444
+ */
8445
+ readonly imageURL?: URL;
8446
+ }
8447
+ /**
8448
+ * @hidden
8449
+ * Represents the cart item that could have accessories
8450
+ * @beta
8451
+ */
8452
+ export interface CartItem extends Item {
8453
+ /**
8454
+ * @hidden
8455
+ * Accessories to the item if existing.
8456
+ */
8457
+ readonly accessories?: Item[];
8458
+ /**
8459
+ * @hidden
8460
+ * The thumbnail imageURL of the cart item.
8461
+ */
8462
+ readonly imageURL?: URL;
8463
+ }
8464
+ /**
8465
+ * @hidden
8466
+ * Represents the persona creating the cart.
8467
+ * @beta
8468
+ */
8469
+ export enum Intent {
8470
+ /**
8471
+ * @hidden
8472
+ * The cart is created by admin of an organization in Teams Admin Center.
8473
+ */
8474
+ TACAdminUser = "TACAdminUser",
8475
+ /**
8476
+ * @hidden
8477
+ * The cart is created by admin of an organization in Teams.
8478
+ */
8479
+ TeamsAdminUser = "TeamsAdminUser",
8480
+ /**
8481
+ * @hidden
8482
+ * The cart is created by end user of an organization in Teams.
8483
+ */
8484
+ TeamsEndUser = "TeamsEndUser"
8485
+ }
8486
+ /**
8487
+ * @hidden
8488
+ * Represents the status of the cart.
8489
+ * @beta
8490
+ */
8491
+ export enum CartStatus {
8492
+ /**
8493
+ * @hidden
8494
+ * Cart is created but not checked out yet.
8495
+ */
8496
+ Open = "Open",
8497
+ /**
8498
+ * @hidden
8499
+ * Cart is checked out but not completed yet.
8500
+ */
8501
+ Processing = "Processing",
8502
+ /**
8503
+ * @hidden
8504
+ * Indicate checking out is completed and the host should
8505
+ * return a new cart in the next getCart call.
8506
+ */
8507
+ Processed = "Processed",
8508
+ /**
8509
+ * @hidden
8510
+ * Indicate checking out process is manually cancelled by the user
8511
+ */
8512
+ Closed = "Closed",
8513
+ /**
8514
+ * @hidden
8515
+ * Indicate checking out is failed and the host should
8516
+ * return a new cart in the next getCart call.
8517
+ */
8518
+ Error = "Error"
8519
+ }
8520
+ /**
8521
+ * @hidden
8522
+ * Represents the parameters to update the cart items.
8523
+ * @beta
8524
+ */
8525
+ export interface AddOrUpdateCartItemsParams {
8526
+ /**
8527
+ * @hidden
8528
+ * The uuid of the cart to be updated, target on the cart
8529
+ * being checked out if cartId is not provided.
8530
+ */
8531
+ cartId?: string;
8532
+ /**
8533
+ * @hidden
8534
+ * A list of cart items object, for each item,
8535
+ * if item id exists in the cart, overwrite the item price and quantity,
8536
+ * otherwise add new items to cart.
8537
+ */
8538
+ cartItems: CartItem[];
8539
+ }
8540
+ /**
8541
+ * @hidden
8542
+ * Represents the parameters to remove the cart items.
8543
+ * @beta
8544
+ */
8545
+ export interface RemoveCartItemsParams {
8546
+ /**
8547
+ * @hidden
8548
+ * The uuid of the cart to be updated, target on the cart
8549
+ * being checked out if cartId is not provided.
8550
+ */
8551
+ cartId?: string;
8552
+ /**
8553
+ * @hidden
8554
+ * A list of cart id, delete the cart item accordingly.
8555
+ */
8556
+ cartItemIds: string[];
8557
+ }
8558
+ /**
8559
+ * @hidden
8560
+ * Represents the parameters to update the cart status.
8561
+ * @beta
8562
+ */
8563
+ export interface UpdateCartStatusParams {
8564
+ /**
8565
+ * @hidden
8566
+ * The uuid of the cart to be updated, target on the cart
8567
+ * being checked out if cartId is not provided.
8568
+ */
8569
+ cartId?: string;
8570
+ /**
8571
+ * @hidden
8572
+ * Status of the cart.
8573
+ */
8574
+ cartStatus: CartStatus;
8575
+ /**
8576
+ * @hidden
8577
+ * Extra info to the status.
8578
+ */
8579
+ statusInfo?: string;
8580
+ }
8581
+ /**
8582
+ * @hidden
8583
+ * Get the cart object owned by the host to checkout.
8584
+ * @returns A promise of the cart object in the cartVersion.
8585
+ * @beta
8586
+ */
8587
+ export function getCart(): Promise<Cart>;
8588
+ /**
8589
+ * @hidden
8590
+ * Add or update cart items in the cart owned by the host.
8591
+ * @param addOrUpdateCartItemsParams Represents the parameters to update the cart items.
8592
+ * @returns A promise of the updated cart object in the cartVersion.
8593
+ * @beta
8594
+ */
8595
+ export function addOrUpdateCartItems(addOrUpdateCartItemsParams: AddOrUpdateCartItemsParams): Promise<Cart>;
8596
+ /**
8597
+ * @hidden
8598
+ * Remove cart items from the cart owned by the host.
8599
+ * @param removeCartItemsParams The parameters to remove the cart items.
8600
+ * @returns A promise of the updated cart object in the cartVersion.
8601
+ * @beta
8602
+ */
8603
+ export function removeCartItems(removeCartItemsParams: RemoveCartItemsParams): Promise<Cart>;
8604
+ /**
8605
+ * @hidden
8606
+ * Update cart status in the cart owned by the host.
8607
+ * @param updateCartStatusParams The parameters to update the cart status.
8608
+ * @returns A promise of the updated cart object in the cartVersion.
8609
+ * @beta
8610
+ */
8611
+ export function updateCartStatus(updateCartStatusParams: UpdateCartStatusParams): Promise<Cart>;
8612
+ /**
8613
+ * @hidden
8614
+ * Checks if the marketplace capability is supported by the host.
8615
+ * @returns Boolean to represent whether the marketplace capability is supported.
8616
+ * @throws Error if {@linkcode app.initialize} has not successfully completed.
8617
+ * @beta
8618
+ */
8619
+ export function isSupported(): boolean;
8620
+ export {};
8621
+ }
8622
+
8241
8623
  /**
8242
8624
  * @hidden
8243
8625
  * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
8244
8626
  */
8245
8627
  export function processMediaStream(streamId: string, videoFrameHandler: video.VideoFrameHandler, notifyError: (string: any) => void): Promise<MediaStreamTrack>;
8628
+ /**
8629
+ * @hidden
8630
+ * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
8631
+ * The videoFrameHandler will receive metadata of the video frame.
8632
+ *
8633
+ * @internal
8634
+ * Limited to Microsoft-internal use
8635
+ */
8636
+ export function processMediaStreamWithMetadata(streamId: string, videoFrameHandler: videoEx.VideoFrameHandler, notifyError: (string: any) => void): Promise<MediaStreamTrack>;
8246
8637
  /**
8247
8638
  * @hidden
8248
8639
  * Video effect change call back function definition