@cognigy/rest-api-client 0.15.0 → 0.17.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 (146) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/build/GenericTusFn.js +64 -0
  3. package/build/RestAPIClient.js +3 -0
  4. package/build/apigroups/AdministrationAPIGroup_2_0.js +7 -2
  5. package/build/apigroups/ResourcesAPIGroup_2_0.js +28 -23
  6. package/build/{shared/interfaces/agentAssist/ISendTileUpdateReferenceParams.js → apigroups/TTusAPIOperation.js} +1 -1
  7. package/build/apigroups/index.js +2 -0
  8. package/build/connector/AxiosAdapter.js +5 -4
  9. package/build/shared/charts/descriptors/agentAssist/constants/constants.js +7 -0
  10. package/build/shared/charts/descriptors/agentAssist/helpers/sentiment.helper.js +41 -0
  11. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/identityAssistTemplate.js +54 -0
  12. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/knowledgeAssistTemplate.js +203 -0
  13. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/nextActionWidgetTemplate.js +93 -0
  14. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/secureForms/stage0.js +81 -0
  15. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/secureForms/stage1.js +84 -0
  16. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/secureForms/stage2.js +97 -0
  17. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/secureForms/stageError.js +85 -0
  18. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/sentimentAnalysisTemplate.js +41 -0
  19. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/stylesPartial.js +15 -0
  20. package/build/shared/charts/descriptors/agentAssist/htmlTemplates/transcriptAssistTemplate.js +53 -0
  21. package/build/shared/charts/descriptors/agentAssist/identityAssist.js +135 -0
  22. package/build/shared/charts/descriptors/agentAssist/index.js +15 -1
  23. package/build/shared/charts/descriptors/agentAssist/knowledgeAssist.js +625 -0
  24. package/build/shared/charts/descriptors/agentAssist/nextActionAssist.js +77 -0
  25. package/build/shared/charts/descriptors/agentAssist/sentimentAssist.js +86 -0
  26. package/build/shared/charts/descriptors/agentAssist/setAdaptiveCardTile.js +2 -2
  27. package/build/shared/charts/descriptors/agentAssist/setAgentAssistGrid.js +120 -0
  28. package/build/shared/charts/descriptors/agentAssist/setHtmlTile.js +2 -2
  29. package/build/shared/charts/descriptors/agentAssist/setIframeTile.js +2 -2
  30. package/build/shared/charts/descriptors/agentAssist/setSecureFormsTile.js +171 -0
  31. package/build/shared/charts/descriptors/agentAssist/transcriptAssist.js +72 -0
  32. package/build/shared/charts/descriptors/allFields.js +12 -0
  33. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/TGenerativeAIConnectionFields.js +3 -0
  34. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/alephAlphaProviderConnection.js +11 -0
  35. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/anthropicProviderConnection.js +1 -1
  36. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnectionV2.js +1 -1
  37. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +6 -2
  38. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAIProviderConnection.js +1 -1
  39. package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/amazonStorageProviderConnection.js +4 -4
  40. package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/azureBlobStorageProviderConnection.js +3 -3
  41. package/build/shared/charts/descriptors/connectionNodes/internalStorageProviders/googleCloudStorageProviderConnection.js +3 -3
  42. package/build/shared/charts/descriptors/connectionNodes/mongoDB/mongoDBConnection.js +1 -1
  43. package/build/shared/charts/descriptors/connectionNodes/smtp/oAuth2Connection.js +8 -8
  44. package/build/shared/charts/descriptors/connectionNodes/smtp/serviceConnection.js +2 -2
  45. package/build/shared/charts/descriptors/connectionNodes/smtp/smtpConnection.js +5 -5
  46. package/build/shared/charts/descriptors/connectionNodes/speechProviders/awsSpeechProviderConnection.js +4 -4
  47. package/build/shared/charts/descriptors/connectionNodes/speechProviders/microsoftSpeechProviderConnection.js +2 -2
  48. package/build/shared/charts/descriptors/connectionNodes/sql/sqlConnection.js +5 -5
  49. package/build/shared/charts/descriptors/connectionNodes/translationProviders/deeplTranslationProviderConnection.js +15 -0
  50. package/build/shared/charts/descriptors/connectionNodes/translationProviders/googleTranslationProviderConnection.js +15 -0
  51. package/build/shared/charts/descriptors/connectionNodes/translationProviders/index.js +23 -0
  52. package/build/shared/charts/descriptors/connectionNodes/translationProviders/microsoftTranslationProviderConnection.js +21 -0
  53. package/build/shared/charts/descriptors/index.js +13 -2
  54. package/build/shared/charts/descriptors/knowledgeSearch/constants/constants.js +6 -0
  55. package/build/shared/charts/descriptors/knowledgeSearch/index.js +5 -1
  56. package/build/shared/charts/descriptors/knowledgeSearch/knowledgeSearch.js +7 -2
  57. package/build/shared/charts/descriptors/knowledgeSearch/knowledgeSearchV2.js +151 -0
  58. package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +985 -0
  59. package/build/shared/charts/descriptors/logic/goTo.js +2 -0
  60. package/build/shared/charts/descriptors/message/question/optionalQuestion.js +2 -2
  61. package/build/shared/charts/descriptors/message/question/question.js +215 -8
  62. package/build/shared/charts/descriptors/nlu/cleanText.js +1 -0
  63. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +107 -5
  64. package/build/shared/charts/descriptors/service/GPTConversation.js +125 -23
  65. package/build/shared/charts/descriptors/service/GPTPrompt.js +148 -12
  66. package/build/shared/charts/descriptors/service/checkAgentAvailability.js +15 -1
  67. package/build/shared/charts/descriptors/service/handoverV2.js +45 -0
  68. package/build/shared/{interfaces/twilioInterface.js → charts/descriptors/voice/interface/IBandwidth.js} +1 -1
  69. package/build/shared/charts/descriptors/voice/mappers/base.mapper.js +14 -0
  70. package/build/shared/charts/descriptors/voice/mappers/hangup.mapper.js +26 -0
  71. package/build/shared/charts/descriptors/voice/mappers/muteSpeechInput.mapper.js +17 -2
  72. package/build/shared/charts/descriptors/voice/mappers/play.mapper.js +54 -0
  73. package/build/shared/charts/descriptors/voice/mappers/record.mapper.js +7 -0
  74. package/build/shared/charts/descriptors/voice/mappers/sendMetadata.mapper.js +15 -0
  75. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +56 -20
  76. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +39 -13
  77. package/build/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -1
  78. package/build/shared/charts/descriptors/voice/nodes/play.js +1 -1
  79. package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +120 -29
  80. package/build/shared/charts/descriptors/voice/nodes/transfer.js +11 -3
  81. package/build/shared/charts/descriptors/voice/utils/vgConstants.js +14 -0
  82. package/build/shared/charts/descriptors/voicegateway/index.js +14 -11
  83. package/build/shared/charts/descriptors/voicegateway/utils/paramUtils.js +1 -5
  84. package/build/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +12 -1
  85. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +6 -0
  86. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +159 -36
  87. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +296 -43
  88. package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +30 -4
  89. package/build/shared/charts/helpers/generativeAI/rephraseSentenceWithAi.js +1 -1
  90. package/build/shared/constants.js +5 -1
  91. package/build/shared/handoverClients/interfaces/THandoverEventType.js +3 -1
  92. package/build/shared/helper/BaseContext.js +33 -15
  93. package/build/shared/helper/nlu/textCleaner.js +25 -3
  94. package/build/shared/interfaces/IEndpointTranslationSettings.js +9 -0
  95. package/build/shared/interfaces/IOrganisation.js +2 -1
  96. package/build/shared/interfaces/agentAssist/ISendConfigUpdateParams.js +3 -0
  97. package/build/shared/interfaces/agentAssist/ISendUpdateReferenceParams.js +3 -0
  98. package/build/shared/interfaces/amqpInterface.js +18 -22
  99. package/build/shared/interfaces/channels/genesysBotConnector.js +21 -0
  100. package/build/shared/interfaces/channels/niceCXOne.js +8 -0
  101. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +17 -7
  102. package/build/shared/interfaces/handover.js +57 -3
  103. package/build/shared/interfaces/journeys/IJourney.js +6 -0
  104. package/build/shared/interfaces/journeys/IJourneyTrackEvent.js +2 -0
  105. package/build/shared/interfaces/messageAPI/endpoints.js +93 -8
  106. package/build/shared/interfaces/messageAPI/handover.js +4 -4
  107. package/build/shared/interfaces/resources/IAuditEvent.js +1 -0
  108. package/build/shared/interfaces/resources/IConnectionSchema.js +3 -0
  109. package/build/shared/interfaces/resources/IEndpoint.js +1 -0
  110. package/build/shared/interfaces/resources/IExtension.js +3 -0
  111. package/build/shared/interfaces/resources/ILargeLanguageModel.js +24 -5
  112. package/build/shared/interfaces/resources/INodeDescriptorSet.js +24 -1
  113. package/build/shared/interfaces/resources/TNLUConnectorType.js +0 -1
  114. package/build/shared/interfaces/resources/TRestChannelType.js +16 -11
  115. package/build/shared/interfaces/resources/TSocketChannelType.js +5 -1
  116. package/build/shared/interfaces/resources/TWebhookChannelType.js +6 -1
  117. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeChunk.js +21 -3
  118. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +13 -2
  119. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeStore.js +1 -1
  120. package/build/shared/interfaces/resources/settings/IAgentSettings.js +3 -23
  121. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -0
  122. package/build/shared/interfaces/resources/settings/ITranslationSettings.js +63 -0
  123. package/build/shared/interfaces/resources/settings/index.js +4 -1
  124. package/build/shared/interfaces/restAPI/administration/voiceGateway/v2.0/IReadVoiceGatewayAccountRest_2_0.js +3 -0
  125. package/build/shared/interfaces/restAPI/administration/voiceGateway/v2.0/ISetupVoiceGatewayAccountRest_2_0.js +3 -0
  126. package/build/shared/interfaces/restAPI/administration/voiceGateway/v2.0/index.js +3 -0
  127. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/ICallCounterAggregatedValue_2_0.js +3 -0
  128. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/IGetCallCounterOrganisationRest_2_0.js +3 -0
  129. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/IGetCallCounterRest_2_0.js +3 -0
  130. package/build/shared/interfaces/restAPI/metrics/callCounter/v2.0/index.js +3 -0
  131. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/IGetKnowledgeQueryCounterOrganisationRest_2_0.js +3 -0
  132. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/IGetKnowledgeQueryCounterRest_2_0.js +3 -0
  133. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/IKnowlegeQueryCounterAggregatedValue_2_0.js +3 -0
  134. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/index.js +3 -0
  135. package/build/shared/interfaces/restAPI/resources/nluconnector/v2.0/TNLUConnectorType_2_0.js +0 -2
  136. package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/IUploadResumableRest_2_0.js +17 -0
  137. package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/index.js +3 -0
  138. package/build/shared/interfaces/security/ICallCounterAggregatedValue.js +3 -0
  139. package/build/shared/interfaces/security/IKnowledgeQueryCounterAggregatedValue.js +3 -0
  140. package/build/shared/interfaces/security/IPermission.js +3 -0
  141. package/build/shared/interfaces/security/IRole.js +9 -1
  142. package/build/shared/interfaces/security/index.js +2 -1
  143. package/build/shared/interfaces/trainer/ITrainerRecord.js +2 -0
  144. package/build/test.js +27 -0
  145. package/package.json +19 -17
  146. package/types/index.d.ts +823 -140
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NEXT_ACTION_ASSIST = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ const nextActionWidgetTemplate_1 = require("./htmlTemplates/nextActionWidgetTemplate");
7
+ /**
8
+ * Node name: "nextActionAssist"
9
+ *
10
+ * Purpose:
11
+ * The Next Action Assist widget will suggest agent responses and provide more information to draft messages.
12
+ */
13
+ exports.NEXT_ACTION_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
14
+ type: "nextActionAssist",
15
+ defaultLabel: "Copilot: Next Action Tile",
16
+ summary: "UI__NODE_EDITOR__NEXT_ACTION_ASSIST__SUMMARY",
17
+ appearance: {
18
+ showIcon: false,
19
+ },
20
+ tags: ["agentAssist"],
21
+ fields: [
22
+ {
23
+ key: "tileId",
24
+ label: "UI__NODE_EDITOR__NEXT_ACTION_ASSIST__ID__LABEL",
25
+ type: "cognigyText",
26
+ description: "UI__NODE_EDITOR__NEXT_ACTION_ASSIST_TILE_ID__DESCRIPTION",
27
+ defaultValue: "next-action",
28
+ params: {
29
+ required: true,
30
+ },
31
+ },
32
+ {
33
+ key: "text",
34
+ label: "UI__NODE_EDITOR__NEXT_ACTION_ASSIST__TEXT__LABEL",
35
+ type: "cognigyText",
36
+ description: "UI__NODE_EDITOR__NEXT_ACTION_ASSIST__TEXT__DESCRIPTION",
37
+ defaultValue: "",
38
+ params: {
39
+ required: true,
40
+ },
41
+ },
42
+ ],
43
+ sections: [],
44
+ form: [
45
+ { type: "field", key: "tileId" },
46
+ { type: "field", key: "text" },
47
+ ].filter((element) => !!element),
48
+ function: async (params) => {
49
+ const { cognigy, config } = params;
50
+ const { api } = cognigy;
51
+ const text = config["text"];
52
+ if (!config.text) {
53
+ api.log("error", "Please provide a text in the text field");
54
+ return;
55
+ }
56
+ try {
57
+ const data = {
58
+ html: (0, nextActionWidgetTemplate_1.default)(text),
59
+ };
60
+ cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
61
+ id: config.tileId,
62
+ type: "html",
63
+ data, // the generated HTML
64
+ } }));
65
+ }
66
+ catch (error) {
67
+ if (error instanceof SyntaxError) {
68
+ api.log("error", "Please provide a valid JSON in the JSON Data field");
69
+ }
70
+ else {
71
+ api.log("error", error);
72
+ }
73
+ }
74
+ return;
75
+ },
76
+ });
77
+ //# sourceMappingURL=nextActionAssist.js.map
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SENTIMENT_ASSIST = void 0;
4
+ /* Custom Modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ /* Templates */
7
+ const sentimentAnalysisTemplate_1 = require("./htmlTemplates/sentimentAnalysisTemplate");
8
+ const prompt_1 = require("../nlu/generativeSlotFiller/prompt");
9
+ const constants_1 = require("./constants/constants");
10
+ const sentiment_helper_1 = require("./helpers/sentiment.helper");
11
+ /**
12
+ * Node name: "sentimentAssist"
13
+ *
14
+ * Purpose:
15
+ * Set a Sentiment Assist Tile for the Agent Assist Workspace
16
+ */
17
+ exports.SENTIMENT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
18
+ type: "sentimentAssist",
19
+ defaultLabel: "Copilot: Sentiment Tile",
20
+ summary: "UI__NODE_EDITOR__SENTIMENT_ASSIST__SUMMARY",
21
+ appearance: {
22
+ showIcon: false,
23
+ },
24
+ tags: ["agentAssist"],
25
+ fields: [
26
+ {
27
+ key: "tileId",
28
+ label: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__TILE_ID__LABEL",
29
+ description: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__TILE_ID__DESCRIPTION",
30
+ type: "cognigyText",
31
+ defaultValue: "sentiment",
32
+ },
33
+ {
34
+ key: "sentimentAnalysisInput",
35
+ label: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__SENTIMENT_ANALYSIS_INPUT__LABEL",
36
+ type: "select",
37
+ defaultValue: "lastInput",
38
+ params: {
39
+ options: [
40
+ {
41
+ label: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__SENTIMENT_ANALYSIS_INPUT__OPTIONS__LAST_INPUT__LABEL",
42
+ value: "lastInput"
43
+ },
44
+ {
45
+ label: "UI__NODE_EDITOR__SENTIMENT_ASSIST__FIELDS__SENTIMENT_ANALYSIS_INPUT__OPTIONS__LAST_TEN_INPUTS__LABEL",
46
+ value: "lastTenInputs"
47
+ },
48
+ ]
49
+ }
50
+ },
51
+ ],
52
+ sections: [],
53
+ form: [
54
+ { type: "field", key: "tileId" },
55
+ { type: "field", key: "sentimentAnalysisInput" },
56
+ ].filter((element) => !!element),
57
+ function: async (params) => {
58
+ const { cognigy, config } = params;
59
+ const { api } = cognigy;
60
+ const sentimentSelection = config.sentimentAnalysisInput;
61
+ try {
62
+ let prompt = "";
63
+ if (sentimentSelection === "lastInput") {
64
+ const curInput = cognigy.input.text;
65
+ prompt = `${constants_1.LAST_INPUT_PROMPT} ${curInput}`;
66
+ }
67
+ else if (sentimentSelection === "lastTenInputs") {
68
+ const conversation = (0, prompt_1.createLastUserInputString)(cognigy.lastConversationEntries) + "\n";
69
+ prompt = `A User had the following conversation with a bot: ${conversation}. Return the average sentiment of the conversation with one word. Use positive, neutral or negative only`;
70
+ }
71
+ const sentiment = await (0, sentiment_helper_1.sentimentAnalysis)(api, prompt);
72
+ const data = {
73
+ html: (0, sentimentAnalysisTemplate_1.default)(sentiment)
74
+ };
75
+ cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
76
+ id: config.tileId,
77
+ type: "html",
78
+ data,
79
+ } }));
80
+ }
81
+ catch (err) {
82
+ api.log("error", err);
83
+ }
84
+ }
85
+ });
86
+ //# sourceMappingURL=sentimentAssist.js.map
@@ -18,11 +18,11 @@ const sampleAdaptiveCard = {
18
18
  * Node name: "setAdaptiveCardTile"
19
19
  *
20
20
  * Purpose:
21
- * Check if agents are available for handover
21
+ * Set an Adaptive Card Tile for the Agent Assist Workspace
22
22
  */
23
23
  exports.SET_ADAPTIVE_CARD_TILE = (0, createNodeDescriptor_1.createNodeDescriptor)({
24
24
  type: "setAdaptiveCardTile",
25
- defaultLabel: "Set Adaptive Card Tile",
25
+ defaultLabel: "Copilot: Adaptive Card Tile",
26
26
  summary: "UI__NODE_EDITOR__SET_ADAPTIVE_CARD_TILE__SUMMARY",
27
27
  appearance: {
28
28
  showIcon: false,
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SET_AGENT_ASSIST_GRID = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ const sampleAgentAssistConfig = {
7
+ grid: {
8
+ columns: 5,
9
+ rows: 10,
10
+ gap: 5,
11
+ },
12
+ tiles: {
13
+ "customer-sentiment": {
14
+ x: 1,
15
+ y: 1,
16
+ rows: 3,
17
+ columns: 2,
18
+ },
19
+ "suggested-reply": {
20
+ x: 3,
21
+ y: 1,
22
+ rows: 3,
23
+ columns: 3,
24
+ },
25
+ profile: {
26
+ x: 1,
27
+ y: 4,
28
+ rows: 3,
29
+ columns: 2,
30
+ },
31
+ "user-history": {
32
+ x: 1,
33
+ y: 7,
34
+ rows: 4,
35
+ columns: 2,
36
+ },
37
+ chat: {
38
+ x: 3,
39
+ y: 4,
40
+ rows: 7,
41
+ columns: 3,
42
+ },
43
+ },
44
+ };
45
+ const checkAgentAssistKeys = (config) => {
46
+ const { grid, tiles } = config;
47
+ const configKeys = Object.keys(config);
48
+ const validKeys = ["grid", "tiles", "background"];
49
+ const invalidKeys = configKeys.filter((key) => !validKeys.includes(key));
50
+ if (invalidKeys.length > 0 ||
51
+ configKeys.length > 2 ||
52
+ configKeys.length < 2) {
53
+ return false;
54
+ }
55
+ if (!grid || !tiles) {
56
+ return false;
57
+ }
58
+ const { columns, rows, gap } = grid;
59
+ if (!columns || !rows || !gap) {
60
+ return false;
61
+ }
62
+ return true;
63
+ };
64
+ const configKey = "agentAssistConfig";
65
+ const backgroundSelectorKey = "backgroundSelector";
66
+ /**
67
+ * Node name: "setAgentAssistGrid"
68
+ *
69
+ * Purpose:
70
+ * Set the Agent Assist Grid configuration for the Agent Assist Workspace
71
+ */
72
+ exports.SET_AGENT_ASSIST_GRID = (0, createNodeDescriptor_1.createNodeDescriptor)({
73
+ type: "setAgentAssistGrid",
74
+ defaultLabel: "Copilot: Set Grid",
75
+ summary: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__SUMMARY",
76
+ appearance: {
77
+ showIcon: false,
78
+ },
79
+ tags: ["agentAssist"],
80
+ fields: [
81
+ {
82
+ key: configKey,
83
+ label: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__CONFIG__LABEL",
84
+ type: "agentAssistConfig",
85
+ description: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__CONFIG__DESCRIPTION",
86
+ params: {
87
+ required: true,
88
+ },
89
+ defaultValue: sampleAgentAssistConfig,
90
+ },
91
+ {
92
+ key: backgroundSelectorKey,
93
+ label: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__BACKGROUND_SELECTOR__LABEL",
94
+ type: "backgroundSelector",
95
+ description: "UI__NODE_EDITOR__SET_AGENT_ASSIST_GRID__BACKGROUND_SELECTOR__DESCRIPTION",
96
+ params: {
97
+ required: true,
98
+ },
99
+ defaultValue: "default",
100
+ },
101
+ ],
102
+ sections: [],
103
+ form: [
104
+ { type: "field", key: configKey },
105
+ { type: "field", key: backgroundSelectorKey }
106
+ ].filter((element) => !!element),
107
+ function: async (params) => {
108
+ const { cognigy, config } = params;
109
+ const { api } = cognigy;
110
+ const agentAssistConfig = config[configKey];
111
+ const background = config[backgroundSelectorKey];
112
+ if (!checkAgentAssistKeys(agentAssistConfig)) {
113
+ api.log("error", "A valid AI Copilot configuration was not provided");
114
+ return;
115
+ }
116
+ cognigy.api.sendConfigUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { agentAssistConfig: Object.assign(Object.assign({}, agentAssistConfig), { background: background === null || background === void 0 ? void 0 : background.data }) }));
117
+ return;
118
+ },
119
+ });
120
+ //# sourceMappingURL=setAgentAssistGrid.js.map
@@ -22,11 +22,11 @@ exports.formExampleHTML = `<!DOCTYPE html>
22
22
  * Node name: "setHTMLTile"
23
23
  *
24
24
  * Purpose:
25
- * Check if agents are available for handover
25
+ * Set an HTML Tile for the Agent Assist Workspace
26
26
  */
27
27
  exports.SET_HTML_TILE = (0, createNodeDescriptor_1.createNodeDescriptor)({
28
28
  type: "setHTMLTile",
29
- defaultLabel: "Set HTML Tile",
29
+ defaultLabel: "Copilot: HTML Tile",
30
30
  summary: "UI__NODE_EDITOR__SET_HTML_TILE__SUMMARY",
31
31
  appearance: {
32
32
  showIcon: false,
@@ -10,11 +10,11 @@ const urlRegex = new RegExp(/^(https?:\/\/)?[\w\-]+(\.[\w\-]+)+[/#?]?.*$/i);
10
10
  * Node name: "setIFrameTile"
11
11
  *
12
12
  * Purpose:
13
- * Check if agents are available for handover
13
+ * Set an IFrame Tile for the Agent Assist Workspace
14
14
  */
15
15
  exports.SET_IFRAME_TILE = (0, createNodeDescriptor_1.createNodeDescriptor)({
16
16
  type: "setIFrameTile",
17
- defaultLabel: "Set IFrame Tile",
17
+ defaultLabel: "Copilot: IFrame Tile",
18
18
  summary: "UI__NODE_EDITOR__SET_IFRAME_TILE__SUMMARY",
19
19
  appearance: {
20
20
  showIcon: false,
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SET_SECURE_FORMS_TILE = void 0;
4
+ // @ts-ignore
5
+ const axios_1 = require("axios");
6
+ /* Custom modules */
7
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
8
+ const buildAppUrl_1 = require("../apps/utils/buildAppUrl");
9
+ const stage0_1 = require("./htmlTemplates/secureForms/stage0");
10
+ const stage1_1 = require("./htmlTemplates/secureForms/stage1");
11
+ const stage2_1 = require("./htmlTemplates/secureForms/stage2");
12
+ const stageError_1 = require("./htmlTemplates/secureForms/stageError");
13
+ // Doubled to make sure autoformat does not put caret return breaking ts-ignore hint
14
+ // @ts-ignore
15
+ const config_1 = require("../../../../config");
16
+ // @ts-ignore
17
+ const config_2 = require("../../../../config");
18
+ function buildSecureFormsAppTemplateData(jwtToken) {
19
+ if (!jwtToken || typeof jwtToken !== "string") {
20
+ throw new TypeError("Unexpected parameter. Can't build template data");
21
+ }
22
+ const submitUrl = (0, config_2.getServiceSecureFormsUrl)() + "/submit";
23
+ return {
24
+ submitUrl,
25
+ jwtToken
26
+ };
27
+ }
28
+ function buildSecureFormsTileTemplateData(jwtReadToken, formId) {
29
+ return {
30
+ retrieveUrl: (0, config_2.getServiceSecureFormsUrl)() + "/" + formId,
31
+ jwtReadToken
32
+ };
33
+ }
34
+ function agentAssistTile(params) {
35
+ return function (stage, options = {}) {
36
+ const stages = [stage0_1.default, stage1_1.default, stage2_1.default, stageError_1.default];
37
+ const { cognigy, config } = params;
38
+ cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
39
+ id: config.tileId,
40
+ type: "html",
41
+ data: {
42
+ html: stages[stage](options)
43
+ }
44
+ } }));
45
+ };
46
+ }
47
+ exports.SET_SECURE_FORMS_TILE = (0, createNodeDescriptor_1.createNodeDescriptor)({
48
+ type: "setSecureFormsTile",
49
+ defaultLabel: "Copilot: SecureForms Tile",
50
+ appearance: {
51
+ showIcon: false
52
+ },
53
+ tags: ["agentAssist"],
54
+ fields: [
55
+ {
56
+ key: "tileId",
57
+ label: "UI__NODE_EDITOR__SET_HTML_TILE__TILE_ID__LABEL",
58
+ type: "cognigyText",
59
+ description: "UI__NODE_EDITOR__SET_HTML_TILE__TILE_ID__DESCRIPTION",
60
+ defaultValue: "secureForms",
61
+ params: {
62
+ required: true
63
+ }
64
+ }
65
+ ],
66
+ sections: [],
67
+ form: [
68
+ { type: "field", key: "tileId" }
69
+ ],
70
+ function: async (params) => {
71
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
72
+ const { cognigy, config } = params;
73
+ const { api, input } = cognigy;
74
+ if (!config.tileId) {
75
+ api.log("error", "Missing required parameter: 'tileId'");
76
+ return;
77
+ }
78
+ const updateAgentTile = agentAssistTile(params);
79
+ const contextKey = "secureForms";
80
+ let contextVal = api.getSystemContext(contextKey);
81
+ function handleError(error) {
82
+ api.log("error", error);
83
+ updateAgentTile(3, { error });
84
+ }
85
+ /**
86
+ * Trigger: Init Process (0 -> 1)
87
+ */
88
+ if (((_c = (_b = (_a = input === null || input === void 0 ? void 0 : input.data) === null || _a === void 0 ? void 0 : _a._cognigy) === null || _b === void 0 ? void 0 : _b._agentAssist) === null || _c === void 0 ? void 0 : _c.payload) === "__secureForms_init__") {
89
+ try {
90
+ const apiKey = (0, config_1.getServiceSecureFormsApiKey)();
91
+ const config = {
92
+ url: (0, config_2.getServiceSecureFormsUrl)(),
93
+ method: "post",
94
+ headers: {
95
+ "x-api-key": apiKey
96
+ }
97
+ };
98
+ const response = await axios_1.default.request(config);
99
+ const { formId, jwtToken, jwtReadToken } = response.data;
100
+ contextVal = {
101
+ appLinkSent: false,
102
+ isFinished: false,
103
+ isSubmitted: false,
104
+ formId,
105
+ jwtReadToken,
106
+ jwtToken
107
+ };
108
+ api.setSystemContext(contextKey, contextVal);
109
+ // Prepare xApp
110
+ if (!input.apps.session.token) {
111
+ const appSessionToken = await api.initAppSession({
112
+ styleConfig: {}
113
+ });
114
+ api.addToInput("apps.session.token", appSessionToken);
115
+ }
116
+ const appTemplateURL = `${input.apps.baseUrl}/apps/secureforms/`;
117
+ api.setAppState(appTemplateURL, buildSecureFormsAppTemplateData(jwtToken));
118
+ }
119
+ catch (error) {
120
+ handleError(`Request to SecureForms server failed, error was: ${error.message}`);
121
+ return;
122
+ }
123
+ }
124
+ /**
125
+ * Trigger: Card data submitted (1 -> 2)
126
+ */
127
+ if (((_g = (_f = (_e = (_d = input === null || input === void 0 ? void 0 : input.data) === null || _d === void 0 ? void 0 : _d._cognigy) === null || _e === void 0 ? void 0 : _e._app) === null || _f === void 0 ? void 0 : _f.payload) === null || _g === void 0 ? void 0 : _g.success) === true) {
128
+ contextVal = Object.assign(Object.assign({}, contextVal), { isSubmitted: true });
129
+ api.setSystemContext(contextKey, contextVal);
130
+ }
131
+ /**
132
+ * Trigger: xApp ERROR Handler (1 -> 3)
133
+ */
134
+ if ((_l = (_k = (_j = (_h = input === null || input === void 0 ? void 0 : input.data) === null || _h === void 0 ? void 0 : _h._cognigy) === null || _j === void 0 ? void 0 : _j._app) === null || _k === void 0 ? void 0 : _k.payload) === null || _l === void 0 ? void 0 : _l.error) {
135
+ handleError("User was not able to submit the card data.");
136
+ return;
137
+ }
138
+ /**
139
+ * Stage 0. Waiting for the human agent to start the process
140
+ */
141
+ if (!contextVal) {
142
+ updateAgentTile(0);
143
+ return;
144
+ }
145
+ /**
146
+ * Stage 1. Waiting for the card data submit
147
+ */
148
+ if ((contextVal === null || contextVal === void 0 ? void 0 : contextVal.isSubmitted) === false) {
149
+ const appUrl = (0, buildAppUrl_1.buildAppUrl)(input.apps.baseUrl, (_m = input.apps.session) === null || _m === void 0 ? void 0 : _m.token);
150
+ const { appLinkSent } = contextVal;
151
+ updateAgentTile(1, { appUrl, appLinkSent });
152
+ contextVal = Object.assign(Object.assign({}, contextVal), { appLinkSent: true });
153
+ api.setSystemContext(contextKey, contextVal);
154
+ return;
155
+ }
156
+ /**
157
+ * Stage 2. Card data submitted.
158
+ * Send this only once by isFinished flag because Tile is a statefull app
159
+ */
160
+ if ((contextVal === null || contextVal === void 0 ? void 0 : contextVal.isSubmitted) === true &&
161
+ (contextVal === null || contextVal === void 0 ? void 0 : contextVal.isFinished) === false) {
162
+ const { formId, jwtReadToken } = contextVal;
163
+ const templateData = buildSecureFormsTileTemplateData(jwtReadToken, formId);
164
+ updateAgentTile(2, templateData);
165
+ contextVal = Object.assign(Object.assign({}, contextVal), { isFinished: true });
166
+ api.setSystemContext(contextKey, contextVal);
167
+ return;
168
+ }
169
+ }
170
+ });
171
+ //# sourceMappingURL=setSecureFormsTile.js.map
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRANSCRIPT_ASSIST = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ const transcriptAssistTemplate_1 = require("./htmlTemplates/transcriptAssistTemplate");
7
+ const constants_1 = require("./constants/constants");
8
+ const sentiment_helper_1 = require("./helpers/sentiment.helper");
9
+ /**
10
+ * Node name: "transcriptAssist"
11
+ *
12
+ * Purpose:
13
+ * The Transcript Assist widget will suggest agent responses and provide more information to draft messages.
14
+ */
15
+ exports.TRANSCRIPT_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
16
+ type: "transcriptAssist",
17
+ defaultLabel: "Copilot: Transcript Tile",
18
+ summary: "UI__NODE_EDITOR__TRANSCRIPT_ASSIST__SUMMARY",
19
+ appearance: {
20
+ showIcon: false,
21
+ },
22
+ tags: ["agentAssist"],
23
+ fields: [
24
+ {
25
+ key: "tileId",
26
+ label: "UI__NODE_EDITOR__TRANSCRIPT_ASSIST__ID__LABEL",
27
+ type: "cognigyText",
28
+ description: "UI__NODE_EDITOR__TRANSCRIPT_ASSIST_TILE_ID__DESCRIPTION",
29
+ defaultValue: "transcript-assist",
30
+ params: {
31
+ required: true,
32
+ },
33
+ },
34
+ {
35
+ key: "enableSentiment",
36
+ label: "UI__NODE_EDITOR__TRANSCRIPT_ASSIST__ENABLE_SENTIMENT__LABEL",
37
+ type: "toggle",
38
+ defaultValue: false,
39
+ },
40
+ ],
41
+ sections: [],
42
+ form: [
43
+ { type: "field", key: "tileId" },
44
+ { type: "field", key: "enableSentiment" },
45
+ ].filter((element) => !!element),
46
+ function: async (params) => {
47
+ const { cognigy, config } = params;
48
+ const { api } = cognigy;
49
+ const sentimentEnabled = config["enableSentiment"];
50
+ let sentiment;
51
+ try {
52
+ const inputText = cognigy.input.text;
53
+ if (sentimentEnabled) {
54
+ const prompt = `${constants_1.LAST_INPUT_PROMPT} ${inputText}`;
55
+ sentiment = await (0, sentiment_helper_1.sentimentAnalysis)(api, prompt);
56
+ }
57
+ const data = {
58
+ html: (0, transcriptAssistTemplate_1.default)(inputText, sentiment),
59
+ };
60
+ cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
61
+ id: config.tileId,
62
+ type: "html",
63
+ data,
64
+ } }));
65
+ }
66
+ catch (error) {
67
+ api.log("error", error);
68
+ }
69
+ return;
70
+ },
71
+ });
72
+ //# sourceMappingURL=transcriptAssist.js.map
@@ -25,6 +25,18 @@ exports.ALL_FIELDS = (0, createNodeDescriptor_1.createNodeDescriptor)({
25
25
  description: "Create an Adaptive Card using this JSON editor",
26
26
  defaultValue: '{"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","type":"AdaptiveCard","version":"1.0","body":[]}'
27
27
  },
28
+ {
29
+ key: "agentAssistConfig",
30
+ type: "agentAssistConfig",
31
+ label: "Copilot Config",
32
+ description: "Create an Copilot Config using this JSON editor",
33
+ },
34
+ {
35
+ key: "backgroundSelector",
36
+ type: "backgroundSelector",
37
+ label: "Background Selector",
38
+ description: "Give the user the ability to select a background image or color",
39
+ },
28
40
  {
29
41
  key: "date",
30
42
  type: "date",
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TGenerativeAIConnectionFields.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ALEPH_ALPHA_PROVIDER_CONNECTION = void 0;
4
+ exports.ALEPH_ALPHA_PROVIDER_CONNECTION = {
5
+ type: "AlephAlphaProvider",
6
+ label: "UI__NODE_EDITOR__ALEPH_ALPHA_PROVIDER_CONNECTION__LABEL",
7
+ fields: [
8
+ { fieldName: "token", label: "UI__CONNECTION_EDITOR__FIELD_TOKEN" },
9
+ ]
10
+ };
11
+ //# sourceMappingURL=alephAlphaProviderConnection.js.map
@@ -5,7 +5,7 @@ exports.ANTHROPIC_PROVIDER_CONNECTION = {
5
5
  type: "AnthropicProvider",
6
6
  label: "UI__NODE_EDITOR__ANTHROPIC_PROVIDER_CONNECTION__LABEL",
7
7
  fields: [
8
- { fieldName: "apiKey" },
8
+ { fieldName: "apiKey", label: "UI__CONNECTION_EDITOR__FIELD_API_KEY" },
9
9
  ]
10
10
  };
11
11
  //# sourceMappingURL=anthropicProviderConnection.js.map
@@ -5,7 +5,7 @@ exports.AZURE_OPEAN_AI_V2_PROVIDER_CONNECTION = {
5
5
  type: "AzureOpenAIProviderV2",
6
6
  label: "UI__NODE_EDITOR__AZURE_OPEAN_AI_V2_PROVIDER_CONNECTION__LABEL",
7
7
  fields: [
8
- { fieldName: "apiKey" },
8
+ { fieldName: "apiKey", label: "UI__CONNECTION_EDITOR__FIELD_API_KEY" },
9
9
  ]
10
10
  };
11
11
  //# sourceMappingURL=azureOpenAIProviderConnectionV2.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cognigyGenerativeAIProviderModule = exports.GOOGLE_VERTEXAI_PROVIDER_CONNECTION = exports.ANTHROPIC_PROVIDER_CONNECTION = exports.AZURE_OPEAN_AI_V2_PROVIDER_CONNECTION = exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = exports.OPEAN_AI_PROVIDER_CONNECTION = void 0;
3
+ exports.cognigyGenerativeAIProviderModule = exports.ALEPH_ALPHA_PROVIDER_CONNECTION = exports.GOOGLE_VERTEXAI_PROVIDER_CONNECTION = exports.ANTHROPIC_PROVIDER_CONNECTION = exports.AZURE_OPEAN_AI_V2_PROVIDER_CONNECTION = exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = exports.OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
4
  /* Custom modules */
5
5
  const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
6
  const openAIProviderConnection_1 = require("./openAIProviderConnection");
@@ -8,6 +8,7 @@ const azureOpenAIProviderConnection_1 = require("./azureOpenAIProviderConnection
8
8
  const azureOpenAIProviderConnectionV2_1 = require("./azureOpenAIProviderConnectionV2");
9
9
  const anthropicProviderConnection_1 = require("./anthropicProviderConnection");
10
10
  const googleVertexAIProviderConnection_1 = require("./googleVertexAIProviderConnection");
11
+ const alephAlphaProviderConnection_1 = require("./alephAlphaProviderConnection");
11
12
  var openAIProviderConnection_2 = require("./openAIProviderConnection");
12
13
  Object.defineProperty(exports, "OPEAN_AI_PROVIDER_CONNECTION", { enumerable: true, get: function () { return openAIProviderConnection_2.OPEAN_AI_PROVIDER_CONNECTION; } });
13
14
  var azureOpenAIProviderConnection_2 = require("./azureOpenAIProviderConnection");
@@ -18,6 +19,8 @@ var anthropicProviderConnection_2 = require("./anthropicProviderConnection");
18
19
  Object.defineProperty(exports, "ANTHROPIC_PROVIDER_CONNECTION", { enumerable: true, get: function () { return anthropicProviderConnection_2.ANTHROPIC_PROVIDER_CONNECTION; } });
19
20
  var googleVertexAIProviderConnection_2 = require("./googleVertexAIProviderConnection");
20
21
  Object.defineProperty(exports, "GOOGLE_VERTEXAI_PROVIDER_CONNECTION", { enumerable: true, get: function () { return googleVertexAIProviderConnection_2.GOOGLE_VERTEXAI_PROVIDER_CONNECTION; } });
22
+ var alephAlphaProviderConnection_2 = require("./alephAlphaProviderConnection");
23
+ Object.defineProperty(exports, "ALEPH_ALPHA_PROVIDER_CONNECTION", { enumerable: true, get: function () { return alephAlphaProviderConnection_2.ALEPH_ALPHA_PROVIDER_CONNECTION; } });
21
24
  exports.cognigyGenerativeAIProviderModule = (0, createNodeDescriptor_1.createExtension)({
22
25
  nodes: [],
23
26
  connections: [
@@ -25,7 +28,8 @@ exports.cognigyGenerativeAIProviderModule = (0, createNodeDescriptor_1.createExt
25
28
  azureOpenAIProviderConnection_1.AZURE_OPEAN_AI_PROVIDER_CONNECTION,
26
29
  azureOpenAIProviderConnectionV2_1.AZURE_OPEAN_AI_V2_PROVIDER_CONNECTION,
27
30
  anthropicProviderConnection_1.ANTHROPIC_PROVIDER_CONNECTION,
28
- googleVertexAIProviderConnection_1.GOOGLE_VERTEXAI_PROVIDER_CONNECTION
31
+ googleVertexAIProviderConnection_1.GOOGLE_VERTEXAI_PROVIDER_CONNECTION,
32
+ alephAlphaProviderConnection_1.ALEPH_ALPHA_PROVIDER_CONNECTION
29
33
  ]
30
34
  });
31
35
  //# sourceMappingURL=index.js.map