@chat21/chat21-web-widget 5.1.34 → 5.2.1
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/.angular-mcp-cache/package.json +1 -0
- package/.cursor/angular18-accessibility-auditor-skill.md +442 -0
- package/.cursor/mcp.json +15 -0
- package/.github/workflows/playwright.yml +27 -0
- package/CHANGELOG.md +25 -0
- package/Dockerfile +4 -5
- package/README.md +1 -1
- package/angular.json +21 -3
- package/docs/ACCESSIBILITY-STATEMENT.md +388 -0
- package/docs/TILEDESK_WIDGET_ACCESSIBILITY_ALIGNMENT.md +60 -0
- package/docs/TILEDESK_WIDGET_ACCESSIBILITY_STATEMENT_COMPLETE.md +386 -0
- package/env.sample +3 -2
- package/mocks/voice-websocket-mock/server.cjs +245 -0
- package/package.json +10 -3
- package/playwright.config.ts +41 -0
- package/src/app/app.component.html +2 -2
- package/src/app/app.component.scss +25 -14
- package/src/app/app.component.spec.ts +21 -6
- package/src/app/app.module.ts +13 -0
- package/src/app/component/conversation-detail/conversation/conversation.component.html +25 -11
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +38 -0
- package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +644 -75
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +70 -2
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +25 -13
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.spec.ts +123 -5
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.ts +1 -0
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +23 -10
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +18 -0
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +241 -149
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +8 -5
- package/src/app/component/conversation-detail/conversation-emojii/conversation-emojii.component.spec.ts +53 -3
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +203 -110
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +212 -1
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.spec.ts +458 -78
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +288 -76
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +113 -53
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +12 -4
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +274 -29
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +23 -9
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.spec.ts +80 -8
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +29 -23
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.spec.ts +185 -16
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +34 -14
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.html +46 -0
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.scss +83 -0
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.ts +192 -0
- package/src/app/component/error-alert/error-alert.component.spec.ts +65 -5
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +16 -7
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +21 -0
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.spec.ts +89 -7
- package/src/app/component/form/form-builder/form-builder.component.html +1 -1
- package/src/app/component/form/form-builder/form-builder.component.spec.ts +163 -21
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.html +8 -4
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +10 -5
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.spec.ts +90 -16
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +26 -0
- package/src/app/component/form/inputs/form-label/form-label.component.spec.ts +45 -11
- package/src/app/component/form/inputs/form-radio-button/form-radio-button.component.spec.ts +24 -6
- package/src/app/component/form/inputs/form-select/form-select.component.spec.ts +14 -5
- package/src/app/component/form/inputs/form-text/form-text.component.html +14 -12
- package/src/app/component/form/inputs/form-text/form-text.component.scss +11 -1
- package/src/app/component/form/inputs/form-text/form-text.component.spec.ts +113 -17
- package/src/app/component/form/inputs/form-text/form-text.component.ts +35 -3
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +13 -11
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +6 -5
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.spec.ts +149 -13
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +26 -0
- package/src/app/component/form/prechat-form/prechat-form.component.html +14 -11
- package/src/app/component/form/prechat-form/prechat-form.component.spec.ts +102 -10
- package/src/app/component/form/prechat-form/prechat-form.component.ts +8 -1
- package/src/app/component/form/prechat-form-test-mock.ts +35 -0
- package/src/app/component/home/home.component.html +38 -31
- package/src/app/component/home/home.component.scss +4 -2
- package/src/app/component/home/home.component.spec.ts +226 -11
- package/src/app/component/home-conversations/home-conversations.component.html +30 -26
- package/src/app/component/home-conversations/home-conversations.component.scss +3 -0
- package/src/app/component/home-conversations/home-conversations.component.spec.ts +212 -36
- package/src/app/component/last-message/last-message.component.html +15 -9
- package/src/app/component/last-message/last-message.component.scss +16 -2
- package/src/app/component/last-message/last-message.component.spec.ts +204 -23
- package/src/app/component/launcher-button/launcher-button.component.html +8 -13
- package/src/app/component/launcher-button/launcher-button.component.spec.ts +104 -8
- package/src/app/component/list-all-conversations/list-all-conversations.component.html +12 -17
- package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -0
- package/src/app/component/list-conversations/list-conversations.component.html +22 -22
- package/src/app/component/menu-options/menu-options.component.html +30 -20
- package/src/app/component/menu-options/menu-options.component.spec.ts +125 -9
- package/src/app/component/message/audio/audio.component.html +13 -15
- package/src/app/component/message/audio/audio.component.spec.ts +140 -5
- package/src/app/component/message/audio/audio.component.ts +1 -5
- package/src/app/component/message/audio-sync/audio-sync.component.html +18 -0
- package/src/app/component/message/audio-sync/audio-sync.component.scss +65 -0
- package/src/app/component/message/audio-sync/audio-sync.component.spec.ts +112 -0
- package/src/app/component/message/audio-sync/audio-sync.component.ts +714 -0
- package/src/app/component/message/avatar/avatar.component.html +2 -2
- package/src/app/component/message/avatar/avatar.component.spec.ts +99 -7
- package/src/app/component/message/bubble-message/bubble-message.component.html +41 -51
- package/src/app/component/message/bubble-message/bubble-message.component.scss +54 -1
- package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +147 -57
- package/src/app/component/message/bubble-message/bubble-message.component.ts +95 -13
- package/src/app/component/message/buttons/action-button/action-button.component.html +3 -4
- package/src/app/component/message/buttons/action-button/action-button.component.spec.ts +49 -5
- package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -8
- package/src/app/component/message/buttons/link-button/link-button.component.spec.ts +50 -5
- package/src/app/component/message/buttons/text-button/text-button.component.spec.ts +44 -5
- package/src/app/component/message/carousel/carousel.component.html +29 -16
- package/src/app/component/message/carousel/carousel.component.scss +20 -8
- package/src/app/component/message/carousel/carousel.component.spec.ts +80 -3
- package/src/app/component/message/carousel/carousel.component.ts +16 -0
- package/src/app/component/message/frame/frame.component.html +9 -4
- package/src/app/component/message/frame/frame.component.spec.ts +34 -15
- package/src/app/component/message/frame/frame.component.ts +7 -2
- package/src/app/component/message/html/html.component.html +1 -1
- package/src/app/component/message/html/html.component.scss +1 -1
- package/src/app/component/message/html/html.component.spec.ts +24 -7
- package/src/app/component/message/image/image.component.html +12 -10
- package/src/app/component/message/image/image.component.scss +16 -0
- package/src/app/component/message/image/image.component.spec.ts +101 -15
- package/src/app/component/message/image/image.component.ts +90 -51
- package/src/app/component/message/info-message/info-message.component.spec.ts +26 -14
- package/src/app/component/message/json-sources/json-sources.component.html +6 -5
- package/src/app/component/message/json-sources/json-sources.component.scss +26 -18
- package/src/app/component/message/json-sources/json-sources.component.ts +41 -0
- package/src/app/component/message/like-unlike/like-unlike.component.html +7 -9
- package/src/app/component/message/like-unlike/like-unlike.component.spec.ts +31 -3
- package/src/app/component/message/return-receipt/return-receipt.component.spec.ts +38 -17
- package/src/app/component/message/text/text.component.html +3 -3
- package/src/app/component/message/text/text.component.scss +80 -86
- package/src/app/component/message/text/text.component.spec.ts +106 -13
- package/src/app/component/message-attachment/message-attachment.component.spec.ts +134 -13
- package/src/app/component/selection-department/selection-department.component.html +21 -23
- package/src/app/component/selection-department/selection-department.component.spec.ts +159 -14
- package/src/app/component/selection-department/selection-department.component.ts +8 -1
- package/src/app/component/send-button/send-button.component.html +5 -13
- package/src/app/component/send-button/send-button.component.spec.ts +2 -2
- package/src/app/component/star-rating-widget/star-rating-widget.component.html +51 -81
- package/src/app/directives/tooltip.directive.spec.ts +8 -4
- package/src/app/modals/confirm-close/confirm-close.component.html +20 -8
- package/src/app/modals/confirm-close/confirm-close.component.scss +3 -0
- package/src/app/modals/confirm-close/confirm-close.component.spec.ts +13 -4
- package/src/app/modals/confirm-close/confirm-close.component.ts +8 -1
- package/src/app/pipe/html-entites-encode.pipe.spec.ts +35 -2
- package/src/app/pipe/marked.pipe.spec.ts +38 -2
- package/src/app/pipe/marked.pipe.ts +51 -41
- package/src/app/providers/app-config.service.ts +4 -2
- package/src/app/providers/brand.service.spec.ts +23 -2
- package/src/app/providers/brand.service.ts +1 -1
- package/src/app/providers/global-settings.service.spec.ts +1009 -14
- package/src/app/providers/global-settings.service.ts +40 -2
- package/src/app/providers/json-sources-parser.service.ts +13 -1
- package/src/app/providers/translator.service.ts +24 -7
- package/src/app/providers/tts-audio-playback-coordinator.service.spec.ts +116 -0
- package/src/app/providers/tts-audio-playback-coordinator.service.ts +122 -0
- package/src/app/providers/voice/STT&TTS/openai-voice.config.ts +12 -0
- package/src/app/providers/voice/STT&TTS/openai-voice.provider.ts +156 -0
- package/src/app/providers/voice/STT&TTS/speech-provider.abstract.ts +39 -0
- package/src/app/providers/voice/audio.types.ts +40 -0
- package/src/app/providers/voice/vad.service.spec.ts +28 -0
- package/src/app/providers/voice/vad.service.ts +70 -0
- package/src/app/providers/voice/voice-streaming.service.spec.ts +23 -0
- package/src/app/providers/voice/voice-streaming.service.ts +702 -0
- package/src/app/providers/voice/voice-streaming.types.ts +112 -0
- package/src/app/providers/voice/voice.service.spec.ts +227 -0
- package/src/app/providers/voice/voice.service.ts +969 -0
- package/src/app/sass/_variables.scss +2 -0
- package/src/app/sass/animations.scss +19 -1
- package/src/app/shims/onnxruntime-web-wasm.ts +4 -0
- package/src/app/utils/globals.ts +14 -0
- package/src/app/utils/utils-resources.ts +1 -1
- package/src/assets/i18n/en.json +128 -100
- package/src/assets/i18n/es.json +128 -100
- package/src/assets/i18n/fr.json +128 -100
- package/src/assets/i18n/it.json +128 -98
- package/src/assets/onnx/ort-wasm-simd-threaded.mjs +59 -0
- package/src/assets/onnx/ort-wasm-simd-threaded.wasm +0 -0
- package/src/assets/sounds/keyboard.mp3 +0 -0
- package/src/assets/vad/silero_vad_legacy.onnx +0 -0
- package/src/assets/vad/vad.worklet.bundle.min.js +1 -0
- package/src/chat21-core/models/message.ts +2 -1
- package/src/chat21-core/providers/chat-manager.spec.ts +72 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +3 -2
- package/src/chat21-core/providers/firebase/firebase-init-service.ts +5 -5
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +12 -0
- package/src/chat21-core/providers/scripts/script.service.spec.ts +12 -2
- package/src/chat21-core/utils/utils-message.ts +7 -0
- package/src/widget-config-template.json +3 -1
- package/src/widget-config.json +28 -27
- package/tests/widget-form-rich.spec.ts +67 -0
- package/tests/widget-index-dev-settings.spec.ts +52 -0
- package/tests/widget-twp-iframe.spec.ts +39 -0
- package/tsconfig.json +5 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat21/chat21-web-widget",
|
|
3
3
|
"author": "Tiledesk SRL",
|
|
4
|
-
"version": "5.1
|
|
4
|
+
"version": "5.2.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.tiledesk.com",
|
|
7
7
|
"repository": {
|
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"ng": "ng",
|
|
13
|
+
"copy-onnx-wasm": "mkdir -p src/assets/onnx && cp node_modules/onnxruntime-web/dist/ort-wasm-simd-threaded.mjs node_modules/onnxruntime-web/dist/ort-wasm-simd-threaded.wasm src/assets/onnx/",
|
|
13
14
|
"start": "ng serve",
|
|
14
15
|
"build": "ng build",
|
|
15
16
|
"test": "ng test",
|
|
17
|
+
"test:e2e": "playwright test",
|
|
16
18
|
"lint": "ng lint",
|
|
17
19
|
"e2e": "ng e2e",
|
|
18
|
-
"source-map-explorer": "source-map-explorer dist/*.js"
|
|
20
|
+
"source-map-explorer": "source-map-explorer dist/*.js",
|
|
21
|
+
"voice-mock": "node mocks/voice-websocket-mock/server.cjs"
|
|
19
22
|
},
|
|
20
23
|
"private": false,
|
|
21
24
|
"dependencies": {
|
|
@@ -32,6 +35,7 @@
|
|
|
32
35
|
"@ctrl/ngx-emoji-mart": "^9.2.0",
|
|
33
36
|
"@ngx-translate/core": "^16.0.4",
|
|
34
37
|
"@ngx-translate/http-loader": "^16.0.1",
|
|
38
|
+
"@ricky0123/vad-web": "^0.0.30",
|
|
35
39
|
"accept-language-parser": "^1.5.0",
|
|
36
40
|
"bootstrap": "^5.1.3",
|
|
37
41
|
"dayjs": "^1.11.7",
|
|
@@ -40,6 +44,7 @@
|
|
|
40
44
|
"humanize-duration-ts": "^2.1.1",
|
|
41
45
|
"marked": "^16.3.0",
|
|
42
46
|
"ngx-logger": "^5.0.11",
|
|
47
|
+
"onnxruntime-web": "^1.24.3",
|
|
43
48
|
"replace": "^1.2.2",
|
|
44
49
|
"rxjs": "^7.8.2",
|
|
45
50
|
"source-map-explorer": "^2.5.3",
|
|
@@ -52,6 +57,7 @@
|
|
|
52
57
|
"@angular/cli": "^18.2.19",
|
|
53
58
|
"@angular/compiler-cli": "^18.2.13",
|
|
54
59
|
"@angular/language-service": "^18.2.13",
|
|
60
|
+
"@playwright/test": "^1.59.1",
|
|
55
61
|
"@types/jasmine": "^3.6.11",
|
|
56
62
|
"@types/jasminewd2": "~2.0.3",
|
|
57
63
|
"@types/marked": "^6.0.0",
|
|
@@ -68,6 +74,7 @@
|
|
|
68
74
|
"protractor": "~7.0.0",
|
|
69
75
|
"ts-node": "~7.0.0",
|
|
70
76
|
"tslint": "~6.1.0",
|
|
71
|
-
"typescript": "~5.4"
|
|
77
|
+
"typescript": "~5.4",
|
|
78
|
+
"ws": "^8.18.0"
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
5
|
+
*/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
testDir: './tests',
|
|
8
|
+
timeout: 120_000,
|
|
9
|
+
expect: { timeout: 30_000 },
|
|
10
|
+
fullyParallel: true,
|
|
11
|
+
forbidOnly: !!process.env.CI,
|
|
12
|
+
retries: process.env.CI ? 2 : 0,
|
|
13
|
+
workers: process.env.CI ? 1 : undefined,
|
|
14
|
+
reporter: 'html',
|
|
15
|
+
use: {
|
|
16
|
+
baseURL: 'http://127.0.0.1:4203',
|
|
17
|
+
trace: 'on-first-retry',
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Solo Chromium: i test TWP chiamano API Tiledesk reali; più browser in parallelo
|
|
22
|
+
* aumentano flakiness. Per Firefox/WebKit decommentare i progetti sotto.
|
|
23
|
+
*/
|
|
24
|
+
projects: [
|
|
25
|
+
{
|
|
26
|
+
name: 'chromium',
|
|
27
|
+
use: { ...devices['Desktop Chrome'] },
|
|
28
|
+
},
|
|
29
|
+
// { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
|
|
30
|
+
// { name: 'webkit', use: { ...devices['Desktop Safari'] } },
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
webServer: {
|
|
34
|
+
command: 'npx ng serve widget --port 4203 --host 127.0.0.1',
|
|
35
|
+
url: 'http://127.0.0.1:4203/',
|
|
36
|
+
reuseExistingServer: !process.env.CI,
|
|
37
|
+
timeout: 300_000,
|
|
38
|
+
stdout: 'pipe',
|
|
39
|
+
stderr: 'pipe',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
<div id="tiledesk-container" [class.active]="g.isShown"
|
|
1
|
+
<!-- tabindex="9999" -->
|
|
2
|
+
<div id="tiledesk-container" [class.active]="g.isShown">
|
|
3
3
|
|
|
4
4
|
<div id="chat21-conversations"
|
|
5
5
|
[ngClass]="{ 'swing-in-bottom-fwd' : g.isOpen === true, 'full-screen-mode' : g.fullscreenMode === true, 'c21-align-left' : g.align === 'left', 'c21-align-right' : g.align !== 'left'}"
|
|
@@ -50,8 +50,18 @@ body {
|
|
|
50
50
|
margin:0px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/* Keyboard focus ring scoped to the widget host only (WCAG 2.4.7) */
|
|
54
|
+
chat-root *:focus:not(:focus-visible) {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
57
|
+
chat-root *:focus-visible {
|
|
58
|
+
outline: 2px solid var(--c21-focus-ring, #1a73e8);
|
|
59
|
+
outline-offset: 2px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
::-moz-focus-inner {
|
|
63
|
+
border: 0;
|
|
64
|
+
}
|
|
55
65
|
|
|
56
66
|
|
|
57
67
|
|
|
@@ -242,10 +252,7 @@ chat-root {
|
|
|
242
252
|
height: 100%;
|
|
243
253
|
|
|
244
254
|
// ========= BEGIN: RESET CSS TAG ========= //
|
|
245
|
-
|
|
246
|
-
outline: none;
|
|
247
|
-
}
|
|
248
|
-
button{
|
|
255
|
+
button {
|
|
249
256
|
cursor: pointer;
|
|
250
257
|
}
|
|
251
258
|
|
|
@@ -255,16 +262,21 @@ chat-root {
|
|
|
255
262
|
|
|
256
263
|
textarea,
|
|
257
264
|
textarea:visited,
|
|
258
|
-
textarea:focus,
|
|
259
265
|
textarea:hover,
|
|
260
|
-
textarea:active{
|
|
261
|
-
// all: unset;
|
|
266
|
+
textarea:active {
|
|
262
267
|
line-height: 20px!important;
|
|
263
|
-
|
|
264
|
-
box-shadow:none!important;
|
|
268
|
+
box-shadow: none!important;
|
|
265
269
|
border: 0px solid var(--trasp-light-black)!important;
|
|
266
270
|
}
|
|
267
271
|
|
|
272
|
+
textarea:focus:not(:focus-visible) {
|
|
273
|
+
outline: none!important;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
textarea:focus-visible {
|
|
277
|
+
outline: 0px !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
268
280
|
// ========= BEGIN: CSS APP.COMPONENT ========= //
|
|
269
281
|
.c21-button-clean {
|
|
270
282
|
-webkit-appearance: initial;
|
|
@@ -403,7 +415,7 @@ chat-root {
|
|
|
403
415
|
}
|
|
404
416
|
}
|
|
405
417
|
button.c21-button-primary:hover,
|
|
406
|
-
button.c21-button-primary:focus,
|
|
418
|
+
button.c21-button-primary:focus:not(:focus-visible),
|
|
407
419
|
button.c21-button-primary:active {
|
|
408
420
|
//outline-width: 0px;
|
|
409
421
|
opacity: 0.8;
|
|
@@ -419,10 +431,9 @@ chat-root {
|
|
|
419
431
|
cursor: pointer;
|
|
420
432
|
}
|
|
421
433
|
button.c21-button-link:hover,
|
|
422
|
-
button.c21-button-link:focus,
|
|
434
|
+
button.c21-button-link:focus:not(:focus-visible),
|
|
423
435
|
button.c21-button-link:active {
|
|
424
436
|
text-decoration: underline;
|
|
425
|
-
outline: none;
|
|
426
437
|
}
|
|
427
438
|
|
|
428
439
|
.c21-divBudge {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
1
2
|
import { Triggerhandler } from './../chat21-core/utils/triggerHandler';
|
|
2
3
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
3
4
|
import { RouterTestingModule } from '@angular/router/testing';
|
|
@@ -20,25 +21,32 @@ import { PresenceService } from 'src/chat21-core/providers/abstract/presence.ser
|
|
|
20
21
|
import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
|
|
21
22
|
import { AppConfigService } from './providers/app-config.service';
|
|
22
23
|
import { ChatManager } from 'src/chat21-core/providers/chat-manager';
|
|
23
|
-
import {
|
|
24
|
+
import { Globals } from './utils/globals';
|
|
25
|
+
|
|
26
|
+
|
|
24
27
|
import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
|
|
25
28
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
26
29
|
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
30
|
+
import { of } from 'rxjs';
|
|
27
31
|
|
|
28
32
|
describe('AppComponent', () => {
|
|
29
33
|
let component: AppComponent;
|
|
30
34
|
let fixture: ComponentFixture<AppComponent>;
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
|
|
36
|
+
const customLogger = new CustomLogger(ngxlogger);
|
|
33
37
|
|
|
34
38
|
beforeEach(waitForAsync(() => {
|
|
39
|
+
LoggerInstance.setInstance(customLogger);
|
|
40
|
+
spyOn(AppComponent.prototype, 'ngAfterViewInit').and.stub();
|
|
35
41
|
TestBed.configureTestingModule({
|
|
36
42
|
declarations: [
|
|
37
43
|
AppComponent
|
|
38
44
|
],
|
|
39
45
|
imports: [RouterTestingModule,
|
|
40
46
|
TranslateModule.forRoot()],
|
|
47
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
41
48
|
providers: [
|
|
49
|
+
Globals,
|
|
42
50
|
Triggerhandler,
|
|
43
51
|
GlobalSettingsService,
|
|
44
52
|
AppStorageService,
|
|
@@ -63,11 +71,18 @@ describe('AppComponent', () => {
|
|
|
63
71
|
}));
|
|
64
72
|
|
|
65
73
|
beforeEach(() => {
|
|
74
|
+
spyOn(TestBed.inject(GlobalSettingsService), 'getProjectParametersById').and.returnValue(
|
|
75
|
+
of({ project: null }) as any,
|
|
76
|
+
);
|
|
77
|
+
spyOn(TestBed.inject(GlobalSettingsService), 'manageLoadingDomains').and.returnValue(true);
|
|
78
|
+
|
|
79
|
+
const translator = TestBed.inject(TranslatorService);
|
|
80
|
+
spyOn(translator, 'initI18n').and.returnValue(Promise.resolve(undefined));
|
|
81
|
+
spyOn(translator, 'translate').and.stub();
|
|
82
|
+
spyOn(translator, 'getLanguage').and.returnValue('en');
|
|
83
|
+
|
|
66
84
|
fixture = TestBed.createComponent(AppComponent);
|
|
67
85
|
component = fixture.componentInstance;
|
|
68
|
-
LoggerInstance.setInstance(customLogger)
|
|
69
|
-
let logger = LoggerInstance.getInstance()
|
|
70
|
-
component['logger']= logger
|
|
71
86
|
fixture.detectChanges();
|
|
72
87
|
});
|
|
73
88
|
|
package/src/app/app.module.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { ConversationFooterComponent } from './component/conversation-detail/con
|
|
|
16
16
|
import { ConversationInternalFrameComponent } from './component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component';
|
|
17
17
|
import { ConversationPreviewComponent } from './component/conversation-detail/conversation-preview/conversation-preview.component';
|
|
18
18
|
import { ConversationAudioRecorderComponent } from './component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component';
|
|
19
|
+
import { StreamAudioSpectrumComponent } from './component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component';
|
|
19
20
|
/** CONVERSATION-DETAIL COMPONENTS */
|
|
20
21
|
import { BubbleMessageComponent } from './component/message/bubble-message/bubble-message.component';
|
|
21
22
|
import { AvatarComponent } from './component/message/avatar/avatar.component';
|
|
@@ -25,6 +26,7 @@ import { InfoMessageComponent } from './component/message/info-message/info-mess
|
|
|
25
26
|
import { HtmlComponent } from './component/message/html/html.component';
|
|
26
27
|
import { FrameComponent } from './component/message/frame/frame.component';
|
|
27
28
|
import { AudioComponent } from './component/message/audio/audio.component';
|
|
29
|
+
import { AudioSyncComponent } from './component/message/audio-sync/audio-sync.component';
|
|
28
30
|
import { UserTypingComponent } from './../chat21-core/utils/user-typing/user-typing.component';
|
|
29
31
|
/** MESSAGE ATTACHMENTS COMPONENTS */
|
|
30
32
|
import { MessageAttachmentComponent } from './component/message-attachment/message-attachment.component';
|
|
@@ -56,6 +58,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
56
58
|
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
|
57
59
|
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
58
60
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
61
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
59
62
|
import { environment } from 'src/environments/environment';
|
|
60
63
|
|
|
61
64
|
//THIRD-PART MODULES
|
|
@@ -136,6 +139,11 @@ import { Rules } from './utils/rules';
|
|
|
136
139
|
import { ScriptService } from 'src/chat21-core/providers/scripts/script.service';
|
|
137
140
|
import { CarouselComponent } from './component/message/carousel/carousel.component';
|
|
138
141
|
import { BrandService } from './providers/brand.service';
|
|
142
|
+
import { OpenAiVoiceProviderService } from './providers/voice/STT&TTS/openai-voice.provider';
|
|
143
|
+
import {
|
|
144
|
+
SpeechToTextProvider,
|
|
145
|
+
TextToSpeechProvider,
|
|
146
|
+
} from './providers/voice/STT&TTS/speech-provider.abstract';
|
|
139
147
|
import { ErrorAlertComponent } from './component/error-alert/error-alert.component';
|
|
140
148
|
import { ConfirmCloseComponent } from './modals/confirm-close/confirm-close.component';
|
|
141
149
|
import { JsonSourcesComponent } from './component/message/json-sources/json-sources.component';
|
|
@@ -289,6 +297,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
289
297
|
ConversationPreviewComponent,
|
|
290
298
|
ConversationInternalFrameComponent,
|
|
291
299
|
ConversationAudioRecorderComponent,
|
|
300
|
+
StreamAudioSpectrumComponent,
|
|
292
301
|
BubbleMessageComponent,
|
|
293
302
|
AvatarComponent,
|
|
294
303
|
FrameComponent,
|
|
@@ -301,6 +310,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
301
310
|
LinkButtonComponent,
|
|
302
311
|
TextButtonComponent,
|
|
303
312
|
AudioComponent,
|
|
313
|
+
AudioSyncComponent,
|
|
304
314
|
UserTypingComponent,
|
|
305
315
|
/**DIRECTIVES */
|
|
306
316
|
HtmlEntitiesEncodePipe,
|
|
@@ -318,6 +328,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
318
328
|
BrowserAnimationsModule,
|
|
319
329
|
FormsModule,
|
|
320
330
|
ReactiveFormsModule,
|
|
331
|
+
A11yModule,
|
|
321
332
|
PickerModule,
|
|
322
333
|
TranslateModule.forRoot({
|
|
323
334
|
// defaultLanguage: 'en',
|
|
@@ -407,6 +418,8 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
407
418
|
WaitingService,
|
|
408
419
|
ScriptService,
|
|
409
420
|
BrandService,
|
|
421
|
+
{ provide: SpeechToTextProvider, useExisting: OpenAiVoiceProviderService },
|
|
422
|
+
{ provide: TextToSpeechProvider, useExisting: OpenAiVoiceProviderService },
|
|
410
423
|
provideHttpClient(withInterceptorsFromDi())
|
|
411
424
|
],
|
|
412
425
|
bootstrap: [AppComponent]
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
<!-- onFocus="document.querySelector('[start-focus-chat21-conversation-component]').focus()" -->
|
|
4
|
-
<div id="chat21-conversation-component"
|
|
2
|
+
<div id="chat21-conversation-component"
|
|
5
3
|
#afConversationComponent
|
|
6
|
-
|
|
7
|
-
aria-
|
|
4
|
+
role="region"
|
|
5
|
+
[attr.aria-label]="g?.project?.widgetTitle"
|
|
6
|
+
[class.chat21-conversation--close-stream-active]="closeStreamButtonActiveForSheetBottom()">
|
|
7
|
+
|
|
8
|
+
<!-- Skip-link: revealed only on focus, jumps straight to the message composer (WCAG 2.4.1 Bypass Blocks). -->
|
|
9
|
+
<a class="c21-skip-link" href="#chat21-main-message-context"
|
|
10
|
+
(click)="$event.preventDefault(); skipToCompose()">
|
|
11
|
+
{{ translationMapFooter?.get('SKIP_TO_COMPOSER') || 'Skip to message composer' }}
|
|
12
|
+
</a>
|
|
8
13
|
|
|
9
14
|
<!-- HEADER -->
|
|
10
15
|
<chat-conversation-header
|
|
@@ -66,6 +71,7 @@
|
|
|
66
71
|
[showThinkingMessage]="showThinkingMessage"
|
|
67
72
|
[lastServerSenderKind]="lastServerSenderKind"
|
|
68
73
|
[fullscreenMode]="g?.fullscreenMode"
|
|
74
|
+
[isStreamAudioActive]="isStreamAudioActive"
|
|
69
75
|
[translationMap]="translationMapContent"
|
|
70
76
|
[stylesMap]="stylesMap"
|
|
71
77
|
(onBeforeMessageRender)="onBeforeMessageRenderFN($event)"
|
|
@@ -113,12 +119,16 @@
|
|
|
113
119
|
</dialog>
|
|
114
120
|
|
|
115
121
|
<!-- FOOTER -->
|
|
116
|
-
<!-- [class.maximize-width]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)" -->
|
|
117
122
|
<div id="chat21-footer">
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
<button *ngIf="showBadgeScroollToBottom"
|
|
124
|
+
type="button"
|
|
125
|
+
id="chat21-buttonToBottom"
|
|
126
|
+
class="c21-button-clean"
|
|
127
|
+
[attr.aria-label]="translationMapContent?.get('BUTTON_SCROLL_TO_BOTTOM') || 'Scroll to last message'"
|
|
128
|
+
(click)="scrollToBottom()">
|
|
129
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path opacity=".87" fill="none" d="M24 24H0V0h24v24z"/><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6-1.41-1.41z"/></svg>
|
|
130
|
+
<span *ngIf="messagesBadgeCount!=0" id="chat21-divBudge" class="c21-divBudge" aria-hidden="true">{{messagesBadgeCount}}</span>
|
|
131
|
+
</button>
|
|
122
132
|
|
|
123
133
|
<chat-conversation-footer
|
|
124
134
|
[conversationWith]="conversationWith"
|
|
@@ -132,6 +142,7 @@
|
|
|
132
142
|
[showAttachmentFooterButton]="g?.showAttachmentFooterButton"
|
|
133
143
|
[showEmojiFooterButton]="g?.showEmojiFooterButton"
|
|
134
144
|
[showAudioRecorderFooterButton]="g?.showAudioRecorderFooterButton"
|
|
145
|
+
[showAudioStreamFooterButton]="g?.showAudioStreamFooterButton"
|
|
135
146
|
[hideTextAreaContent]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)"
|
|
136
147
|
[isConversationArchived]="isConversationArchived"
|
|
137
148
|
[hideTextReply]="hideFooterTextReply"
|
|
@@ -148,7 +159,10 @@
|
|
|
148
159
|
(onAfterSendMessage)="onAfterSendMessageFN($event)"
|
|
149
160
|
(onChangeTextArea)="onChangeTextArea($event)"
|
|
150
161
|
(onAttachmentFileButtonClicked)="onAttachmentFileButtonClicked($event)"
|
|
151
|
-
(onNewConversationButtonClicked)="onNewConversationButtonClickedFN($event)"
|
|
162
|
+
(onNewConversationButtonClicked)="onNewConversationButtonClickedFN($event)"
|
|
163
|
+
(onStreamAudioActiveChange)="onStreamAudioActiveChange($event)"
|
|
164
|
+
(onStreamAudioConnectingChange)="onStreamAudioConnectingChange($event)"
|
|
165
|
+
(onCloseChatButtonClicked)="onCloseChatButtonClickedFN($event)">
|
|
152
166
|
</chat-conversation-footer>
|
|
153
167
|
|
|
154
168
|
</div>
|
|
@@ -13,6 +13,34 @@
|
|
|
13
13
|
bottom: var(--chat-footer-height) !important
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/* Skip-link visible only when focused via keyboard (WCAG 2.4.1) */
|
|
17
|
+
.c21-skip-link {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: -40px;
|
|
20
|
+
left: 8px;
|
|
21
|
+
z-index: 100;
|
|
22
|
+
padding: 6px 12px;
|
|
23
|
+
background-color: #1a73e8;
|
|
24
|
+
color: #ffffff !important;
|
|
25
|
+
border-radius: 4px;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
transition: top 0.15s ease-in-out;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.c21-skip-link:focus,
|
|
32
|
+
.c21-skip-link:focus-visible {
|
|
33
|
+
top: 8px;
|
|
34
|
+
outline: 2px solid #ffffff;
|
|
35
|
+
outline-offset: 2px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-reduced-motion: reduce) {
|
|
39
|
+
.c21-skip-link {
|
|
40
|
+
transition: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
// ============= CSS #chat21-conversation-component ================= //
|
|
17
45
|
#chat21-conversation-component {
|
|
18
46
|
// background-color: #ffffff;
|
|
@@ -242,6 +270,16 @@ dialog:-internal-dialog-in-top-layer{
|
|
|
242
270
|
::ng-deep .chat21-sheet-content{
|
|
243
271
|
bottom: calc(var(--chat-footer-logo-height) + var(--chat-footer-height) + 34px)!important;
|
|
244
272
|
}
|
|
273
|
+
|
|
274
|
+
/* Con `.close-stream-button` (stream in ascolto): spazio per alert stream sopra il footer */
|
|
275
|
+
#chat21-conversation-component.chat21-conversation--close-stream-active ::ng-deep .chat21-sheet-content {
|
|
276
|
+
bottom: calc(
|
|
277
|
+
var(--chat-footer-logo-height) +
|
|
278
|
+
var(--chat-footer-height) +
|
|
279
|
+
var(--chat-footer-stream-button-height) +
|
|
280
|
+
34px
|
|
281
|
+
) !important;
|
|
282
|
+
}
|
|
245
283
|
|
|
246
284
|
}
|
|
247
285
|
|