@cognigy/rest-api-client 0.15.0 → 0.16.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 (137) hide show
  1. package/CHANGELOG.md +11 -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 +187 -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 +105 -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 +6 -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 +3 -1
  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 +103 -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 +38 -8
  76. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +31 -9
  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 +118 -4
  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 +158 -10
  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 +2 -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 +15 -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 +91 -8
  106. package/build/shared/interfaces/resources/IAuditEvent.js +1 -0
  107. package/build/shared/interfaces/resources/IConnectionSchema.js +3 -0
  108. package/build/shared/interfaces/resources/IEndpoint.js +1 -0
  109. package/build/shared/interfaces/resources/IExtension.js +3 -0
  110. package/build/shared/interfaces/resources/ILargeLanguageModel.js +24 -5
  111. package/build/shared/interfaces/resources/INodeDescriptorSet.js +23 -1
  112. package/build/shared/interfaces/resources/TNLUConnectorType.js +0 -1
  113. package/build/shared/interfaces/resources/TRestChannelType.js +16 -11
  114. package/build/shared/interfaces/resources/TWebhookChannelType.js +6 -1
  115. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeChunk.js +21 -3
  116. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeSource.js +13 -2
  117. package/build/shared/interfaces/resources/knowledgeStore/IKnowledgeStore.js +1 -1
  118. package/build/shared/interfaces/resources/settings/IAgentSettings.js +3 -23
  119. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -0
  120. package/build/shared/interfaces/resources/settings/ITranslationSettings.js +63 -0
  121. package/build/shared/interfaces/resources/settings/index.js +4 -1
  122. package/build/shared/interfaces/restAPI/administration/voiceGateway/v2.0/IReadVoiceGatewayAccountRest_2_0.js +3 -0
  123. package/build/shared/interfaces/restAPI/administration/voiceGateway/v2.0/ISetupVoiceGatewayAccountRest_2_0.js +3 -0
  124. package/build/shared/interfaces/restAPI/administration/voiceGateway/v2.0/index.js +3 -0
  125. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/IGetKnowledgeQueryCounterOrganisationRest_2_0.js +3 -0
  126. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/IGetKnowledgeQueryCounterRest_2_0.js +3 -0
  127. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/IKnowlegeQueryCounterAggregatedValue_2_0.js +3 -0
  128. package/build/shared/interfaces/restAPI/metrics/knowledgeQueryCounter/v2.0/index.js +3 -0
  129. package/build/shared/interfaces/restAPI/resources/nluconnector/v2.0/TNLUConnectorType_2_0.js +0 -2
  130. package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/IUploadResumableRest_2_0.js +17 -0
  131. package/build/shared/interfaces/restAPI/resources/uploadResumable/v2.0/index.js +3 -0
  132. package/build/shared/interfaces/security/IKnowledgeQueryCounterAggregatedValue.js +3 -0
  133. package/build/shared/interfaces/security/IPermission.js +2 -0
  134. package/build/shared/interfaces/security/IRole.js +3 -1
  135. package/build/test.js +27 -0
  136. package/package.json +19 -17
  137. package/types/index.d.ts +581 -129
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const nextActionWidgetTemplate = (text) => {
4
+ return `<!DOCTYPE html>
5
+ <html lang="en">
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
+ <script>
15
+ let showButton = false;
16
+
17
+ function updateButtonVisibility() {
18
+ const button = document.getElementById("liveAgentForwardButton");
19
+ if (button) {
20
+ button.className = showButton
21
+ ? "absolute bottom-0 right-0 flex items-center justify-center"
22
+ : "hidden";
23
+ }
24
+ }
25
+
26
+ window.addEventListener("message", (event) => {
27
+ const message = event.data;
28
+
29
+ if (message.type === "toggleButton") {
30
+ showButton = message.show;
31
+ updateButtonVisibility();
32
+ }
33
+ });
34
+
35
+ function sendPostMessage() {
36
+ const content = document.querySelector("p").innerHTML;
37
+ window.parent.postMessage(
38
+ { type: "replyBoxContent", content },
39
+ "${process.env.AGENT_ASSIST_WORKSPACE_FRONTEND_URL_WITH_PROTOCOL}"
40
+ );
41
+ }
42
+
43
+ document.addEventListener("DOMContentLoaded", updateButtonVisibility);
44
+ </script>
45
+ </head>
46
+ <body>
47
+ <div class="flex h-screen flex-col justify-center bg-gray-100 pb-1">
48
+ <div
49
+ class="relative flex flex-1 overflow-hidden rounded-xl bg-white shadow-md"
50
+ >
51
+ <div class="absolute right-2 top-2">
52
+ <img
53
+ class="h-6 w-6"
54
+ src="https://www.cognigy.com/hubfs/AI%20badge.png"
55
+ alt="AI Logo"
56
+ />
57
+ </div>
58
+ <div>
59
+ <div
60
+ class="text-sm font-semibold uppercase tracking-wide ml-6 mt-6 text-indigo-500"
61
+ >
62
+ Next Best Action
63
+ </div>
64
+ <div class="p-6 overflow-auto h-5/6">
65
+ <p class="mt-2 text-gray-800">${text}</p>
66
+ </div>
67
+ <button
68
+ id="liveAgentForwardButton"
69
+ onclick="sendPostMessage()"
70
+ class="hidden"
71
+ >
72
+ <svg
73
+ width="45px"
74
+ height="auto"
75
+ viewBox="0 0 45 35"
76
+ xmlns="http://www.w3.org/2000/svg"
77
+ >
78
+ <path
79
+ 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"
80
+ fill="#0b3694"
81
+ transform="scale(-1, 1) translate(-50, 0)"
82
+ />
83
+ </svg>
84
+ </button>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </body>
89
+ </html>
90
+ `;
91
+ };
92
+ exports.default = nextActionWidgetTemplate;
93
+ //# sourceMappingURL=nextActionWidgetTemplate.js.map
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const template = () => `
4
+ <!DOCTYPE html>
5
+ <html>
6
+ <head>
7
+ <meta charset="UTF-8">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" />
10
+ </head>
11
+ <body>
12
+ <div
13
+ class="relative flex min-h-screen flex-col justify-center overflow-hidden bg-white py-6 sm:py-12"
14
+ >
15
+ <button
16
+ id="postbackButton"
17
+ class="bg-blue-900 hover:bg-blue-800 disabled:bg-blue-300 text-gray-50 py-2 px-4 rounded-full m-auto active:translate-y-0.5"
18
+ >
19
+ Request payment information
20
+ </button>
21
+ </div>
22
+ <script>
23
+
24
+ const u = (o) => ({ __INTER_FRAME_SOCKET_MESSAGE: !0, workspaceEvent: o }),
25
+ h = (o, e) => ({ type: o, payload: e }),
26
+ w = (o) => {
27
+ var e;
28
+ return !!((e = o.data) != null && e.__INTER_FRAME_SOCKET_MESSAGE);
29
+ };
30
+
31
+ class b {
32
+
33
+ constructor(e, a, d) {
34
+ (this.sourceWindow = e),
35
+ (this.targetWindow = a),
36
+ (this.targetOrigin = d),
37
+ (this.emit = (s, r) => {
38
+ const t = h(s, r),
39
+ i = u(t);
40
+ this.targetWindow.postMessage(i, this.targetOrigin);
41
+ });
42
+ }
43
+
44
+ }
45
+
46
+ class c {
47
+ constructor() {
48
+
49
+ this.socket = new b(
50
+ window,
51
+ window.parent,
52
+ new URL(document?.referrer || window?.origin).origin
53
+ );
54
+
55
+ return this; // Return this object.
56
+ }
57
+ postback(e) {
58
+ this.socket.emit("postback", e); // Send the postback event immediately.
59
+ return this; // Return this object for chaining.
60
+ }
61
+ static log(...e) {
62
+ console.log("[AgentAssistWorkspaceSDK]", ...e);
63
+ }
64
+ }
65
+
66
+ window.SDK = new c();
67
+
68
+ document.getElementById('postbackButton').onclick = (event) => {
69
+ // data to be send in postback
70
+ const data = '__secureForms_init__'
71
+
72
+ event.target.disabled = true;
73
+
74
+ window.SDK.postback(data);
75
+ };
76
+ </script>
77
+ </body>
78
+ </html>
79
+ `;
80
+ exports.default = template;
81
+ //# sourceMappingURL=stage0.js.map
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const template = (params) => {
4
+ const { appUrl, appLinkSent } = params;
5
+ return `
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" />
12
+ </head>
13
+ <body>
14
+ <div
15
+ class="relative flex min-h-screen flex-col justify-center overflow-hidden py-6"
16
+ >
17
+ <p
18
+ class="animate-pulse m-0 text-base text-center font-semibold text-lg"
19
+ >
20
+ Waiting for payment card data...
21
+ </p>
22
+
23
+ <p
24
+ class="m-0 mt-12 text-base text-center"
25
+ >
26
+ If the user has not received the link,
27
+ <br /> forward it manually:
28
+ <code class="my-4 block text-xs">${appUrl}</code>
29
+ </p>
30
+ </div>
31
+ <script>
32
+
33
+ const u = (o) => ({ __INTER_FRAME_SOCKET_MESSAGE: !0, workspaceEvent: o }),
34
+ h = (o, e) => ({ type: o, payload: e }),
35
+ w = (o) => {
36
+ var e;
37
+ return !!((e = o.data) != null && e.__INTER_FRAME_SOCKET_MESSAGE);
38
+ };
39
+
40
+ class b {
41
+
42
+ constructor(e, a, d) {
43
+ (this.sourceWindow = e),
44
+ (this.targetWindow = a),
45
+ (this.targetOrigin = d),
46
+ (this.emit = (s, r) => {
47
+ const t = h(s, r),
48
+ i = u(t);
49
+ this.targetWindow.postMessage(i, this.targetOrigin);
50
+ });
51
+ }
52
+
53
+ }
54
+
55
+ class c {
56
+ constructor() {
57
+
58
+ this.socket = new b(
59
+ window,
60
+ window.parent,
61
+ new URL(document?.referrer || window?.origin).origin
62
+ );
63
+
64
+ return this; // Return this object.
65
+ }
66
+ sendMessage(e) {
67
+ this.socket.emit("sendMessage", e); // Send text message to handover session .
68
+ return this; // Return this object for chaining.
69
+ }
70
+ }
71
+
72
+ window.SDK = new c();
73
+
74
+ if (!${appLinkSent}) {
75
+ window.SDK.sendMessage?.("${appUrl}");
76
+ }
77
+
78
+ </script>
79
+ </body>
80
+ </html>
81
+ `;
82
+ };
83
+ exports.default = template;
84
+ //# sourceMappingURL=stage1.js.map
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const template = (params) => {
4
+ const { retrieveUrl, jwtReadToken } = params;
5
+ return `
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" />
12
+ </head>
13
+ <body>
14
+ <div
15
+ class="relative flex min-h-screen flex-col justify-center overflow-hidden bg-gray-50 py-6 sm:py-12"
16
+ >
17
+ <form class="w-auto m-auto text-center" id="form">
18
+ <label for="pin" class="block">Unlock pin</label>
19
+ <input
20
+ type="text"
21
+ id="pin"
22
+ name="pin"
23
+ class="block py-2 px-2 font-semibold my-2 border border-gray-300 rounded-md mx-auto"
24
+ autocomplete="off"
25
+ />
26
+ <p class="text-xs text-gray-700">Please enter the unlock pin provided by the customer</p>
27
+ <button
28
+ id="submit"
29
+ class="bg-blue-900 hover:bg-blue-800 text-white py-2 px-5 rounded-full m-auto mt-3 active:translate-y-0.5"
30
+ >
31
+ Unlock card info
32
+ </button>
33
+ </form>
34
+ </div>
35
+ <script type="module">
36
+ import dompurify from "https://cdn.jsdelivr.net/npm/dompurify@3.0.5/+esm"
37
+
38
+ const config = {ALLOWED_TAGS: [], SAFE_FOR_TEMPLATES: true};
39
+
40
+ const retrieveUrl = "${retrieveUrl}";
41
+ const apiKey = "${jwtReadToken}";
42
+
43
+ document.querySelector("#submit").addEventListener("click", async function (event) {
44
+ event.stopPropagation();
45
+ event.preventDefault();
46
+
47
+ try {
48
+ const pin = document.querySelector("#pin").value;
49
+ const button = document.querySelector("#submit");
50
+ button.setAttribute("disabled", true);
51
+
52
+ const fullUrl = new URL(retrieveUrl);
53
+ fullUrl.searchParams.append("pin", pin);
54
+
55
+ const result = await fetch(fullUrl, {
56
+ method: "GET",
57
+ headers: {
58
+ Authorization: apiKey,
59
+ },
60
+ });
61
+
62
+ if (!result.ok) throw new Error("The form could not be retrieved.");
63
+
64
+ const { fields } = await result.json();
65
+
66
+ const html = cardTemplate(fields);
67
+
68
+ document.getElementById("form").innerHTML = html;
69
+ document.getElementById("form").classList.remove("text-center");
70
+ } catch (error) {
71
+ console.error(error);
72
+ alert(
73
+ "Something went wrong when retrieving card data. More details in the console.",
74
+ );
75
+ button.setAttribute("disabled", false);
76
+ }
77
+ });
78
+
79
+ const cardTemplate = fields => \`
80
+ <div class="flex flex-col justify-center items-center pl-2">
81
+ <div class="flex flex-col">
82
+ <p class="text-sm font-semibold">Card Number:<span class="font-normal"> \${dompurify.sanitize(fields.number, config)\}</span></p>
83
+ <p class="text-sm font-semibold">Card Holder:<span class="font-normal"> \${dompurify.sanitize(fields.cardHolder, config)\}</span></p>
84
+ <p class="text-sm font-semibold">Expiry:<span class="font-normal"> \${dompurify.sanitize(fields.expiration, config)\}</span></p>
85
+ <p class="text-sm font-semibold">CVC/CVV:<span class="font-normal"> \${dompurify.sanitize(fields.cvc, config)\}</span></p>
86
+ <p class="mt-8 text-sm text-gray-700">For security reasons, the card data can only be unlocked once.</p>
87
+ <p class="text-sm text-gray-700">It disappears when switching to another conversation.</p>
88
+ <p class="font-bold mt-4 text-sm text-gray-700">Take immediate action.</p>
89
+ </div>
90
+ </div>\`
91
+ </script>
92
+ </body>
93
+ </html>
94
+ `;
95
+ };
96
+ exports.default = template;
97
+ //# sourceMappingURL=stage2.js.map
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const template = (params) => {
4
+ const { error } = params;
5
+ return `
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" />
12
+ </head>
13
+ <body>
14
+ <div
15
+ class="relative flex min-h-screen flex-col justify-center overflow-hidden bg-white py-6 sm:py-12 text-center"
16
+ >
17
+ <h1 class="text-lg font-bold">${error}</h1>
18
+ <button
19
+ id="postbackButton"
20
+ class="bg-red-800 hover:bg-red-700 disabled:bg-red-300 text-gray-50 py-2 px-4 rounded-full m-auto active:translate-y-0.5"
21
+ >
22
+ Request payment information
23
+ </button>
24
+ </div>
25
+ <script>
26
+
27
+ const u = (o) => ({ __INTER_FRAME_SOCKET_MESSAGE: !0, workspaceEvent: o }),
28
+ h = (o, e) => ({ type: o, payload: e }),
29
+ w = (o) => {
30
+ var e;
31
+ return !!((e = o.data) != null && e.__INTER_FRAME_SOCKET_MESSAGE);
32
+ };
33
+
34
+ class b {
35
+
36
+ constructor(e, a, d) {
37
+ (this.sourceWindow = e),
38
+ (this.targetWindow = a),
39
+ (this.targetOrigin = d),
40
+ (this.emit = (s, r) => {
41
+ const t = h(s, r),
42
+ i = u(t);
43
+ this.targetWindow.postMessage(i, this.targetOrigin);
44
+ });
45
+ }
46
+
47
+ }
48
+
49
+ class c {
50
+ constructor() {
51
+
52
+ this.socket = new b(
53
+ window,
54
+ window.parent,
55
+ new URL(document?.referrer || window?.origin).origin
56
+ );
57
+
58
+ return this; // Return this object.
59
+ }
60
+ postback(e) {
61
+ this.socket.emit("postback", e); // Send the postback event immediately.
62
+ return this; // Return this object for chaining.
63
+ }
64
+ static log(...e) {
65
+ console.log("[AgentAssistWorkspaceSDK]", ...e);
66
+ }
67
+ }
68
+
69
+ window.SDK = new c();
70
+
71
+ document.getElementById('postbackButton').onclick = (event) => {
72
+ // data to be send in postback
73
+ const data = '__secureForms_init__'
74
+
75
+ event.target.disabled = true;
76
+
77
+ window.SDK.postback(data);
78
+ };
79
+ </script>
80
+ </body>
81
+ </html>
82
+ `;
83
+ };
84
+ exports.default = template;
85
+ //# sourceMappingURL=stageError.js.map
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stylesPartial_1 = require("./stylesPartial");
4
+ const sentimentAnalysisTemplate = (sentiment) => {
5
+ const mapSentimentToColor = {
6
+ positive: 'bg-positive',
7
+ negative: 'bg-negative',
8
+ neutral: 'bg-neutral'
9
+ };
10
+ let currentSentiment = sentiment === null || sentiment === void 0 ? void 0 : sentiment.toLowerCase();
11
+ if (currentSentiment) {
12
+ Object.keys(mapSentimentToColor).forEach((key) => {
13
+ if (currentSentiment.includes(key)) {
14
+ currentSentiment = key;
15
+ }
16
+ });
17
+ }
18
+ return `
19
+ <!DOCTYPE html>
20
+ <html lang="en">
21
+ <head>
22
+ <meta charset="UTF-8">
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
24
+ <title>Positive Box</title>
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
26
+ <style>
27
+ ${stylesPartial_1.default}
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <div class="flex h-screen justify-center bg-gray-100">
32
+ <div class="flex flex-1 items-center justify-center overflow-hidden rounded-lg ${mapSentimentToColor[currentSentiment]} shadow-md">
33
+ <span class="text-4xl font-semibold text-white">${sentiment}</span>
34
+ </div>
35
+ </div>
36
+ </body>
37
+ </html>
38
+ `;
39
+ };
40
+ exports.default = sentimentAnalysisTemplate;
41
+ //# sourceMappingURL=sentimentAnalysisTemplate.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stylesPartial = `
4
+ .bg-positive {
5
+ background-color: #86efac;
6
+ }
7
+ .bg-negative {
8
+ background-color: #e57373;
9
+ }
10
+ .bg-neutral {
11
+ background-color: #c0c0c0;
12
+ }
13
+ `;
14
+ exports.default = stylesPartial;
15
+ //# sourceMappingURL=stylesPartial.js.map
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stylesPartial_1 = require("./stylesPartial");
4
+ const transcriptAssistTemplate = (message, sentiment) => {
5
+ const mapSentimentToColor = {
6
+ positive: 'bg-positive',
7
+ negative: 'bg-negative',
8
+ neutral: 'bg-neutral'
9
+ };
10
+ let currentSentiment = sentiment === null || sentiment === void 0 ? void 0 : sentiment.toLowerCase();
11
+ if (currentSentiment) {
12
+ Object.keys(mapSentimentToColor).forEach((key) => {
13
+ if (currentSentiment.includes(key)) {
14
+ currentSentiment = key;
15
+ }
16
+ });
17
+ }
18
+ return `
19
+ <!DOCTYPE html>
20
+ <html lang="en">
21
+ <head>
22
+ <meta charset="UTF-8">
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
24
+ <title>Next Best Action</title>
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
26
+ <style>
27
+ ${stylesPartial_1.default}
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <div class="flex h-screen flex-col justify-center bg-gray-100 pb-1">
32
+ <div class="relative flex flex-1 overflow-hidden rounded-xl bg-white justify-between shadow-md">
33
+ <div class="p-4 w-11/12">
34
+ <div class="text-sm font-semibold uppercase tracking-wide text-indigo-500">Transcription</div>
35
+ <div class="overflow-auto h-5/6">
36
+ <p class="mt-2 text-gray-800">${message}</p>
37
+ </div>
38
+ </div>
39
+ ${currentSentiment ? `
40
+ <div class="flex w-1/12 flex-col items-center justify-center ${mapSentimentToColor[currentSentiment]}">
41
+ <div class="mb-2 h-4 w-4">
42
+ <img class="max-h-full max-w-full" src="${process.env.AGENT_ASSIST_WORKSPACE_FRONTEND_URL_WITH_PROTOCOL}/assets/${currentSentiment}.svg" alt="Smiley Icon" />
43
+ </div>
44
+ </div>
45
+ ` : ''}
46
+ </div>
47
+ </div>
48
+ </body>
49
+ </html>
50
+ `;
51
+ };
52
+ exports.default = transcriptAssistTemplate;
53
+ //# sourceMappingURL=transcriptAssistTemplate.js.map
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IDENTITY_ASSIST = void 0;
4
+ /* Custom Modules */
5
+ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
+ /* Templates */
7
+ const identityAssistTemplate_1 = require("./htmlTemplates/identityAssistTemplate");
8
+ /**
9
+ * Node name: "identityAssist"
10
+ *
11
+ * Purpose:
12
+ * Set a Identity Assist Tile for the Agent Assist Workspace
13
+ */
14
+ exports.IDENTITY_ASSIST = (0, createNodeDescriptor_1.createNodeDescriptor)({
15
+ type: "identityAssist",
16
+ defaultLabel: "Copilot: Identity Tile",
17
+ summary: "UI__NODE_EDITOR__IDENTITY_ASSIST__SUMMARY",
18
+ appearance: {
19
+ showIcon: false,
20
+ },
21
+ tags: ["agentAssist"],
22
+ fields: [
23
+ {
24
+ key: "tileId",
25
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__TILE_ID__LABEL",
26
+ description: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__TILE_ID__DESCRIPTION",
27
+ type: "cognigyText",
28
+ defaultValue: "identity-assist",
29
+ params: {
30
+ required: true,
31
+ },
32
+ },
33
+ {
34
+ key: "widgetLayout",
35
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__WIDGET_LAYOUT__LABEL",
36
+ type: "select",
37
+ defaultValue: "horizontal",
38
+ params: {
39
+ options: [
40
+ {
41
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__WIDGET_LAYOUT__OPTIONS__HORIZONTAL__LABEL",
42
+ value: "horizontal"
43
+ },
44
+ {
45
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__WIDGET_LAYOUT__OPTIONS__VERTICAL__LABEL",
46
+ value: "vertical"
47
+ },
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ key: "imageShape",
53
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_SHAPE__LABEL",
54
+ type: "select",
55
+ defaultValue: "round",
56
+ params: {
57
+ options: [
58
+ {
59
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_SHAPE__OPTIONS__ROUND__LABEL",
60
+ value: "round"
61
+ },
62
+ {
63
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_SHAPE__OPTIONS__SQUARE__LABEL",
64
+ value: "square"
65
+ },
66
+ ]
67
+ }
68
+ },
69
+ {
70
+ key: "imageUrl",
71
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_URL__LABEL",
72
+ description: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__IMAGE_URL__DESCRIPTION",
73
+ type: "cognigyText",
74
+ defaultValue: "{{profile.profilepic}}",
75
+ params: {
76
+ required: true,
77
+ },
78
+ },
79
+ {
80
+ key: "customer",
81
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__CUSTOMER__LABEL",
82
+ description: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__CUSTOMER__DESCRIPTION",
83
+ type: "cognigyText",
84
+ defaultValue: "{{profile.firstName}} {{profile.lastName}}",
85
+ },
86
+ {
87
+ key: "customerData",
88
+ type: "keyValuePairs",
89
+ label: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__CUSTOMER_DATA__LABEL",
90
+ description: "UI__NODE_EDITOR__IDENTITY_ASSIST__FIELDS__CUSTOMER_DATA__DESCRIPTION",
91
+ defaultValue: `{"Email": "{{profile.email}}","Phone": "{{profile.phone}}"}`,
92
+ params: {
93
+ required: true
94
+ },
95
+ },
96
+ ],
97
+ sections: [],
98
+ form: [
99
+ { type: "field", key: "tileId" },
100
+ { type: "field", key: "widgetLayout" },
101
+ { type: "field", key: "imageShape" },
102
+ { type: "field", key: "imageUrl" },
103
+ { type: "field", key: "customer" },
104
+ { type: "field", key: "customerData" },
105
+ ].filter((element) => !!element),
106
+ function: async (params) => {
107
+ const { cognigy, config } = params;
108
+ const { api } = cognigy;
109
+ const widgetLayout = config.widgetLayout;
110
+ const imageShape = config.imageShape;
111
+ const imageUrl = config.imageUrl;
112
+ const customer = config.customer;
113
+ const customerData = config.customerData;
114
+ try {
115
+ const data = {
116
+ html: (0, identityAssistTemplate_1.default)({
117
+ widgetLayout,
118
+ imageShape,
119
+ imageUrl,
120
+ customer,
121
+ customerData
122
+ })
123
+ };
124
+ cognigy.api.sendTileUpdateToAgentAssistWorkspace(Object.assign(Object.assign({}, params), { tile: {
125
+ id: config.tileId,
126
+ type: "html",
127
+ data,
128
+ } }));
129
+ }
130
+ catch (err) {
131
+ api.log("error", err);
132
+ }
133
+ }
134
+ });
135
+ //# sourceMappingURL=identityAssist.js.map