@cognigy/rest-api-client 0.13.1 → 0.14.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 (110) hide show
  1. package/.eslintConfig.json +117 -0
  2. package/.eslintrc.json +2 -2
  3. package/CHANGELOG.md +12 -1
  4. package/build/apigroups/ResourcesAPIGroup_2_0.js +25 -4
  5. package/build/shared/charts/descriptors/allFields.js +8 -0
  6. package/build/shared/charts/descriptors/apps/getAppSessionPin.js +9 -9
  7. package/build/shared/charts/descriptors/apps/initAppSession.js +36 -53
  8. package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +5 -18
  9. package/build/shared/charts/descriptors/apps/setAppState.js +6 -6
  10. package/build/shared/charts/descriptors/apps/setHtmlAppState.js +85 -15
  11. package/build/shared/charts/descriptors/apps/utils/buildAppUrl.js +12 -0
  12. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnection.js +14 -0
  13. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +19 -0
  14. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAIProviderConnection.js +11 -0
  15. package/build/shared/charts/descriptors/index.js +9 -6
  16. package/build/shared/charts/descriptors/logic/switch/switch.js +3 -2
  17. package/build/shared/charts/descriptors/message/question/optionalQuestion.js +30 -7
  18. package/build/shared/charts/descriptors/message/question/question.js +200 -28
  19. package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +6 -0
  20. package/build/shared/charts/descriptors/message/say.js +33 -2
  21. package/build/shared/charts/descriptors/service/completeText.js +316 -0
  22. package/build/shared/charts/descriptors/service/handoverV2.js +48 -2
  23. package/build/shared/charts/descriptors/service/index.js +3 -1
  24. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +62 -26
  25. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +93 -32
  26. package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +53 -0
  27. package/build/shared/charts/descriptors/voice/nodes/dtmf.js +5 -3
  28. package/build/shared/charts/descriptors/voice/nodes/play.js +14 -5
  29. package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +90 -8
  30. package/build/shared/charts/descriptors/voice/nodes/transfer.js +6 -2
  31. package/build/shared/charts/descriptors/voice/utils/helper.js +11 -1
  32. package/build/shared/charts/descriptors/voicegateway/nodes/agentAssist.js +2 -2
  33. package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +5 -1
  34. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +20 -5
  35. package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +3 -3
  36. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +150 -33
  37. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +95 -7
  38. package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +18 -11
  39. package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +4 -1
  40. package/build/shared/charts/helpers/generativeAI/getRephraseWithAIFields.js +100 -0
  41. package/build/shared/charts/helpers/generativeAI/rephraseSentenceWithAi.js +44 -0
  42. package/build/shared/constants.js +2 -1
  43. package/build/shared/errors/BadGatewayError.js +2 -1
  44. package/build/shared/errors/BadRequestError.js +2 -1
  45. package/build/shared/errors/ForbiddenError.js +2 -1
  46. package/build/shared/errors/GatewayTimeoutError.js +2 -1
  47. package/build/shared/errors/MethodNotAllowedError.js +2 -1
  48. package/build/shared/errors/NetworkError.js +2 -1
  49. package/build/shared/errors/PayloadTooLargeError.js +2 -1
  50. package/build/shared/errors/PaymentRequiredError.js +2 -1
  51. package/build/shared/errors/ServiceUnavailableError.js +2 -1
  52. package/build/shared/errors/UnauthorizedError.js +2 -1
  53. package/build/shared/errors/baseError.js +27 -4
  54. package/build/shared/errors/conflict.js +2 -1
  55. package/build/shared/errors/databaseConnectError.js +2 -2
  56. package/build/shared/errors/databaseQueryError.js +2 -2
  57. package/build/shared/errors/databaseRead.js +2 -2
  58. package/build/shared/errors/databaseWrite.js +2 -2
  59. package/build/shared/errors/exportError.js +2 -2
  60. package/build/shared/errors/fileRead.js +2 -2
  61. package/build/shared/errors/fileWrite.js +2 -2
  62. package/build/shared/errors/importError.js +1 -1
  63. package/build/shared/errors/inputOutputError.js +2 -2
  64. package/build/shared/errors/internalServerError.js +2 -1
  65. package/build/shared/errors/invalidArgument.js +2 -2
  66. package/build/shared/errors/missingArgument.js +2 -2
  67. package/build/shared/errors/notImplementedError.js +2 -1
  68. package/build/shared/errors/process.js +2 -2
  69. package/build/shared/errors/resourceNotFound.js +5 -1
  70. package/build/shared/errors/smtpConnectError.js +2 -2
  71. package/build/shared/errors/timeoutError.js +2 -2
  72. package/build/shared/interfaces/ai.js +16 -0
  73. package/build/shared/interfaces/analytics/IAnalyticsDataGoals.js +3 -0
  74. package/build/shared/interfaces/endpointInterface.js +1 -0
  75. package/build/shared/interfaces/filemanager/IRuntimeFile.js +30 -0
  76. package/build/shared/interfaces/filemanager/index.js +1 -0
  77. package/build/shared/interfaces/handover.js +40 -3
  78. package/build/shared/interfaces/messageAPI/endpoints.js +2 -0
  79. package/build/shared/interfaces/messageAPI/handover.js +6 -0
  80. package/build/shared/interfaces/resources/IAgentAssistConfig.js +56 -0
  81. package/build/shared/interfaces/resources/IConnectionSchema.js +2 -1
  82. package/build/shared/interfaces/resources/IExtension.js +2 -1
  83. package/build/shared/interfaces/resources/IFlow.js +2 -1
  84. package/build/shared/interfaces/resources/ILexicon.js +15 -2
  85. package/build/shared/interfaces/resources/ILocale.js +25 -3
  86. package/build/shared/interfaces/resources/INodeDescriptorSet.js +2 -1
  87. package/build/shared/interfaces/resources/TResourceType.js +3 -0
  88. package/build/shared/interfaces/resources/intent/IIntent.js +5 -2
  89. package/build/shared/interfaces/resources/intent/IIntentRelation.js +3 -1
  90. package/build/shared/interfaces/resources/settings/IAgentSettings.js +9 -4
  91. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +136 -0
  92. package/build/shared/interfaces/resources/settings/ISharedSettings.js +1 -1
  93. package/build/shared/interfaces/resources/settings/index.js +7 -1
  94. package/build/shared/interfaces/resources/yesNoIntent/IYesNoItem.js +5 -5
  95. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ICognigyLiveAgentMiddleware_2_0.js +3 -0
  96. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IAgentAssistConfig_2_0.js +3 -0
  97. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/ICreateAgentAssistConfigRest_2_0.js +3 -0
  98. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IDeleteAgentAssistConfigRest_2_0.js +3 -0
  99. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IIndexAgentAssistConfigsRest_2_0.js +3 -0
  100. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IReadAgentAssistConfigRest_2_0.js +3 -0
  101. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IUpdateAgentAssistConfigRest_2_0.js +3 -0
  102. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/index.js +3 -0
  103. package/build/shared/interfaces/restAPI/resources/flow/v2.0/sentence/IGenerateSentencesRest_2_0.js +3 -0
  104. package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/ITrainYesNoIntentsProjectRest_2_0.js +3 -0
  105. package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntents_2_0.js +4 -4
  106. package/build/shared/interfaces/security/IACL.js +1 -1
  107. package/build/shared/interfaces/security/IPermission.js +2 -0
  108. package/build/shared/interfaces/security/IRole.js +4 -0
  109. package/package.json +2 -2
  110. package/types/index.d.ts +925 -388
@@ -3,18 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SET_HTML_APP_STATE = void 0;
4
4
  /* Custom modules */
5
5
  const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
- const getEasyHtmlValue = (body) => `<!DOCTYPE html>
6
+ const getEasyHtmlValue = (body) => /* html */ `<!DOCTYPE html>
7
7
  <html lang="en">
8
+
8
9
  <head>
9
- <script>
10
- var d=Object.defineProperty;var c=(a,e,s)=>e in a?d(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s;var t=(a,e,s)=>(c(a,typeof e!="symbol"?e+"":e,s),s);const u=a=>({__INTER_FRAME_SOCKET_MESSAGE:!0,appEvent:a}),l=(a,e)=>({type:a,payload:e}),h=a=>{var e;return!!((e=a.data)!=null&&e.__INTER_FRAME_SOCKET_MESSAGE)};class p{constructor(e,s){t(this,"unsubscribers",new Set);t(this,"emit",(e,s)=>{const n=l(e,s),o=u(n);this.targetWindow.postMessage(o,"*")});t(this,"on",(e,s)=>{const n=r=>{if(r.source===this.targetWindow&&!!h(r)&&r.data.appEvent.type===e)try{s(r.data.appEvent)}catch{}};this.sourceWindow.addEventListener("message",n);const o=()=>{this.sourceWindow.removeEventListener("message",n),this.unsubscribers.delete(o)};return this.unsubscribers.add(o),o});t(this,"once",(e,s)=>{const n=this.on(e,o=>{s(o),n()});return n});t(this,"cleanup",()=>{for(const e of this.unsubscribers)e()});this.sourceWindow=e,this.targetWindow=s}}class i{constructor(){t(this,"appTemplateData");t(this,"_ready",!1);t(this,"_loaded",!1);t(this,"_customReadyCheckRequested",!1);t(this,"_customReadyCheckDone",!1);t(this,"_appTemplateDataInitialized",!1);t(this,"socket",new p(window,window.parent));t(this,"sendReady",()=>{this._ready||(this.socket.emit("ready"),i.log("ready!"),this._ready=!0)});t(this,"doReadinessCheck",()=>{if(!this._ready){if(!this._appTemplateDataInitialized){i.log("not yet ready: initial app template data missing");return}if(!this._customReadyCheckRequested&&!this._loaded){i.log("not yet ready: page not loaded, yet");return}if(this._customReadyCheckRequested&&!this._customReadyCheckDone){i.log("not yet ready: custom readiness check not called");return}this.sendReady()}});t(this,"getCustomReadyHandler",()=>(i.log("switching to 'manual ready check'"),this._customReadyCheckRequested=!0,()=>{i.log("'manual ready check' done"),this._customReadyCheckDone=!0,this.doReadinessCheck()}));t(this,"onAppTemplateData",e=>this.socket.on("appTemplateData",s=>{e(s.payload)}));t(this,"getAppTemplateData",async()=>this._appTemplateDataInitialized?this.appTemplateData:new Promise(e=>{const s=this.onAppTemplateData(n=>{s(),e(n)})}));t(this,"submit",e=>{this.socket.emit("submit",e)});window.addEventListener("load",()=>{this._loaded=!0,this.doReadinessCheck()}),this.onAppTemplateData(e=>{this._appTemplateDataInitialized=!0,this.appTemplateData=e,i.log("received data from shell page",e),this.doReadinessCheck()}),this.socket.emit("sdk-loaded"),i.log("initialized")}static log(...e){console.log("[AppPageSDK]",...e)}}window.SDK=new i;
11
- </script>
10
+ <!--
11
+ loads the App Page SDK, provided by Cognigy,
12
+ exposed as a global variable called "SDK".
13
+ -->
14
+ <script src="/sdk/app-page-sdk.js"></script>
15
+
16
+ <!--
17
+ Example: Form Submission
18
+
19
+ This example shows how you can use native HTML
20
+ form functionality to submit data from your App.
21
+
22
+ We're rendering a simple form with a text input
23
+ and a submit button.
24
+
25
+ The "name" attribute is important and will be used
26
+ to identify this field in the result!
27
+
28
+ Using this example, the end user can type a nickname
29
+ and submit it either via the button or by hitting "return".
30
+
31
+ The script will pick the first "form" element on the page
32
+ and configures it to submit its result via the "App Page SDK"
33
+ -->
34
+ <form>
35
+ <input name="nickname" placeholder="your nickname" />
36
+ <button>submit</button>
37
+ </form>
12
38
  <script>
13
39
  window.addEventListener("load", () => {
14
- const form = document.querySelector('form');
15
- form.onsubmit = e => {
16
- e.preventDefault();
17
- e.stopPropagation();
40
+ const form = document.querySelector('form');
41
+ form.onsubmit = e => {
42
+ e.preventDefault();
43
+ e.stopPropagation();
18
44
  const formData = new FormData(form);
19
45
  const values = [...formData.entries()].reduce((obj, [key, value]) => {
20
46
  obj[key] = value;
@@ -25,18 +51,62 @@ const getEasyHtmlValue = (body) => `<!DOCTYPE html>
25
51
  };
26
52
  });
27
53
  </script>
54
+
55
+
56
+
57
+ <!--
58
+ Example: Submitting fixed values
59
+
60
+ This example shows how to submit fixed values by clicking a button.
61
+ Clicking the "OK" button will submit { option: "ok" },
62
+ while clicking the "Cancel" button will submit { option: "cancel" }
63
+ -->
64
+ <!--
65
+ <button type="button" onclick="SDK.submit({ option: 'ok' })">OK</button>
66
+ <button type="button" onclick="SDK.submit({ option: 'cancel' })">Cancel</button>
67
+ -->
68
+
69
+
70
+
71
+ <!--
72
+ Example: Custom Readiness Handler
73
+
74
+ If your App Page needs to load additional resources
75
+ before being "ready", you can postpone the "readiness"
76
+ of your App Page with a "custom ready handler".
77
+
78
+ If you do this, the App Shell Page will show a "loading"
79
+ screen until you decide that this App Page is ready!
80
+
81
+ Beware: your App Page has 10 seconds to get ready,
82
+ otherwise it will be treated as "failed to load".
83
+ -->
84
+ <script>
85
+ const ready = SDK.getCustomReadyHandler();
86
+
87
+ // App Page "ready" after 2 seconds
88
+ setTimeout(() => {
89
+ ready();
90
+ }, 2000);
91
+ </script>
28
92
  </head>
93
+
29
94
  <body>
30
- ${body}
95
+ ${body}
31
96
  </body>
32
- </html>`;
33
- const defaultBody = `<form>
97
+
98
+ </html>
99
+ `;
100
+ const defaultBody =
101
+ /* html */
102
+ `<form>
34
103
  <input
35
104
  name="nickname"
36
- placeholder="your nickname"
105
+ placeholder="your nickname"
37
106
  />
38
107
  <button>submit</button>
39
- </form>`;
108
+ </form>
109
+ `;
40
110
  const defaultFullHTMLDocument = getEasyHtmlValue("");
41
111
  /**
42
112
  * Node name: 'setHTMLAppState'
@@ -46,8 +116,8 @@ const defaultFullHTMLDocument = getEasyHtmlValue("");
46
116
  */
47
117
  exports.SET_HTML_APP_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
48
118
  type: "setHTMLAppState",
49
- defaultLabel: "Set HTML App State",
50
- summary: "Set the HTML Code of a Generic HTML App.",
119
+ defaultLabel: "Set HTML xApp State",
120
+ summary: "Set the HTML Code of a Generic HTML xApp.",
51
121
  appearance: {
52
122
  showIcon: false,
53
123
  },
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAppUrl = void 0;
4
+ function buildAppUrl(baseUrl, appSessionToken, customization) {
5
+ let finalUrl = `${baseUrl}?token=${appSessionToken}`;
6
+ if (customization) {
7
+ finalUrl = `${finalUrl}&overrides=${encodeURIComponent(JSON.stringify(customization))}`;
8
+ }
9
+ return finalUrl;
10
+ }
11
+ exports.buildAppUrl = buildAppUrl;
12
+ //# sourceMappingURL=buildAppUrl.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
+ exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = {
5
+ type: "AzureOpenAIProvider",
6
+ label: "A Connection to Azure Open.AI",
7
+ fields: [
8
+ { fieldName: "apiKey" },
9
+ { fieldName: "resourceName" },
10
+ { fieldName: "deploymentName" },
11
+ { fieldName: "apiVersion", required: false },
12
+ ]
13
+ };
14
+ //# sourceMappingURL=azureOpenAIProviderConnection.js.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cognigyGenerativeAIProviderModule = exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = exports.OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
+ const openAIProviderConnection_1 = require("./openAIProviderConnection");
7
+ const azureOpenAIProviderConnection_1 = require("./azureOpenAIProviderConnection");
8
+ var openAIProviderConnection_2 = require("./openAIProviderConnection");
9
+ Object.defineProperty(exports, "OPEAN_AI_PROVIDER_CONNECTION", { enumerable: true, get: function () { return openAIProviderConnection_2.OPEAN_AI_PROVIDER_CONNECTION; } });
10
+ var azureOpenAIProviderConnection_2 = require("./azureOpenAIProviderConnection");
11
+ Object.defineProperty(exports, "AZURE_OPEAN_AI_PROVIDER_CONNECTION", { enumerable: true, get: function () { return azureOpenAIProviderConnection_2.AZURE_OPEAN_AI_PROVIDER_CONNECTION; } });
12
+ exports.cognigyGenerativeAIProviderModule = (0, createNodeDescriptor_1.createExtension)({
13
+ nodes: [],
14
+ connections: [
15
+ openAIProviderConnection_1.OPEAN_AI_PROVIDER_CONNECTION,
16
+ azureOpenAIProviderConnection_1.AZURE_OPEAN_AI_PROVIDER_CONNECTION
17
+ ]
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
+ exports.OPEAN_AI_PROVIDER_CONNECTION = {
5
+ type: "OpenAIProvider",
6
+ label: "A Connection to Open.AI",
7
+ fields: [
8
+ { fieldName: "apiKey" },
9
+ ]
10
+ };
11
+ //# sourceMappingURL=openAIProviderConnection.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cognigyInternalStorageProviderModule = exports.cognigyVoiceGateway2Module = exports.cognigyMicrosoftModule = exports.cognigyVoiceGatewayModule = exports.cognigySMTPModule = exports.cognigySQLModule = exports.cognigyMongoDBModule = exports.cognigyBasicModule = void 0;
3
+ exports.cognigyGenerativeAIProviderModule = exports.cognigyInternalStorageProviderModule = exports.cognigyVoiceGateway2Module = exports.cognigyMicrosoftModule = exports.cognigyVoiceGatewayModule = exports.cognigySMTPModule = exports.cognigySQLModule = exports.cognigyMongoDBModule = exports.cognigyBasicModule = void 0;
4
4
  /* Custom modules */
5
5
  const createNodeDescriptor_1 = require("../createNodeDescriptor");
6
6
  /* Nodes */
@@ -79,19 +79,20 @@ const nodes = [
79
79
  service_1.HANDOVER_V2,
80
80
  service_1.CHECK_AGENT_AVAILABILITY,
81
81
  service_1.HTTP_REQUEST,
82
+ service_1.COMPLETE_TEXT,
82
83
  service_1.TRIGGER_FUNCTION,
83
84
  service_1.ON_SCHEDULING_ERROR,
84
85
  service_1.ON_SCHEDULED,
85
86
  // REQUIRED_FIELDS,
86
- //ALL_FIELDS,
87
+ // ALL_FIELDS,
87
88
  logic_1.ENABLE_SLOT_FILLERS,
88
- logic_1.DISABLE_SLOT_FILLERS,
89
+ logic_1.DISABLE_SLOT_FILLERS
89
90
  ];
90
91
  if (process.env.FEATURE_USE_COGNIGY_LIVE_AGENT === "true") {
91
92
  nodes.push(liveAgent_1.ASSIST_INFO);
92
93
  }
93
94
  if (process.env.FEATURE_USE_COGNIGY_APPS === "true") {
94
- nodes.push(apps_1.INIT_APP_SESSION, apps_1.SET_APP_STATE, apps_1.GET_APP_SESSION_PIN, apps_1.SET_HTML_APP_STATE, apps_1.SET_ADAPTIVE_CARD_APP_STATE);
95
+ nodes.push(apps_1.INIT_APP_SESSION, apps_1.GET_APP_SESSION_PIN, apps_1.SET_HTML_APP_STATE, apps_1.SET_ADAPTIVE_CARD_APP_STATE);
95
96
  }
96
97
  if (process.env.FEATURE_TMP_ENABLE_GENERIC_VOICE_NODES === "true") {
97
98
  nodes.push(voice_1.HANG_UP, voice_1.PLAY, voice_1.TRANSFER_VOICE, voice_1.BARGE_IN, voice_1.CONTINUOUS_ASR, voice_1.DTMF, voice_1.USER_INPUT_TIMEOUT, voice_1.SESSION_SPEECH_PARAMETERS);
@@ -108,8 +109,8 @@ exports.cognigyBasicModule = (0, createNodeDescriptor_1.createExtension)({
108
109
  service_1.HTTP_CONNECTION_BASIC,
109
110
  service_1.HTTP_CONNECTION_APIKEYAUTHKEY,
110
111
  service_1.HTTP_CONNECTION_APIKEYXKEY,
111
- service_1.HTTP_CONNECTION_OAUTH2,
112
- ],
112
+ service_1.HTTP_CONNECTION_OAUTH2
113
+ ]
113
114
  });
114
115
  var mongoDB_1 = require("./connectionNodes/mongoDB");
115
116
  Object.defineProperty(exports, "cognigyMongoDBModule", { enumerable: true, get: function () { return mongoDB_1.cognigyMongoDBModule; } });
@@ -125,4 +126,6 @@ var voicegateway2_1 = require("./voicegateway2");
125
126
  Object.defineProperty(exports, "cognigyVoiceGateway2Module", { enumerable: true, get: function () { return voicegateway2_1.cognigyVoiceGateway2Module; } });
126
127
  var internalStorageProviders_1 = require("./connectionNodes/internalStorageProviders");
127
128
  Object.defineProperty(exports, "cognigyInternalStorageProviderModule", { enumerable: true, get: function () { return internalStorageProviders_1.cognigyInternalStorageProviderModule; } });
129
+ var generativeAIProviders_1 = require("./connectionNodes/generativeAIProviders");
130
+ Object.defineProperty(exports, "cognigyGenerativeAIProviderModule", { enumerable: true, get: function () { return generativeAIProviders_1.cognigyGenerativeAIProviderModule; } });
128
131
  //# sourceMappingURL=index.js.map
@@ -189,11 +189,12 @@ exports.SWITCH = (0, createNodeDescriptor_1.createNodeDescriptor)({
189
189
  }
190
190
  }
191
191
  const matchedCase = children === null || children === void 0 ? void 0 : children.find((child) => {
192
+ var _a, _b;
192
193
  if (child.type !== "case") {
193
194
  return;
194
195
  }
195
196
  if (useStrict) {
196
- return api.parseCognigyScriptText(`${child.config.case.value}`) === parsedOperator;
197
+ return api.parseCognigyScriptText(`${(_a = child.config.case.value) === null || _a === void 0 ? void 0 : _a.trim()}`) === parsedOperator;
197
198
  }
198
199
  else {
199
200
  /**
@@ -203,7 +204,7 @@ exports.SWITCH = (0, createNodeDescriptor_1.createNodeDescriptor)({
203
204
  * operator is a number. We do not support switching on
204
205
  * objects
205
206
  */
206
- return `${api.parseCognigyScriptText(`${child.config.case.value}`)}` === `${parsedOperator}`;
207
+ return `${api.parseCognigyScriptText(`${(_b = child.config.case.value) === null || _b === void 0 ? void 0 : _b.trim()}`)}` === `${parsedOperator}`;
207
208
  }
208
209
  });
209
210
  if (matchedCase) {
@@ -6,6 +6,7 @@ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
6
  const evaluateQuestionAnswer_1 = require("./utils/evaluateQuestionAnswer");
7
7
  const say_1 = require("../say");
8
8
  const BaseContext_1 = require("../../../../helper/BaseContext");
9
+ const getRephraseWithAIFields_1 = require("../../../helpers/generativeAI/getRephraseWithAIFields");
9
10
  exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
10
11
  type: "optionalQuestion",
11
12
  defaultLabel: "Optional Question",
@@ -77,11 +78,15 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
77
78
  label: "Regex",
78
79
  value: "regex",
79
80
  },
81
+ process.env.FEATURE_USE_COGNIGY_APPS && {
82
+ label: "xApp",
83
+ value: "app",
84
+ },
80
85
  {
81
86
  label: "Data",
82
87
  value: "data",
83
88
  },
84
- ],
89
+ ].filter(option => !!option),
85
90
  },
86
91
  defaultValue: "yesNo",
87
92
  },
@@ -174,8 +179,9 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
174
179
  ]
175
180
  },
176
181
  defaultValue: "answer"
177
- }
178
- ],
182
+ },
183
+ ...(0, getRephraseWithAIFields_1.getRephraseWithAIFields)(),
184
+ ].filter(field => !!field),
179
185
  sections: [
180
186
  {
181
187
  key: "context",
@@ -197,8 +203,9 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
197
203
  "retentionTime",
198
204
  "cognigyScript"
199
205
  ]
200
- }
201
- ],
206
+ },
207
+ (0, getRephraseWithAIFields_1.getRephraseWithAISection)(),
208
+ ].filter(section => !!section),
202
209
  form: [
203
210
  { type: "field", key: "type" },
204
211
  { type: "field", key: "keyphraseTag" },
@@ -207,6 +214,7 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
207
214
  { type: "field", key: "say" },
208
215
  { type: "section", key: "advanced" },
209
216
  { type: "section", key: "context" },
217
+ { type: "section", key: "aiEnhancedOutput" },
210
218
  ],
211
219
  preview: {
212
220
  key: "say",
@@ -220,7 +228,7 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
220
228
  placement: {}
221
229
  },
222
230
  tags: ["basic", "message", "nlu"],
223
- function: async ({ cognigy, config, childConfigs, nodeId }) => {
231
+ function: async ({ cognigy, config, childConfigs, nodeId, organisationId, }) => {
224
232
  const { say, retentionTime = 3, type, executeChildrenOnly, cognigyScript, storeResultInContext, contextKey } = config;
225
233
  const { regex: regexField } = config;
226
234
  const { keyphraseTag, usePositiveOnly } = config;
@@ -275,6 +283,9 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
275
283
  condition = (usePositiveOnly) ? `input.slots['${keyphraseTag}'] && !!input.slots['${keyphraseTag}'].find(k => k.neg === false)` : `!!input.slots['${keyphraseTag}']`;
276
284
  break;
277
285
  }
286
+ case "app": {
287
+ condition = `input.data?._cognigy?._app?.type === "submit"`;
288
+ }
278
289
  }
279
290
  const addConditionalEntrypointParams = {
280
291
  entrypoint: nodeId,
@@ -285,7 +296,19 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
285
296
  addConditionalEntrypointParams.cognigyScriptInput = input;
286
297
  }
287
298
  api.addConditionalEntrypoint(addConditionalEntrypointParams);
288
- say_1.SAY.function({ cognigy, config: { say }, childConfigs: [], nodeId });
299
+ const rephraseWithAIParams = {
300
+ generativeAI_rephraseOutputMode: config.generativeAI_rephraseOutputMode,
301
+ generativeAI_temperature: config.generativeAI_temperature,
302
+ generativeAI_amountOfLastUserInputs: config.generativeAI_amountOfLastUserInputs,
303
+ generativeAI_customInputs: config.generativeAI_customInputs,
304
+ promtType: "question",
305
+ questionType: config.type,
306
+ question: undefined,
307
+ answer: undefined,
308
+ };
309
+ rephraseWithAIParams.promtType = "question";
310
+ rephraseWithAIParams.questionType = config.type;
311
+ await say_1.SAY.function({ cognigy, config: Object.assign({ say }, rephraseWithAIParams), childConfigs: [], nodeId, organisationId });
289
312
  if (onQuestionChild) {
290
313
  api.setNextNode(onQuestionChild.id);
291
314
  }