@microsoft/teams-js 2.13.0-beta.1 → 2.13.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
@@ -7420,7 +7459,7 @@ export namespace stageView {
7420
7459
  /**
7421
7460
  * The title to give the stage view.
7422
7461
  */
7423
- title: string;
7462
+ title?: string;
7424
7463
  /**
7425
7464
  * The Teams application website URL.
7426
7465
  */
@@ -8238,11 +8277,342 @@ export class LiveShareHost {
8238
8277
  static create(): LiveShareHost;
8239
8278
  }
8240
8279
 
8280
+ /**
8281
+ * @hidden
8282
+ * Namespace for an app to support a checkout flow by interacting with the marketplace cart in the host.
8283
+ * @beta
8284
+ */
8285
+ export namespace marketplace {
8286
+ /**
8287
+ * @hidden
8288
+ * the version of the current cart interface
8289
+ * which is forced to send to the host in the calls.
8290
+ * @internal
8291
+ * Limited to Microsoft-internal use
8292
+ * @beta
8293
+ */
8294
+ export const cartVersion: CartVersion;
8295
+ /**
8296
+ * @hidden
8297
+ * Represents the cart object for the app checkout flow.
8298
+ * @beta
8299
+ */
8300
+ export interface Cart {
8301
+ /**
8302
+ * @hidden
8303
+ * Version of the cart.
8304
+ */
8305
+ readonly version: CartVersion;
8306
+ /**
8307
+ * @hidden
8308
+ * The uuid of the cart.
8309
+ */
8310
+ readonly id: string;
8311
+ /**
8312
+ * @hidden
8313
+ * The cart info.
8314
+ */
8315
+ readonly cartInfo: CartInfo;
8316
+ /**
8317
+ * @hidden
8318
+ * The cart items.
8319
+ */
8320
+ readonly cartItems: CartItem[];
8321
+ }
8322
+ /**
8323
+ * @hidden
8324
+ * Version of the cart that is used by the app.
8325
+ * @internal
8326
+ * Limited to Microsoft-internal use
8327
+ * @beta
8328
+ */
8329
+ interface CartVersion {
8330
+ /**
8331
+ * @hidden
8332
+ * Represents the major version of a cart, it
8333
+ * not compatible with the previous major version.
8334
+ */
8335
+ readonly majorVersion: number;
8336
+ /**
8337
+ * @hidden
8338
+ * The minor version of a cart, which is compatible
8339
+ * with the previous minor version in the same major version.
8340
+ */
8341
+ readonly minorVersion: number;
8342
+ }
8343
+ /**
8344
+ * @hidden
8345
+ * Represents the cart information
8346
+ * @beta
8347
+ */
8348
+ interface CartInfo {
8349
+ /**
8350
+ * @hidden
8351
+ * The country market where the products are selling.
8352
+ * Should be country code in ISO 3166-1 alpha-2 format, e.g. CA for Canada.
8353
+ * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
8354
+ */
8355
+ readonly market: string;
8356
+ /**
8357
+ * @hidden
8358
+ * The identifier to tell the cart is checked out by admin or end user.
8359
+ */
8360
+ readonly intent: Intent;
8361
+ /**
8362
+ * @hidden
8363
+ * Locale the app should render for the user
8364
+ * Should be a BCP 47 language tag, e.g. en-US ([primary tag]-[ISO 3166-1 alpha-2 code]).
8365
+ * https://en.wikipedia.org/wiki/IETF_language_tag
8366
+ */
8367
+ readonly locale: string;
8368
+ /**
8369
+ * @hidden
8370
+ * The status of the cart.
8371
+ */
8372
+ readonly status: CartStatus;
8373
+ /**
8374
+ * @hidden
8375
+ * ISO 4217 currency code for the cart item price, e.g. USD for US Dollar.
8376
+ * https://en.wikipedia.org/wiki/ISO_4217
8377
+ */
8378
+ readonly currency: string;
8379
+ /**
8380
+ * @hidden
8381
+ * ISO 8601 timestamp string in UTC, indicates when the cart is created.
8382
+ * e.g. 2023-06-19T22:06:59Z
8383
+ * https://en.wikipedia.org/wiki/ISO_8601
8384
+ */
8385
+ readonly createdAt: string;
8386
+ /**
8387
+ * @hidden
8388
+ * ISO 8601 timestamp string in UTC, indicates when the cart is updated.
8389
+ * e.g. 2023-06-19T22:06:59Z
8390
+ * https://en.wikipedia.org/wiki/ISO_8601
8391
+ */
8392
+ readonly updatedAt: string;
8393
+ }
8394
+ /**
8395
+ * @hidden
8396
+ * Represents the basic cart item information.
8397
+ * @beta
8398
+ */
8399
+ export interface Item {
8400
+ /**
8401
+ * @hidden
8402
+ * The id of the cart item.
8403
+ */
8404
+ readonly id: string;
8405
+ /**
8406
+ * @hidden
8407
+ * The display name of the cart item.
8408
+ */
8409
+ readonly name: string;
8410
+ /**
8411
+ * @hidden
8412
+ * The quantity of the cart item.
8413
+ */
8414
+ readonly quantity: number;
8415
+ /**
8416
+ * @hidden
8417
+ * The price of the single cart item.
8418
+ */
8419
+ readonly price: number;
8420
+ /**
8421
+ * @hidden
8422
+ * The thumbnail imageURL of the cart item.
8423
+ */
8424
+ readonly imageURL?: URL;
8425
+ }
8426
+ /**
8427
+ * @hidden
8428
+ * Represents the cart item that could have accessories
8429
+ * @beta
8430
+ */
8431
+ export interface CartItem extends Item {
8432
+ /**
8433
+ * @hidden
8434
+ * Accessories to the item if existing.
8435
+ */
8436
+ readonly accessories?: Item[];
8437
+ /**
8438
+ * @hidden
8439
+ * The thumbnail imageURL of the cart item.
8440
+ */
8441
+ readonly imageURL?: URL;
8442
+ }
8443
+ /**
8444
+ * @hidden
8445
+ * Represents the persona creating the cart.
8446
+ * @beta
8447
+ */
8448
+ export enum Intent {
8449
+ /**
8450
+ * @hidden
8451
+ * The cart is created by admin of an organization in Teams Admin Center.
8452
+ */
8453
+ TACAdminUser = "TACAdminUser",
8454
+ /**
8455
+ * @hidden
8456
+ * The cart is created by admin of an organization in Teams.
8457
+ */
8458
+ TeamsAdminUser = "TeamsAdminUser",
8459
+ /**
8460
+ * @hidden
8461
+ * The cart is created by end user of an organization in Teams.
8462
+ */
8463
+ TeamsEndUser = "TeamsEndUser"
8464
+ }
8465
+ /**
8466
+ * @hidden
8467
+ * Represents the status of the cart.
8468
+ * @beta
8469
+ */
8470
+ export enum CartStatus {
8471
+ /**
8472
+ * @hidden
8473
+ * Cart is created but not checked out yet.
8474
+ */
8475
+ Open = "Open",
8476
+ /**
8477
+ * @hidden
8478
+ * Cart is checked out but not completed yet.
8479
+ */
8480
+ Processing = "Processing",
8481
+ /**
8482
+ * @hidden
8483
+ * Indicate checking out is completed and the host should
8484
+ * return a new cart in the next getCart call.
8485
+ */
8486
+ Processed = "Processed",
8487
+ /**
8488
+ * @hidden
8489
+ * Indicate checking out process is manually cancelled by the user
8490
+ */
8491
+ Closed = "Closed",
8492
+ /**
8493
+ * @hidden
8494
+ * Indicate checking out is failed and the host should
8495
+ * return a new cart in the next getCart call.
8496
+ */
8497
+ Error = "Error"
8498
+ }
8499
+ /**
8500
+ * @hidden
8501
+ * Represents the parameters to update the cart items.
8502
+ * @beta
8503
+ */
8504
+ export interface AddOrUpdateCartItemsParams {
8505
+ /**
8506
+ * @hidden
8507
+ * The uuid of the cart to be updated, target on the cart
8508
+ * being checked out if cartId is not provided.
8509
+ */
8510
+ cartId?: string;
8511
+ /**
8512
+ * @hidden
8513
+ * A list of cart items object, for each item,
8514
+ * if item id exists in the cart, overwrite the item price and quantity,
8515
+ * otherwise add new items to cart.
8516
+ */
8517
+ cartItems: CartItem[];
8518
+ }
8519
+ /**
8520
+ * @hidden
8521
+ * Represents the parameters to remove the cart items.
8522
+ * @beta
8523
+ */
8524
+ export interface RemoveCartItemsParams {
8525
+ /**
8526
+ * @hidden
8527
+ * The uuid of the cart to be updated, target on the cart
8528
+ * being checked out if cartId is not provided.
8529
+ */
8530
+ cartId?: string;
8531
+ /**
8532
+ * @hidden
8533
+ * A list of cart id, delete the cart item accordingly.
8534
+ */
8535
+ cartItemIds: string[];
8536
+ }
8537
+ /**
8538
+ * @hidden
8539
+ * Represents the parameters to update the cart status.
8540
+ * @beta
8541
+ */
8542
+ export interface UpdateCartStatusParams {
8543
+ /**
8544
+ * @hidden
8545
+ * The uuid of the cart to be updated, target on the cart
8546
+ * being checked out if cartId is not provided.
8547
+ */
8548
+ cartId?: string;
8549
+ /**
8550
+ * @hidden
8551
+ * Status of the cart.
8552
+ */
8553
+ cartStatus: CartStatus;
8554
+ /**
8555
+ * @hidden
8556
+ * Extra info to the status.
8557
+ */
8558
+ statusInfo?: string;
8559
+ }
8560
+ /**
8561
+ * @hidden
8562
+ * Get the cart object owned by the host to checkout.
8563
+ * @returns A promise of the cart object in the cartVersion.
8564
+ * @beta
8565
+ */
8566
+ export function getCart(): Promise<Cart>;
8567
+ /**
8568
+ * @hidden
8569
+ * Add or update cart items in the cart owned by the host.
8570
+ * @param addOrUpdateCartItemsParams Represents the parameters to update the cart items.
8571
+ * @returns A promise of the updated cart object in the cartVersion.
8572
+ * @beta
8573
+ */
8574
+ export function addOrUpdateCartItems(addOrUpdateCartItemsParams: AddOrUpdateCartItemsParams): Promise<Cart>;
8575
+ /**
8576
+ * @hidden
8577
+ * Remove cart items from the cart owned by the host.
8578
+ * @param removeCartItemsParams The parameters to remove the cart items.
8579
+ * @returns A promise of the updated cart object in the cartVersion.
8580
+ * @beta
8581
+ */
8582
+ export function removeCartItems(removeCartItemsParams: RemoveCartItemsParams): Promise<Cart>;
8583
+ /**
8584
+ * @hidden
8585
+ * Update cart status in the cart owned by the host.
8586
+ * @param updateCartStatusParams The parameters to update the cart status.
8587
+ * @returns A promise of the updated cart object in the cartVersion.
8588
+ * @beta
8589
+ */
8590
+ export function updateCartStatus(updateCartStatusParams: UpdateCartStatusParams): Promise<Cart>;
8591
+ /**
8592
+ * @hidden
8593
+ * Checks if the marketplace capability is supported by the host.
8594
+ * @returns Boolean to represent whether the marketplace capability is supported.
8595
+ * @throws Error if {@linkcode app.initialize} has not successfully completed.
8596
+ * @beta
8597
+ */
8598
+ export function isSupported(): boolean;
8599
+ export {};
8600
+ }
8601
+
8241
8602
  /**
8242
8603
  * @hidden
8243
8604
  * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
8244
8605
  */
8245
8606
  export function processMediaStream(streamId: string, videoFrameHandler: video.VideoFrameHandler, notifyError: (string: any) => void): Promise<MediaStreamTrack>;
8607
+ /**
8608
+ * @hidden
8609
+ * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
8610
+ * The videoFrameHandler will receive metadata of the video frame.
8611
+ *
8612
+ * @internal
8613
+ * Limited to Microsoft-internal use
8614
+ */
8615
+ export function processMediaStreamWithMetadata(streamId: string, videoFrameHandler: videoEx.VideoFrameHandler, notifyError: (string: any) => void): Promise<MediaStreamTrack>;
8246
8616
  /**
8247
8617
  * @hidden
8248
8618
  * Video effect change call back function definition