@voiceflow/alexa-types
Version:
Alexa service types
49 lines (48 loc) • 2.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultSettings = exports.defaultAccountLinking = exports.AccountLinkingAccessTokenScheme = exports.ModelSensitivity = exports.AccountLinkingType = void 0;
const constants_1 = require("../constants");
const voice_types_1 = require("@voiceflow/voice-types");
var AccountLinkingType;
(function (AccountLinkingType) {
AccountLinkingType["IMPLICIT"] = "IMPLICIT";
AccountLinkingType["AUTH_CODE"] = "AUTH_CODE";
})(AccountLinkingType || (exports.AccountLinkingType = AccountLinkingType = {}));
var ModelSensitivity;
(function (ModelSensitivity) {
ModelSensitivity["LOW"] = "LOW";
ModelSensitivity["HIGH"] = "HIGH";
ModelSensitivity["MEDIUM"] = "MEDIUM";
})(ModelSensitivity || (exports.ModelSensitivity = ModelSensitivity = {}));
var AccountLinkingAccessTokenScheme;
(function (AccountLinkingAccessTokenScheme) {
AccountLinkingAccessTokenScheme["HTTP_BASIC"] = "HTTP_BASIC";
AccountLinkingAccessTokenScheme["REQUEST_BODY_CREDENTIALS"] = "REQUEST_BODY_CREDENTIALS";
})(AccountLinkingAccessTokenScheme || (exports.AccountLinkingAccessTokenScheme = AccountLinkingAccessTokenScheme = {}));
const defaultAccountLinking = (accountLinking) => {
if (!accountLinking) {
return null;
}
const { type = AccountLinkingType.AUTH_CODE, scopes = [], domains = [], clientId = '', clientSecret = '', accessTokenUrl = '', authorizationUrl = '', accessTokenScheme = AccountLinkingAccessTokenScheme.HTTP_BASIC, defaultTokenExpirationInSeconds = 3600, } = accountLinking;
return {
type,
scopes,
domains,
clientId,
clientSecret,
accessTokenUrl,
authorizationUrl,
accessTokenScheme,
defaultTokenExpirationInSeconds,
};
};
exports.defaultAccountLinking = defaultAccountLinking;
const defaultSettings = ({ events = null, permissions = [], accountLinking, customInterface = false, modelSensitivity = null, ...voiceSettings } = {}) => ({
...voice_types_1.VoiceVersion.defaultSettings(voiceSettings, { defaultPromptVoice: constants_1.Voice.ALEXA }),
events,
permissions,
accountLinking: (0, exports.defaultAccountLinking)(accountLinking),
customInterface,
modelSensitivity,
});
exports.defaultSettings = defaultSettings;