@microsoft/teams-js 2.17.1-beta.2 → 2.18.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -502,6 +502,353 @@ export namespace conversations {
502
502
  function isSupported(): boolean;
503
503
  }
504
504
 
505
+ /**
506
+ * @hidden
507
+ * Namespace to delegate authentication and message extension requests to the host
508
+ * @internal
509
+ * Limited to Microsoft-internal use
510
+ */
511
+ export namespace externalAppAuthentication {
512
+ /**
513
+ * @hidden
514
+ * Information about the bot request that should be resent by the host
515
+ * @internal
516
+ * Limited to Microsoft-internal use
517
+ */
518
+ type IOriginalRequestInfo = IQueryMessageExtensionRequest | IActionExecuteInvokeRequest;
519
+ /**
520
+ * @hidden
521
+ * Information about the message extension request that should be resent by the host. Corresponds to request schema in https://learn.microsoft.com/en-us/microsoftteams/platform/resources/messaging-extension-v3/search-extensions#receive-user-requests
522
+ * @internal
523
+ * Limited to Microsoft-internal use
524
+ */
525
+ interface IQueryMessageExtensionRequest {
526
+ requestType: OriginalRequestType.QueryMessageExtensionRequest;
527
+ commandId: string;
528
+ parameters?: {
529
+ name?: string;
530
+ value?: string;
531
+ }[];
532
+ queryOptions?: {
533
+ count: number;
534
+ skip: number;
535
+ };
536
+ }
537
+ /**
538
+ * @hidden
539
+ * Information about the Action.Execute request that should be resent by the host. Corresponds to schema in https://adaptivecards.io/explorer/Action.Execute.html
540
+ * @internal
541
+ * Limited to Microsoft-internal use
542
+ */
543
+ interface IActionExecuteInvokeRequest {
544
+ requestType: OriginalRequestType.ActionExecuteInvokeRequest;
545
+ type: string;
546
+ id: string;
547
+ verb: string;
548
+ data: string | Record<string, unknown>;
549
+ }
550
+ /**
551
+ * @hidden
552
+ * Used to differentiate between IOriginalRequestInfo types
553
+ * @internal
554
+ * Limited to Microsoft-internal use
555
+ */
556
+ enum OriginalRequestType {
557
+ ActionExecuteInvokeRequest = "ActionExecuteInvokeRequest",
558
+ QueryMessageExtensionRequest = "QueryMessageExtensionRequest"
559
+ }
560
+ /**
561
+ * @hidden
562
+ * The response from the bot returned via the host
563
+ * @internal
564
+ * Limited to Microsoft-internal use
565
+ */
566
+ type IInvokeResponse = IQueryMessageExtensionResponse | IActionExecuteResponse;
567
+ /**
568
+ * @hidden
569
+ * Used to differentiate between IInvokeResponse types
570
+ * @internal
571
+ * Limited to Microsoft-internal use
572
+ */
573
+ enum InvokeResponseType {
574
+ ActionExecuteInvokeResponse = "ActionExecuteInvokeResponse",
575
+ QueryMessageExtensionResponse = "QueryMessageExtensionResponse"
576
+ }
577
+ /**
578
+ * @hidden
579
+ * The response from the bot returned via the host for a message extension query request.
580
+ * @internal
581
+ * Limited to Microsoft-internal use
582
+ */
583
+ interface IQueryMessageExtensionResponse {
584
+ responseType: InvokeResponseType.QueryMessageExtensionResponse;
585
+ composeExtension?: ComposeExtensionResponse;
586
+ }
587
+ /**
588
+ * @hidden
589
+ * The response from the bot returned via the host for an Action.Execute request.
590
+ * @internal
591
+ * Limited to Microsoft-internal use
592
+ */
593
+ interface IActionExecuteResponse {
594
+ responseType: InvokeResponseType.ActionExecuteInvokeResponse;
595
+ value: Record<string, unknown>;
596
+ signature?: string;
597
+ statusCode: number;
598
+ type: string;
599
+ }
600
+ /**
601
+ * @hidden
602
+ *
603
+ * @internal
604
+ * Limited to Microsoft-internal use
605
+ */
606
+ type ComposeExtensionResponse = {
607
+ attachmentLayout: AttachmentLayout;
608
+ type: ComposeResultTypes;
609
+ attachments: QueryMessageExtensionAttachment[];
610
+ suggestedActions?: QueryMessageExtensionSuggestedActions;
611
+ text?: string;
612
+ };
613
+ /**
614
+ * @hidden
615
+ *
616
+ * @internal
617
+ * Limited to Microsoft-internal use
618
+ */
619
+ type QueryMessageExtensionSuggestedActions = {
620
+ actions?: Action[];
621
+ };
622
+ /**
623
+ * @hidden
624
+ *
625
+ * @internal
626
+ * Limited to Microsoft-internal use
627
+ */
628
+ type Action = {
629
+ type: string;
630
+ title: string;
631
+ value: string;
632
+ };
633
+ /**
634
+ * @hidden
635
+ *
636
+ * @internal
637
+ * Limited to Microsoft-internal use
638
+ */
639
+ type QueryMessageExtensionCard = {
640
+ contentType: string;
641
+ content: Record<string, unknown>;
642
+ fallbackHtml?: string;
643
+ signature?: string;
644
+ };
645
+ /**
646
+ * @hidden
647
+ *
648
+ * @internal
649
+ * Limited to Microsoft-internal use
650
+ */
651
+ type QueryMessageExtensionAttachment = QueryMessageExtensionCard & {
652
+ preview?: QueryMessageExtensionCard;
653
+ };
654
+ /**
655
+ * @hidden
656
+ *
657
+ * @internal
658
+ * Limited to Microsoft-internal use
659
+ */
660
+ type AttachmentLayout = 'grid' | 'list';
661
+ /**
662
+ * @hidden
663
+ *
664
+ * @internal
665
+ * Limited to Microsoft-internal use
666
+ */
667
+ type ComposeResultTypes = 'auth' | 'config' | 'message' | 'result' | 'silentAuth';
668
+ /*********** BEGIN ERROR TYPE ***********/
669
+ interface InvokeError {
670
+ errorCode: InvokeErrorCode;
671
+ message?: string;
672
+ }
673
+ /**
674
+ * @hidden
675
+ *
676
+ * @internal
677
+ * Limited to Microsoft-internal use
678
+ */
679
+ enum InvokeErrorCode {
680
+ INTERNAL_ERROR = "INTERNAL_ERROR"
681
+ }
682
+ /**
683
+ * @beta
684
+ * @hidden
685
+ * Signals to the host to perform authentication using the given authentication parameters and then resend the request to the application specified by the app ID with the authentication result.
686
+ * @internal
687
+ * Limited to Microsoft-internal use
688
+ * @param appId ID of the application backend to which the request and authentication response should be sent
689
+ * @param authenticateParameters Parameters for the authentication pop-up
690
+ * @param originalRequestInfo Information about the original request that should be resent
691
+ * @returns A promise that resolves to the IInvokeResponse from the application backend and rejects with InvokeError if the host encounters an error while authenticating or resending the request
692
+ */
693
+ function authenticateAndResendRequest(appId: string, authenticateParameters: authentication.AuthenticatePopUpParameters, originalRequestInfo: IOriginalRequestInfo): Promise<IInvokeResponse>;
694
+ /**
695
+ * @beta
696
+ * @hidden
697
+ * Signals to the host to perform SSO authentication for the application specified by the app ID
698
+ * @internal
699
+ * Limited to Microsoft-internal use
700
+ * @param appId ID of the application backend for which the host should attempt SSO authentication
701
+ * @param authTokenRequest Parameters for SSO authentication
702
+ * @returns A promise that resolves when authentication and succeeds and rejects with InvokeError on failure
703
+ */
704
+ function authenticateWithSSO(appId: string, authTokenRequest: authentication.AuthTokenRequestParameters): Promise<void>;
705
+ /**
706
+ * @beta
707
+ * @hidden
708
+ * Signals to the host to perform SSO authentication for the application specified by the app ID and then resend the request to the application backend with the authentication result
709
+ * @internal
710
+ * Limited to Microsoft-internal use
711
+ * @param appId ID of the application backend for which the host should attempt SSO authentication and resend the request and authentication response
712
+ * @param authTokenRequest Parameters for SSO authentication
713
+ * @param originalRequestInfo Information about the original request that should be resent
714
+ * @returns A promise that resolves to the IInvokeResponse from the application backend and rejects with InvokeError if the host encounters an error while authenticating or resending the request
715
+ */
716
+ function authenticateWithSSOAndResendRequest(appId: string, authTokenRequest: authentication.AuthTokenRequestParameters, originalRequestInfo: IOriginalRequestInfo): Promise<IInvokeResponse>;
717
+ /**
718
+ * @hidden
719
+ * Checks if the externalAppAuthentication capability is supported by the host
720
+ * @returns boolean to represent whether externalAppAuthentication capability is supported
721
+ *
722
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
723
+ *
724
+ * @internal
725
+ * Limited to Microsoft-internal use
726
+ */
727
+ function isSupported(): boolean;
728
+ }
729
+
730
+ /**
731
+ * @hidden
732
+ * Namespace to delegate adaptive card action execution to the host
733
+ * @internal
734
+ * Limited to Microsoft-internal use
735
+ */
736
+ export namespace externalAppCardActions {
737
+ /**
738
+ * @hidden
739
+ * The type of deeplink action that was executed by the host
740
+ * @internal
741
+ * Limited to Microsoft-internal use
742
+ */
743
+ enum ActionOpenUrlType {
744
+ DeepLinkDialog = "DeepLinkDialog",
745
+ DeepLinkOther = "DeepLinkOther",
746
+ DeepLinkStageView = "DeepLinkStageView",
747
+ GenericUrl = "GenericUrl"
748
+ }
749
+ /**
750
+ * @hidden
751
+ * Error that can be thrown from IExternalAppCardActionService.handleActionOpenUrl
752
+ *
753
+ * @internal
754
+ * Limited to Microsoft-internal use
755
+ */
756
+ interface ActionOpenUrlError {
757
+ errorCode: ActionOpenUrlErrorCode;
758
+ message?: string;
759
+ }
760
+ /**
761
+ * @hidden
762
+ * Error codes that can be thrown from IExternalAppCardActionService.handleActionOpenUrl
763
+ * @internal
764
+ * Limited to Microsoft-internal use
765
+ */
766
+ enum ActionOpenUrlErrorCode {
767
+ INVALID_LINK = "INVALID_LINK",
768
+ NOT_SUPPORTED = "NOT_SUPPORTED",
769
+ INTERNAL_ERROR = "INTERNAL_ERROR"
770
+ }
771
+ /**
772
+ * @hidden
773
+ * The payload that is used when executing an Adaptive Card Action.Submit
774
+ * @internal
775
+ * Limited to Microsoft-internal use
776
+ */
777
+ interface IAdaptiveCardActionSubmit {
778
+ id: string;
779
+ data: Record<string, unknown>;
780
+ }
781
+ /**
782
+ * @hidden
783
+ * The configuration for Adaptive Card Action.Submit. This indicates which subtypes of actions are supported by the calling app.
784
+ * @internal
785
+ * Limited to Microsoft-internal use
786
+ */
787
+ interface ICardActionsConfig {
788
+ enableImback: boolean;
789
+ enableInvoke: boolean;
790
+ enableDialog: boolean;
791
+ enableStageView: boolean;
792
+ enableSignIn: boolean;
793
+ enableO365Submit: boolean;
794
+ }
795
+ /**
796
+ *
797
+ * @hidden
798
+ * Error that can be thrown from IExternalAppCardActionService.handleActionSubmit
799
+ *
800
+ * @internal
801
+ * Limited to Microsoft-internal use
802
+ */
803
+ interface ActionSubmitError {
804
+ errorCode: ActionSubmitErrorCode;
805
+ message?: string;
806
+ }
807
+ /**
808
+ * @hidden
809
+ * Error codes that can be thrown from IExternalAppCardActionService.handleActionSubmit
810
+ * @internal
811
+ * Limited to Microsoft-internal use
812
+ */
813
+ enum ActionSubmitErrorCode {
814
+ INTERNAL_ERROR = "INTERNAL_ERROR"
815
+ }
816
+ /**
817
+ * @beta
818
+ * @hidden
819
+ * Delegates an Adaptive Card Action.Submit request to the host for the application with the provided app ID
820
+ * @internal
821
+ * Limited to Microsoft-internal use
822
+ * @param appId ID of the application the request is intended for
823
+ * @param actionSubmitPayload The Adaptive Card Action.Submit payload
824
+ * @param cardActionsConfig The card actions configuration. This indicates which subtypes should be handled by this API
825
+ * @returns Promise that resolves when the request is completed and rejects with ActionSubmitError if the request fails
826
+ */
827
+ function processActionSubmit(appId: string, actionSubmitPayload: IAdaptiveCardActionSubmit, cardActionsConfig: ICardActionsConfig): Promise<void>;
828
+ /**
829
+ * @beta
830
+ * @hidden
831
+ * Delegates an Adaptive Card Action.OpenUrl request to the host for the application with the provided app ID
832
+ * @internal
833
+ * Limited to Microsoft-internal use
834
+ * @param appId ID of the application the request is intended for
835
+ * @param url The URL to open
836
+ * @returns Promise that resolves to ActionOpenUrlType indicating the type of URL that was opened on success and rejects with ActionOpenUrlError if the request fails
837
+ */
838
+ function processActionOpenUrl(appId: string, url: string): Promise<ActionOpenUrlType>;
839
+ /**
840
+ * @hidden
841
+ * Checks if the externalAppCardActions capability is supported by the host
842
+ * @returns boolean to represent whether externalAppCardActions capability is supported
843
+ *
844
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
845
+ *
846
+ * @internal
847
+ * Limited to Microsoft-internal use
848
+ */
849
+ function isSupported(): boolean;
850
+ }
851
+
505
852
  /**
506
853
  * @hidden
507
854
  *
@@ -3690,6 +4037,7 @@ export interface SdkError {
3690
4037
  */
3691
4038
  message?: string;
3692
4039
  }
4040
+ export function isSdkError(err: unknown): err is SdkError;
3693
4041
  /** Error codes used to identify different types of errors that can occur while developing apps. */
3694
4042
  export enum ErrorCode {
3695
4043
  /**
@@ -6484,6 +6832,51 @@ export namespace meeting {
6484
6832
  * @returns A promise with the updated microphone state
6485
6833
  */
6486
6834
  micMuteStateChangedCallback: (micState: MicState) => Promise<MicState>;
6835
+ /**
6836
+ * Callback for the host to tell the app to change its speaker selection
6837
+ */
6838
+ audioDeviceSelectionChangedCallback?: (selectedDevices: AudioDeviceSelection | SdkError) => void;
6839
+ }
6840
+ /**
6841
+ * Interface for AudioDeviceSelection from host selection.
6842
+ * If the speaker or the microphone is undefined or don't have a device label, you can try to find the default devices
6843
+ * by using
6844
+ * ```ts
6845
+ * const devices = await navigator.mediaDevices.enumerateDevices();
6846
+ * const defaultSpeaker = devices.find((d) => d.deviceId === 'default' && d.kind === 'audiooutput');
6847
+ * const defaultMic = devices.find((d) => d.deviceId === 'default' && d.kind === 'audioinput');
6848
+ * ```
6849
+ *
6850
+ * @hidden
6851
+ * Hide from docs.
6852
+ *
6853
+ * @internal
6854
+ * Limited to Microsoft-internal use
6855
+ *
6856
+ * @beta
6857
+ */
6858
+ interface AudioDeviceSelection {
6859
+ speaker?: AudioDeviceInfo;
6860
+ microphone?: AudioDeviceInfo;
6861
+ }
6862
+ /**
6863
+ * Interface for AudioDeviceInfo, includes a device label with the same format as {@link MediaDeviceInfo.label}
6864
+ *
6865
+ * Hosted app can use this label to compare it with the device info fetched from {@link navigator.mediaDevices.enumerateDevices()}.
6866
+ * {@link MediaDeviceInfo} has {@link MediaDeviceInfo.deviceId} as an unique identifier, but that id is also unique to the origin
6867
+ * of the calling application, so {@link MediaDeviceInfo.deviceId} cannot be used here as an identifier. Notice there are some cases
6868
+ * that devices may have the same device label, but we don't have a better way to solve this, keep this as a known limitation for now.
6869
+ *
6870
+ * @hidden
6871
+ * Hide from docs.
6872
+ *
6873
+ * @internal
6874
+ * Limited to Microsoft-internal use
6875
+ *
6876
+ * @beta
6877
+ */
6878
+ interface AudioDeviceInfo {
6879
+ deviceLabel: string;
6487
6880
  }
6488
6881
  /**
6489
6882
  * Different types of meeting reactions that can be sent/received