/** * @module botbuilder-dialogs-adaptive-teams */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { OnTeamsAppBasedLinkQuery } from './conditions/onTeamsAppBasedLinkQuery'; import { ComponentDeclarativeTypes, CustomDeserializer, DeclarativeType, ResourceExplorer, } from 'botbuilder-dialogs-declarative'; import { OnActivityConfiguration } from 'botbuilder-dialogs-adaptive'; import { OnTeamsCardAction, OnTeamsChannelCreated, OnTeamsChannelDeleted, OnTeamsChannelRenamed, OnTeamsChannelRestored, OnTeamsFileConsent, OnTeamsMEBotMessagePreviewEdit, OnTeamsMEBotMessagePreviewSend, OnTeamsMECardButtonClicked, OnTeamsMEConfigQuerySettingUrl, OnTeamsMEConfigurationSetting, OnTeamsMEFetchTask, OnTeamsMEQuery, OnTeamsMESelectItem, OnTeamsMESubmitAction, OnTeamsO365ConnectorCardAction, OnTeamsTabFetch, OnTeamsTabSubmit, OnTeamsTaskModuleFetch, OnTeamsTaskModuleSubmit, OnTeamsTeamArchived, OnTeamsTeamDeleted, OnTeamsTeamHardDeleted, OnTeamsTeamRenamed, OnTeamsTeamRestored, OnTeamsTeamUnarchived, } from './conditions'; import { GetMeetingParticipant, GetMeetingParticipantConfiguration, GetMember, GetMemberConfiguration, GetPagedMembers, GetPagedMembersConfiguration, GetPagedTeamMembers, GetPagedTeamMembersConfiguration, GetTeamChannels, GetTeamChannelsConfiguration, GetTeamDetails, GetTeamDetailsConfiguration, GetTeamMember, GetTeamMemberConfiguration, SendAppBasedLinkQueryResponse, SendAppBasedLinkQueryResponseConfiguration, SendMessageToTeamsChannel, SendMEActionResponse, SendMEActionResponseConfiguration, SendMEAttachmentsResponse, SendMEAttachmentsResponseConfiguration, SendMEAuthResponse, SendMEBotMessagePreviewResponse, SendMEBotMessagePreviewResponseConfiguration, SendMEConfigQuerySettingUrlResponse, SendMEConfigQuerySettingUrlResponseConfiguration, SendMEMessageResponse, SendMEMessageResponseConfiguration, SendMESelectItemResponse, SendMESelectItemResponseConfiguration, SendTaskModuleCardResponse, SendTaskModuleCardResponseConfiguration, SendTaskModuleMessageResponse, SendTaskModuleMessageResponseConfiguration, SendTaskModuleUrlResponse, SendTaskModuleUrlResponseConfiguration, } from './actions'; import { ComponentRegistration } from 'botbuilder'; import { Dialog } from 'botbuilder-dialogs'; import { BaseAuthResponseDialogConfiguration } from './actions/baseAuthResponseDialog'; import { SendTabAuthResponse } from './actions/sendTabAuthResponse'; import { SendTabCardResponse } from './actions/sendTabCardResponse'; import { OnTeamsMEConfigSetting } from './conditions/onTeamsMEConfigSetting'; type ActionType = { $kind: string; new (dialogId?: string | undefined): T; }; type ConditionType = { $kind: string; new (actions?: Dialog>[] | undefined, condition?: string | undefined): T; }; type Type = { $kind: string; new (...args: unknown[]): T; }; /* eslint-disable prettier/prettier */ /* eslint-reason It's extremely difficult to read with limited line widths.*/ export class TeamsComponentRegistration extends ComponentRegistration implements ComponentDeclarativeTypes { private _declarativeTypes: DeclarativeType[] = []; /** * Initializes a new instance of `TeamsComponentRegistration`. */ public constructor() { super(); // Actions this._addDeclarativeType(GetMeetingParticipant); this._addDeclarativeType(GetMember); this._addDeclarativeType(GetPagedMembers); this._addDeclarativeType(GetPagedTeamMembers); this._addDeclarativeType(GetTeamChannels); this._addDeclarativeType(GetTeamDetails); this._addDeclarativeType(GetTeamMember); this._addDeclarativeType(SendAppBasedLinkQueryResponse); this._addDeclarativeType(SendMessageToTeamsChannel); this._addDeclarativeType(SendMEActionResponse); this._addDeclarativeType(SendMEAttachmentsResponse); this._addDeclarativeType(SendMEAuthResponse); this._addDeclarativeType(SendMEBotMessagePreviewResponse); this._addDeclarativeType(SendMEConfigQuerySettingUrlResponse); this._addDeclarativeType(SendMEMessageResponse); this._addDeclarativeType(SendMESelectItemResponse); this._addDeclarativeType(SendTaskModuleCardResponse); this._addDeclarativeType(SendTaskModuleMessageResponse); this._addDeclarativeType(SendTaskModuleUrlResponse); this._addDeclarativeType(SendTabAuthResponse); this._addDeclarativeType(SendTabCardResponse); // Conditions this._addDeclarativeType(OnTeamsAppBasedLinkQuery); this._addDeclarativeType(OnTeamsCardAction); this._addDeclarativeType(OnTeamsChannelCreated); this._addDeclarativeType(OnTeamsChannelDeleted); this._addDeclarativeType(OnTeamsChannelRenamed); this._addDeclarativeType(OnTeamsChannelRestored); this._addDeclarativeType(OnTeamsFileConsent); this._addDeclarativeType(OnTeamsMEBotMessagePreviewEdit); this._addDeclarativeType(OnTeamsMEBotMessagePreviewSend); this._addDeclarativeType(OnTeamsMECardButtonClicked); this._addDeclarativeType(OnTeamsMEConfigSetting); this._addDeclarativeType(OnTeamsMEConfigQuerySettingUrl); this._addDeclarativeType(OnTeamsMEFetchTask); this._addDeclarativeType(OnTeamsMEQuery); this._addDeclarativeType(OnTeamsMESelectItem); this._addDeclarativeType(OnTeamsMEConfigurationSetting); this._addDeclarativeType(OnTeamsMESubmitAction); this._addDeclarativeType(OnTeamsO365ConnectorCardAction); this._addDeclarativeType(OnTeamsTabFetch); this._addDeclarativeType(OnTeamsTabSubmit); this._addDeclarativeType(OnTeamsTaskModuleFetch); this._addDeclarativeType(OnTeamsTaskModuleSubmit); this._addDeclarativeType(OnTeamsTeamArchived); this._addDeclarativeType(OnTeamsTeamDeleted); this._addDeclarativeType(OnTeamsTeamHardDeleted); this._addDeclarativeType(OnTeamsTeamRenamed); this._addDeclarativeType(OnTeamsTeamRestored); this._addDeclarativeType(OnTeamsTeamUnarchived); } /** * Gets adaptive testing `DeclarativeType` resources. * * @param {ResourceExplorer} _resourceExplorer `ResourceExplorer` with expected path to get all resources. * @returns {DeclarativeType[]} Adaptive testing `DeclarativeType` resources. */ public getDeclarativeTypes(_resourceExplorer: ResourceExplorer): DeclarativeType[] { return this._declarativeTypes; } private _addDeclarativeType(type: ActionType | ConditionType, loader?: CustomDeserializer): void { const declarativeType: DeclarativeType = { kind: type.$kind, type: >type, loader, }; this._declarativeTypes.push(declarativeType); } }