@cognigy/rest-api-client
Version:
Cognigy REST-Client
65 lines • 2.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SWITCH_LOCALE = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
/**
* Node name: 'switchLocale'
*
* Purpose:
* Switches the session into another Locale
*/
exports.SWITCH_LOCALE = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "switchLocale",
defaultLabel: "Switch Locale",
summary: "UI__NODE_EDITOR__SWITCH_LOCALE__SUMMARY",
appearance: {
showIcon: false
},
fields: [
{
key: "getLocaleFromScript",
type: "toggle",
label: "UI__NODE_EDITOR__SWITCH_LOCALE__GET_LOCALE_FROM_SCRIPT__LABEL",
defaultValue: false
},
{
key: "localeReferenceId",
type: "localeField",
label: "UI__NODE_EDITOR__SWITCH_LOCALE__LOCALE_REFERENCE_ID__LABEL",
condition: {
key: "getLocaleFromScript",
value: false
},
params: {
required: true
}
},
{
key: "localeScript",
type: "cognigyText",
label: "UI__NODE_EDITOR__SWITCH_LOCALE__LOCALE_SCRIPT__LABEL",
description: "UI__NODE_EDITOR__SWITCH_LOCALE__LOCALE_SCRIPT__DESCRIPTION",
condition: {
key: "getLocaleFromScript",
value: true
},
params: {
required: true
}
}
],
tags: ["logic", "locale", "language"],
function: async ({ cognigy, config }) => {
const { localeReferenceId, localeScript, getLocaleFromScript } = config;
const { api } = cognigy;
if (getLocaleFromScript) {
await api.setLocaleReferenceId(localeScript);
}
else {
await api.setLocaleReferenceId(localeReferenceId);
}
api.logDebugMessage(`UI__DEBUG_MODE__SWITCH_LOCALE__MESSAGE`);
}
});
//# sourceMappingURL=switchLocale.js.map