Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [#3518] Remove public access modifier from botbuilder-dialogs #4217

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libraries/botbuilder-dialogs/src/choices/choiceFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class ChoiceFactory {
* @param speak (Optional) SSML to speak for the message.
* @param options (Optional) formatting options to use when rendering as a list.
*/
public static forChannel(
static forChannel(
channelOrContext: string | TurnContext,
choices: (string | Choice)[],
text?: string,
Expand Down Expand Up @@ -137,13 +137,13 @@ export class ChoiceFactory {

/**
* Creates a message [Activity](xref:botframework-schema.Activity) that includes a [Choice](xref:botbuilder-dialogs.Choice) list that have been added as `HeroCard`'s.
*
*
* @param choices Optional. The [Choice](xref:botbuilder-dialogs.Choice) list to add.
* @param text Optional. Text of the message.
* @param speak Optional. SSML text to be spoken by the bot on a speech-enabled channel.
* @returns An [Activity](xref:botframework-schema.Activity) with choices as `HeroCard` with buttons.
*/
public static heroCard(choices: (string | Choice)[] = [], text = '', speak = ''): Activity {
static heroCard(choices: (string | Choice)[] = [], text = '', speak = ''): Activity {
const buttons: CardAction[] = ChoiceFactory.toChoices(choices).map(
(choice) =>
({
Expand Down Expand Up @@ -173,7 +173,7 @@ export class ChoiceFactory {
* @param speak (Optional) SSML to speak for the message.
* @param options (Optional) formatting options to tweak rendering of list.
*/
public static inline(
static inline(
choices: (string | Choice)[],
text?: string,
speak?: string,
Expand Down Expand Up @@ -223,7 +223,7 @@ export class ChoiceFactory {
* @param speak (Optional) SSML to speak for the message.
* @param options (Optional) formatting options to tweak rendering of list.
*/
public static list(
static list(
choices: (string | Choice)[],
text?: string,
speak?: string,
Expand Down Expand Up @@ -264,7 +264,7 @@ export class ChoiceFactory {
* @param text (Optional) text of the message.
* @param speak (Optional) SSML to speak for the message.
*/
public static suggestedAction(choices: (string | Choice)[], text?: string, speak?: string): Partial<Activity> {
static suggestedAction(choices: (string | Choice)[], text?: string, speak?: string): Partial<Activity> {
// Map choices to actions
const actions: CardAction[] = ChoiceFactory.toChoices(choices).map<CardAction>((choice: Choice) => {
if (choice.action) {
Expand Down Expand Up @@ -292,7 +292,7 @@ export class ChoiceFactory {
* ```
* @param choices List of choices to add.
*/
public static toChoices(choices: (string | Choice)[] | undefined): Choice[] {
static toChoices(choices: (string | Choice)[] | undefined): Choice[] {
return (choices || [])
.map((choice: Choice) => (typeof choice === 'string' ? { value: choice } : choice))
.map((choice: Choice) => {
Expand Down
16 changes: 8 additions & 8 deletions libraries/botbuilder-dialogs/src/componentDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* @param options Optional, initial information to pass to the dialog.
* @returns A Promise representing the asynchronous operation.
* @remarks
* If the task is successful, the result indicates whether the dialog is still
* If the task is successful, the result indicates whether the dialog is still
* active after the turn has been processed by the dialog.
*/
public async beginDialog(outerDC: DialogContext, options?: O): Promise<DialogTurnResult> {
async beginDialog(outerDC: DialogContext, options?: O): Promise<DialogTurnResult> {
await this.checkForVersionChange(outerDC);

telemetryTrackDialogView(this.telemetryClient, this.id);
Expand Down Expand Up @@ -127,7 +127,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* active after the turn has been processed by the dialog. The result may also contain a
* return value.
*/
public async continueDialog(outerDC: DialogContext): Promise<DialogTurnResult> {
async continueDialog(outerDC: DialogContext): Promise<DialogTurnResult> {
await this.checkForVersionChange(outerDC);

// Continue execution of inner dialog.
Expand Down Expand Up @@ -162,7 +162,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* If this method is *not* overridden, the dialog automatically calls its
* RepromptDialog(ITurnContext, DialogInstance) when the user replies.
*/
public async resumeDialog(outerDC: DialogContext, reason: DialogReason, result?: any): Promise<DialogTurnResult> {
async resumeDialog(outerDC: DialogContext, reason: DialogReason, result?: any): Promise<DialogTurnResult> {
await this.checkForVersionChange(outerDC);

// Containers are typically leaf nodes on the stack but the dev is free to push other dialogs
Expand All @@ -181,7 +181,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* @param instance State information for this dialog.
* @returns A Promise representing the asynchronous operation.
*/
public async repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void> {
async repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void> {
// Forward to inner dialogs
const innerDC: DialogContext = this.createInnerDC(context, instance);
await innerDC.repromptDialog();
Expand All @@ -200,7 +200,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* @remarks When this method is called from the parent dialog's context, the component [Dialog](xref:botbuilder-dialogs.Dialog)
* cancels all of the dialogs on its inner dialog stack before ending.
*/
public async endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
async endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
// Forward cancel to inner dialogs
if (reason === DialogReason.cancelCalled) {
const innerDC: DialogContext = this.createInnerDC(context, instance);
Expand All @@ -217,7 +217,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* @remarks
* The [Dialog.id](xref:botbuilder-dialogs.Dialog.id) of the first child added to the component will be assigned to the initialDialogId property.
*/
public addDialog(dialog: Dialog): this {
addDialog(dialog: Dialog): this {
this.dialogs.add(dialog);
if (this.initialDialogId === undefined) {
this.initialDialogId = dialog.id;
Expand All @@ -230,7 +230,7 @@ export class ComponentDialog<O extends object = {}> extends DialogContainer<O> {
* Creates the inner dialog context
* @param outerDC the outer dialog context
*/
public createChildContext(outerDC: DialogContext): DialogContext {
createChildContext(outerDC: DialogContext): DialogContext {
return this.createInnerDC(outerDC, outerDC.activeDialog);
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/botbuilder-dialogs/src/configurable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export abstract class Configurable {
* Fluent method for configuring the object.
* @param config Configuration settings to apply.
*/
public configure(config: Record<string, unknown>): this {
configure(config: Record<string, unknown>): this {
for (const key in config) {
if (Object.prototype.hasOwnProperty.call(config, key)) {
const setting = config[`${key}`];
Expand Down Expand Up @@ -46,7 +46,7 @@ export abstract class Configurable {
return this;
}

public getConverter(_property: string): Converter | ConverterFactory {
getConverter(_property: string): Converter | ConverterFactory {
return undefined;
}
}
26 changes: 13 additions & 13 deletions libraries/botbuilder-dialogs/src/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* This result indicates that a dialog (or a logical step within a dialog) has completed
* processing for the current turn, is still active, and is waiting for more input.
*/
public static EndOfTurn: DialogTurnResult = { status: DialogTurnStatus.waiting };
static EndOfTurn: DialogTurnResult = { status: DialogTurnStatus.waiting };

/**
* The telemetry client for logging events.
Expand All @@ -250,7 +250,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
*
* @param dialogId Optional. unique ID of the dialog.
*/
public constructor(dialogId?: string) {
constructor(dialogId?: string) {
super();
this.id = dialogId;
}
Expand All @@ -261,7 +261,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* @remarks
* This will be automatically generated if not specified.
*/
public get id(): string {
get id(): string {
if (this._id === undefined) {
this._id = this.onComputeId();
}
Expand All @@ -271,21 +271,21 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
/**
* Sets the unique ID of the dialog.
*/
public set id(value: string) {
set id(value: string) {
this._id = value;
}

/**
* Gets the telemetry client for this dialog.
*/
public get telemetryClient(): BotTelemetryClient {
get telemetryClient(): BotTelemetryClient {
return this._telemetryClient;
}

/**
* Sets the telemetry client for this dialog.
*/
public set telemetryClient(client: BotTelemetryClient) {
set telemetryClient(client: BotTelemetryClient) {
this._telemetryClient = client ? client : new NullTelemetryClient();
}

Expand All @@ -300,7 +300,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
*
* Returning an empty string will disable version tracking for the component all together.
*/
public getVersion(): string {
getVersion(): string {
return this.id;
}

Expand All @@ -324,7 +324,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* - [DialogContext.beginDialog](xref:botbuilder-dialogs.DialogContext.beginDialog)
* - [DialogContext.replaceDialog](xref:botbuilder-dialogs.DialogContext.replaceDialog)
*/
public abstract beginDialog(dc: DialogContext, options?: O): Promise<DialogTurnResult>;
abstract beginDialog(dc: DialogContext, options?: O): Promise<DialogTurnResult>;

/**
* When overridden in a derived class, continues the dialog.
Expand All @@ -344,7 +344,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* **See also**
* - [DialogContext.continueDialog](xref:botbuilder-dialogs.DialogContext.continueDialog)
*/
public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {
async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {
// By default just end the current dialog.
return dc.endDialog();
}
Expand Down Expand Up @@ -374,7 +374,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* **See also**
* - [DialogContext.endDialog](xref:botbuilder-dialogs.DialogContext.endDialog)
*/
public async resumeDialog(dc: DialogContext, reason: DialogReason, result?: any): Promise<DialogTurnResult> {
async resumeDialog(dc: DialogContext, reason: DialogReason, result?: any): Promise<DialogTurnResult> {
// By default just end the current dialog and return result to parent.
return dc.endDialog(result);
}
Expand All @@ -396,7 +396,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* - [DialogContext.repromptDialog](xref:botbuilder-dialogs.DialogContext.repromptDialog)
* - [Prompt](xref:botbuilder-dialogs.Prompt)
*/
public async repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void> {
async repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void> {
// No-op by default
}

Expand All @@ -419,7 +419,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* - [DialogContext.endDialog](xref:botbuilder-dialogs.DialogContext.endDialog)
* - [DialogContext.replaceDialog](xref:botbuilder-dialogs.DialogContext.replaceDialog)
*/
public async endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
async endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
// No-op by default
}

Expand All @@ -430,7 +430,7 @@ export abstract class Dialog<O extends object = {}> extends Configurable {
* @param e - The event being raised.
* @returns True if the event is handled by the current dialog and bubbling should stop.
*/
public async onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean> {
async onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean> {
// Before bubble
let handled = await this.onPreBubbleEvent(dc, e);

Expand Down
12 changes: 6 additions & 6 deletions libraries/botbuilder-dialogs/src/dialogContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
/**
* The containers dialog set.
*/
public readonly dialogs = new DialogSet(undefined);
readonly dialogs = new DialogSet(undefined);

/**
* Creates an inner dialog context for the containers active child.
* @param dc Parents dialog context.
* @returns A new dialog context for the active child or `undefined` if there is no active child.
*/
public abstract createChildContext(dc: DialogContext): DialogContext | undefined;
abstract createChildContext(dc: DialogContext): DialogContext | undefined;

/**
* Finds a child dialog that was previously added to the container.
* @param dialogId ID of the dialog to lookup.
*/
public findDialog(dialogId: string): Dialog | undefined {
findDialog(dialogId: string): Dialog | undefined {
return this.dialogs.find(dialogId);
}

Expand All @@ -42,7 +42,7 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
* @param dc The dialog context for the current turn of conversation.
* @param e The event being raised.
*/
public async onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean> {
async onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean> {
const handled = await super.onDialogEvent(dc, e);
if (!handled && e.name === DialogEvents.versionChanged) {
const traceMessage = `Unhandled dialog event: ${e.name}. Active Dialog: ${dc.activeDialog.id}`;
Expand Down Expand Up @@ -95,7 +95,7 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
* 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) {
set telemetryClient(client: BotTelemetryClient) {
this._telemetryClient = client ?? new NullTelemetryClient();
if (this.dialogs.telemetryClient !== this._telemetryClient) {
this.dialogs.telemetryClient = this._telemetryClient;
Expand All @@ -105,7 +105,7 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
/**
* Get the current telemetry client.
*/
public get telemetryClient(): BotTelemetryClient {
get telemetryClient(): BotTelemetryClient {
return this._telemetryClient;
}
}
Loading