botbuilder
Advanced tools
Comparing version 3.5.0-rc7 to 3.5.0-rc8
@@ -28,2 +28,18 @@ "use strict"; | ||
} | ||
Library.prototype.clone = function (copyTo, newName) { | ||
var obj = copyTo || new Library(newName || this.name); | ||
for (var id in this.dialogs) { | ||
obj.dialogs[id] = this.dialogs[id]; | ||
} | ||
for (var name in this.libraries) { | ||
obj.libraries[name] = this.libraries[name]; | ||
} | ||
this.actions.clone(obj.actions); | ||
this.recognizers.clone(obj.recognizers); | ||
obj._localePath = this._localePath; | ||
obj._onFindRoutes = this._onFindRoutes; | ||
obj._onSelectRoute = this._onSelectRoute; | ||
obj.triggersAdded = this.triggersAdded; | ||
return obj; | ||
}; | ||
Library.prototype.localePath = function (path) { | ||
@@ -98,3 +114,2 @@ if (path) { | ||
libraryName: _this.name, | ||
label: 'active_dialog_label', | ||
routeType: Library.RouteTypes.ActiveDialog, | ||
@@ -101,0 +116,0 @@ routeData: result |
@@ -40,2 +40,17 @@ "use strict"; | ||
} | ||
UniversalBot.prototype.clone = function (copyTo, newName) { | ||
var obj = copyTo || new UniversalBot(null, null, newName || this.name); | ||
for (var name in this.settings) { | ||
if (this.settings.hasOwnProperty(name)) { | ||
this.set(name, this.settings[name]); | ||
} | ||
} | ||
for (var channel in this.connectors) { | ||
obj.connector(channel, this.connectors[channel]); | ||
} | ||
obj.mwReceive = this.mwReceive.slice(0); | ||
obj.mwSession = this.mwSession.slice(0); | ||
obj.mwSend = this.mwSend.slice(0); | ||
return _super.prototype.clone.call(this, obj); | ||
}; | ||
UniversalBot.prototype.set = function (name, value) { | ||
@@ -220,2 +235,5 @@ this.settings[name] = value; | ||
}; | ||
UniversalBot.prototype.onDisambiguateRoute = function (handler) { | ||
this._onDisambiguateRoute = handler; | ||
}; | ||
UniversalBot.prototype.dispatch = function (storageCtx, message, dialogId, dialogArgs, done, newStack) { | ||
@@ -282,12 +300,20 @@ var _this = this; | ||
if (!err) { | ||
var route = Library_1.Library.bestRouteResult(results, session.dialogStack(), _this.name); | ||
if (route) { | ||
_this.library(route.libraryName).selectRoute(session, route); | ||
var disambiguateRoute = function (session, routes) { | ||
var route = Library_1.Library.bestRouteResult(results, session.dialogStack(), _this.name); | ||
if (route) { | ||
_this.library(route.libraryName).selectRoute(session, route); | ||
} | ||
else { | ||
session.routeToActiveDialog(); | ||
} | ||
}; | ||
if (_this._onDisambiguateRoute) { | ||
disambiguateRoute = _this._onDisambiguateRoute; | ||
} | ||
else { | ||
session.routeToActiveDialog(); | ||
} | ||
disambiguateRoute(session, results); | ||
done(null); | ||
} | ||
else { | ||
session.error(err); | ||
done(err); | ||
} | ||
@@ -294,0 +320,0 @@ }); |
@@ -30,3 +30,4 @@ "use strict"; | ||
ConfirmCancel: 'BotBuilder:ConfirmCancel', | ||
Interruption: 'BotBuilder:Interruption' | ||
Interruption: 'BotBuilder:Interruption', | ||
Disambiguate: 'BotBuilder:Disambiguate' | ||
}; | ||
@@ -33,0 +34,0 @@ exports.Id = { |
@@ -9,2 +9,10 @@ "use strict"; | ||
} | ||
ActionSet.prototype.clone = function (copyTo) { | ||
var obj = copyTo || new ActionSet(); | ||
obj.trigger = this.trigger; | ||
for (var name in this.actions) { | ||
obj.actions[name] = this.actions[name]; | ||
} | ||
return obj; | ||
}; | ||
ActionSet.prototype.addDialogTrigger = function (actions, dialogId) { | ||
@@ -88,3 +96,2 @@ if (this.trigger) { | ||
libraryName: context.libraryName, | ||
label: options.label || name, | ||
routeType: context.routeType, | ||
@@ -106,3 +113,2 @@ routeData: routeData | ||
libraryName: context.libraryName, | ||
label: entry.options.label || action, | ||
routeType: context.routeType, | ||
@@ -121,3 +127,2 @@ routeData: routeData | ||
libraryName: context.libraryName, | ||
label: entry.options.label || name, | ||
routeType: context.routeType, | ||
@@ -124,0 +129,0 @@ routeData: routeData |
"use strict"; | ||
var utils = require('../utils'); | ||
var async = require('async'); | ||
@@ -29,2 +30,7 @@ (function (RecognizeOrder) { | ||
} | ||
IntentRecognizerSet.prototype.clone = function (copyTo) { | ||
var obj = copyTo || new IntentRecognizerSet(utils.clone(this.options)); | ||
obj.options.recognizers = this.options.recognizers.slice(0); | ||
return obj; | ||
}; | ||
IntentRecognizerSet.prototype.recognize = function (context, done) { | ||
@@ -31,0 +37,0 @@ if (this.options.recognizeOrder == RecognizeOrder.parallel) { |
@@ -314,2 +314,9 @@ "use strict"; | ||
}; | ||
Prompts.disambiguate = function (session, prompt, choices, options) { | ||
session.beginDialog(consts.DialogId.Disambiguate, { | ||
prompt: prompt, | ||
choices: choices, | ||
options: options | ||
}); | ||
}; | ||
Prompts.options = { | ||
@@ -383,1 +390,19 @@ recognizer: new SimplePromptRecognizer(), | ||
]); | ||
Library_1.systemLib.dialog(consts.DialogId.Disambiguate, [ | ||
function (session, args) { | ||
session.dialogData.choices = args.choices; | ||
Prompts.choice(session, args.prompt, args.choices, args.options); | ||
}, | ||
function (session, results) { | ||
var route = session.dialogData.choices[results.response.entity]; | ||
if (route) { | ||
var stack = session.dialogStack(); | ||
stack.pop(); | ||
session.dialogStack(stack); | ||
session.library.library(route.libraryName).selectRoute(session, route); | ||
} | ||
else { | ||
session.endDialogWithResult({ resumed: Dialog_1.ResumeReason.reprompt }); | ||
} | ||
} | ||
]); |
@@ -423,4 +423,4 @@ "use strict"; | ||
if (newStack) { | ||
stack = this.sessionState.callstack = newStack || []; | ||
this.dialogData = stack.length > 0 ? stack[stack.length - 1] : null; | ||
stack = this.sessionState.callstack = newStack; | ||
this.dialogData = stack.length > 0 ? stack[stack.length - 1].state : null; | ||
} | ||
@@ -427,0 +427,0 @@ else { |
@@ -5,3 +5,3 @@ { | ||
"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.", | ||
"version": "3.5.0-rc7", | ||
"version": "3.5.0-rc8", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
429691
68
9417