From c4488ce8e920bfb63f96d98727d9e3fa00db3c49 Mon Sep 17 00:00:00 2001 From: mrestorff Date: Wed, 1 Jul 2020 19:40:58 +0200 Subject: [PATCH] Move TelemetryClient property to DialogContainer (#2463) --- .../src/adaptiveDialog.ts | 9 +-------- .../botbuilder-dialogs/src/componentDialog.ts | 18 +----------------- .../botbuilder-dialogs/src/dialogContainer.ts | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/libraries/botbuilder-dialogs-adaptive/src/adaptiveDialog.ts b/libraries/botbuilder-dialogs-adaptive/src/adaptiveDialog.ts index fbe235bc01..af30c8ec8d 100644 --- a/libraries/botbuilder-dialogs-adaptive/src/adaptiveDialog.ts +++ b/libraries/botbuilder-dialogs-adaptive/src/adaptiveDialog.ts @@ -6,9 +6,7 @@ * Licensed under the MIT License. */ import { - TurnContext, BotTelemetryClient, NullTelemetryClient, ActivityTypes, - Activity, RecognizerResult, getTopScoringIntent -} from 'botbuilder-core'; + TurnContext, ActivityTypes, Activity, RecognizerResult, getTopScoringIntent } from 'botbuilder-core'; import { Dialog, DialogInstance, DialogReason, DialogTurnResult, DialogTurnStatus, DialogEvent, DialogContext, DialogContainer, DialogDependencies, TurnPath, DialogPath, DialogState } from 'botbuilder-dialogs'; import { OnCondition } from './conditions'; import { Recognizer } from './recognizers'; @@ -90,11 +88,6 @@ export class AdaptiveDialog extends DialogContainer { return this.dialogSchema ? this.dialogSchema.schema : undefined; } - public set telemetryClient(client: BotTelemetryClient) { - super.telemetryClient = client ? client : new NullTelemetryClient(); - this.dialogs.telemetryClient = client; - } - protected ensureDependenciesInstalled(): void { if (this.installedDependencies) { return; diff --git a/libraries/botbuilder-dialogs/src/componentDialog.ts b/libraries/botbuilder-dialogs/src/componentDialog.ts index 4b4a78a356..8a6739fd6f 100644 --- a/libraries/botbuilder-dialogs/src/componentDialog.ts +++ b/libraries/botbuilder-dialogs/src/componentDialog.ts @@ -5,7 +5,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { BotTelemetryClient, NullTelemetryClient, telemetryTrackDialogView, TurnContext } from 'botbuilder-core'; +import { telemetryTrackDialogView, TurnContext } from 'botbuilder-core'; import { Dialog, DialogInstance, DialogReason, DialogTurnResult, DialogTurnStatus } from './dialog'; import { DialogContext } from './dialogContext'; import { DialogContainer } from './dialogContainer'; @@ -250,20 +250,4 @@ export class ComponentDialog extends DialogContainer { return innerDC } - - /** - * Set the telemetry client, and also apply it to all child dialogs. - * Future dialogs added to the component will also inherit this client. - */ - public set telemetryClient(client: BotTelemetryClient) { - this._telemetryClient = client ? client : new NullTelemetryClient(); - this.dialogs.telemetryClient = client; - } - - /** - * Get the current telemetry client. - */ - public get telemetryClient(): BotTelemetryClient { - return this._telemetryClient; - } } diff --git a/libraries/botbuilder-dialogs/src/dialogContainer.ts b/libraries/botbuilder-dialogs/src/dialogContainer.ts index a785cd09f7..a8c8dd5601 100644 --- a/libraries/botbuilder-dialogs/src/dialogContainer.ts +++ b/libraries/botbuilder-dialogs/src/dialogContainer.ts @@ -5,6 +5,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ +import { BotTelemetryClient, NullTelemetryClient } from 'botbuilder-core'; import { Dialog } from './dialog'; import { DialogSet } from './dialogSet'; import { DialogContext } from './dialogContext'; @@ -66,4 +67,20 @@ export abstract class DialogContainer extends Dialog { await dc.emitEvent(DialogEvents.versionChanged, this.id, true, false); } } + + /** + * Set the telemetry client, and also apply it to all child dialogs. + * Future dialogs added to the component will also inherit this client. + */ + public set telemetryClient(client: BotTelemetryClient) { + this._telemetryClient = client ? client : new NullTelemetryClient(); + this.dialogs.telemetryClient = client; + } + + /** + * Get the current telemetry client. + */ + public get telemetryClient(): BotTelemetryClient { + return this._telemetryClient; + } } \ No newline at end of file