@cognigy/rest-api-client 0.17.0 → 0.19.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.
- package/CHANGELOG.md +12 -0
- package/build/GenericTusFn.js +6 -1
- package/build/GenericUploadFn.js +3 -5
- package/build/apigroups/AdministrationAPIGroup_2_0.js +3 -1
- package/build/apigroups/MetricsAPIGroup_2_0.js +5 -0
- package/build/apigroups/ResourcesAPIGroup_2_0.js +21 -7
- package/build/connector/AxiosAdapter.js +35 -15
- package/build/shared/charts/createNodeDescriptor.js +5 -5
- package/build/shared/charts/descriptors/agentAssist/constants/constants.js +16 -1
- package/build/shared/charts/descriptors/agentAssist/helpers/agentAssistTranslator.helper.js +19 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/determineMetadata.js +15 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/getFontSizeFieldOptions.js +84 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/getLanguageName.helper.js +33 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/answerExtraction.helper.js +59 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/configValidator.helper.js +20 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/errorHandler.helper.js +64 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/followUpDetection.helper.js +72 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/knowledgeSearch/knowledgeSearch.helper.js +58 -0
- package/build/shared/charts/descriptors/agentAssist/helpers/sentiment.helper.js +7 -13
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/identityAssistTemplate.js +17 -18
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/knowledgeAssistTemplate.js +330 -153
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/nextActionWidgetTemplate.js +212 -80
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/sentimentAnalysisTemplate.js +11 -6
- package/build/shared/charts/descriptors/agentAssist/htmlTemplates/transcriptAssistTemplate.js +15 -13
- package/build/shared/charts/descriptors/agentAssist/identityAssist.js +88 -15
- package/build/shared/charts/descriptors/agentAssist/knowledgeAssist.js +192 -327
- package/build/shared/charts/descriptors/agentAssist/locales/cs.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/de.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/en.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/es.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/fr.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/index.js +22 -0
- package/build/shared/charts/descriptors/agentAssist/locales/ja.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/ko.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/locales/pt.locale.js +11 -0
- package/build/shared/charts/descriptors/agentAssist/nextActionAssist.js +484 -10
- package/build/shared/charts/descriptors/agentAssist/sentimentAssist.js +32 -9
- package/build/shared/charts/descriptors/agentAssist/setAdaptiveCardTile.js +2 -0
- package/build/shared/charts/descriptors/agentAssist/setAgentAssistGrid.js +2 -1
- package/build/shared/charts/descriptors/agentAssist/setHtmlTile.js +5 -3
- package/build/shared/charts/descriptors/agentAssist/setIframeTile.js +5 -3
- package/build/shared/charts/descriptors/agentAssist/setSecureFormsTile.js +2 -2
- package/build/shared/charts/descriptors/agentAssist/transcriptAssist.js +42 -3
- package/build/shared/charts/descriptors/analytics/activateProfile.js +1 -0
- package/build/shared/charts/descriptors/analytics/blindMode.js +2 -0
- package/build/shared/charts/descriptors/analytics/completeGoal.js +1 -0
- package/build/shared/charts/descriptors/analytics/deactivateProfile.js +1 -0
- package/build/shared/charts/descriptors/analytics/deleteProfile.js +1 -0
- package/build/shared/charts/descriptors/analytics/index.js +3 -1
- package/build/shared/charts/descriptors/analytics/mergeProfile.js +1 -0
- package/build/shared/charts/descriptors/analytics/overwriteAnalytics.js +9 -0
- package/build/shared/charts/descriptors/analytics/requestRating.js +56 -2
- package/build/shared/charts/descriptors/analytics/setRating.js +4 -2
- package/build/shared/charts/descriptors/analytics/trackMilestone.js +95 -0
- package/build/shared/charts/descriptors/analytics/updateProfile.js +1 -0
- package/build/shared/charts/descriptors/apps/initAppSession.js +1 -0
- package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +35 -10
- package/build/shared/charts/descriptors/apps/setHtmlAppState.js +25 -2
- package/build/shared/charts/descriptors/apps/utils/getXAppsOverlaySettings.js +54 -0
- package/build/shared/charts/descriptors/connectionNodes/documentParserProviders/azureAIDocumentIntelligenceConnection.js +12 -0
- package/build/shared/charts/descriptors/connectionNodes/documentParserProviders/index.js +13 -0
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/awsBedrockProviderConnection.js +12 -0
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnection.js +4 -3
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnectionV2.js +3 -3
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderOauth2Connection.js +14 -0
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +16 -8
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAIProviderConnection.js +3 -3
- package/build/shared/charts/descriptors/data/addToContext.js +7 -0
- package/build/shared/charts/descriptors/data/copyDataToContext.js +3 -0
- package/build/shared/charts/descriptors/data/copySlotsToContext.js +3 -0
- package/build/shared/charts/descriptors/data/debugMessage.js +73 -0
- package/build/shared/charts/descriptors/data/index.js +3 -1
- package/build/shared/charts/descriptors/data/removeFromContext.js +9 -1
- package/build/shared/charts/descriptors/data/resetContext.js +1 -0
- package/build/shared/charts/descriptors/index.js +8 -4
- package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +36 -11
- package/build/shared/charts/descriptors/logic/resetState.js +1 -0
- package/build/shared/charts/descriptors/logic/setState.js +2 -1
- package/build/shared/charts/descriptors/logic/setTranslation.js +3 -1
- package/build/shared/charts/descriptors/logic/switchLocale.js +1 -0
- package/build/shared/charts/descriptors/logic/think.js +3 -1
- package/build/shared/charts/descriptors/logic/thinkV2.js +2 -0
- package/build/shared/charts/descriptors/message/question/optionalQuestion.js +1 -1
- package/build/shared/charts/descriptors/message/question/question.js +173 -7
- package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +44 -3
- package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +4 -2
- package/build/shared/charts/descriptors/nlu/cleanText.js +1 -0
- package/build/shared/charts/descriptors/nlu/fuzzySearch.js +23 -1
- package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +45 -19
- package/build/shared/charts/descriptors/nlu/index.js +1 -3
- package/build/shared/charts/descriptors/service/GPTPrompt.js +362 -29
- package/build/shared/charts/descriptors/service/LLMEntityExtract.js +283 -0
- package/build/shared/charts/descriptors/service/handoverV2.js +84 -1
- package/build/shared/charts/descriptors/service/httpRequest.js +68 -3
- package/build/shared/charts/descriptors/service/index.js +3 -1
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +110 -27
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -4
- package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +2 -0
- package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +2 -0
- package/build/shared/charts/descriptors/voice/nodes/dtmf.js +2 -0
- package/build/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -0
- package/build/shared/charts/descriptors/voice/nodes/noUserInput.js +2 -0
- package/build/shared/charts/descriptors/voice/nodes/play.js +8 -1
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +46 -45
- package/build/shared/charts/descriptors/voice/nodes/transfer.js +2 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +2 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +2 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +3 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/record.js +1 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +1 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +1 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +329 -47
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +27 -31
- package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +2 -2
- package/build/shared/charts/helpers/generativeAI/generativeAIPrompts.js +55 -0
- package/build/shared/charts/helpers/generativeAI/rephraseSentenceWithAi.js +4 -2
- package/build/shared/constants.js +10 -1
- package/build/shared/handoverClients/interfaces/THandoverEventType.js +1 -0
- package/build/shared/helper/logFullConfigToDebugMode.js +30 -0
- package/build/shared/helper/nlu/textCleaner.js +3 -1
- package/build/shared/interfaces/IOrganisation.js +1 -0
- package/build/shared/interfaces/IProfile.js +1 -0
- package/build/shared/interfaces/IProfileSchema.js +3 -0
- package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +20 -20
- package/build/shared/interfaces/{restAPI/resources/journey/v2.0/IJourneyProgress_2_0.js → analytics/IMilestoneAnalytics.js} +1 -1
- package/build/shared/interfaces/{restAPI/resources/journey/v2.0/IJourney_2_0.js → appsession/IAppSession.js} +1 -1
- package/build/shared/interfaces/{restAPI/resources/journey/v2.0/IJourneyStep_2_0.js → appsession/ISetAppState.js} +1 -1
- package/build/shared/interfaces/appsession/ISetAppStateOptions.js +3 -0
- package/build/shared/interfaces/appsession/ISetAppStateOverlaySettings.js +3 -0
- package/build/shared/interfaces/appsession/ISetAppStateOverlaySettingsMetaData.js +3 -0
- package/build/shared/interfaces/debugEvents/TDebugEventMessagePayload.js +3 -0
- package/build/shared/interfaces/debugEvents/TDebugEventType.js +2 -0
- package/build/shared/interfaces/fileStorage.js +6 -0
- package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +45 -52
- package/build/shared/interfaces/handover.js +44 -2
- package/build/shared/interfaces/license.js +3 -2
- package/build/shared/interfaces/license.js.map +1 -1
- package/build/shared/interfaces/messageAPI/endpoints.js +17 -2
- package/build/shared/interfaces/messageAPI/handover.js +25 -2
- package/build/shared/interfaces/nlu/nlu.js +3 -0
- package/build/shared/interfaces/resources/IAuditEvent.js +10 -9
- package/build/shared/interfaces/resources/IConnection.js +1 -0
- package/build/shared/interfaces/resources/IEndpoint.js +1 -2
- package/build/shared/interfaces/resources/ILargeLanguageModel.js +56 -21
- package/build/shared/interfaces/resources/IMilestone.js +50 -0
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +96 -75
- package/build/shared/interfaces/resources/TResourceType.js +12 -5
- package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +1 -1
- package/build/shared/interfaces/resources/settings/IAgentSettings.js +12 -7
- package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +8 -0
- package/build/shared/interfaces/resources/settings/IKnowledgeAISettings.js +18 -0
- package/build/shared/interfaces/resources/settings/index.js +4 -1
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IReadCollectionsToBeDeletedRest_2_0.js +0 -1
- package/build/shared/interfaces/restAPI/administration/organisations/v2.0/IReadOrganisationKnowledgeChunksCountRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/operations/index.js +3 -0
- package/build/shared/interfaces/restAPI/operations/nlu/v2.0/IGenerateNluScoresRest_2_0.js +57 -0
- package/build/shared/interfaces/restAPI/operations/nlu/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/largeLanguageModel/v2.0/IAvailableModelsForLLMProvider_2_0 .js +18 -0
- package/build/shared/interfaces/restAPI/resources/largeLanguageModel/v2.0/IGetAvailableModelsForLLMRest_2_0 .js +3 -0
- package/build/shared/interfaces/restAPI/resources/{journey/v2.0/IJourneyIndexItem_2_0.js → milestone/v2.0/ICloneMilestoneRest_2_0.js} +1 -1
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/ICreateMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IDeleteMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IIndexMilestonesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStepMetric_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestoneStep_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IMilestone_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/{journey/v2.0/IIndexJourneysRest_2_0.js → milestone/v2.0/IReadMilestoneRest_2_0.js} +1 -1
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/IUpdateMilestoneRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/milestone/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/IUploadResumableRest_2_0.js +3 -1
- package/build/shared/interfaces/security/IPermission.js +4 -2
- package/build/shared/interfaces/security/IRole.js +2 -0
- package/build/shared/interfaces/security/ISystemCapabilities.js +3 -0
- package/build/shared/interfaces/security/index.js +1 -1
- package/build/shared/interfaces/trainer/ITrainerRecord.js +2 -2
- package/build/shared/interfaces/user.js +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +2194 -957
- package/build/shared/charts/descriptors/nlu/extractAnswer.js +0 -115
- package/build/shared/interfaces/journeys/IJourney.js +0 -83
- package/build/shared/interfaces/journeys/IJourneyProgress.js +0 -40
- package/build/shared/interfaces/journeys/IJourneyTrackEvent.js +0 -35
- package/build/shared/interfaces/journeys/index.js +0 -14
- package/build/shared/interfaces/restAPI/resources/journey/v2.0/IJourneyTrackEvents_2_0.js +0 -3
- package/build/shared/interfaces/restAPI/resources/journey/v2.0/IReadJourneyProgressRest_2_0.js +0 -3
- package/build/shared/interfaces/restAPI/resources/journey/v2.0/IReadJourneyRest_2_0.js +0 -3
- package/build/shared/interfaces/restAPI/resources/journey/v2.0/ITrackJourneyEventRest_2_0.js +0 -3
- package/build/shared/interfaces/restAPI/resources/journey/v2.0/IUpdateSelectedJourneyRest_2_0.js +0 -3
- /package/build/shared/interfaces/{restAPI/resources/journey/v2.0 → appsession}/index.js +0 -0
package/build/shared/charts/descriptors/agentAssist/htmlTemplates/nextActionWidgetTemplate.js
CHANGED
|
@@ -1,91 +1,223 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const nextActionWidgetTemplate = (text) => {
|
|
3
|
+
const nextActionWidgetTemplate = ({ text, postMessageUrl, enableCopyToClipboard, fontSize, actionFontSize, }) => {
|
|
4
4
|
return `<!DOCTYPE html>
|
|
5
|
-
<html lang="en">
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
<html lang="en" class="h-full">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="UTF-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
9
|
+
<title>Next Best Action</title>
|
|
10
|
+
<link
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"
|
|
13
|
+
/>
|
|
14
|
+
<style>
|
|
15
|
+
.min-w-20 {
|
|
16
|
+
min-width: 5rem;
|
|
17
|
+
}
|
|
18
|
+
@keyframes blinkGreen {
|
|
19
|
+
50% {
|
|
20
|
+
background-color: #10b981;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
.blink-green {
|
|
25
|
+
animation: blinkGreen 0.5s ease-in-out;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
<script>
|
|
29
|
+
(function () {
|
|
30
|
+
let showButton = false;
|
|
31
|
+
let showCopyButton = true;
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
function updateCopyButtonVisibility() {
|
|
34
|
+
const elements = document.querySelectorAll(
|
|
35
|
+
"[data-cognigy-copilot-tile-nba]",
|
|
36
|
+
);
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
elements.forEach((element) => {
|
|
39
|
+
const button = element.querySelector("[data-cognigy-clipboard-button]");
|
|
40
|
+
if(!button) return;
|
|
41
|
+
|
|
42
|
+
if (showCopyButton) {
|
|
43
|
+
button.classList.remove("hidden");
|
|
44
|
+
} else {
|
|
45
|
+
button.classList.add("hidden");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
34
49
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"${process.env.AGENT_ASSIST_WORKSPACE_FRONTEND_URL_WITH_PROTOCOL}"
|
|
40
|
-
);
|
|
41
|
-
}
|
|
50
|
+
function updateButtonVisibility() {
|
|
51
|
+
const elements = document.querySelectorAll(
|
|
52
|
+
"[data-cognigy-copilot-tile-nba]",
|
|
53
|
+
);
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
55
|
+
elements.forEach((element) => {
|
|
56
|
+
const button = element.querySelector("#liveAgentForwardButton");
|
|
57
|
+
if (button) {
|
|
58
|
+
button.className = showButton
|
|
59
|
+
? "justify-self-end col-start-8"
|
|
60
|
+
: "hidden";
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function sendPostMessage(event) {
|
|
66
|
+
const wrapper = event.target.closest("[data-cognigy-copilot-tile]");
|
|
67
|
+
const contentElement = wrapper.querySelector(
|
|
68
|
+
"[data-cognigy-content]",
|
|
69
|
+
);
|
|
70
|
+
window.parent.postMessage(
|
|
71
|
+
{ type: "replyBoxContent", content: contentElement.innerHTML.trim() },
|
|
72
|
+
"${postMessageUrl}",
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
${enableCopyToClipboard
|
|
77
|
+
? `
|
|
78
|
+
async function copyToClipboard(event) {
|
|
79
|
+
const wrapper = event.target.closest("[data-cognigy-copilot-tile]");
|
|
80
|
+
const contentElement = wrapper.querySelector(
|
|
81
|
+
"[data-cognigy-content]",
|
|
82
|
+
);
|
|
83
|
+
const button = wrapper.querySelector(
|
|
84
|
+
"[data-cognigy-clipboard-button]",
|
|
85
|
+
);
|
|
86
|
+
button.classList.add("blink-green");
|
|
87
|
+
button.addEventListener(
|
|
88
|
+
"animationend",
|
|
89
|
+
function () {
|
|
90
|
+
button.classList.remove("blink-green");
|
|
91
|
+
},
|
|
92
|
+
{ once: true },
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const defaultMessage = button.querySelector(".default-message");
|
|
96
|
+
const successMessage = button.querySelector(".success-message");
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
await navigator.clipboard.writeText(contentElement.textContent.trim());
|
|
100
|
+
defaultMessage.classList.add("hidden");
|
|
101
|
+
successMessage.classList.remove("hidden");
|
|
102
|
+
|
|
103
|
+
// reset to default state
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
defaultMessage.classList.remove("hidden");
|
|
106
|
+
successMessage.classList.add("hidden");
|
|
107
|
+
}, 2000);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
console.error("Failed to copy: ", err);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`
|
|
113
|
+
: ""}
|
|
114
|
+
|
|
115
|
+
window.addEventListener("message", (event) => {
|
|
116
|
+
const message = event.data;
|
|
117
|
+
|
|
118
|
+
if (message.type === "toggleButton") {
|
|
119
|
+
showButton = message.show;
|
|
120
|
+
updateButtonVisibility();
|
|
121
|
+
}
|
|
122
|
+
if (message.type === "toggleCopyButton") {
|
|
123
|
+
showCopyButton = message.show;
|
|
124
|
+
updateCopyButtonVisibility();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
document.addEventListener("DOMContentLoaded", updateButtonVisibility);
|
|
128
|
+
document.addEventListener("DOMContentLoaded", updateCopyButtonVisibility);
|
|
129
|
+
|
|
130
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
131
|
+
document
|
|
132
|
+
.querySelector("[data-cognigy-copilot-tile-nba] #liveAgentForwardButton")
|
|
133
|
+
.addEventListener("click", sendPostMessage);
|
|
134
|
+
document
|
|
135
|
+
.querySelector("[data-cognigy-copilot-tile-nba] #liveAgentForwardButton")
|
|
136
|
+
.removeAttribute("disabled");
|
|
137
|
+
${enableCopyToClipboard
|
|
138
|
+
? `
|
|
139
|
+
document
|
|
140
|
+
.querySelector("[data-cognigy-copilot-tile-nba] [data-cognigy-clipboard-button]")
|
|
141
|
+
.addEventListener("click", copyToClipboard);
|
|
142
|
+
|
|
143
|
+
document
|
|
144
|
+
.querySelector("[data-cognigy-copilot-tile-nba] [data-cognigy-clipboard-button]")
|
|
145
|
+
.removeAttribute("disabled");
|
|
146
|
+
`
|
|
147
|
+
: ""}
|
|
148
|
+
});
|
|
149
|
+
})();
|
|
150
|
+
</script>
|
|
151
|
+
</head>
|
|
152
|
+
<body class="h-full">
|
|
153
|
+
<div
|
|
154
|
+
class="flex flex-col h-full overflow-auto p-4 justify-center pb-1 bg-white rounded-xl shadow-md"
|
|
155
|
+
data-cognigy-copilot-tile
|
|
156
|
+
data-cognigy-copilot-tile-nba
|
|
157
|
+
>
|
|
158
|
+
<div class="flex justify-between">
|
|
159
|
+
<span
|
|
160
|
+
class="${fontSize} font-semibold uppercase tracking-wide text-indigo-500 flex-grow"
|
|
161
|
+
>
|
|
162
|
+
Next Best Action
|
|
163
|
+
</span>
|
|
164
|
+
<img
|
|
165
|
+
class="h-6 w-6"
|
|
166
|
+
src="https://www.cognigy.com/hubfs/AI%20badge.png"
|
|
167
|
+
alt="AI Logo"
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<p class="flex-grow overflow-auto text-gray-800 ${actionFontSize}" data-cognigy-content>
|
|
172
|
+
${text}
|
|
173
|
+
</p>
|
|
174
|
+
<div class="flex mt-auto w-full justify-between py-2">
|
|
175
|
+
${enableCopyToClipboard
|
|
176
|
+
? `
|
|
177
|
+
<button
|
|
178
|
+
class="min-w-20 bg-blue-500 hover:bg-blue-700 text-white font-bold rounded focus:ring-4 focus:outline-none focus:ring-blue-300 ${fontSize} py-2 items-center inline-flex justify-center hidden"
|
|
179
|
+
data-cognigy-clipboard-button
|
|
180
|
+
disabled
|
|
181
|
+
>
|
|
182
|
+
<span class="default-message">Copy</span>
|
|
183
|
+
<span class="success-message hidden inline-flex items-center gap-1">
|
|
184
|
+
<svg
|
|
185
|
+
class="w-3 h-3 text-white me-1.5"
|
|
186
|
+
aria-hidden="true"
|
|
187
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
188
|
+
fill="none"
|
|
189
|
+
viewBox="0 0 16 12"
|
|
190
|
+
>
|
|
191
|
+
<path
|
|
192
|
+
stroke="currentColor"
|
|
193
|
+
stroke-linecap="round"
|
|
194
|
+
stroke-linejoin="round"
|
|
195
|
+
stroke-width="2"
|
|
196
|
+
d="M1 5.917 5.724 10.5 15 1.5"
|
|
197
|
+
/>
|
|
198
|
+
</svg>
|
|
199
|
+
Copied!
|
|
200
|
+
</span>
|
|
201
|
+
</button>
|
|
202
|
+
`
|
|
203
|
+
: "<div></div>"}
|
|
204
|
+
<button id="liveAgentForwardButton" class="hidden" disabled>
|
|
205
|
+
<svg
|
|
206
|
+
width="45px"
|
|
207
|
+
height="auto"
|
|
208
|
+
viewBox="0 0 45 35"
|
|
209
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
210
|
+
>
|
|
211
|
+
<path
|
|
212
|
+
d="M 18.17 19.653 C 18.538 19.338 16.6 12.9 30.995 15.028 L 30.968 18.05 L 39.7 12.4 L 31.021 6.619 L 31.021 9.326 C 30.1 10.2 16.042 8.143 18.118 19.627"
|
|
213
|
+
fill="#0b3694"
|
|
214
|
+
transform="scale(-1, 1) translate(-50, 0)"
|
|
215
|
+
/>
|
|
216
|
+
</svg>
|
|
217
|
+
</button>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</body>
|
|
89
221
|
</html>
|
|
90
222
|
`;
|
|
91
223
|
};
|
package/build/shared/charts/descriptors/agentAssist/htmlTemplates/sentimentAnalysisTemplate.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const agentAssistTranslator_helper_1 = require("../helpers/agentAssistTranslator.helper");
|
|
3
4
|
const stylesPartial_1 = require("./stylesPartial");
|
|
4
|
-
const sentimentAnalysisTemplate = (sentiment) => {
|
|
5
|
+
const sentimentAnalysisTemplate = ({ sentiment, fontSize, input, }) => {
|
|
5
6
|
const mapSentimentToColor = {
|
|
6
|
-
positive:
|
|
7
|
-
negative:
|
|
8
|
-
neutral:
|
|
7
|
+
positive: "bg-positive",
|
|
8
|
+
negative: "bg-negative",
|
|
9
|
+
neutral: "bg-neutral",
|
|
9
10
|
};
|
|
10
11
|
let currentSentiment = sentiment === null || sentiment === void 0 ? void 0 : sentiment.toLowerCase();
|
|
11
12
|
if (currentSentiment) {
|
|
@@ -15,6 +16,10 @@ const sentimentAnalysisTemplate = (sentiment) => {
|
|
|
15
16
|
}
|
|
16
17
|
});
|
|
17
18
|
}
|
|
19
|
+
const translatedSentiment = (0, agentAssistTranslator_helper_1.agentAssistTranslator)({
|
|
20
|
+
key: currentSentiment,
|
|
21
|
+
input,
|
|
22
|
+
});
|
|
18
23
|
return `
|
|
19
24
|
<!DOCTYPE html>
|
|
20
25
|
<html lang="en">
|
|
@@ -28,9 +33,9 @@ const sentimentAnalysisTemplate = (sentiment) => {
|
|
|
28
33
|
</style>
|
|
29
34
|
</head>
|
|
30
35
|
<body>
|
|
31
|
-
<div class="flex h-screen justify-center bg-gray-100">
|
|
36
|
+
<div class="flex h-screen justify-center bg-gray-100 rounded-lg">
|
|
32
37
|
<div class="flex flex-1 items-center justify-center overflow-hidden rounded-lg ${mapSentimentToColor[currentSentiment]} shadow-md">
|
|
33
|
-
<span class="
|
|
38
|
+
<span class="${fontSize} font-semibold text-white">${translatedSentiment}</span>
|
|
34
39
|
</div>
|
|
35
40
|
</div>
|
|
36
41
|
</body>
|
package/build/shared/charts/descriptors/agentAssist/htmlTemplates/transcriptAssistTemplate.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const stylesPartial_1 = require("./stylesPartial");
|
|
4
|
-
const transcriptAssistTemplate = (message, sentiment) => {
|
|
4
|
+
const transcriptAssistTemplate = ({ message, assetsBaseURL, sentiment, fontSize, messageFontSize, }) => {
|
|
5
5
|
const mapSentimentToColor = {
|
|
6
|
-
positive:
|
|
7
|
-
negative:
|
|
8
|
-
neutral:
|
|
6
|
+
positive: "bg-positive",
|
|
7
|
+
negative: "bg-negative",
|
|
8
|
+
neutral: "bg-neutral",
|
|
9
9
|
};
|
|
10
10
|
let currentSentiment = sentiment === null || sentiment === void 0 ? void 0 : sentiment.toLowerCase();
|
|
11
11
|
if (currentSentiment) {
|
|
@@ -28,21 +28,23 @@ const transcriptAssistTemplate = (message, sentiment) => {
|
|
|
28
28
|
</style>
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
|
-
<div class="flex h-screen flex-col justify-center bg-gray-100
|
|
32
|
-
<div class="relative flex flex-1 overflow-hidden rounded-
|
|
33
|
-
<div class="p-4 w-11/12">
|
|
34
|
-
<div class="
|
|
31
|
+
<div class="flex h-screen flex-col justify-center bg-gray-100 rounded-lg">
|
|
32
|
+
<div class="relative flex flex-1 overflow-hidden rounded-lg bg-white justify-between shadow-md">
|
|
33
|
+
<div class="p-4 w-11/12 overflow-auto">
|
|
34
|
+
<div class="${fontSize} font-semibold uppercase tracking-wide text-indigo-500">Transcription</div>
|
|
35
35
|
<div class="overflow-auto h-5/6">
|
|
36
|
-
<p class="mt-2 text-gray-800">${message}</p>
|
|
36
|
+
<p class="mt-2 text-gray-800 ${messageFontSize}">${message}</p>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
39
|
-
${currentSentiment
|
|
40
|
-
|
|
39
|
+
${currentSentiment
|
|
40
|
+
? `
|
|
41
|
+
<div id="sentiment" class="flex w-1/12 flex-col items-center justify-center ${mapSentimentToColor[currentSentiment]}">
|
|
41
42
|
<div class="mb-2 h-4 w-4">
|
|
42
|
-
<img class="max-h-full max-w-full" src="${
|
|
43
|
+
<img class="max-h-full max-w-full" src="${assetsBaseURL}/assets/${currentSentiment}.svg" alt="Smiley Icon" />
|
|
43
44
|
</div>
|
|
44
45
|
</div>
|
|
45
|
-
`
|
|
46
|
+
`
|
|
47
|
+
: ""}
|
|
46
48
|
</div>
|
|
47
49
|
</div>
|
|
48
50
|
</body>
|
|
@@ -5,6 +5,7 @@ exports.IDENTITY_ASSIST = void 0;
|
|
|
5
5
|
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
6
|
/* Templates */
|
|
7
7
|
const identityAssistTemplate_1 = require("./htmlTemplates/identityAssistTemplate");
|
|
8
|
+
const getFontSizeFieldOptions_1 = require("./helpers/getFontSizeFieldOptions");
|
|
8
9
|
/**
|
|
9
10
|
* Node name: "identityAssist"
|
|
10
11
|
*
|
|
@@ -39,14 +40,20 @@ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
39
40
|
options: [
|
|
40
41
|
{
|
|
41
42
|
label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__WIDGET_LAYOUT__OPTIONS__HORIZONTAL__LABEL",
|
|
42
|
-
value: "horizontal"
|
|
43
|
+
value: "horizontal",
|
|
43
44
|
},
|
|
44
45
|
{
|
|
45
46
|
label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__WIDGET_LAYOUT__OPTIONS__VERTICAL__LABEL",
|
|
46
|
-
value: "vertical"
|
|
47
|
+
value: "vertical",
|
|
47
48
|
},
|
|
48
|
-
]
|
|
49
|
-
}
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "showProfileImage",
|
|
54
|
+
label: "UI__NODE_EDITOR__IDENTITY_ASSIST__ENABLE_PROFILE_IMAGE__LABEL",
|
|
55
|
+
type: "toggle",
|
|
56
|
+
defaultValue: true,
|
|
50
57
|
},
|
|
51
58
|
{
|
|
52
59
|
key: "imageShape",
|
|
@@ -57,14 +64,18 @@ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
57
64
|
options: [
|
|
58
65
|
{
|
|
59
66
|
label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_SHAPE__OPTIONS__ROUND__LABEL",
|
|
60
|
-
value: "round"
|
|
67
|
+
value: "round",
|
|
61
68
|
},
|
|
62
69
|
{
|
|
63
70
|
label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_SHAPE__OPTIONS__SQUARE__LABEL",
|
|
64
|
-
value: "square"
|
|
71
|
+
value: "square",
|
|
65
72
|
},
|
|
66
|
-
]
|
|
67
|
-
}
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
condition: {
|
|
76
|
+
key: "showProfileImage",
|
|
77
|
+
value: true,
|
|
78
|
+
},
|
|
68
79
|
},
|
|
69
80
|
{
|
|
70
81
|
key: "imageUrl",
|
|
@@ -75,6 +86,10 @@ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
75
86
|
params: {
|
|
76
87
|
required: true,
|
|
77
88
|
},
|
|
89
|
+
condition: {
|
|
90
|
+
key: "showProfileImage",
|
|
91
|
+
value: true,
|
|
92
|
+
},
|
|
78
93
|
},
|
|
79
94
|
{
|
|
80
95
|
key: "customer",
|
|
@@ -90,19 +105,72 @@ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
90
105
|
description: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__CUSTOMER_DATA__DESCRIPTION",
|
|
91
106
|
defaultValue: `{"Email": "{{profile.email}}","Phone": "{{profile.phone}}"}`,
|
|
92
107
|
params: {
|
|
93
|
-
required: true
|
|
108
|
+
required: true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: "fontSize",
|
|
113
|
+
type: "select",
|
|
114
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE",
|
|
115
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__FONT_SIZE__INFO",
|
|
116
|
+
defaultValue: "text-sm",
|
|
117
|
+
params: {
|
|
118
|
+
options: getFontSizeFieldOptions_1.getFontSizeFieldOptions,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "profileFontSize",
|
|
123
|
+
type: "select",
|
|
124
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__IDENTITY_ASSIST__PROFILE__FONT_SIZE",
|
|
125
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__IDENTITY_ASSIST__PROFILE__FONT_SIZE__DESCRIPTION",
|
|
126
|
+
defaultValue: "text-xl",
|
|
127
|
+
params: {
|
|
128
|
+
options: getFontSizeFieldOptions_1.getFontSizeFieldOptions,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: "keyValueFontSize",
|
|
133
|
+
type: "select",
|
|
134
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__IDENTITY_ASSIST__KEY_VALUE__FONT_SIZE",
|
|
135
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__IDENTITY_ASSIST__KEY_VALUE__FONT_SIZE__DESCRIPTION",
|
|
136
|
+
defaultValue: "text-sm",
|
|
137
|
+
params: {
|
|
138
|
+
options: getFontSizeFieldOptions_1.getFontSizeFieldOptions,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: "profileImageSize",
|
|
143
|
+
type: "select",
|
|
144
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__IDENTITY_ASSIST__IMAGE__SIZE",
|
|
145
|
+
description: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__IDENTITY_ASSIST__IMAGE__SIZE__DESCRIPTION",
|
|
146
|
+
defaultValue: "h-32 w-32",
|
|
147
|
+
params: {
|
|
148
|
+
options: getFontSizeFieldOptions_1.getImageSizeFieldOptions,
|
|
149
|
+
},
|
|
150
|
+
condition: {
|
|
151
|
+
key: "showProfileImage",
|
|
152
|
+
value: true,
|
|
94
153
|
},
|
|
95
154
|
},
|
|
96
155
|
],
|
|
97
|
-
sections: [
|
|
156
|
+
sections: [
|
|
157
|
+
{
|
|
158
|
+
key: "uiPreferences",
|
|
159
|
+
label: "UI__NODE_EDITOR__COPILOT__TILE_UI_PREFERENCES__TITLE",
|
|
160
|
+
defaultCollapsed: true,
|
|
161
|
+
fields: ["fontSize", "profileFontSize", "keyValueFontSize", "profileImageSize"],
|
|
162
|
+
},
|
|
163
|
+
],
|
|
98
164
|
form: [
|
|
99
165
|
{ type: "field", key: "tileId" },
|
|
100
166
|
{ type: "field", key: "widgetLayout" },
|
|
167
|
+
{ type: "field", key: "showProfileImage" },
|
|
101
168
|
{ type: "field", key: "imageShape" },
|
|
102
169
|
{ type: "field", key: "imageUrl" },
|
|
103
170
|
{ type: "field", key: "customer" },
|
|
104
171
|
{ type: "field", key: "customerData" },
|
|
105
|
-
|
|
172
|
+
{ type: "section", key: "uiPreferences" },
|
|
173
|
+
].filter(element => !!element),
|
|
106
174
|
function: async (params) => {
|
|
107
175
|
const { cognigy, config } = params;
|
|
108
176
|
const { api } = cognigy;
|
|
@@ -118,8 +186,13 @@ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
118
186
|
imageShape,
|
|
119
187
|
imageUrl,
|
|
120
188
|
customer,
|
|
121
|
-
customerData
|
|
122
|
-
|
|
189
|
+
customerData,
|
|
190
|
+
fontSize: config.fontSize,
|
|
191
|
+
profileFontSize: config.profileFontSize,
|
|
192
|
+
keyValueFontSize: config.keyValueFontSize,
|
|
193
|
+
showProfileImage: config.showProfileImage,
|
|
194
|
+
profileImageSize: config.profileImageSize,
|
|
195
|
+
}),
|
|
123
196
|
};
|
|
124
197
|
cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
|
|
125
198
|
id: config.tileId,
|
|
@@ -128,8 +201,8 @@ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
128
201
|
} }));
|
|
129
202
|
}
|
|
130
203
|
catch (err) {
|
|
131
|
-
api.
|
|
204
|
+
api.logDebugError(err, "UI__DEBUG_MODE__IDENTITY_ASSIST__ERROR");
|
|
132
205
|
}
|
|
133
|
-
}
|
|
206
|
+
},
|
|
134
207
|
});
|
|
135
208
|
//# sourceMappingURL=identityAssist.js.map
|