• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / botbuilder-js / 6124258740

08 Sep 2023 04:40PM UTC coverage: 84.866%. Remained the same
6124258740

Pull #4534

github

web-flow
Merge dd3872b14 into 3685e5ee5
Pull Request #4534: fix: [#4525] Replace read-text-file package to avoid using LGPL

9912 of 12925 branches covered (0.0%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

20167 of 22518 relevant lines covered (89.56%)

7187.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.0
/libraries/botbuilder-dialogs-adaptive/src/actions/sendHandoffActivity.ts
1
// Copyright (c) Microsoft Corporation.
2
// Licensed under the MIT License.
3

4
/**
5
 * @module botbuilder-dialogs-adaptive
6
 */
7

8
import { EventFactory, ResourceResponse, Transcript } from 'botbuilder';
2✔
9
import { ObjectExpression, ObjectExpressionConverter } from 'adaptive-expressions';
2✔
10
import { ObjectProperty } from '../properties';
11

12
import {
2✔
13
    Converter,
14
    ConverterFactory,
15
    Dialog,
16
    DialogConfiguration,
17
    DialogContext,
18
    DialogTurnResult,
19
} from 'botbuilder-dialogs';
20

21
export interface SendHandoffActivityConfiguration extends DialogConfiguration {
22
    context?: ObjectProperty<Record<string, unknown>>;
23
    transcript?: ObjectProperty<Transcript>;
24
}
25

26
/**
27
 * Sends a handoff activity. Note that this is a single turn/step dialog (i.e. it calls
28
 * this.endDialog).
29
 */
30
export class SendHandoffActivity extends Dialog implements SendHandoffActivityConfiguration {
2✔
31
    static $kind = 'Microsoft.SendHandoffActivity';
2✔
32

33
    /**
34
     * Context to send with handoff activity
35
     */
36
    context: ObjectExpression<Record<string, unknown>>;
37

38
    /**
39
     * Transcript to send with handoff activity
40
     */
41
    transcript: ObjectExpression<Transcript>;
42

43
    /**
44
     * @param property The key of the conditional selector configuration.
45
     * @returns The converter for the selector configuration.
46
     */
47
    getConverter(property: keyof SendHandoffActivityConfiguration): Converter | ConverterFactory {
48
        switch (property) {
×
49
            case 'context':
×
50
                return new ObjectExpressionConverter<Record<string, unknown>>();
×
51
            case 'transcript':
52
                return new ObjectExpressionConverter<Transcript>();
×
53
            default:
54
                return super.getConverter(property);
×
55
        }
56
    }
57

58
    /**
59
     * Starts a new [Dialog](xref:botbuilder-dialogs.Dialog) and pushes it onto the dialog stack.
60
     *
61
     * @param {DialogContext} dc dialog context
62
     * @returns {Promise<DialogTurnResult<ResourceResponse>>} result of sending handoff activity
63
     */
64
    async beginDialog(dc: DialogContext): Promise<DialogTurnResult<ResourceResponse>> {
65
        const context = this.context?.getValue(dc.state);
×
66
        const transcript = this.transcript?.getValue(dc.state);
×
67

68
        const activity = EventFactory.createHandoffInitiation(dc.context, context, transcript);
×
69
        const response = await dc.context.sendActivity(activity);
×
70

71
        return dc.endDialog(response);
×
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc