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

microsoft / botbuilder-js / 6660259550

26 Oct 2023 10:05PM UTC coverage: 84.822% (+0.02%) from 84.802%
6660259550

Pull #4551

github

web-flow
Merge 41d0092da into 593cd3b86
Pull Request #4551: SP ACE API

9970 of 13012 branches covered (0.0%)

Branch coverage included in aggregate %.

78 of 78 new or added lines in 9 files covered. (100.0%)

20341 of 22723 relevant lines covered (89.52%)

7220.43 hits per line

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

50.0
/libraries/botframework-schema/src/sharepoint/cardView/cardViewParameters.ts
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the MIT License.
3

4
import { CardImage } from './cardImage';
5
import { CardBarComponent } from './cardBarComponent';
6
import { CardButtonComponent } from './cardButtonComponent';
7
import { CardSearchBoxComponent } from './cardSearchBoxComponent';
8
import { CardSearchFooterComponent } from './cardSearchFooterComponent';
9
import { CardTextComponent } from './cardTextComponent';
10
import { CardTextInputComponent } from './cardTextInputComponent';
11

12
/**
13
 * The actions-only footer parameters for the card view.
14
 */
15
export type CardViewActionsFooterParameters =
16
    | [CardButtonComponent]
17
    | [CardButtonComponent, CardButtonComponent]
18
    | undefined;
19

20
/**
21
 * The footer parameters for the card view. Can contain either 0 to 2 buttons or a single text input.
22
 */
23
export type CardViewFooterParameters = CardViewActionsFooterParameters | [CardTextInputComponent];
24

25
/**
26
 * Base parameters for the card view.
27
 */
28
export interface BaseCardViewParameters {
29
    /**
30
     * Card view title area (card bar) components.
31
     */
32
    cardBar: [CardBarComponent];
33
}
34

35
/**
36
 * The parameters for the card view with text or empty body.
37
 */
38
export interface TextCardViewParameters extends BaseCardViewParameters {
39
    /**
40
     * Card View type
41
     */
42
    cardViewType: 'text';
43
    /**
44
     * Header area components.
45
     */
46
    header: [CardTextComponent];
47
    /**
48
     * Body area components.
49
     */
50
    body: [CardTextComponent] | undefined;
51
    /**
52
     * Footer area components.
53
     */
54
    footer?: CardViewFooterParameters;
55

56
    /**
57
     * Image displayed on the card.
58
     */
59
    image?: CardImage;
60
}
61

62
/**
63
 * The parameters for the card view with text input in the body.
64
 */
65
export interface TextInputCardViewParameters extends BaseCardViewParameters {
66
    /**
67
     * Card View type
68
     */
69
    cardViewType: 'textInput';
70
    /**
71
     * Header area components.
72
     */
73
    header: [CardTextComponent];
74
    /**
75
     * Body area components.
76
     */
77
    body: [CardTextInputComponent];
78
    /**
79
     * Footer area components.
80
     */
81
    footer?: CardViewActionsFooterParameters;
82
    /**
83
     * Image displayed on the card.
84
     */
85
    image?: CardImage;
86
}
87

88
/**
89
 * The parameters for the search card view.
90
 */
91
export interface SearchCardViewParameters extends BaseCardViewParameters {
92
    /**
93
     * Card View type
94
     */
95
    cardViewType: 'search';
96
    /**
97
     * Header area components. Contains a single text field.
98
     */
99
    header: [CardTextComponent];
100
    /**
101
     * Body area components. Contains a single search box.
102
     */
103
    body: [CardSearchBoxComponent];
104
    /**
105
     * Footer area components. Contains a single search footer.
106
     */
107
    footer?: [CardSearchFooterComponent];
108
}
109

110
/**
111
 * The parameters for the sign in card view.
112
 */
113
export interface SignInCardViewParameters extends BaseCardViewParameters {
114
    /**
115
     * Card View type
116
     */
117
    cardViewType: 'signIn';
118
    /**
119
     * Header area components.
120
     */
121
    header: [CardTextComponent];
122
    /**
123
     * Body area components.
124
     */
125
    body: [CardTextComponent] | undefined;
126
    /**
127
     * Footer area components.
128
     */
129
    footer?: [CardButtonComponent];
130
}
131

132
/**
133
 * Card View Parameters.
134
 */
135
export type CardViewParameters =
136
    | TextCardViewParameters
137
    | TextInputCardViewParameters
138
    | SearchCardViewParameters
139
    | SignInCardViewParameters;
140

141
/**
142
 * Helper method to create a Basic Card View.
143
 * The Basic Text card view displays the following:
144
 * - Card bar
145
 * - One primary text field
146
 * - Zero or one button in the Medium card size, up to two buttons in Large card size; or text input.
147
 *
148
 * @param cardBar - card bar component
149
 * @param header - text component to display as header
150
 * @param footer - up to two buttons or text input to display as footer
151
 * @returns basic card view parameters.
152
 */
153
export function BasicCardView(
2✔
154
    cardBar: CardBarComponent,
155
    header: CardTextComponent,
156
    footer?: CardViewFooterParameters
157
): TextCardViewParameters {
158
    return {
×
159
        cardViewType: 'text',
160
        body: undefined,
161
        cardBar: [cardBar],
162
        header: [header],
163
        footer: footer,
164
    };
165
}
166

167
/**
168
 * Helper method to create a Primary Text Card View.
169
 * The Primary Text card view displays the following:
170
 * - Card bar
171
 * - One primary text field
172
 * - One description text field
173
 * - Zero or one button in the Medium card size, up to two buttons in Large card size; or text input.
174
 *
175
 * @param cardBar - card bar component
176
 * @param header - text component to display as header
177
 * @param body - text component to display as body
178
 * @param footer - up to two buttons or text input to display as footer
179
 * @returns primary text card view parameters.
180
 */
181
export function PrimaryTextCardView(
2✔
182
    cardBar: CardBarComponent,
183
    header: CardTextComponent,
184
    body: CardTextComponent,
185
    footer?: CardViewFooterParameters
186
): TextCardViewParameters {
187
    return {
×
188
        cardViewType: 'text',
189
        cardBar: [cardBar],
190
        header: [header],
191
        body: [body],
192
        footer: footer,
193
    };
194
}
195

196
/**
197
 * Helper method to create an Image Card View.
198
 * The Image Card view displays the following:
199
 * - Card bar
200
 * - One primary text field
201
 * - One image
202
 * - Zero buttons in the Medium card size, up to two buttons in Large card size; or text input.
203
 *
204
 * @param cardBar - card bar component
205
 * @param header - text component to display as header
206
 * @param image - image to display
207
 * @param footer - up to two buttons or text input to display as footer
208
 * @returns image card view parameters
209
 */
210
export function ImageCardView(
2✔
211
    cardBar: CardBarComponent,
212
    header: CardTextComponent,
213
    image: CardImage,
214
    footer?: CardViewFooterParameters
215
): TextCardViewParameters {
216
    return {
×
217
        cardViewType: 'text',
218
        image: image,
219
        cardBar: [cardBar],
220
        header: [header],
221
        body: undefined,
222
        footer: footer,
223
    };
224
}
225

226
/**
227
 * Helper method to create an Text Input Card View.
228
 * The Text Input Card view displays the following:
229
 * - Card bar
230
 * - One primary text field
231
 * - Zero or one image
232
 * - Zero text input in Medium card size if image is presented, one text input in Medium card size if no image is presented, one text input in Large card size
233
 * - Zero buttons in the Medium card size if image is presented, one button in Medium card size if no image is presented, up to two buttons in Large card size; or text input.
234
 *
235
 * @param cardBar - card bar component
236
 * @param header - text component to display as header
237
 * @param body - text input component to display as body
238
 * @param footer - up to two buttons to display as footer
239
 * @returns text input card view parameters
240
 */
241
export function TextInputCardView(
2✔
242
    cardBar: CardBarComponent,
243
    header: CardTextComponent,
244
    body: CardTextInputComponent,
245
    footer?: CardViewActionsFooterParameters
246
): TextInputCardViewParameters {
247
    return {
×
248
        cardViewType: 'textInput',
249
        cardBar: [cardBar],
250
        header: [header],
251
        body: [body],
252
        footer: footer,
253
    };
254
}
255

256
/**
257
 * Helper method to create a Search Card View.
258
 * The Search Card view displays the following:
259
 * - Card bar
260
 * - One primary text field
261
 * - One search box
262
 * - One search footer
263
 *
264
 * @param cardBar - card bar component
265
 * @param header - text component to display as header
266
 * @param body - search box component to display as body
267
 * @param footer - search footer component to display as footer
268
 * @returns search card view parameters
269
 */
270
export function SearchCardView(
2✔
271
    cardBar: CardBarComponent,
272
    header: CardTextComponent,
273
    body: CardSearchBoxComponent,
274
    footer: CardSearchFooterComponent
275
): SearchCardViewParameters {
276
    return {
×
277
        cardViewType: 'search',
278
        cardBar: [cardBar],
279
        header: [header],
280
        body: [body],
281
        footer: [footer],
282
    };
283
}
284

285
/**
286
 * Helper method to create a Sign In Card View.
287
 * The Sign In Card view displays the following:
288
 * - Card bar
289
 * - One primary text field
290
 * - One description text field
291
 * - Two buttons.
292
 *
293
 * @remarks The first button (sign in button) is always displayed based on the signInText property of the Adaptive Card Extension. Here you should specify the second button (sign in complete button) to display.
294
 * @param cardBar - card bar component
295
 * @param header - text component to display as header
296
 * @param body - text component to display as body
297
 * @param footer - sign in complete button to display as footer
298
 * @returns sign in card view parameters
299
 */
300
export function SignInCardView(
2✔
301
    cardBar: CardBarComponent,
302
    header: CardTextComponent,
303
    body: CardTextComponent,
304
    footer: CardButtonComponent
305
): SignInCardViewParameters {
306
    return {
×
307
        cardViewType: 'signIn',
308
        cardBar: [cardBar],
309
        header: [header],
310
        body: [body],
311
        footer: [footer],
312
    };
313
}
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