@jargon/actions-on-google
Version:
The Jargon Actions on Google SDK makes it easy to manage the content of your Google Action
36 lines • 1.53 kB
JavaScript
;
/*
* Copyright 2018 Jargon, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const sdk_core_1 = require("@jargon/sdk-core");
const responseFactory_1 = require("./responseFactory");
exports.DefaultJargonAppBaseOptions = Object.assign({}, sdk_core_1.DefaultResourceManagerOptions);
/**
* Common Jargon application state for Actions SDK and Dialogflow
*/
class JargonAppBase {
constructor(options) {
this._options = Object.assign({}, options);
this._resourceManagerFactory = new sdk_core_1.DefaultResourceManagerFactory(this._options);
}
commonMiddleware(conv) {
const rm = this._resourceManagerFactory.forLocale(conv.user.locale);
conv.jrm = rm;
conv.jargonResourceManager = rm;
const rf = new responseFactory_1.CommonResponseFactory(rm);
conv.jrf = rf;
conv.jargonResponseFactory = rf;
}
}
exports.JargonAppBase = JargonAppBase;
//# sourceMappingURL=app.js.map