@@ -179,4 +179,43 @@ export class DataQueryContext extends BaseContext {
179
179
return this . getVariable ( 'system.isFollowupResponse' ) ;
180
180
}
181
181
182
+ /**
183
+ * The end flow action that is set that can be used to transition to a different flow by defining a mapping for this action in the
184
+ * main flow.
185
+ * @param {string } action - the end flow action that can be used to transition in the main flow
186
+ */
187
+ setEndFlowAction ( action : string ) : void {
188
+ this . setVariable ( 'system.sqlDialog.endFlowAction' , action ) ;
189
+ this . getResponse ( ) . transitionAction = 'system.sqlDialog.endFlow' ;
190
+ }
191
+
192
+ /**
193
+ * Creates a postback action that ends the flow with the specified end flow action.
194
+ * @param {string } the label of the postback button
195
+ * @param {string } action - the end flow action that can be used to transition in the main flow
196
+ */
197
+ createEndFlowPostbackAction ( label : string , action : string ) : PostbackAction {
198
+ const mf = this . getMessageFactory ( ) ;
199
+ return mf . createPostbackAction ( label , { 'action' : 'system.sqlDialog.endFlow' , 'variables' : { 'system.sqlDialog.endFlowAction' : action } } ) ;
200
+ }
201
+
202
+ /**
203
+ * Invoke another flow
204
+ * @param {string } flowName - name of the flow to invoke
205
+ */
206
+ invokeFlow ( flowName : string ) : void {
207
+ this . setVariable ( 'system.sqlDialog.invokeFlowName' , flowName ) ;
208
+ this . getResponse ( ) . transitionAction = 'system.sqlDialog.invokeFlow' ;
209
+ }
210
+
211
+ /**
212
+ * Creates a postback action that invokes the specified flow.
213
+ * @param {string } the label of the postback button
214
+ * @param {string } flowName - name of the flow to invoke
215
+ */
216
+ createInvokeFlowPostbackAction ( label , flowName ) : PostbackAction {
217
+ const mf = this . getMessageFactory ( ) ;
218
+ return mf . createPostbackAction ( label , { 'action' : 'system.sqlDialog.invokeFlow' ,
219
+ 'variables' : { 'system.sqlDialog.invokeFlowName' : flowName } } ) ;
220
+ }
182
221
}
0 commit comments