twilio-ccai-fulfillment-tools
Version:
A collection of tools to assist in the creation of Twilio CCAI Integration cards via fulfillment scripts
21 lines (20 loc) • 839 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createMapHandler = void 0;
var addIntentsToMapContext_1 = require("./addIntentsToMapContext");
exports.createMapHandler = function (createContext, dfRequest, withIntentDetailsAdded) {
if (withIntentDetailsAdded === void 0) { withIntentDetailsAdded = true; }
return function (agent) {
var _a;
if ((_a = dfRequest.queryResult) === null || _a === void 0 ? void 0 : _a.fulfillmentText) {
agent.add(dfRequest.queryResult.fulfillmentText);
}
var mapContext = createContext();
if (mapContext) {
if (withIntentDetailsAdded) {
addIntentsToMapContext_1.addIntentsToMapContext(mapContext, dfRequest);
}
agent.setContext(mapContext);
}
};
};