@chat21/chat21-web-widget 5.1.32-rc9 → 5.1.33-rc11
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/.playwright-mcp/console-2026-05-08T15-31-09-000Z.log +17 -0
- package/.playwright-mcp/console-2026-05-08T15-32-19-412Z.log +89 -0
- package/.playwright-mcp/console-2026-05-08T16-18-48-424Z.log +133 -0
- package/.playwright-mcp/console-2026-05-11T12-54-06-869Z.log +13 -0
- package/.playwright-mcp/console-2026-05-11T12-54-56-229Z.log +147 -0
- package/.playwright-mcp/console-2026-05-11T12-55-47-174Z.log +183 -0
- package/.playwright-mcp/console-2026-05-11T15-34-03-590Z.log +210 -0
- package/.playwright-mcp/console-2026-05-12T15-07-31-880Z.log +118 -0
- package/.playwright-mcp/page-2026-05-08T15-32-19-900Z.yml +851 -0
- package/.playwright-mcp/page-2026-05-08T15-32-47-264Z.yml +857 -0
- package/.playwright-mcp/page-2026-05-08T15-33-17-089Z.yml +1110 -0
- package/.playwright-mcp/page-2026-05-08T15-33-23-486Z.yml +1069 -0
- package/.playwright-mcp/page-2026-05-08T15-33-45-390Z.yml +1076 -0
- package/.playwright-mcp/page-2026-05-08T15-33-52-666Z.yml +1072 -0
- package/.playwright-mcp/page-2026-05-08T15-34-01-338Z.yml +1085 -0
- package/.playwright-mcp/page-2026-05-08T15-34-07-227Z.yml +1072 -0
- package/.playwright-mcp/page-2026-05-08T15-34-13-875Z.yml +1072 -0
- package/.playwright-mcp/page-2026-05-08T15-34-21-885Z.yml +1109 -0
- package/.playwright-mcp/page-2026-05-08T15-34-32-755Z.yml +1109 -0
- package/.playwright-mcp/page-2026-05-08T15-35-09-607Z.yml +1119 -0
- package/.playwright-mcp/page-2026-05-08T15-35-14-242Z.yml +1109 -0
- package/.playwright-mcp/page-2026-05-08T16-18-48-671Z.yml +44 -0
- package/.playwright-mcp/page-2026-05-08T16-18-52-753Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-19-13-919Z.yml +68 -0
- package/.playwright-mcp/page-2026-05-08T16-19-17-977Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-19-25-733Z.yml +120 -0
- package/.playwright-mcp/page-2026-05-08T16-19-29-252Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-19-39-269Z.yml +80 -0
- package/.playwright-mcp/page-2026-05-08T16-19-43-915Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-20-04-407Z.yml +81 -0
- package/.playwright-mcp/page-2026-05-08T16-20-08-984Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-20-32-397Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-20-58-658Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-21-12-320Z.yml +86 -0
- package/.playwright-mcp/page-2026-05-08T16-21-39-154Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-21-45-420Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-22-21-062Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-08T16-22-58-232Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-23-36-520Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-08T16-23-46-805Z.yml +100 -0
- package/.playwright-mcp/page-2026-05-08T16-23-55-169Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-24-26-574Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-25-34-414Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-25-59-831Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-26-21-809Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-26-47-443Z.yml +105 -0
- package/.playwright-mcp/page-2026-05-08T16-26-56-136Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-27-59-610Z.yml +48 -0
- package/.playwright-mcp/page-2026-05-11T12-54-07-180Z.yml +44 -0
- package/.playwright-mcp/page-2026-05-11T12-54-56-946Z.yml +4 -0
- package/.playwright-mcp/page-2026-05-11T12-55-47-503Z.yml +24 -0
- package/.playwright-mcp/page-2026-05-11T12-56-00-766Z.yml +28 -0
- package/.playwright-mcp/page-2026-05-11T12-56-06-438Z.yml +90 -0
- package/.playwright-mcp/page-2026-05-11T12-57-56-838Z.yml +106 -0
- package/.playwright-mcp/page-2026-05-11T12-58-00-124Z.yml +106 -0
- package/.playwright-mcp/page-2026-05-11T12-59-08-836Z.yml +61 -0
- package/.playwright-mcp/page-2026-05-11T12-59-12-088Z.yml +61 -0
- package/.playwright-mcp/page-2026-05-11T12-59-26-215Z.yml +69 -0
- package/.playwright-mcp/page-2026-05-11T12-59-29-519Z.yml +69 -0
- package/.playwright-mcp/page-2026-05-11T12-59-37-309Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-11T12-59-39-968Z.yml +79 -0
- package/.playwright-mcp/page-2026-05-11T12-59-45-983Z.yml +78 -0
- package/.playwright-mcp/page-2026-05-11T12-59-49-951Z.yml +78 -0
- package/.playwright-mcp/page-2026-05-11T15-34-04-515Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-12T15-07-32-171Z.yml +44 -0
- package/.playwright-mcp/page-2026-05-12T15-08-09-820Z.yml +119 -0
- package/CHANGELOG.md +61 -4
- package/angular.json +20 -3
- package/deploy_amazon_beta.sh +7 -17
- package/deploy_amazon_prod.sh +41 -0
- package/docs/TILEDESK_WIDGET_ACCESSIBILITY_STATEMENT_COMPLETE.md +379 -0
- package/env.sample +3 -2
- package/mocks/voice-websocket-mock/server.cjs +245 -0
- package/package.json +7 -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 +4 -0
- package/src/app/component/conversation-detail/conversation/conversation.component.html +19 -11
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +28 -0
- package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +644 -75
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +63 -17
- 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 +17 -7
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +15 -3
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +242 -149
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +7 -6
- 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 copy.html +172 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +112 -61
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +133 -16
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.spec.ts +452 -78
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +198 -84
- 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 -18
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.scss +60 -2
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.ts +135 -5
- 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 -0
- package/src/app/component/message/audio-sync/audio-sync.component.scss +1 -0
- package/src/app/component/message/audio-sync/audio-sync.component.spec.ts +81 -1
- package/src/app/component/message/audio-sync/audio-sync.component.ts +133 -86
- 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 +39 -52
- package/src/app/component/message/bubble-message/bubble-message.component.scss +59 -1
- package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +154 -57
- package/src/app/component/message/bubble-message/bubble-message.component.ts +152 -110
- 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 +38 -0
- package/src/app/component/message/json-sources/json-sources.component.scss +201 -0
- package/src/app/component/message/json-sources/json-sources.component.ts +89 -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 +59 -2
- package/src/app/providers/json-sources-parser.service.ts +175 -0
- package/src/app/providers/translator.service.ts +24 -6
- package/src/app/providers/tts-audio-playback-coordinator.service.spec.ts +117 -0
- package/src/app/providers/tts-audio-playback-coordinator.service.ts +39 -16
- package/src/app/providers/url-preview.service.ts +82 -0
- package/src/app/providers/voice/audio.types.ts +6 -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 +170 -3
- package/src/app/providers/voice/voice.service.ts +691 -17
- package/src/app/sass/_variables.scss +1 -1
- package/src/app/sass/animations.scss +19 -1
- package/src/app/utils/globals.ts +14 -0
- package/src/app/utils/json-sources-utils.ts +27 -0
- package/src/app/utils/url-utils.ts +98 -0
- package/src/app/utils/utils-resources.ts +1 -1
- package/src/assets/i18n/en.json +106 -100
- package/src/assets/i18n/es.json +107 -101
- package/src/assets/i18n/fr.json +107 -101
- package/src/assets/i18n/it.json +107 -99
- package/src/assets/sounds/keyboard.mp3 +0 -0
- package/src/assets/twp/index-dev.html +18 -0
- package/src/assets/twp/tiledesk_widget_files/widget-css-override-example.css +14 -0
- package/src/chat21-core/providers/chat-manager.spec.ts +72 -0
- package/src/chat21-core/providers/scripts/script.service.spec.ts +12 -2
- package/src/chat21-core/utils/constants.ts +4 -0
- package/src/chat21-core/utils/utils-message.ts +23 -1
- 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
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
max-height: 2.4em;
|
|
91
91
|
font-weight: 400;
|
|
92
92
|
font-size: 3.0em;
|
|
93
|
-
margin
|
|
93
|
+
margin: 0 0 10px 0;
|
|
94
94
|
}
|
|
95
95
|
.c21-text-intro {
|
|
96
96
|
display: inline-block;
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
font-weight: 300;
|
|
99
99
|
line-height: 1.2em;
|
|
100
100
|
max-height: 2.4em;
|
|
101
|
+
margin: 0;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
}
|
|
@@ -132,7 +133,7 @@
|
|
|
132
133
|
max-height: 3em; //2.4em;
|
|
133
134
|
font-weight: 200;
|
|
134
135
|
font-size: 2.5em; //3.0em;
|
|
135
|
-
margin
|
|
136
|
+
margin: 0 0 15px 0;
|
|
136
137
|
}
|
|
137
138
|
.c21-text-intro {
|
|
138
139
|
display: inline-block;
|
|
@@ -140,6 +141,7 @@
|
|
|
140
141
|
font-weight: 600; //400;
|
|
141
142
|
line-height: 1.2em;
|
|
142
143
|
max-height: 2.4em;
|
|
144
|
+
margin: 0;
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
-
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
2
|
+
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
|
|
3
5
|
import { NGXLogger } from 'ngx-logger';
|
|
6
|
+
import { ConversationModel } from 'src/chat21-core/models/conversation';
|
|
7
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
4
8
|
import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
|
|
5
9
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
10
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
11
|
+
import { HEADER_MENU_OPTION } from '../../utils/constants';
|
|
6
12
|
import { Globals } from '../../utils/globals';
|
|
7
13
|
|
|
8
14
|
import { HomeComponent } from './home.component';
|
|
@@ -10,31 +16,240 @@ import { HomeComponent } from './home.component';
|
|
|
10
16
|
describe('HomeComponent', () => {
|
|
11
17
|
let component: HomeComponent;
|
|
12
18
|
let fixture: ComponentFixture<HomeComponent>;
|
|
13
|
-
let
|
|
14
|
-
|
|
19
|
+
let globals: Globals;
|
|
20
|
+
const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
|
|
21
|
+
|
|
22
|
+
const tiledeskAuthStub = {
|
|
23
|
+
getCurrentUser: jasmine.createSpy('getCurrentUser').and.returnValue({
|
|
24
|
+
uid: 'u-1',
|
|
25
|
+
firstname: 'Ada',
|
|
26
|
+
lastname: 'Lovelace',
|
|
27
|
+
email: 'ada@example.com',
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const translateStub = {
|
|
32
|
+
translateLanguage: jasmine.createSpy('translateLanguage').and.callFake((keys: string[]) => {
|
|
33
|
+
const m = new Map<string, string>();
|
|
34
|
+
keys.forEach((k) => m.set(k, `T:${k}`));
|
|
35
|
+
return m;
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
15
38
|
|
|
16
39
|
beforeEach(waitForAsync(() => {
|
|
40
|
+
LoggerInstance.setInstance(new CustomLogger(ngxlogger));
|
|
17
41
|
TestBed.configureTestingModule({
|
|
18
|
-
declarations: [
|
|
42
|
+
declarations: [HomeComponent],
|
|
19
43
|
providers: [
|
|
20
44
|
Globals,
|
|
21
|
-
NGXLogger
|
|
45
|
+
{ provide: NGXLogger, useValue: ngxlogger },
|
|
46
|
+
{ provide: TiledeskAuthService, useValue: tiledeskAuthStub },
|
|
47
|
+
{ provide: CustomTranslateService, useValue: translateStub },
|
|
22
48
|
],
|
|
23
|
-
schemas: [NO_ERRORS_SCHEMA]
|
|
24
|
-
})
|
|
25
|
-
.compileComponents();
|
|
49
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
50
|
+
}).compileComponents();
|
|
26
51
|
}));
|
|
27
52
|
|
|
28
53
|
beforeEach(() => {
|
|
29
54
|
fixture = TestBed.createComponent(HomeComponent);
|
|
30
55
|
component = fixture.componentInstance;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
56
|
+
globals = TestBed.inject(Globals);
|
|
57
|
+
globals.initDefafultParameters();
|
|
58
|
+
globals.welcomeTitle = 'Benvenuto';
|
|
59
|
+
globals.welcomeMsg = 'Intro';
|
|
60
|
+
globals.themeForegroundColor = '#fff';
|
|
61
|
+
globals.colorGradient = 'linear-gradient(red,blue)';
|
|
62
|
+
globals.project = { logoChat: 'nologo' } as any;
|
|
63
|
+
globals.poweredBy = '<a href="https://brand.example"><span id="pb-inner">Logo</span></a>';
|
|
64
|
+
globals.whatsappNumber = '1234567890';
|
|
65
|
+
globals.telegramUsername = '';
|
|
66
|
+
globals.messangerPageTitle = '';
|
|
67
|
+
|
|
68
|
+
component.listConversations = [];
|
|
69
|
+
component.archivedConversations = [];
|
|
70
|
+
component.hideSettings = true;
|
|
71
|
+
component.hideNewConversationButton = false;
|
|
72
|
+
component.stylesMap = new Map([
|
|
73
|
+
['themeColor', '#111'],
|
|
74
|
+
['foregroundColor', '#fff'],
|
|
75
|
+
]);
|
|
76
|
+
component.size = 'min';
|
|
77
|
+
component.fullscreenMode = false;
|
|
78
|
+
component.hideHeaderConversationOptionsMenu = false;
|
|
79
|
+
component.isButtonsDisabled = false;
|
|
80
|
+
component.translationMap = new Map([
|
|
81
|
+
['MAXIMIZE', 'Massimizza'],
|
|
82
|
+
['MINIMIZE', 'Riduci'],
|
|
83
|
+
['CENTER', 'Centra'],
|
|
84
|
+
]);
|
|
85
|
+
|
|
34
86
|
fixture.detectChanges();
|
|
35
87
|
});
|
|
36
88
|
|
|
37
89
|
it('should create', () => {
|
|
38
90
|
expect(component).toBeTruthy();
|
|
39
91
|
});
|
|
92
|
+
|
|
93
|
+
describe('translations and DOM shell', () => {
|
|
94
|
+
it('initiTranslations should fill header/footer maps via CustomTranslateService', () => {
|
|
95
|
+
component.initiTranslations();
|
|
96
|
+
expect(component.translationMapHeader?.get('BUTTON_CLOSE_TO_ICON')).toBe('T:BUTTON_CLOSE_TO_ICON');
|
|
97
|
+
expect(component.translationMapFooter?.get('SWITCH_TO')).toBe('T:SWITCH_TO');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should render region root, welcome title and close control', () => {
|
|
101
|
+
const region = fixture.debugElement.query(By.css('#chat21-home-component'));
|
|
102
|
+
expect(region).toBeTruthy();
|
|
103
|
+
const h1 = fixture.nativeElement.querySelector('.c21-text-welcome') as HTMLElement;
|
|
104
|
+
expect(h1.textContent).toContain('Benvenuto');
|
|
105
|
+
const closeBtn = fixture.debugElement.query(By.css('.c21-close-button-body'));
|
|
106
|
+
expect(closeBtn).toBeTruthy();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should set region aria-label from welcomeTitle (accessibility / MCP home shell)', () => {
|
|
110
|
+
globals.welcomeTitle = 'Ciao, benvenuto su BrandExample';
|
|
111
|
+
fixture.detectChanges();
|
|
112
|
+
const host = fixture.nativeElement.querySelector('#chat21-home-component') as HTMLElement;
|
|
113
|
+
expect(host.getAttribute('aria-label')).toBe('Ciao, benvenuto su BrandExample');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should render welcome intro paragraph when welcomeMsg is set', () => {
|
|
117
|
+
globals.welcomeMsg = 'Come possiamo aiutarti?';
|
|
118
|
+
fixture.detectChanges();
|
|
119
|
+
const intro = fixture.nativeElement.querySelector('.c21-text-intro') as HTMLElement;
|
|
120
|
+
expect(intro.textContent).toContain('Come possiamo aiutarti?');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('outputs and actions', () => {
|
|
125
|
+
it('f21_close should emit onCloseWidget and add start-animation class', () => {
|
|
126
|
+
spyOn(component.onCloseWidget, 'emit');
|
|
127
|
+
component.f21_close();
|
|
128
|
+
expect(component.onCloseWidget.emit).toHaveBeenCalled();
|
|
129
|
+
const root = fixture.debugElement.query(By.css('#chat21-home-component')).nativeElement as HTMLElement;
|
|
130
|
+
expect(root.classList.contains('start-animation')).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('onChangeSize should emit correct HEADER_MENU_OPTION', () => {
|
|
134
|
+
spyOn(component.onMenuOptionClick, 'emit');
|
|
135
|
+
component.onChangeSize('min');
|
|
136
|
+
component.onChangeSize('max');
|
|
137
|
+
component.onChangeSize('top');
|
|
138
|
+
expect(component.onMenuOptionClick.emit).toHaveBeenCalledWith(HEADER_MENU_OPTION.MINIMIZE);
|
|
139
|
+
expect(component.onMenuOptionClick.emit).toHaveBeenCalledWith(HEADER_MENU_OPTION.MAXIMIZE);
|
|
140
|
+
expect(component.onMenuOptionClick.emit).toHaveBeenCalledWith(HEADER_MENU_OPTION.TOP);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('onNewConversationFN should emit onNewConversation and strip animation', () => {
|
|
144
|
+
spyOn(component.onNewConversation, 'emit');
|
|
145
|
+
const root = fixture.debugElement.query(By.css('#chat21-home-component')).nativeElement as HTMLElement;
|
|
146
|
+
root.classList.add('start-animation');
|
|
147
|
+
component.onNewConversationFN();
|
|
148
|
+
expect(component.onNewConversation.emit).toHaveBeenCalled();
|
|
149
|
+
expect(root.classList.contains('start-animation')).toBe(false);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('onConversationSelectedFN should emit conversation', () => {
|
|
153
|
+
spyOn(component.onConversationSelected, 'emit');
|
|
154
|
+
const conv = { uid: 'c1' } as ConversationModel;
|
|
155
|
+
component.onConversationSelectedFN(conv);
|
|
156
|
+
expect(component.onConversationSelected.emit).toHaveBeenCalledWith(conv);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('onConversationSelectedFN should ignore null', () => {
|
|
160
|
+
spyOn(component.onConversationSelected, 'emit');
|
|
161
|
+
component.onConversationSelectedFN(null as any);
|
|
162
|
+
expect(component.onConversationSelected.emit).not.toHaveBeenCalled();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('onOpenAllConversation should emit onOpenAllConvesations', () => {
|
|
166
|
+
spyOn(component.onOpenAllConvesations, 'emit');
|
|
167
|
+
component.onOpenAllConversation();
|
|
168
|
+
expect(component.onOpenAllConvesations.emit).toHaveBeenCalled();
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('onSignOutFN should emit onSignOut', () => {
|
|
172
|
+
spyOn(component.onSignOut, 'emit');
|
|
173
|
+
component.onSignOutFN();
|
|
174
|
+
expect(component.onSignOut.emit).toHaveBeenCalled();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('onImageLoadedFN / onConversationLoadedFN should forward emits', () => {
|
|
178
|
+
spyOn(component.onImageLoaded, 'emit');
|
|
179
|
+
spyOn(component.onConversationLoaded, 'emit');
|
|
180
|
+
const c = { uid: 'x' } as ConversationModel;
|
|
181
|
+
component.onImageLoadedFN(c);
|
|
182
|
+
component.onConversationLoadedFN(c);
|
|
183
|
+
expect(component.onImageLoaded.emit).toHaveBeenCalledWith(c);
|
|
184
|
+
expect(component.onConversationLoaded.emit).toHaveBeenCalledWith(c);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
describe('hideMenuOptions and openConversationOnPlatform', () => {
|
|
189
|
+
it('hideMenuOptions should set isOpenMenuOptions on Globals', () => {
|
|
190
|
+
spyOn(globals, 'setParameter');
|
|
191
|
+
component.hideMenuOptions();
|
|
192
|
+
expect(globals.setParameter).toHaveBeenCalledWith('isOpenMenuOptions', false, true);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('openConversationOnPlatform should open external URLs', () => {
|
|
196
|
+
spyOn(window, 'open');
|
|
197
|
+
globals.telegramUsername = 'mybot';
|
|
198
|
+
globals.whatsappNumber = '39333';
|
|
199
|
+
globals.messangerPageTitle = 'mypage';
|
|
200
|
+
component.openConversationOnPlatform('telegram');
|
|
201
|
+
component.openConversationOnPlatform('whatsapp');
|
|
202
|
+
component.openConversationOnPlatform('messanger');
|
|
203
|
+
expect(window.open).toHaveBeenCalledWith('https://telegram.me/mybot', '_blank');
|
|
204
|
+
expect(window.open).toHaveBeenCalledWith(jasmine.stringMatching(/^https:\/\/wa\.me\/39333/), '_blank');
|
|
205
|
+
expect(window.open).toHaveBeenCalledWith('https://m.me/mypage', '_blank');
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
describe('managePoweredBy and analytics', () => {
|
|
210
|
+
it('managePoweredBy should open parent anchor href', () => {
|
|
211
|
+
spyOn(window, 'open');
|
|
212
|
+
const anchor = document.createElement('a');
|
|
213
|
+
anchor.setAttribute('href', 'https://brand.example');
|
|
214
|
+
const inner = document.createElement('span');
|
|
215
|
+
anchor.appendChild(inner);
|
|
216
|
+
const ev = new MouseEvent('click', { bubbles: true });
|
|
217
|
+
Object.defineProperty(ev, 'target', { value: inner, configurable: true });
|
|
218
|
+
component.managePoweredBy(ev);
|
|
219
|
+
expect(window.open).toHaveBeenCalledWith('https://brand.example', '_blank');
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('segmentLogoClick should invoke analytics when present', () => {
|
|
223
|
+
(window as any).analytics = {
|
|
224
|
+
page: jasmine.createSpy('page'),
|
|
225
|
+
identify: jasmine.createSpy('identify'),
|
|
226
|
+
track: jasmine.createSpy('track'),
|
|
227
|
+
};
|
|
228
|
+
(component as any).segmentLogoClick();
|
|
229
|
+
expect((window as any).analytics.page).toHaveBeenCalled();
|
|
230
|
+
expect((window as any).analytics.identify).toHaveBeenCalled();
|
|
231
|
+
expect((window as any).analytics.track).toHaveBeenCalled();
|
|
232
|
+
delete (window as any).analytics;
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
describe('ngAfterViewInit', () => {
|
|
237
|
+
it('should add animation only on first open then clear flag', () => {
|
|
238
|
+
globals.firstOpen = true;
|
|
239
|
+
component.ngAfterViewInit();
|
|
240
|
+
const root = fixture.debugElement.query(By.css('#chat21-home-component')).nativeElement as HTMLElement;
|
|
241
|
+
expect(root.classList.contains('start-animation')).toBe(true);
|
|
242
|
+
expect(globals.firstOpen).toBe(false);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('should focus aflistconv after delay when present', fakeAsync(() => {
|
|
246
|
+
const btn = document.createElement('button');
|
|
247
|
+
btn.setAttribute('aflistconv', '');
|
|
248
|
+
spyOn(btn, 'focus');
|
|
249
|
+
(component as any).aflistconv = { nativeElement: btn };
|
|
250
|
+
component.ngAfterViewInit();
|
|
251
|
+
tick(1000);
|
|
252
|
+
expect(btn.focus).toHaveBeenCalled();
|
|
253
|
+
}));
|
|
254
|
+
});
|
|
40
255
|
});
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
<div id='c21-app-list-conversations'>
|
|
2
|
-
<!-- tabindex="1100"-->
|
|
3
2
|
|
|
4
3
|
<div class="c21-header">
|
|
5
4
|
<div *ngIf="checkShowAllConversation()">
|
|
6
5
|
<div class="c21-title">{{g.PREV_CONVERSATIONS}}</div>
|
|
7
6
|
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</button>
|
|
19
|
-
</div>
|
|
7
|
+
<button *ngIf="g.showAllConversations == true"
|
|
8
|
+
type="button"
|
|
9
|
+
class="c21-button c21-button-clean"
|
|
10
|
+
[attr.aria-label]="g.SHOW_ALL_CONV"
|
|
11
|
+
(click)="returnOpenAllConversation()">
|
|
12
|
+
<span style="display:inline-block; line-height: 40px; margin-right: 10px;">{{g.SHOW_ALL_CONV}} </span>
|
|
13
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
|
|
14
|
+
<path d="M1.9,15.4h16.2v-1.8H1.9V15.4z M1.9,10.9h16.2V9.1H1.9V10.9z M1.9,4.6v1.8h16.2V4.6H1.9z"/>
|
|
15
|
+
</svg>
|
|
16
|
+
</button>
|
|
20
17
|
|
|
21
18
|
</div>
|
|
22
19
|
<div *ngIf="!checkShowAllConversation()">
|
|
23
20
|
<div class="c21-title">{{g.NO_CONVERSATION}}</div>
|
|
24
|
-
<div *ngIf="listConversations && listConversations.length > 0"
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
<div *ngIf="listConversations && listConversations.length > 0">
|
|
22
|
+
<button type="button"
|
|
23
|
+
class="c21-button c21-button-clean"
|
|
24
|
+
[attr.aria-label]="g.SHOW_ALL_CONV"
|
|
25
|
+
(click)="returnOpenAllConversation()">
|
|
26
|
+
<span style="display:inline-block; line-height: 40px; margin-right: 10px;">{{g.SHOW_ALL_CONV}}</span>
|
|
27
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24">
|
|
27
28
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
|
28
29
|
<path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7zm-4 6h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"/>
|
|
29
30
|
</svg>
|
|
31
|
+
</button>
|
|
30
32
|
</div>
|
|
31
33
|
</div>
|
|
32
34
|
</div>
|
|
@@ -63,15 +65,18 @@
|
|
|
63
65
|
<div *ngIf="isImageLoaded(agent)" #avatarImage class="c21-avatar-image" [style.background-image]="'url(' + agent.imageurl + ')'"></div>
|
|
64
66
|
</div>
|
|
65
67
|
</div>
|
|
66
|
-
<button
|
|
68
|
+
<button type="button" aflistconv #aflistconv class="c21-button-primary"
|
|
69
|
+
[attr.aria-label]="g.LABEL_START_NW_CONV"
|
|
70
|
+
(click)="openNewConversation()"
|
|
71
|
+
[ngStyle]="{'background-color': g.themeColor, 'border-color': g.themeColor, 'color': g.themeForegroundColor }">
|
|
67
72
|
<span class="v-align-center">
|
|
68
|
-
<svg
|
|
73
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
|
|
69
74
|
<path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
|
|
70
75
|
</svg>
|
|
71
76
|
</span>
|
|
72
77
|
<span class="v-align-center c21-label-button">
|
|
73
78
|
{{g.LABEL_START_NW_CONV}}
|
|
74
|
-
</span>
|
|
79
|
+
</span>
|
|
75
80
|
<div class="clear"></div>
|
|
76
81
|
</button>
|
|
77
82
|
</div>
|
|
@@ -88,16 +93,15 @@
|
|
|
88
93
|
(onConversationLoaded)="onConversationLoadedFN($event)">
|
|
89
94
|
</chat-list-conversations>
|
|
90
95
|
|
|
91
|
-
<div class="c21-new-conversation"
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
<div class="c21-new-conversation">
|
|
97
|
+
<button type="button" aflistconv #aflistconv class="c21-button-primary"
|
|
98
|
+
[attr.aria-label]="g.LABEL_START_NW_CONV"
|
|
99
|
+
(click)="openNewConversation()"
|
|
100
|
+
[ngStyle]="{'background-color': g.themeColor, 'border-color': g.themeColor, 'color': g.themeForegroundColor }">
|
|
94
101
|
<span class="v-align-center">
|
|
95
|
-
<svg
|
|
102
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
|
|
96
103
|
<path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
|
|
97
104
|
</svg>
|
|
98
|
-
<!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 20 20" width="20" height="20" style="enable-background:new 0 0 20 20;" xml:space="preserve" >
|
|
99
|
-
<path d="M16.3,10.9h-5.4v5.4H9.1v-5.4H3.7V9.1h5.4V3.7h1.8v5.4h5.4V10.9z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
|
|
100
|
-
</svg> -->
|
|
101
105
|
</span>
|
|
102
106
|
<span class="v-align-center c21-label-button">
|
|
103
107
|
<!-- {{LABEL_START_NW_CONV}} -->
|