import { override } from '@microsoft/decorators' ; import { Log } from '@microsoft/sp-core-library' ; import { BaseApplicationCustomizer , PlaceholderContent , PlaceholderName } from '@microsoft/sp-application-base' ; import { Dialog } from '@microsoft/sp-dialog' ; import * as React from 'react' ; import * as ReactDom from 'react-dom' ; import * as strings from 'QnAChatApplicationCustomizerStrings' ; import { IFooterChatProps } from './components/IFooterChatProps' ; import FooterChat from './components/FooterChat' ; import { CognitiveService } from '../../services/cognitiveservices' ; const LOG_SOURCE = 'QnAChatApplicationCustomizer' ; /**
 * If your command set uses the ClientSideComponentProperties JSON input,
 * it will be deserialized into the BaseExtension.properties object.
 * You can define an interface to describe it.
 */ export interface IQnAChatApplicationCustomizerProperties { testMessage : string ; } /** A Custom Action which can be run during execution of a Client Side Application */ export default class QnAChatApplicationCustomizer extends BaseApplicationCustomizer < IQnAChatApplicationCustomizerProperties > { private _bottomPlaceholder : PlaceholderContent | undefined ; @ override public onInit ( ) { this . _renderFooter ( ) ; return Promise . resolve ( ) ; } private _renderFooter ( ) { const cognitiveService = new CognitiveService ( { context : this . context , } ) ; if ( ! this . _bottomPlaceholder ) { this . _bottomPlaceholder = this . context . placeholderProvider . tryCreateContent ( PlaceholderName . Bottom , { onDispose : this . _onDispose } ) ; if ( ! this . _bottomPlaceholder ) { console . error ( 'The expected placeholder (Bottom) was not found.' ) ; return ; } const element = React . createElement ( FooterChat , { cognitiveService : cognitiveService } ) ; ReactDom . render ( element , this . _bottomPlaceholder . domElement ) ; } } private _onDispose ( ) { console . log ( 'Disposed custom bottom placeholders.' ) ; } }