@cognigy/rest-api-client 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/.snyk +1 -1
  2. package/build/GenericUploadFn.js +1 -1
  3. package/build/RestAPIClient.js +14 -0
  4. package/build/apigroups/AdministrationAPIGroup_2_0.js +25 -3
  5. package/build/apigroups/AnalyticsAPIGroup_2_0.js +12 -0
  6. package/build/apigroups/InsightsAPIGroup_2_0.js +53 -0
  7. package/build/apigroups/ResourcesAPIGroup_2_0.js +23 -2
  8. package/build/apigroups/index.js +5 -1
  9. package/build/authentication/BasicAuthentication/BasicAuthentication.js +8 -1
  10. package/build/authentication/OAuth2/ILoginByClientCredentialsParameters.js +3 -0
  11. package/build/authentication/OAuth2/IOAuth2ClientCredentialsGrantAccessTokenRequest.js +11 -0
  12. package/build/authentication/OAuth2/OAuth2Authentication.js +41 -15
  13. package/build/shared/charts/createNodeDescriptor.js +1 -1
  14. package/build/shared/charts/descriptors/apps/index.js +8 -0
  15. package/build/shared/charts/descriptors/apps/initAppSession.js +33 -0
  16. package/build/shared/charts/descriptors/apps/setAppState.js +46 -0
  17. package/build/shared/charts/descriptors/connectionNodes/smtp/emailNotification.js +6 -4
  18. package/build/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +2 -2
  19. package/build/shared/charts/descriptors/end.js +1 -0
  20. package/build/shared/charts/descriptors/index.js +86 -67
  21. package/build/shared/charts/descriptors/logic/goTo.js +1 -0
  22. package/build/shared/charts/descriptors/logic/if/else.js +2 -0
  23. package/build/shared/charts/descriptors/logic/if/if.js +2 -1
  24. package/build/shared/charts/descriptors/logic/if/then.js +2 -0
  25. package/build/shared/charts/descriptors/logic/index.js +5 -3
  26. package/build/shared/charts/descriptors/logic/interval/elseInterval.js +1 -0
  27. package/build/shared/charts/descriptors/logic/interval/onInterval.js +1 -0
  28. package/build/shared/charts/descriptors/logic/once/afterwards.js +1 -0
  29. package/build/shared/charts/descriptors/logic/once/onFirstExecution.js +1 -0
  30. package/build/shared/charts/descriptors/logic/setTranslation.js +88 -0
  31. package/build/shared/charts/descriptors/logic/switch/case.js +2 -0
  32. package/build/shared/charts/descriptors/logic/switch/default.js +2 -0
  33. package/build/shared/charts/descriptors/logic/switch/switch.js +52 -4
  34. package/build/shared/charts/descriptors/logic/switchLocale.js +30 -2
  35. package/build/shared/charts/descriptors/logic/think.js +7 -3
  36. package/build/shared/charts/descriptors/logic/thinkV2.js +104 -0
  37. package/build/shared/charts/descriptors/logic/wait.js +2 -9
  38. package/build/shared/charts/descriptors/message/checkChannelChange/checkChannelChange.js +1 -0
  39. package/build/shared/charts/descriptors/message/checkChannelChange/onNo.js +3 -1
  40. package/build/shared/charts/descriptors/message/checkChannelChange/onYes.js +3 -1
  41. package/build/shared/charts/descriptors/message/checkChannelChange/unchanged.js +3 -1
  42. package/build/shared/charts/descriptors/message/question/onAnswer.js +3 -1
  43. package/build/shared/charts/descriptors/message/question/onQuestion.js +3 -1
  44. package/build/shared/charts/descriptors/message/question/question.js +474 -56
  45. package/build/shared/charts/descriptors/message/question/utils/datepickerUtils.js +1 -0
  46. package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +9 -3
  47. package/build/shared/charts/descriptors/message/question/utils/generateAnswerShortForm.js +37 -0
  48. package/build/shared/charts/descriptors/message/question/utils/getQuestionText.js +36 -0
  49. package/build/shared/charts/descriptors/message/question/utils/resetNodeState.js +12 -0
  50. package/build/shared/charts/descriptors/message/question/utils/storeQuestionAnswer.js +30 -0
  51. package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +22 -0
  52. package/build/shared/charts/descriptors/microsoft/getToken.js +34 -0
  53. package/build/shared/charts/descriptors/microsoft/index.js +22 -0
  54. package/build/shared/charts/descriptors/microsoft/invalidateToken.js +29 -0
  55. package/build/shared/charts/descriptors/microsoft/tokenStatus/index.js +51 -0
  56. package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenGranted.js +24 -0
  57. package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenNotGranted.js +24 -0
  58. package/build/shared/charts/descriptors/microsoft/utils/design.js +5 -0
  59. package/build/shared/charts/descriptors/nlu/executeCognigyNLU.js +5 -0
  60. package/build/shared/charts/descriptors/nlu/extractAnswer.js +115 -0
  61. package/build/shared/charts/descriptors/nlu/fuzzySearch.js +270 -0
  62. package/build/shared/charts/descriptors/nlu/index.js +7 -1
  63. package/build/shared/charts/descriptors/nlu/matchPattern.js +104 -0
  64. package/build/shared/charts/descriptors/nlu/utils/patternMatcher.js +197 -0
  65. package/build/shared/charts/descriptors/profile/index.js +5 -1
  66. package/build/shared/charts/descriptors/profile/overwriteAnalytics.js +54 -2
  67. package/build/shared/charts/descriptors/profile/requestRating.js +57 -0
  68. package/build/shared/charts/descriptors/profile/setRating.js +39 -0
  69. package/build/shared/charts/descriptors/service/handover.js +29 -2
  70. package/build/shared/charts/descriptors/service/handoverV2.js +129 -0
  71. package/build/shared/charts/descriptors/service/httpRequest.js +26 -7
  72. package/build/shared/charts/descriptors/service/index.js +3 -1
  73. package/build/shared/charts/descriptors/service/triggerFunction/onScheduled.js +2 -0
  74. package/build/shared/charts/descriptors/service/triggerFunction/onSchedulingError.js +2 -0
  75. package/build/shared/charts/descriptors/start.js +1 -0
  76. package/build/shared/charts/descriptors/voicegateway/nodes/callRecording.js +36 -16
  77. package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +2 -2
  78. package/build/shared/charts/descriptors/voicegateway/nodes/playURL.js +9 -0
  79. package/build/shared/charts/descriptors/voicegateway/nodes/sendMessage.js +1 -1
  80. package/build/shared/charts/descriptors/voicegateway/utils/paramUtils.js +9 -1
  81. package/build/shared/charts/descriptors/voicegateway2/index.js +21 -0
  82. package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +56 -0
  83. package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +48 -0
  84. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +199 -0
  85. package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +44 -0
  86. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +584 -0
  87. package/build/shared/charts/descriptors/voicegateway2/utils/design.js +5 -0
  88. package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +19 -0
  89. package/build/shared/constants.js +9 -1
  90. package/build/shared/errors/baseError.js +34 -1
  91. package/build/shared/helper/rest/array.js +19 -0
  92. package/build/shared/helper/rest/boolean.js +5 -1
  93. package/build/shared/helper/rest/index.js +4 -1
  94. package/build/shared/interfaces/IEndpointTranslationSettings.js +32 -0
  95. package/build/shared/interfaces/IHandoverRequestStatus.js +3 -0
  96. package/build/shared/interfaces/{restAPI/administration/user/v2.0/IDeleteUserMeRest_2_0.js → IHttpRequest.js} +1 -1
  97. package/build/shared/interfaces/IOrganisation.js +1 -1
  98. package/build/shared/interfaces/TEntrypointType.js +2 -0
  99. package/build/shared/interfaces/amqpInterface.js +3 -0
  100. package/build/shared/interfaces/analytics/IAnalyticsFlowHistoryData.js +3 -0
  101. package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +196 -45
  102. package/build/shared/interfaces/analytics/IStepEvent.js +2 -1
  103. package/build/shared/interfaces/analytics/TAnalyticsMode.js +10 -0
  104. package/build/shared/interfaces/analytics/TAnalyticsType.js +5 -0
  105. package/build/shared/interfaces/debugEvents/IErrorEventPayload.js +3 -0
  106. package/build/shared/interfaces/debugEvents/TDebugEndpointEvent.js +1 -0
  107. package/build/shared/interfaces/debugEvents/TDebugEventType.js +2 -1
  108. package/build/shared/interfaces/debugEvents/TSessionStateEmitParams.js +3 -0
  109. package/build/shared/interfaces/handover.js +81 -3
  110. package/build/shared/interfaces/license.js +34 -0
  111. package/build/shared/interfaces/license.js.map +1 -0
  112. package/build/shared/interfaces/messageAPI/ai.js +15 -1
  113. package/build/shared/interfaces/messageAPI/endpoints.js +273 -9
  114. package/build/shared/interfaces/resources/IAuditEvent.js +15 -2
  115. package/build/shared/interfaces/resources/IChartNode.js +56 -10
  116. package/build/shared/interfaces/resources/IEndpoint.js +5 -2
  117. package/build/shared/interfaces/resources/IFlow.js +1 -1
  118. package/build/shared/interfaces/resources/ILexicon.js +8 -2
  119. package/build/shared/interfaces/resources/INLUConnector.js +15 -2
  120. package/build/shared/interfaces/resources/INodeDescriptorSet.js +164 -52
  121. package/build/shared/interfaces/resources/IOptionsResolverFunction.js +18 -0
  122. package/build/shared/interfaces/resources/IPlaybookRun.js +61 -0
  123. package/build/shared/interfaces/resources/IProject.js +7 -1
  124. package/build/shared/interfaces/resources/ISlotFiller.js +38 -21
  125. package/build/shared/interfaces/resources/ISnapshot.js +1 -1
  126. package/build/shared/interfaces/resources/ITrackAnalyticsStepsArguments.js +3 -0
  127. package/build/shared/interfaces/resources/TNLUConnectorType.js +2 -1
  128. package/build/shared/interfaces/resources/TResourceType.js +1 -0
  129. package/build/shared/interfaces/resources/TRestChannelType.js +5 -0
  130. package/build/shared/interfaces/resources/TSocketChannelType.js +5 -1
  131. package/build/shared/interfaces/resources/chart/IChartExecutable.js +3 -2
  132. package/build/shared/interfaces/resources/chart/IChartExecutableNode.js +1 -0
  133. package/build/shared/interfaces/resources/intent/IIntent.js +4 -2
  134. package/build/shared/interfaces/resources/intent/IIntentTrainGroup.js +3 -1
  135. package/build/shared/interfaces/resources/intent/ISentence.js +32 -8
  136. package/build/shared/interfaces/resources/settings/IAgentSettings.js +40 -2
  137. package/build/shared/interfaces/resources/settings/IFlowSettings.js +1 -1
  138. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadLiveAgentAccountRest_2_0.js +3 -0
  139. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadProjectInboxRest_2_0.js +3 -0
  140. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentInboxRest_2_0.js +3 -0
  141. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentRest_2_0.js +3 -0
  142. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/index.js +3 -0
  143. package/build/shared/interfaces/restAPI/analytics/IDeleteAnalyticsRecordsRest_2_0.js +3 -0
  144. package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordProperties_2_0.js +3 -0
  145. package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordsRest_2_0.js +3 -0
  146. package/build/shared/interfaces/restAPI/insights/IAnalyticsQueryFilter_2_0.js +3 -0
  147. package/build/shared/interfaces/restAPI/insights/TAnalyticsQueryFilterOperator_2_0.js +3 -0
  148. package/build/shared/interfaces/restAPI/insights/messages/IGenerateMessagesRest_2_0.js +5 -0
  149. package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashResponse_2_0.js +3 -0
  150. package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashRestData_2_0.js +3 -0
  151. package/build/shared/interfaces/restAPI/insights/messages/ITopNMessages_2_0.js +3 -0
  152. package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportResponse_2_0.js +3 -0
  153. package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportRest_2_0.js +41 -0
  154. package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashResponse_2_0.js +3 -0
  155. package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashRest_2_0.js +3 -0
  156. package/build/shared/interfaces/restAPI/insights/steps/IGenerateStepReportRest_2_0.js +3 -0
  157. package/build/shared/interfaces/restAPI/insights/steps/IIndexStepsRest_2_0.js +3 -0
  158. package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashResponse_2_0.js +3 -0
  159. package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashRestData_2_0.js +3 -0
  160. package/build/shared/interfaces/restAPI/insights/steps/IStepIndexItem_2_0.js +3 -0
  161. package/build/shared/interfaces/restAPI/insights/steps/IStepReport_2_0.js +3 -0
  162. package/build/shared/interfaces/restAPI/insights/steps/IStep_2_0.js +3 -0
  163. package/build/shared/interfaces/restAPI/insights/transcripts/IGenerateTranscriptsRest_2_0.js +3 -0
  164. package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashResponse_2_0.js +3 -0
  165. package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashRestData_2_0.js +3 -0
  166. package/build/shared/interfaces/restAPI/insights/transcripts/IStepPath_2_0.js +3 -0
  167. package/build/shared/interfaces/restAPI/resources/chart/v2.0/ISearchChartNodesRest_2_0.js +3 -0
  168. package/build/shared/interfaces/restAPI/resources/extension/v2.0/IUpdateExtensionPackageRest_2_0.js +4 -0
  169. package/build/shared/interfaces/restAPI/resources/flow/v2.0/ICreateFlowFromChildrenRest_2_0.js +4 -0
  170. package/build/shared/interfaces/restAPI/resources/flow/v2.0/intent/ITrainYesNoIntentsRest_2_0.js +3 -0
  171. package/build/shared/interfaces/restAPI/resources/lexicon/v2.0/IComposeLexiconDownloadLinkRest_2_0.js +3 -0
  172. package/build/shared/interfaces/restAPI/resources/nluconnector/v2.0/TNLUConnectorType_2_0.js +3 -1
  173. package/build/shared/interfaces/restAPI/resources/nodedescriptorsets/v2.0/IOptionsResolverRest_2_0.js +3 -0
  174. package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IDeletePlaybookRunRest_2_0.js +3 -0
  175. package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IIndexPlaybookRunsRest_2_0.js +3 -0
  176. package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRunIndexItem_2_0.js +3 -0
  177. package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRun_2_0.js +7 -0
  178. package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IReadPlaybookRunRest_2_0.js +3 -0
  179. package/build/shared/interfaces/restAPI/resources/playbook/v2.0/ISchedulePlaybookRunRest_2_0.js +3 -0
  180. package/build/shared/interfaces/security/IACL.js +1 -1
  181. package/build/shared/interfaces/security/IPermission.js +6 -0
  182. package/build/shared/interfaces/security/IRole.js +8 -2
  183. package/build/shared/interfaces/sessionstate/ISessionState.js +3 -0
  184. package/build/shared/interfaces/sessionstate/index.js +3 -0
  185. package/build/shared/interfaces/trainer/ITrainerRecord.js +4 -0
  186. package/build/shared/interfaces/translation.js +11 -0
  187. package/package.json +5 -5
  188. package/types/index.d.ts +3905 -1178
  189. package/build/shared/charts/descriptors/logic/checkFrustration.js +0 -82
@@ -0,0 +1,584 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setSessionConfigNode = exports.voiceConfigFields = void 0;
4
+ /** Custom Modules */
5
+ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
+ /** Helper Modules */
7
+ const design_1 = require("../utils/design");
8
+ const strip_nulls_1 = require("../utils/strip-nulls");
9
+ exports.voiceConfigFields = [
10
+ {
11
+ key: "bargeInMinWordCount",
12
+ type: "slider",
13
+ label: "Barge In Minimum Words",
14
+ description: "Defines the minimum number of words that the user must say for the Voice Gateway to consider it a barge in",
15
+ defaultValue: 1,
16
+ params: {
17
+ min: 0,
18
+ max: 5,
19
+ step: 1
20
+ }
21
+ },
22
+ {
23
+ key: "bargeInOnSpeech",
24
+ type: "toggle",
25
+ label: "Barge In On Speech",
26
+ description: "Allows the user to interrupt bot output with speech",
27
+ defaultValue: false
28
+ },
29
+ {
30
+ key: "bargeInOnDtmf",
31
+ type: "toggle",
32
+ label: "Barge In On DTMF",
33
+ description: "Allows the user to interrupt bot output with DTMF",
34
+ defaultValue: false
35
+ },
36
+ {
37
+ key: "sttVendor",
38
+ type: "sttSelect",
39
+ label: "_unused_",
40
+ description: "_unused_",
41
+ defaultValue: "",
42
+ params: {
43
+ languageKey: "config.sttLanguage"
44
+ }
45
+ },
46
+ {
47
+ key: "sttHints",
48
+ type: "textArray",
49
+ label: "STT Hints",
50
+ description: "Array of words or phrases to assist speech detection",
51
+ defaultValue: [""]
52
+ },
53
+ {
54
+ key: "ttsDisableCache",
55
+ type: "toggle",
56
+ label: "Disable TTS audio caching",
57
+ description: "Disable TTS audio caching for a reduced number of queries to TSS vendor. Warning, " +
58
+ "disabling caching increases your TTS costs",
59
+ defaultValue: false
60
+ },
61
+ {
62
+ key: "ttsVendor",
63
+ defaultValue: "",
64
+ type: "ttsSelect",
65
+ label: "_unused_",
66
+ description: "_unused_",
67
+ params: {
68
+ languageKey: "config.ttsLanguage",
69
+ voiceKey: "config.ttsVoice"
70
+ }
71
+ },
72
+ {
73
+ key: "sttVadEnabled",
74
+ type: "toggle",
75
+ label: "Enable Voice Activity Detection",
76
+ description: "Delay connection to cloud recognizer until speech is detected",
77
+ defaultValue: true
78
+ },
79
+ {
80
+ key: "sttVadMode",
81
+ type: "slider",
82
+ label: "VAD sensitivity",
83
+ description: "Detection sensitivity, the lowest value has the highest sensitivity",
84
+ defaultValue: 1,
85
+ params: {
86
+ min: 0,
87
+ max: 3,
88
+ step: 1
89
+ },
90
+ condition: {
91
+ key: "sttVadEnabled",
92
+ value: true
93
+ }
94
+ },
95
+ {
96
+ key: "sttVadVoiceMs",
97
+ type: "slider",
98
+ label: "Minimal voice duration",
99
+ description: "Milliseconds of speech activity required before connecting to the cloud recognizer",
100
+ defaultValue: 100,
101
+ params: {
102
+ min: 100,
103
+ max: 1000,
104
+ step: 100
105
+ },
106
+ condition: {
107
+ key: "sttVadEnabled",
108
+ value: true
109
+ }
110
+ },
111
+ /*
112
+ {
113
+ key: "azureTtsDeploymentId",
114
+ type: "text",
115
+ label: "Azure TTS deployment ID",
116
+ description: "Define a custom azure deployment for TTS",
117
+ defaultValue: ""
118
+ },
119
+ {
120
+ key: "azureSttDeploymentId",
121
+ type: "text",
122
+ label: "Azure STT deployment ID",
123
+ description: "Define a custome azure STT deployment",
124
+ defaultValue: ""
125
+ },
126
+ {
127
+ key: "azureSpeechRecognitionMode",
128
+ type: "text",
129
+ label: "Azure Speech recognition mode",
130
+ description: "Define azure STT mode",
131
+ defaultValue: ""
132
+ },
133
+ {
134
+ key: "azureEnableAudioLogging",
135
+ type: "toggle",
136
+ label: "Azure Audio logging",
137
+ description: "Select the desired TTS Vendor",
138
+ defaultValue: false
139
+ },
140
+ {
141
+ key: "azureHintsBoost",
142
+ type: "number",
143
+ label: "Azure Hints Boost",
144
+ description: "Define if Azure Hints needs to be boosted",
145
+ defaultValue: 0
146
+ },
147
+ {
148
+ key: "googleDisablePunctuation",
149
+ type: "toggle",
150
+ label: "Google Disable Punctuation",
151
+ description: "Disable Punctuation detection in Google's STT",
152
+ defaultValue: false
153
+ },
154
+ {
155
+ key: "googleInteractionType",
156
+ type: "text",
157
+ label: "Google STT Interaction type",
158
+ description: "Define Google STT interaction type",
159
+ defaultValue: ""
160
+ },
161
+ {
162
+ key: "googleHintsBoost",
163
+ type: "number",
164
+ label: "Google STT Hints Boost",
165
+ description: "Define if Google Hints needs to be boosted",
166
+ defaultValue: 0
167
+ },*/
168
+ {
169
+ key: "userNoInputMode",
170
+ type: "select",
171
+ label: "User No Input Mode",
172
+ description: "Define what should happen if a user does not provide input to the bot in time",
173
+ defaultValue: "event",
174
+ params: {
175
+ options: [
176
+ {
177
+ label: "Speak", value: "speech"
178
+ },
179
+ {
180
+ label: "Play File", value: "play"
181
+ },
182
+ {
183
+ label: "Send Event", value: "event"
184
+ }
185
+ ]
186
+ }
187
+ },
188
+ {
189
+ key: "userNoInputTimeout",
190
+ type: "number",
191
+ label: "User No Input Timeout",
192
+ description: "Define the timeout for user input in ms",
193
+ defaultValue: 10000
194
+ },
195
+ {
196
+ key: "userNoInputRetries",
197
+ type: "number",
198
+ label: "User No Input Retries",
199
+ description: "Define how often the bot should retry to get an input from a user before completing the call",
200
+ defaultValue: 1
201
+ },
202
+ {
203
+ key: "userNoInputSpeech",
204
+ type: "text",
205
+ label: "User No Input Speech",
206
+ description: "Define a prompt to speak in case a user does not answer the bot in time",
207
+ defaultValue: "",
208
+ condition: {
209
+ key: "userNoInputMode",
210
+ value: "speech"
211
+ },
212
+ params: {
213
+ required: true
214
+ }
215
+ },
216
+ {
217
+ key: "userNoInputUrl",
218
+ type: "text",
219
+ label: "User No Input URL",
220
+ description: "Define which URL will be played in case a user does not answer the bot in time. MP3 and WAV files are supported",
221
+ defaultValue: "",
222
+ condition: {
223
+ key: "userNoInputMode",
224
+ value: "play"
225
+ },
226
+ params: {
227
+ required: true
228
+ }
229
+ },
230
+ /*
231
+ {
232
+ key: "botFailOnError",
233
+ type: "toggle",
234
+ label: "Bot Fail on Error",
235
+ description: "Define if the Bot should fail and escalate the call if an error occured",
236
+ defaultValue: true
237
+ },
238
+ {
239
+ key: "botNoOutputGiveupTimeout",
240
+ type: "number",
241
+ label: "Bot No Output Giveup Tinmeout",
242
+ description:
243
+ "Define the time in ms, after which the bot should escalate if no output has been provided by cognigy",
244
+ defaultValue: 0
245
+ },
246
+ {
247
+ key: "botNoOutputTimeout",
248
+ type: "number",
249
+ label: "Bot No Output Timeout",
250
+ description: "Define the timeout for bot outputin ms",
251
+ defaultValue: 0
252
+ },
253
+ {
254
+ key: "botNoOutputRetries",
255
+ type: "number",
256
+ label: "Bot No Input Retries",
257
+ description: "Define how many times should we try to get bot output",
258
+ defaultValue: 0
259
+ },
260
+ {
261
+ key: "botNoOutputSpeech",
262
+ type: "text",
263
+ label: "Bot No Input Speech",
264
+ description: "Define the default speech the bot will speak if no bot output detected",
265
+ defaultValue: ""
266
+ },
267
+ {
268
+ key: "botNoOutputUrl",
269
+ type: "text",
270
+ label: "Bot No Input URL",
271
+ description: "Define the file which should be played if no bot output was detected",
272
+ defaultValue: ""
273
+ },*/
274
+ {
275
+ key: "dtmfEnable",
276
+ type: "toggle",
277
+ label: "Capture DTMF signals",
278
+ description: "Enable capturing of DTMF signals by the bot",
279
+ defaultValue: false
280
+ },
281
+ {
282
+ key: "dtmfInterDigitTimeout",
283
+ type: "number",
284
+ label: "DTMF Inter Digit Timeout",
285
+ description: "Define the max timeout between entering the digits on the phone",
286
+ defaultValue: 1000,
287
+ condition: {
288
+ key: "dtmfEnable",
289
+ value: true
290
+ }
291
+ },
292
+ {
293
+ key: "dtmfMaxDigits",
294
+ type: "number",
295
+ label: "DTMF Max Digits",
296
+ description: "Define the max number of digits which can be entered by the user. After reaching the max number of entered digits these will be automatically submited to the bot",
297
+ defaultValue: 1,
298
+ condition: {
299
+ key: "dtmfEnable",
300
+ value: true
301
+ }
302
+ },
303
+ {
304
+ key: "dtmfMinDigits",
305
+ type: "number",
306
+ label: "DTMF Min Digits",
307
+ description: "Define the min number of digits a user needs to submit before they are forwarded to the bot. Can be overriden by a submit digit",
308
+ defaultValue: 1,
309
+ condition: {
310
+ key: "dtmfEnable",
311
+ value: true
312
+ }
313
+ },
314
+ {
315
+ key: "dtmfSubmitDigit",
316
+ type: "text",
317
+ label: "DTMF Submit Digit",
318
+ description: "Define the DTMF submit digit which will be used for submitting the previously entered digits. Overrides min digits validation",
319
+ defaultValue: "#",
320
+ condition: {
321
+ key: "dtmfEnable",
322
+ value: true
323
+ }
324
+ },
325
+ /*
326
+ {
327
+ key: "asrDigits",
328
+ type: "text",
329
+ label: "ASR Digits",
330
+ description: "???????",
331
+ defaultValue: ""
332
+ },
333
+ {
334
+ key: "asrTimeout",
335
+ type: "number",
336
+ label: "ASR Timeout in ms",
337
+ description: "???",
338
+ defaultValue: 0
339
+ },
340
+ */
341
+ /*
342
+ {
343
+ key: "setBotOutputParams",
344
+ label: "Set Bot Output Parameters",
345
+ type: "toggle",
346
+ defaultValue: false
347
+ },
348
+ {
349
+ key: "setContiniousASR",
350
+ label: "Set continous ASR params",
351
+ type: "toggle",
352
+ defaultValue: false
353
+ },
354
+ {
355
+ key: "setAzureParams",
356
+ label: "Set Azure STT/TTS params",
357
+ type: "toggle",
358
+ defaultValue: false
359
+ },
360
+ {
361
+ key: "setGoogleParams",
362
+ label: "Set Google STT/TTS params",
363
+ type: "toggle",
364
+ defaultValue: false
365
+ }*/
366
+ ];
367
+ exports.setSessionConfigNode = createNodeDescriptor_1.createNodeDescriptor({
368
+ type: "setSessionConfig",
369
+ defaultLabel: "Set Session Config",
370
+ appearance: {
371
+ color: design_1.nodeColor
372
+ },
373
+ fields: exports.voiceConfigFields,
374
+ sections: [
375
+ {
376
+ key: "params_stt",
377
+ label: "Recognizer (STT)",
378
+ defaultCollapsed: true,
379
+ fields: ["sttVendor", "sttHints", "sttVadEnabled", "sttVadMode", "sttVadVoiceMs"]
380
+ },
381
+ {
382
+ key: "params_tts",
383
+ label: "Synthesizer (TTS)",
384
+ defaultCollapsed: true,
385
+ fields: ["ttsVendor"]
386
+ },
387
+ {
388
+ key: "params_bargein",
389
+ label: "Barge In",
390
+ defaultCollapsed: true,
391
+ fields: ["bargeInOnSpeech", "bargeInOnDtmf", "bargeInMinWordCount"]
392
+ },
393
+ /*
394
+ {
395
+ key: "params_azure",
396
+ label: "Azure STT/TTS Configuration",
397
+ defaultCollapsed: true,
398
+ fields: [
399
+ "azureTtsDeploymentId",
400
+ "azureSttDeploymentId",
401
+ "azureSpeechRecognitionMode",
402
+ "azureEnableAudioLogging",
403
+ "azureHintsBoost"
404
+ ],
405
+ condition: {
406
+ key: "setAzureParams",
407
+ value: true
408
+ }
409
+ },
410
+ {
411
+ key: "params_google",
412
+ label: "Google STT/TTS Configuration",
413
+ defaultCollapsed: true,
414
+ fields: ["googleDisablePunctuation", "googleInteractionType", "googleHintsBoost"],
415
+ condition: {
416
+ key: "setGoogleParams",
417
+ value: true
418
+ }
419
+ },*/
420
+ {
421
+ key: "params_user_timeouts",
422
+ label: "User Input Timeout",
423
+ defaultCollapsed: true,
424
+ fields: [
425
+ "userNoInputMode",
426
+ "userNoInputSpeech",
427
+ "userNoInputUrl",
428
+ "userNoInputTimeout",
429
+ "userNoInputRetries"
430
+ ]
431
+ },
432
+ /*
433
+ {
434
+ key: "params_bot_timeouts",
435
+ label: "Configure what should happen on bot output timeout",
436
+ defaultCollapsed: true,
437
+ fields: [
438
+ "botFailOnError",
439
+ "botNoOutputGiveupTimeout",
440
+ "botNoOutputTimeout",
441
+ "botNoOutputRetries",
442
+ "botNoOutputSpeech",
443
+ "botNoOutputUrl"
444
+ ],
445
+ condition: {
446
+ key: "setBotOutputParams",
447
+ value: true
448
+ }
449
+ },*/
450
+ {
451
+ key: "params_dtmf",
452
+ label: "DTMF",
453
+ defaultCollapsed: true,
454
+ fields: ["dtmfEnable", "dtmfInterDigitTimeout", "dtmfMaxDigits", "dtmfMinDigits", "dtmfSubmitDigit"]
455
+ }
456
+ /*
457
+ {
458
+ key: "params_continuousasr",
459
+ label: "Configgure the cotinious Audio Speech Recognition",
460
+ defaultCollapsed: true,
461
+ fields: ["arsDigits", "asrTimeout"],
462
+ condition: {
463
+ key: "setContiniousASR",
464
+ value: true
465
+ }
466
+ }*/
467
+ ],
468
+ form: [
469
+ { type: "section", key: "params_tts" },
470
+ { type: "section", key: "params_stt" },
471
+ { type: "section", key: "params_bargein" },
472
+ { type: "section", key: "params_user_timeouts" },
473
+ //{ type: "field", key: "setBotOutputParams" },
474
+ //{ type: "section", key: "params_bot_timeouts" },
475
+ { type: "section", key: "params_dtmf" },
476
+ //{ type: "field", key: "setContiniousASR" },
477
+ //{ type: "section", key: "params_continuousasr" },
478
+ //{ type: "field", key: "setAzureParams" },
479
+ //{ type: "section", key: "params_azure" },
480
+ //{ type: "field", key: "setGoogleParams" },
481
+ //{ type: "section", key: "params_google" }
482
+ ],
483
+ summary: "Change configuration settings for the call session",
484
+ function: async ({ cognigy, config }) => {
485
+ const { api } = cognigy;
486
+ const voiceGateway2VerbConfig = {};
487
+ const voiceGateway2CongnigyConfig = {};
488
+ const synthesizer = {
489
+ language: config.ttsLanguage,
490
+ voice: config.ttsVoice,
491
+ vendor: config.ttsVendor
492
+ };
493
+ voiceGateway2VerbConfig.synthesizer = synthesizer;
494
+ const recognizer = {
495
+ language: config.sttLanguage,
496
+ vendor: config.sttVendor || "default",
497
+ hints: config.sttHints,
498
+ vad: {
499
+ enable: config.sttVadEnabled,
500
+ mode: config.sttVadMode,
501
+ voiceMs: config.sttVadVoiceMs
502
+ }
503
+ };
504
+ voiceGateway2VerbConfig.recognizer = recognizer;
505
+ const bargein = {
506
+ enable: false,
507
+ minBargeinWordCount: config.bargeInMinWordCount,
508
+ input: [],
509
+ actionHook: "voice"
510
+ };
511
+ if (config.bargeInOnDtmf) {
512
+ bargein.dtmfBargein = true;
513
+ bargein.input.push("digits");
514
+ }
515
+ if (config.bargeInOnSpeech) {
516
+ bargein.input.push("speech");
517
+ }
518
+ if (bargein.input.length > 0) {
519
+ bargein.enable = true;
520
+ bargein.sticky = true;
521
+ }
522
+ voiceGateway2VerbConfig.bargeIn = bargein;
523
+ const user = {
524
+ noInputMode: config.userNoInputMode,
525
+ noInputTimeout: (config.userNoInputTimeout || 10000) / 1000,
526
+ noInputRetries: config.userNoInputRetries,
527
+ noInputSpeech: config.userNoInputSpeech,
528
+ noInputUrl: config.userNoInputUrl
529
+ };
530
+ voiceGateway2CongnigyConfig.cognigyConfig = { user };
531
+ /*
532
+ todo this needs to be implemented on voiceGateway2 side first
533
+ if (setBotOutputParams) {
534
+ const bot: BotOutputConfig = {
535
+ failOnError: config.botFailOnError,
536
+ noInputGiveUpTimeoutMs: config.botNoOutputGiveupTimeout,
537
+ noInputTimeout: config.botNoOutputTimeout,
538
+ noInputRetries: config.botNoOutputRetries,
539
+ noInputSpeech: config.botNoOutputSpeech,
540
+ noInputUrl: config.botNoOutputUrl
541
+ };
542
+
543
+ sessionConfig.bot = bot;
544
+ }
545
+ */
546
+ if (config.dtmfEnable) {
547
+ if (!voiceGateway2VerbConfig.bargeIn) {
548
+ voiceGateway2VerbConfig.bargeIn = {
549
+ enable: false
550
+ };
551
+ }
552
+ voiceGateway2VerbConfig.bargeIn.interDigitTimeout =
553
+ (config.dtmfInterDigitTimeout || 500) / 1000;
554
+ voiceGateway2VerbConfig.bargeIn.maxDigits = config.dtmfMaxDigits;
555
+ voiceGateway2VerbConfig.bargeIn.minDigits = config.dtmfMinDigits;
556
+ voiceGateway2VerbConfig.bargeIn.finishOnKey = config.dtmfSubmitDigit;
557
+ if (!voiceGateway2CongnigyConfig.cognigyConfig) {
558
+ voiceGateway2CongnigyConfig.cognigyConfig = {};
559
+ }
560
+ voiceGateway2CongnigyConfig.cognigyConfig.dtmf = true;
561
+ }
562
+ //if (setContiniousASR) {
563
+ // // todo
564
+ //}
565
+ //if (setAzureParams) {
566
+ // // todo
567
+ //}
568
+ //if (setGoogleParams) {
569
+ // todo
570
+ //}
571
+ if (Object.keys(voiceGateway2VerbConfig).length > 0) {
572
+ voiceGateway2CongnigyConfig.voiceGateway2Config = voiceGateway2VerbConfig;
573
+ }
574
+ strip_nulls_1.stripNulls(voiceGateway2CongnigyConfig);
575
+ api.say(null, {
576
+ _cognigy: {
577
+ _voiceGateway2: {
578
+ json: voiceGateway2CongnigyConfig
579
+ }
580
+ }
581
+ });
582
+ }
583
+ });
584
+ //# sourceMappingURL=setSessionConfig.js.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeColor = void 0;
4
+ exports.nodeColor = "#F5A623";
5
+ //# sourceMappingURL=design.js.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripNulls = void 0;
4
+ function stripNulls(data) {
5
+ Object.entries(data).forEach(([key, value]) => {
6
+ if (typeof value === "undefined" || typeof value === null || (typeof value === "string" && value.length == 0)) {
7
+ delete data[key];
8
+ }
9
+ if (typeof value === "object" && (typeof value !== "number" || typeof value !== "string")) {
10
+ stripNulls(value);
11
+ }
12
+ if (typeof value === "object" && (typeof value !== "number" || typeof value !== "string" || typeof value !== "boolean") && Object.keys(value).length === 0) {
13
+ delete data[key];
14
+ }
15
+ });
16
+ return data;
17
+ }
18
+ exports.stripNulls = stripNulls;
19
+ //# sourceMappingURL=strip-nulls.js.map
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VOICE_GATEWAY_EXTENSION = exports.SMTP_EXTENSION = exports.SQL_EXTENSION = exports.MONGO_DB_EXTENSION = exports.BASIC_EXTENSION = exports.MAX_INT32 = exports.PASSWORD_RESET_TOKEN_TTL_IN_SECONDS = exports.SYSTEM = exports.CREATED_BY_SSO = void 0;
3
+ exports.ADMIN_CONSOLE_URL_TOKEN = exports.X_COGNIGY_ORIGIN = exports.EMBEDDED_EXTENSION = exports.VOICE_GATEWAY_2_EXTENSION = exports.MICROSOFT_EXTENSION = exports.VOICE_GATEWAY_EXTENSION = exports.SMTP_EXTENSION = exports.SQL_EXTENSION = exports.MONGO_DB_EXTENSION = exports.BASIC_EXTENSION = exports.MAX_INT32 = exports.PASSWORD_RESET_TOKEN_TTL_IN_SECONDS = exports.SCOPED_USER = exports.SYSTEM = exports.CREATED_BY_SSO = void 0;
4
4
  exports.CREATED_BY_SSO = "000000000000000000000550";
5
5
  exports.SYSTEM = "000000000000000000000000";
6
+ exports.SCOPED_USER = "000000000000000000000660";
6
7
  exports.PASSWORD_RESET_TOKEN_TTL_IN_SECONDS = 900;
7
8
  exports.MAX_INT32 = 2147483647;
8
9
  exports.BASIC_EXTENSION = "@cognigy/basic-nodes";
@@ -10,4 +11,11 @@ exports.MONGO_DB_EXTENSION = "@cognigy/mongodb";
10
11
  exports.SQL_EXTENSION = "@cognigy/mssql";
11
12
  exports.SMTP_EXTENSION = "@cognigy/smtp";
12
13
  exports.VOICE_GATEWAY_EXTENSION = "@cognigy/voicegateway";
14
+ exports.MICROSOFT_EXTENSION = "@cognigy/microsoft";
15
+ // to minimize confusion and also to not break existing voicegateway nodes implementation,
16
+ // we will call the new set of voice nodes voiceGateway2
17
+ exports.VOICE_GATEWAY_2_EXTENSION = "@cognigy/voicegateway2";
18
+ exports.EMBEDDED_EXTENSION = "@embedded/";
19
+ exports.X_COGNIGY_ORIGIN = "x-cognigy-origin";
20
+ exports.ADMIN_CONSOLE_URL_TOKEN = "ffffffffffffffffffff55555555555555555eeeeeeeeeeeeeeeaaaaaaaaaaaa";
13
21
  //# sourceMappingURL=constants.js.map
@@ -15,9 +15,42 @@ class BaseError extends Error {
15
15
  this.httpStatusText = httpStatusText || "Internal Server Error";
16
16
  this.loggerstack = stack;
17
17
  this.details = details || {};
18
- this.meta = meta;
18
+ this.meta = meta || {};
19
+ if (this.meta.originalError) {
20
+ if (this.meta.originalError instanceof BaseError) {
21
+ // if the passed error is already an instance of our base class error class, no need to
22
+ this.originalErrorDetails = this.meta.originalError.originalErrorDetails;
23
+ }
24
+ else {
25
+ this.originalErrorDetails = this.parseOriginalError(this.meta.originalError);
26
+ }
27
+ delete this.meta.originalError;
28
+ }
19
29
  exports.errorLogger.log("error", stack, message || name, meta);
20
30
  }
31
+ parseOriginalError(error) {
32
+ return {
33
+ message: error.message,
34
+ stack: error.stack,
35
+ name: error.name,
36
+ code: error.code,
37
+ data: error.data,
38
+ path: error.path
39
+ };
40
+ }
41
+ toErrorLogDetails() {
42
+ return {
43
+ name: this.name,
44
+ code: this.code,
45
+ httpStatusCode: this.httpStatusCode,
46
+ httpStatusText: this.httpStatusText,
47
+ loggerstack: this.loggerstack,
48
+ details: this.details,
49
+ meta: this.meta,
50
+ originalError: this.originalErrorDetails,
51
+ stack: this.stack
52
+ };
53
+ }
21
54
  toResponse() {
22
55
  return {
23
56
  error: {
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseArray = void 0;
4
+ const parseArray = (value) => {
5
+ try {
6
+ if (typeof value === "string") {
7
+ value = JSON.parse(value);
8
+ }
9
+ else {
10
+ return value;
11
+ }
12
+ }
13
+ catch (_a) {
14
+ return [value];
15
+ }
16
+ return typeof value === "object" ? value : [value];
17
+ };
18
+ exports.parseArray = parseArray;
19
+ //# sourceMappingURL=array.js.map