/**
 * -------------------------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation.  All Rights Reserved.  Licensed under the MIT License.
 * See License in the project root for license information.
 * -------------------------------------------------------------------------------------------
 */ import { customElement , property } from 'lit-element' ; import { Configuration } from 'msal' ; import { Providers , MgtBaseProvider } from '@microsoft/mgt-element' ; import { TeamsConfig , TeamsProvider } from './TeamsProvider' ; export class extends MgtBaseProvider @ customElement ( 'mgt-teams-provider' ) export class MgtTeamsProvider extends MgtBaseProvider { memberof @ property ( { attribute : 'client-id' , type : String } ) public clientId = '' ; memberof @ property ( { attribute : 'auth-popup-url' , type : String } ) public authPopupUrl = '' ; memberof @ property ( ) public authority ; memberof @ property ( { attribute : 'scopes' , type : String } ) public scopes ; readonly memberof public get isAvailable ( ) { return TeamsProvider . isAvailable ; } protected memberof protected initializeProvider ( ) { if ( this . clientId && this . authPopupUrl ) { const config = { authPopupUrl : this . authPopupUrl , clientId : this . clientId } ; if ( this . scopes ) { const scope = this . scopes . split ( ',' ) ; if ( scope && scope . length > 0 ) { config . scopes = scope ; } } if ( this . authority ) { const msalConfig = { auth : { authority : this . authority , clientId : this . clientId } } ; config . msalOptions = msalConfig ; } this . provider = new TeamsProvider ( config ) ; Providers . globalProvider = this . provider ; } } }