@chat21/chat21-web-widget 5.1.32-rc8 → 5.1.33-rc8

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 (246) hide show
  1. package/.angular-mcp-cache/package.json +1 -0
  2. package/.cursor/angular18-accessibility-auditor-skill.md +442 -0
  3. package/.cursor/mcp.json +15 -0
  4. package/.github/workflows/playwright.yml +27 -0
  5. package/.playwright-mcp/console-2026-05-08T15-31-09-000Z.log +17 -0
  6. package/.playwright-mcp/console-2026-05-08T15-32-19-412Z.log +89 -0
  7. package/.playwright-mcp/console-2026-05-08T16-18-48-424Z.log +133 -0
  8. package/.playwright-mcp/console-2026-05-11T12-54-06-869Z.log +13 -0
  9. package/.playwright-mcp/console-2026-05-11T12-54-56-229Z.log +147 -0
  10. package/.playwright-mcp/console-2026-05-11T12-55-47-174Z.log +183 -0
  11. package/.playwright-mcp/console-2026-05-11T15-34-03-590Z.log +210 -0
  12. package/.playwright-mcp/console-2026-05-12T15-07-31-880Z.log +118 -0
  13. package/.playwright-mcp/page-2026-05-08T15-32-19-900Z.yml +851 -0
  14. package/.playwright-mcp/page-2026-05-08T15-32-47-264Z.yml +857 -0
  15. package/.playwright-mcp/page-2026-05-08T15-33-17-089Z.yml +1110 -0
  16. package/.playwright-mcp/page-2026-05-08T15-33-23-486Z.yml +1069 -0
  17. package/.playwright-mcp/page-2026-05-08T15-33-45-390Z.yml +1076 -0
  18. package/.playwright-mcp/page-2026-05-08T15-33-52-666Z.yml +1072 -0
  19. package/.playwright-mcp/page-2026-05-08T15-34-01-338Z.yml +1085 -0
  20. package/.playwright-mcp/page-2026-05-08T15-34-07-227Z.yml +1072 -0
  21. package/.playwright-mcp/page-2026-05-08T15-34-13-875Z.yml +1072 -0
  22. package/.playwright-mcp/page-2026-05-08T15-34-21-885Z.yml +1109 -0
  23. package/.playwright-mcp/page-2026-05-08T15-34-32-755Z.yml +1109 -0
  24. package/.playwright-mcp/page-2026-05-08T15-35-09-607Z.yml +1119 -0
  25. package/.playwright-mcp/page-2026-05-08T15-35-14-242Z.yml +1109 -0
  26. package/.playwright-mcp/page-2026-05-08T16-18-48-671Z.yml +44 -0
  27. package/.playwright-mcp/page-2026-05-08T16-18-52-753Z.png +0 -0
  28. package/.playwright-mcp/page-2026-05-08T16-19-13-919Z.yml +68 -0
  29. package/.playwright-mcp/page-2026-05-08T16-19-17-977Z.png +0 -0
  30. package/.playwright-mcp/page-2026-05-08T16-19-25-733Z.yml +120 -0
  31. package/.playwright-mcp/page-2026-05-08T16-19-29-252Z.png +0 -0
  32. package/.playwright-mcp/page-2026-05-08T16-19-39-269Z.yml +80 -0
  33. package/.playwright-mcp/page-2026-05-08T16-19-43-915Z.png +0 -0
  34. package/.playwright-mcp/page-2026-05-08T16-20-04-407Z.yml +81 -0
  35. package/.playwright-mcp/page-2026-05-08T16-20-08-984Z.png +0 -0
  36. package/.playwright-mcp/page-2026-05-08T16-20-32-397Z.png +0 -0
  37. package/.playwright-mcp/page-2026-05-08T16-20-58-658Z.png +0 -0
  38. package/.playwright-mcp/page-2026-05-08T16-21-12-320Z.yml +86 -0
  39. package/.playwright-mcp/page-2026-05-08T16-21-39-154Z.yml +91 -0
  40. package/.playwright-mcp/page-2026-05-08T16-21-45-420Z.png +0 -0
  41. package/.playwright-mcp/page-2026-05-08T16-22-21-062Z.yml +0 -0
  42. package/.playwright-mcp/page-2026-05-08T16-22-58-232Z.yml +91 -0
  43. package/.playwright-mcp/page-2026-05-08T16-23-36-520Z.yml +0 -0
  44. package/.playwright-mcp/page-2026-05-08T16-23-46-805Z.yml +100 -0
  45. package/.playwright-mcp/page-2026-05-08T16-23-55-169Z.png +0 -0
  46. package/.playwright-mcp/page-2026-05-08T16-24-26-574Z.yml +91 -0
  47. package/.playwright-mcp/page-2026-05-08T16-25-34-414Z.png +0 -0
  48. package/.playwright-mcp/page-2026-05-08T16-25-59-831Z.png +0 -0
  49. package/.playwright-mcp/page-2026-05-08T16-26-21-809Z.yml +91 -0
  50. package/.playwright-mcp/page-2026-05-08T16-26-47-443Z.yml +105 -0
  51. package/.playwright-mcp/page-2026-05-08T16-26-56-136Z.png +0 -0
  52. package/.playwright-mcp/page-2026-05-08T16-27-59-610Z.yml +48 -0
  53. package/.playwright-mcp/page-2026-05-11T12-54-07-180Z.yml +44 -0
  54. package/.playwright-mcp/page-2026-05-11T12-54-56-946Z.yml +4 -0
  55. package/.playwright-mcp/page-2026-05-11T12-55-47-503Z.yml +24 -0
  56. package/.playwright-mcp/page-2026-05-11T12-56-00-766Z.yml +28 -0
  57. package/.playwright-mcp/page-2026-05-11T12-56-06-438Z.yml +90 -0
  58. package/.playwright-mcp/page-2026-05-11T12-57-56-838Z.yml +106 -0
  59. package/.playwright-mcp/page-2026-05-11T12-58-00-124Z.yml +106 -0
  60. package/.playwright-mcp/page-2026-05-11T12-59-08-836Z.yml +61 -0
  61. package/.playwright-mcp/page-2026-05-11T12-59-12-088Z.yml +61 -0
  62. package/.playwright-mcp/page-2026-05-11T12-59-26-215Z.yml +69 -0
  63. package/.playwright-mcp/page-2026-05-11T12-59-29-519Z.yml +69 -0
  64. package/.playwright-mcp/page-2026-05-11T12-59-37-309Z.yml +0 -0
  65. package/.playwright-mcp/page-2026-05-11T12-59-39-968Z.yml +79 -0
  66. package/.playwright-mcp/page-2026-05-11T12-59-45-983Z.yml +78 -0
  67. package/.playwright-mcp/page-2026-05-11T12-59-49-951Z.yml +78 -0
  68. package/.playwright-mcp/page-2026-05-11T15-34-04-515Z.yml +0 -0
  69. package/.playwright-mcp/page-2026-05-12T15-07-32-171Z.yml +44 -0
  70. package/.playwright-mcp/page-2026-05-12T15-08-09-820Z.yml +119 -0
  71. package/CHANGELOG.md +61 -3
  72. package/angular.json +20 -3
  73. package/deploy_amazon_beta.sh +7 -17
  74. package/deploy_amazon_prod.sh +41 -0
  75. package/docs/TILEDESK_WIDGET_ACCESSIBILITY_STATEMENT_COMPLETE.md +379 -0
  76. package/env.sample +3 -2
  77. package/mocks/voice-websocket-mock/server.cjs +245 -0
  78. package/package.json +7 -3
  79. package/playwright-report/index.html +90 -0
  80. package/playwright.config.ts +41 -0
  81. package/src/app/app.component.html +2 -2
  82. package/src/app/app.component.scss +25 -14
  83. package/src/app/app.component.spec.ts +21 -6
  84. package/src/app/app.module.ts +4 -0
  85. package/src/app/component/conversation-detail/conversation/conversation.component.html +19 -11
  86. package/src/app/component/conversation-detail/conversation/conversation.component.scss +28 -0
  87. package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +644 -75
  88. package/src/app/component/conversation-detail/conversation/conversation.component.ts +61 -17
  89. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +25 -13
  90. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.spec.ts +123 -5
  91. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.ts +1 -0
  92. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +22 -9
  93. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +23 -1
  94. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +249 -149
  95. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +0 -1
  96. package/src/app/component/conversation-detail/conversation-emojii/conversation-emojii.component.spec.ts +53 -3
  97. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component copy.html +172 -0
  98. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +112 -62
  99. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +133 -7
  100. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.spec.ts +452 -78
  101. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +193 -79
  102. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +113 -53
  103. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +12 -4
  104. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +274 -29
  105. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +23 -9
  106. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.spec.ts +80 -8
  107. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +29 -23
  108. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.spec.ts +185 -16
  109. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +34 -14
  110. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.html +43 -19
  111. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.scss +63 -10
  112. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.ts +142 -12
  113. package/src/app/component/error-alert/error-alert.component.spec.ts +65 -5
  114. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +16 -7
  115. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +21 -0
  116. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.spec.ts +89 -7
  117. package/src/app/component/form/form-builder/form-builder.component.html +1 -1
  118. package/src/app/component/form/form-builder/form-builder.component.spec.ts +163 -21
  119. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.html +8 -4
  120. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +10 -5
  121. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.spec.ts +90 -16
  122. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +26 -0
  123. package/src/app/component/form/inputs/form-label/form-label.component.spec.ts +45 -11
  124. package/src/app/component/form/inputs/form-radio-button/form-radio-button.component.spec.ts +24 -6
  125. package/src/app/component/form/inputs/form-select/form-select.component.spec.ts +14 -5
  126. package/src/app/component/form/inputs/form-text/form-text.component.html +14 -12
  127. package/src/app/component/form/inputs/form-text/form-text.component.scss +11 -1
  128. package/src/app/component/form/inputs/form-text/form-text.component.spec.ts +113 -17
  129. package/src/app/component/form/inputs/form-text/form-text.component.ts +26 -0
  130. package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +13 -11
  131. package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +6 -5
  132. package/src/app/component/form/inputs/form-textarea/form-textarea.component.spec.ts +149 -13
  133. package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +26 -0
  134. package/src/app/component/form/prechat-form/prechat-form.component.html +14 -11
  135. package/src/app/component/form/prechat-form/prechat-form.component.spec.ts +102 -10
  136. package/src/app/component/form/prechat-form/prechat-form.component.ts +8 -1
  137. package/src/app/component/form/prechat-form-test-mock.ts +35 -0
  138. package/src/app/component/home/home.component.html +38 -31
  139. package/src/app/component/home/home.component.scss +4 -2
  140. package/src/app/component/home/home.component.spec.ts +226 -11
  141. package/src/app/component/home-conversations/home-conversations.component.html +30 -26
  142. package/src/app/component/home-conversations/home-conversations.component.scss +3 -0
  143. package/src/app/component/home-conversations/home-conversations.component.spec.ts +212 -36
  144. package/src/app/component/last-message/last-message.component.html +15 -9
  145. package/src/app/component/last-message/last-message.component.scss +16 -2
  146. package/src/app/component/last-message/last-message.component.spec.ts +204 -23
  147. package/src/app/component/launcher-button/launcher-button.component.html +8 -13
  148. package/src/app/component/launcher-button/launcher-button.component.spec.ts +104 -8
  149. package/src/app/component/list-all-conversations/list-all-conversations.component.html +12 -17
  150. package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -0
  151. package/src/app/component/list-conversations/list-conversations.component.html +22 -22
  152. package/src/app/component/menu-options/menu-options.component.html +30 -20
  153. package/src/app/component/menu-options/menu-options.component.spec.ts +125 -9
  154. package/src/app/component/message/audio/audio.component.html +13 -15
  155. package/src/app/component/message/audio/audio.component.spec.ts +140 -5
  156. package/src/app/component/message/audio/audio.component.ts +1 -0
  157. package/src/app/component/message/audio-sync/audio-sync.component.scss +1 -1
  158. package/src/app/component/message/audio-sync/audio-sync.component.spec.ts +81 -1
  159. package/src/app/component/message/audio-sync/audio-sync.component.ts +134 -24
  160. package/src/app/component/message/avatar/avatar.component.html +2 -2
  161. package/src/app/component/message/avatar/avatar.component.spec.ts +99 -7
  162. package/src/app/component/message/bubble-message/bubble-message.component.html +39 -52
  163. package/src/app/component/message/bubble-message/bubble-message.component.scss +54 -1
  164. package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +154 -57
  165. package/src/app/component/message/bubble-message/bubble-message.component.ts +138 -110
  166. package/src/app/component/message/buttons/action-button/action-button.component.html +3 -4
  167. package/src/app/component/message/buttons/action-button/action-button.component.spec.ts +49 -5
  168. package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -8
  169. package/src/app/component/message/buttons/link-button/link-button.component.spec.ts +50 -5
  170. package/src/app/component/message/buttons/text-button/text-button.component.spec.ts +44 -5
  171. package/src/app/component/message/carousel/carousel.component.html +29 -16
  172. package/src/app/component/message/carousel/carousel.component.scss +20 -8
  173. package/src/app/component/message/carousel/carousel.component.spec.ts +80 -3
  174. package/src/app/component/message/carousel/carousel.component.ts +16 -0
  175. package/src/app/component/message/frame/frame.component.html +9 -4
  176. package/src/app/component/message/frame/frame.component.spec.ts +34 -15
  177. package/src/app/component/message/frame/frame.component.ts +7 -2
  178. package/src/app/component/message/html/html.component.html +1 -1
  179. package/src/app/component/message/html/html.component.scss +1 -1
  180. package/src/app/component/message/html/html.component.spec.ts +24 -7
  181. package/src/app/component/message/image/image.component.html +12 -10
  182. package/src/app/component/message/image/image.component.scss +16 -0
  183. package/src/app/component/message/image/image.component.spec.ts +101 -15
  184. package/src/app/component/message/image/image.component.ts +90 -51
  185. package/src/app/component/message/info-message/info-message.component.spec.ts +26 -14
  186. package/src/app/component/message/json-sources/json-sources.component.html +38 -0
  187. package/src/app/component/message/json-sources/json-sources.component.scss +197 -0
  188. package/src/app/component/message/json-sources/json-sources.component.ts +89 -0
  189. package/src/app/component/message/like-unlike/like-unlike.component.html +7 -9
  190. package/src/app/component/message/like-unlike/like-unlike.component.spec.ts +31 -3
  191. package/src/app/component/message/return-receipt/return-receipt.component.spec.ts +38 -17
  192. package/src/app/component/message/text/text.component.html +3 -3
  193. package/src/app/component/message/text/text.component.scss +80 -86
  194. package/src/app/component/message/text/text.component.spec.ts +106 -13
  195. package/src/app/component/message-attachment/message-attachment.component.spec.ts +134 -13
  196. package/src/app/component/selection-department/selection-department.component.html +21 -23
  197. package/src/app/component/selection-department/selection-department.component.spec.ts +159 -14
  198. package/src/app/component/selection-department/selection-department.component.ts +8 -1
  199. package/src/app/component/send-button/send-button.component.html +5 -13
  200. package/src/app/component/send-button/send-button.component.spec.ts +2 -2
  201. package/src/app/component/star-rating-widget/star-rating-widget.component.html +51 -81
  202. package/src/app/directives/tooltip.directive.spec.ts +8 -4
  203. package/src/app/modals/confirm-close/confirm-close.component.html +20 -8
  204. package/src/app/modals/confirm-close/confirm-close.component.scss +3 -0
  205. package/src/app/modals/confirm-close/confirm-close.component.spec.ts +13 -4
  206. package/src/app/modals/confirm-close/confirm-close.component.ts +8 -1
  207. package/src/app/pipe/html-entites-encode.pipe.spec.ts +35 -2
  208. package/src/app/pipe/marked.pipe.spec.ts +38 -2
  209. package/src/app/providers/app-config.service.ts +4 -2
  210. package/src/app/providers/brand.service.spec.ts +23 -2
  211. package/src/app/providers/brand.service.ts +1 -1
  212. package/src/app/providers/global-settings.service.spec.ts +1009 -14
  213. package/src/app/providers/global-settings.service.ts +30 -2
  214. package/src/app/providers/json-sources-parser.service.ts +182 -0
  215. package/src/app/providers/translator.service.ts +24 -6
  216. package/src/app/providers/tts-audio-playback-coordinator.service.spec.ts +117 -0
  217. package/src/app/providers/tts-audio-playback-coordinator.service.ts +45 -7
  218. package/src/app/providers/url-preview.service.ts +82 -0
  219. package/src/app/providers/voice/audio.types.ts +6 -0
  220. package/src/app/providers/voice/voice-streaming.service.spec.ts +23 -0
  221. package/src/app/providers/voice/voice-streaming.service.ts +710 -0
  222. package/src/app/providers/voice/voice-streaming.types.ts +113 -0
  223. package/src/app/providers/voice/voice.service.spec.ts +203 -3
  224. package/src/app/providers/voice/voice.service.ts +521 -12
  225. package/src/app/sass/_variables.scss +1 -1
  226. package/src/app/sass/animations.scss +19 -1
  227. package/src/app/utils/globals.ts +4 -0
  228. package/src/app/utils/json-sources-utils.ts +27 -0
  229. package/src/app/utils/url-utils.ts +98 -0
  230. package/src/app/utils/utils-resources.ts +1 -1
  231. package/src/assets/i18n/en.json +26 -1
  232. package/src/assets/i18n/es.json +106 -101
  233. package/src/assets/i18n/fr.json +106 -101
  234. package/src/assets/i18n/it.json +106 -99
  235. package/src/assets/twp/index-dev.html +18 -0
  236. package/src/assets/twp/tiledesk_widget_files/widget-css-override-example.css +14 -0
  237. package/src/chat21-core/providers/chat-manager.spec.ts +72 -0
  238. package/src/chat21-core/providers/scripts/script.service.spec.ts +12 -2
  239. package/src/chat21-core/utils/constants.ts +4 -0
  240. package/src/chat21-core/utils/utils-message.ts +23 -1
  241. package/src/widget-config-template.json +3 -1
  242. package/src/widget-config.json +28 -27
  243. package/test-results/.last-run.json +4 -0
  244. package/tests/widget-form-rich.spec.ts +67 -0
  245. package/tests/widget-index-dev-settings.spec.ts +52 -0
  246. package/tests/widget-twp-iframe.spec.ts +39 -0
@@ -1,34 +1,179 @@
1
- import { ElementRef } from '@angular/core';
2
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
1
+ import { A11yModule } from '@angular/cdk/a11y';
2
+ import { Injectable } from '@angular/core';
3
+ import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
4
+ import { By } from '@angular/platform-browser';
5
+ import { NGXLogger } from 'ngx-logger';
6
+
3
7
  import { AppStorageService } from '../../../chat21-core/providers/abstract/app-storage.service';
8
+ import { CustomLogger } from '../../../chat21-core/providers/logger/customLogger';
9
+ import { LoggerInstance } from '../../../chat21-core/providers/logger/loggerInstance';
4
10
  import { Globals } from '../../utils/globals';
5
11
 
6
12
  import { SelectionDepartmentComponent } from './selection-department.component';
7
13
 
14
+ @Injectable()
15
+ class AppStorageServiceStub extends AppStorageService {
16
+ lastAttributesJson: string | null = null;
17
+ setItem = jasmine.createSpy('setItem').and.callFake((key: string, value: any) => {
18
+ if (key === 'attributes') {
19
+ this.lastAttributesJson = value as string;
20
+ }
21
+ });
22
+ getItem(): any {
23
+ return null;
24
+ }
25
+ getItemWithoutProjectID(): any {
26
+ return null;
27
+ }
28
+ setItemWithoutProjectID(): void {}
29
+ removeItem(): void {}
30
+ clear(): void {}
31
+ initialize(): void {}
32
+ }
33
+
8
34
  describe('SelectionDepartmentComponent', () => {
9
35
  let component: SelectionDepartmentComponent;
10
36
  let fixture: ComponentFixture<SelectionDepartmentComponent>;
11
- class MockElementRef {}
12
-
13
- beforeEach(async(() => {
37
+ let globals: Globals;
38
+ let storage: AppStorageServiceStub;
39
+
40
+ beforeEach(waitForAsync(() => {
41
+ const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
42
+ LoggerInstance.setInstance(new CustomLogger(ngxlogger));
14
43
  TestBed.configureTestingModule({
15
- declarations: [ SelectionDepartmentComponent ],
16
- providers: [
17
- Globals,
18
- { provide: ElementRef, useClass: MockElementRef },
19
- AppStorageService
20
- ]
21
- })
22
- .compileComponents();
44
+ imports: [A11yModule],
45
+ declarations: [SelectionDepartmentComponent],
46
+ providers: [
47
+ Globals,
48
+ { provide: AppStorageService, useClass: AppStorageServiceStub },
49
+ { provide: NGXLogger, useValue: ngxlogger },
50
+ ],
51
+ }).compileComponents();
23
52
  }));
24
53
 
25
54
  beforeEach(() => {
26
55
  fixture = TestBed.createComponent(SelectionDepartmentComponent);
27
56
  component = fixture.componentInstance;
28
- fixture.detectChanges();
57
+ globals = TestBed.inject(Globals);
58
+ storage = TestBed.inject(AppStorageService) as unknown as AppStorageServiceStub;
59
+ globals.initDefafultParameters();
60
+ globals.themeColor = '#112233';
61
+ globals.themeForegroundColor = '#ddeeff';
62
+ globals.colorGradient180 = 'linear-gradient(#000,#fff)';
63
+ globals.LABEL_SELECT_TOPIC = 'Scegli un argomento';
64
+ globals.BUTTON_CLOSE_TO_ICON = 'Chiudi';
65
+ globals.departments = [
66
+ { _id: 'dep-a', name: 'Vendite' } as any,
67
+ { _id: 'dep-b', name: 'Supporto' } as any,
68
+ ];
69
+ globals.attributes = { userFullname: 'Ada', userEmail: 'ada@example.com' } as any;
70
+ globals.windowContext = {} as any;
29
71
  });
30
72
 
31
73
  it('should create', () => {
74
+ fixture.detectChanges();
32
75
  expect(component).toBeTruthy();
33
76
  });
77
+
78
+ it('should render dialog with topic label and one list row per department', () => {
79
+ fixture.detectChanges();
80
+ const dialog = fixture.nativeElement.querySelector('#chat21-selection-department') as HTMLElement;
81
+ expect(dialog.getAttribute('role')).toBe('dialog');
82
+ expect(dialog.getAttribute('aria-modal')).toBe('true');
83
+ expect(dialog.getAttribute('aria-label')).toBe('Scegli un argomento');
84
+ const heading = fixture.nativeElement.querySelector('h2.c21-message-field') as HTMLElement;
85
+ expect(heading.textContent?.trim()).toBe('Scegli un argomento');
86
+ const buttons = fixture.nativeElement.querySelectorAll('.c21-button-department');
87
+ expect(buttons.length).toBe(2);
88
+ expect(buttons[0].textContent).toContain('Vendite');
89
+ expect(buttons[1].textContent).toContain('Supporto');
90
+ });
91
+
92
+ it('onSelectDepartment should set globals, attributes and persist JSON in storage', () => {
93
+ fixture.detectChanges();
94
+ spyOn(component.onDepartmentSelected, 'emit');
95
+ const dept = { _id: 'dep-b', name: 'Supporto' };
96
+ component.onSelectDepartment(dept);
97
+ expect(globals.departmentSelected).toEqual(dept as any);
98
+ expect(globals.attributes.departmentId).toBe('dep-b');
99
+ expect(globals.attributes.departmentName).toBe('Supporto');
100
+ expect(storage.setItem).toHaveBeenCalledWith('attributes', jasmine.any(String));
101
+ const parsed = JSON.parse(storage.lastAttributesJson!);
102
+ expect(parsed.departmentId).toBe('dep-b');
103
+ expect(parsed.departmentName).toBe('Supporto');
104
+ expect(parsed.userEmail).toBe('ada@example.com');
105
+ expect(component.onDepartmentSelected.emit).toHaveBeenCalledWith(dept);
106
+ });
107
+
108
+ it('click on department button should trigger selection flow', () => {
109
+ fixture.detectChanges();
110
+ spyOn(component, 'onSelectDepartment').and.callThrough();
111
+ const second = fixture.debugElement.queryAll(By.css('.c21-button-department'))[1];
112
+ second.nativeElement.click();
113
+ expect(component.onSelectDepartment).toHaveBeenCalledWith(jasmine.objectContaining({ _id: 'dep-b' }));
114
+ });
115
+
116
+ it('closePage should emit onClose', () => {
117
+ fixture.detectChanges();
118
+ spyOn(component.onClose, 'emit');
119
+ component.closePage();
120
+ expect(component.onClose.emit).toHaveBeenCalled();
121
+ });
122
+
123
+ it('openPage should emit onOpen', () => {
124
+ fixture.detectChanges();
125
+ spyOn(component.onOpen, 'emit');
126
+ component.openPage();
127
+ expect(component.onOpen.emit).toHaveBeenCalled();
128
+ });
129
+
130
+ it('cancelPage should reset newConversationStart and emit onClose', () => {
131
+ fixture.detectChanges();
132
+ globals.newConversationStart = true;
133
+ spyOn(component.onClose, 'emit');
134
+ component.cancelPage();
135
+ expect(globals.newConversationStart).toBe(false);
136
+ expect(component.onClose.emit).toHaveBeenCalled();
137
+ });
138
+
139
+ it('should invoke beforeDepartmentsFormRender hook when present on windowContext.tiledesk', () => {
140
+ const hook = jasmine.createSpy('beforeDepartmentsFormRender').and.returnValue([{ _id: 'x', name: 'Filtered' }]);
141
+ globals.windowContext = { tiledesk: { beforeDepartmentsFormRender: hook } } as any;
142
+ const f2 = TestBed.createComponent(SelectionDepartmentComponent);
143
+ const c2 = f2.componentInstance;
144
+ f2.detectChanges();
145
+ expect(hook).toHaveBeenCalledWith(globals.departments);
146
+ expect(c2.departments.length).toBe(1);
147
+ expect(c2.departments[0].name).toBe('Filtered');
148
+ f2.destroy();
149
+ });
150
+
151
+ it('should emit onBeforeDepartmentsFormRender when hook is absent', () => {
152
+ spyOn(component.onBeforeDepartmentsFormRender, 'emit');
153
+ fixture.detectChanges();
154
+ expect(component.onBeforeDepartmentsFormRender.emit).toHaveBeenCalledWith(
155
+ jasmine.arrayContaining([jasmine.objectContaining({ name: 'Vendite' })]),
156
+ );
157
+ });
158
+
159
+ it('Escape host listener should call closePage', () => {
160
+ fixture.detectChanges();
161
+ spyOn(component, 'closePage');
162
+ const ev = new KeyboardEvent('keydown', { key: 'Escape' });
163
+ spyOn(ev, 'preventDefault');
164
+ spyOn(ev, 'stopPropagation');
165
+ component.onEscape(ev);
166
+ expect(ev.preventDefault).toHaveBeenCalled();
167
+ expect(ev.stopPropagation).toHaveBeenCalled();
168
+ expect(component.closePage).toHaveBeenCalled();
169
+ });
170
+
171
+ it('should focus afSelectionDepartment after delay in ngAfterViewInit', fakeAsync(() => {
172
+ fixture.detectChanges();
173
+ const dialog = fixture.nativeElement.querySelector('#chat21-selection-department') as HTMLElement;
174
+ spyOn(dialog, 'focus');
175
+ component.ngAfterViewInit();
176
+ tick(1000);
177
+ expect(dialog.focus).toHaveBeenCalled();
178
+ }));
34
179
  });
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
1
+ import { AfterViewInit, Component, ElementRef, EventEmitter, HostListener, OnInit, Output, ViewChild } from '@angular/core';
2
2
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
3
3
  import { Globals } from '../../utils/globals';
4
4
 
@@ -172,6 +172,13 @@ export class SelectionDepartmentComponent implements OnInit, AfterViewInit {
172
172
  this.onClose.emit();
173
173
  }
174
174
 
175
+ @HostListener('keydown.escape', ['$event'])
176
+ onEscape(event: KeyboardEvent){
177
+ event.preventDefault();
178
+ event.stopPropagation();
179
+ this.closePage();
180
+ }
181
+
175
182
  cancelPage() {
176
183
  this.logger.debug('[SELECT-DEP] cancelPage');
177
184
  this.g.newConversationStart = false;
@@ -1,21 +1,13 @@
1
- <!-- tabindex="000"-->
2
-
3
- <button aflauncherbutton #aflauncherbutton id="c21-launcher-button" class="c21-button-clean scale-in-center c21-align-right"
4
- *ngIf="g.isLogged == true"
1
+ <button aflauncherbutton #aflauncherbutton type="button" id="c21-launcher-button" class="c21-button-clean scale-in-center c21-align-right"
2
+ *ngIf="g.isLogged == true"
5
3
  [style]="{ 'background-color': g.themeColor, 'bottom': g.marginY+'px!important', 'left':(g.align==='left')?g.marginX+'px!important':'', 'right':(g.align==='right')?g.marginX+'px!important':'', 'width': g.launcherWidth, 'height': g.launcherHeight, 'border-radius': g.baloonShape}"
6
4
  (click)="onSendPressed($event)"
7
- tabindex="1000"
8
- aria-label=" apri chat"
9
- >
5
+ [attr.aria-label]="g.LABEL_SEND_NEW_MESSAGE || 'Send new message'">
10
6
 
11
7
  <!-- SEND ICON -->
12
- <!-- [@enterBubbleAnimation] -->
13
- <div class="launcher-button rotate-center" >
14
- <!-- <img *ngIf="g.baloonImage !== '' " [src]="g.baloonImage" [ngStyle]="{'width': '100%', 'height': '100%', 'margin': 'auto'}"> -->
15
- <svg role="img" [style]="{'fill': g.themeForegroundColor, 'display': (g.baloonImage==='')?'':'none' }" xmlns="http://www.w3.org/2000/svg" width="100%"
8
+ <div class="launcher-button rotate-center">
9
+ <svg aria-hidden="true" focusable="false" [style]="{'fill': g.themeForegroundColor, 'display': (g.baloonImage==='')?'':'none' }" xmlns="http://www.w3.org/2000/svg" width="100%"
16
10
  height="100%" viewBox="0 0 90 90">
17
- <!-- <path fill="none" d="M0 0h24v24H0V0z" />
18
- <path d="M33.57,31A4.58,4.58,0,0,0,29,35.57V58.3a1.94,1.94,0,0,0,3.32,1.38l3-3a.29.29,0,0,1,.21-.09H56.43A4.58,4.58,0,0,0,61,52V35.57A4.58,4.58,0,0,0,56.43,31Z" /> -->
19
11
  <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" />
20
12
  </svg>
21
13
  </div>
@@ -1,4 +1,4 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
1
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
2
 
3
3
  import { SendButtonComponent } from './send-button.component';
4
4
 
@@ -6,7 +6,7 @@ describe('SendButtonComponent', () => {
6
6
  let component: SendButtonComponent;
7
7
  let fixture: ComponentFixture<SendButtonComponent>;
8
8
 
9
- beforeEach(async(() => {
9
+ beforeEach(waitForAsync(() => {
10
10
  TestBed.configureTestingModule({
11
11
  declarations: [ SendButtonComponent ]
12
12
  })
@@ -9,33 +9,22 @@ svg.star:hover{
9
9
  fill: #FFD700;
10
10
  }
11
11
  </style>
12
- <div id="chat21-star-rating-widget">
12
+ <div id="chat21-star-rating-widget" role="dialog" aria-modal="true" [attr.aria-label]="g.CUSTOMER_SATISFACTION">
13
13
  <!-- HEADER -->
14
14
  <div class="c21-header" [ngStyle]="{ 'color': g.themeForegroundColor, 'background-image': g.colorGradient180 }">
15
15
  <div class="c21-header-container">
16
- <!-- ICON CLOSE CHAT -->
17
- <!-- <div class="c21-header-button">
18
- <div class="c21-close-button c21-small" aria-label="Close" aria-hidden="true" role="button">
19
- <div class="c21-close-button-body" (click)="returnClosePage()">
20
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': g.themeForegroundColor }"
21
- xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewBox="0 0 24 24">
22
- <path fill="none" d="M0 0h24v24H0V0z" />
23
- <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
24
- </svg>
25
- </div>
26
- </div>
27
- </div> -->
28
-
29
16
  <!-- CONTENT HEADER -->
30
17
  <div class="c21-header-content">
31
18
  <!-- ICON BACK -->
32
- <button *ngIf="(step > 0 && step != 2)" tabindex="1417" aria-label=" indietro " class="c21-header-button c21-left c21-button-clean" (click)="prevStep()">
33
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('foregroundColor') }" xmlns="http://www.w3.org/2000/svg"
19
+ <button *ngIf="(step > 0 && step != 2)"
20
+ type="button"
21
+ [attr.aria-label]="g['BACK']"
22
+ class="c21-header-button c21-left c21-button-clean"
23
+ (click)="prevStep()">
24
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': stylesMap?.get('foregroundColor') }" xmlns="http://www.w3.org/2000/svg"
34
25
  width="24px" height="24px" viewBox="0 0 24 24">
35
- <!-- <path fill="none" d="M0 0h24v24H0V0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7.07 18.28c.43-.9 3.05-1.78 4.93-1.78s4.51.88 4.93 1.78C15.57 19.36 13.86 20 12 20s-3.57-.64-4.93-1.72zm11.29-1.45c-1.43-1.74-4.9-2.33-6.36-2.33s-4.93.59-6.36 2.33C4.62 15.49 4 13.82 4 12c0-4.41 3.59-8 8-8s8 3.59 8 8c0 1.82-.62 3.49-1.64 4.83zM12 6c-1.94 0-3.5 1.56-3.5 3.5S10.06 13 12 13s3.5-1.56 3.5-3.5S13.94 6 12 6zm0 5c-.83 0-1.5-.67-1.5-1.5S11.17 8 12 8s1.5.67 1.5 1.5S12.83 11 12 11z"/> -->
36
26
  <path fill="none" d="M0 0h24v24H0V0z" />
37
27
  <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z" />
38
- <title id="altIconTitle">{{ g['BACK'] }}</title>
39
28
  </svg>
40
29
  </button>
41
30
  <!-- TITLE HEADER -->
@@ -58,61 +47,56 @@ svg.star:hover{
58
47
  <!-- *************** STEP 0 : BEGIN ***************** -->
59
48
  <div *ngIf="step==0" class="step-rate">
60
49
  <div *ngIf="g.allowTranscriptDownload" class="c21-modal-content" style="text-align: right; margin: 0px 20px 30px 10px;">
61
- <div class="c21-link" (click)="dowloadTranscript()" >
50
+ <button type="button" class="c21-link c21-button-clean" (click)="dowloadTranscript()">
62
51
  <span [ngStyle]="{'color': stylesMap?.get('themeColor')}">{{ g.DOWNLOAD_TRANSCRIPT }}</span>
63
- </div>
52
+ </button>
64
53
  </div>
65
54
  <div class="clear"></div>
66
-
55
+
67
56
  <!-- CONTENT -->
68
57
  <div class="c21-modal-content">
69
58
  <div class="default-text">{{ g.YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE }}</div>
70
59
  <fieldset class="chat21-rating" [attr.disabled]="!g.isOpenStartRating? '' : null">
60
+ <legend class="visually-hidden">{{ g.YOUR_RATING }}</legend>
71
61
  <input class="c21-input-star" type="radio" id="star1" name="rating" value="1" />
72
62
  <label (mouseover)="mouseOverRate(1)" (mouseleave)="mouseOverRate(0)" (click)="openRate(1)" class="full c21-button" for="star1" title="scarso - 1 star">
73
- <svg class="star" [class.active]="mouseRate>=1" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
63
+ <svg aria-hidden="true" focusable="false" class="star" [class.active]="mouseRate>=1" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
74
64
  </label>
75
65
  <input class="c21-input-star" type="radio" id="star2" name="rating" value="2" />
76
66
  <label (mouseover)="mouseOverRate(2)" (mouseleave)="mouseOverRate(0)" (click)="openRate(2)" class="full c21-button" for="star2" title="sufficiente - 2 stars">
77
- <svg class="star" [class.active]="mouseRate>=2" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
67
+ <svg aria-hidden="true" focusable="false" class="star" [class.active]="mouseRate>=2" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
78
68
  </label>
79
69
  <input class="c21-input-star" type="radio" id="star3" name="rating" value="3" />
80
70
  <label (mouseover)="mouseOverRate(3)" (mouseleave)="mouseOverRate(0)" (click)="openRate(3)" class="full c21-button" for="star3" title="buono - 3 stars">
81
- <svg class="star" [class.active]="mouseRate>=3" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
71
+ <svg aria-hidden="true" focusable="false" class="star" [class.active]="mouseRate>=3" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
82
72
  </label>
83
73
  <input class="c21-input-star" type="radio" id="star4" name="rating" value="4" />
84
74
  <label (mouseover)="mouseOverRate(4)" (mouseleave)="mouseOverRate(0)" (click)="openRate(4)" class="full c21-button" for="star4" title="ottimo - 4 stars">
85
- <svg class="star" [class.active]="mouseRate>=4" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
75
+ <svg aria-hidden="true" focusable="false" class="star" [class.active]="mouseRate>=4" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
86
76
  </label>
87
77
  <input class="c21-input-star" type="radio" id="star5" name="rating" value="5" />
88
78
  <label (mouseover)="mouseOverRate(5)" (mouseleave)="mouseOverRate(0)" (click)="openRate(5)" class="full c21-button" for="star5" title="eccellente - 5 stars">
89
- <svg class="star" [class.active]="mouseRate>=5" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
79
+ <svg aria-hidden="true" focusable="false" class="star" [class.active]="mouseRate>=5" width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"/></svg>
90
80
  </label>
91
81
  </fieldset>
92
82
  </div>
93
83
  <div class="clear"></div>
94
- <!-- <button [attr.disabled]="!g.isOpenStartRating? '' : null" *ngIf="g.allowTranscriptDownload !== true" class="c21-button-primary" [ngStyle]="{'background-color': g.themeColor, 'border-color': g.themeColor}"
95
- (click)="dowloadTranscript()">
96
- <span [ngStyle]="{'color': g.themeForegroundColor}">{{ g.DOWNLOAD_TRANSCRIPT }}</span>
97
- </button> -->
98
- <!-- <button class="c21-button-link" (click)="returnClosePage()">
99
- <span>{{ g.CLOSE }}</span>
100
- </button> -->
101
-
102
- <!-- ICON CLOSE -->
103
- <button tabindex="1414" class="c21-button-primary" (click)="returnClosePage()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
84
+
85
+ <!-- BUTTON CLOSE -->
86
+ <button type="button" class="c21-button-primary"
87
+ [attr.aria-label]="g.CLOSE"
88
+ (click)="returnClosePage()"
89
+ [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
104
90
  <span class="v-align-center">
105
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
91
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
106
92
  width="18" height="18" viewBox="0 0 24 24">
107
93
  <path fill="none" d="M0 0h24v24H0V0z" />
108
94
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
109
- <title id="altIconTitle">{{ g.CLOSE }}</title>
110
95
  </svg>
111
96
  </span>
112
97
  <span class="v-align-center c21-label-button">
113
98
  {{ g.CLOSE }}
114
- <!-- {{translationMap?.get('LABEL_START_NW_CONV')}} -->
115
- </span>
99
+ </span>
116
100
  <div class="clear"></div>
117
101
  </button>
118
102
  </div>
@@ -120,62 +104,47 @@ svg.star:hover{
120
104
 
121
105
  <!-- *************** STEP 1 : BEGIN ***************** -->
122
106
  <div *ngIf="step==1" class="step-rate">
123
- <!-- CONTENT -->
124
- <!-- <div *ngIf="g.allowTranscriptDownload" class="c21-modal-content" style="text-align: right; margin: 0px 20px 30px 10px;">
125
- <div class="c21-link" (click)="dowloadTranscript()" >
126
- <span [ngStyle]="{'color': g.themeColor}">{{ g.DOWNLOAD_TRANSCRIPT }}</span>
127
- </div>
128
- </div> -->
129
107
  <div class="clear"></div>
130
108
  <div class="c21-step-content">
131
- <!-- il tuo voto: -->
132
-
133
- <!-- <div class="chat21-stars">
134
- <span *ngIf="rate>0" class="fa fa-star checked"></span>
135
- <span *ngIf="rate>1" class="fa fa-star checked"></span>
136
- <span *ngIf="rate>2" class="fa fa-star checked"></span>
137
- <span *ngIf="rate>3" class="fa fa-star checked"></span>
138
- <span *ngIf="rate>4" class="fa fa-star checked"></span>
139
- </div> -->
140
- <!-- <div class="default-text">{{ g.YOUR_RATING }}</div> -->
141
-
142
-
143
- <!-- Scrivi la tua opinione...(opzionale) -->
109
+
144
110
  <textarea #textbox rows="1" id="chat21-message-rate-context" class='textarea-rate'
111
+ [attr.aria-label]="g.WRITE_YOUR_OPINION"
145
112
  placeholder="{{ g.WRITE_YOUR_OPINION }}">{{message}}</textarea>
146
113
  <div class="clear"></div>
147
114
 
148
- <!-- ICON CLOSE -->
149
- <button tabindex="1415" class="c21-button-primary" (click)="returnClosePage()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
115
+ <!-- BUTTON CLOSE -->
116
+ <button type="button" class="c21-button-primary"
117
+ [attr.aria-label]="g.CLOSE"
118
+ (click)="returnClosePage()"
119
+ [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
150
120
  <span class="v-align-center">
151
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
121
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
152
122
  width="18" height="18" viewBox="0 0 24 24">
153
123
  <path fill="none" d="M0 0h24v24H0V0z" />
154
124
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
155
- <title id="altIconTitle">{{ g.CLOSE }}</title>
156
125
  </svg>
157
126
  </span>
158
127
  <span class="v-align-center c21-label-button">
159
128
  {{ g.CLOSE }}
160
- <!-- {{translationMap?.get('LABEL_START_NW_CONV')}} -->
161
- </span>
129
+ </span>
162
130
  <div class="clear"></div>
163
131
  </button>
164
132
 
165
- <!-- ICON SUBMIT -->
166
- <button tabindex="1416" class="c21-button-primary" (click)="sendRate()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
133
+ <!-- BUTTON SUBMIT -->
134
+ <button type="button" class="c21-button-primary"
135
+ [attr.aria-label]="g.SUBMIT"
136
+ (click)="sendRate()"
137
+ [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
167
138
  <span class="v-align-center">
168
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
139
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
169
140
  width="18" height="18" viewBox="0 0 24 24">
170
141
  <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
171
142
  <path d="M0 0h24v24H0z" fill="none"/>
172
- <title id="altIconTitle">{{ g.SUBMIT }}</title>
173
143
  </svg>
174
144
  </span>
175
145
  <span class="v-align-center c21-label-button">
176
146
  {{ g.SUBMIT }}
177
- <!-- {{translationMap?.get('LABEL_START_NW_CONV')}} -->
178
- </span>
147
+ </span>
179
148
  <div class="clear"></div>
180
149
  </button>
181
150
 
@@ -187,32 +156,33 @@ svg.star:hover{
187
156
  <!-- *************** STEP 2 : BEGIN ***************** -->
188
157
  <div *ngIf="step==2" class="step-rate">
189
158
  <div *ngIf="g.allowTranscriptDownload" class="c21-modal-content" style="text-align: right; margin: 0px 20px 30px 10px;">
190
- <div class="c21-link" (click)="dowloadTranscript()" >
159
+ <button type="button" class="c21-link c21-button-clean" (click)="dowloadTranscript()">
191
160
  <span [ngStyle]="{'color': stylesMap?.get('themeColor')}">{{ g.DOWNLOAD_TRANSCRIPT }}</span>
192
- </div>
161
+ </button>
193
162
  </div>
194
163
  <div class="clear"></div>
195
-
164
+
196
165
  <!-- CONTENT -->
197
166
  <div class="c21-step-content">
198
167
  <div class="default-title">{{ g.THANK_YOU_FOR_YOUR_EVALUATION }}</div>
199
168
  <div class="default-text">{{ g.YOUR_RATING_HAS_BEEN_RECEIVED }}</div>
200
169
  </div>
201
170
 
202
- <!-- ICON CLOSE -->
203
- <button tabindex="1415" class="c21-button-primary" (click)="returnClosePage()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
171
+ <!-- BUTTON CLOSE -->
172
+ <button type="button" class="c21-button-primary"
173
+ [attr.aria-label]="g.CLOSE"
174
+ (click)="returnClosePage()"
175
+ [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
204
176
  <span class="v-align-center">
205
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
177
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': stylesMap?.get('foregroundColor')}" xmlns="http://www.w3.org/2000/svg"
206
178
  width="18" height="18" viewBox="0 0 24 24">
207
179
  <path fill="none" d="M0 0h24v24H0V0z" />
208
180
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
209
- <title id="altIconTitle">{{ g.CLOSE }}</title>
210
181
  </svg>
211
182
  </span>
212
183
  <span class="v-align-center c21-label-button">
213
184
  {{ g.CLOSE }}
214
- <!-- {{translationMap?.get('LABEL_START_NW_CONV')}} -->
215
- </span>
185
+ </span>
216
186
  <div class="clear"></div>
217
187
  </button>
218
188
  </div>
@@ -225,4 +195,4 @@ svg.star:hover{
225
195
 
226
196
  </div>
227
197
 
228
- </div>
198
+ </div>
@@ -1,8 +1,12 @@
1
+ import { ElementRef, Renderer2 } from '@angular/core';
2
+
1
3
  import { TooltipDirective } from './tooltip.directive';
2
4
 
3
5
  describe('TooltipDirective', () => {
4
- // it('should create an instance', () => {
5
- // const directive = new TooltipDirective();
6
- // expect(directive).toBeTruthy();
7
- // });
6
+ it('should create', () => {
7
+ const el = document.createElement('span');
8
+ const renderer = jasmine.createSpyObj('Renderer2', ['createElement', 'appendChild', 'addClass', 'removeClass', 'removeChild', 'setStyle']);
9
+ const directive = new TooltipDirective(new ElementRef(el), renderer as unknown as Renderer2);
10
+ expect(directive).toBeTruthy();
11
+ });
8
12
  });
@@ -1,25 +1,37 @@
1
- <div class="modal-container">
1
+ <div class="modal-container"
2
+ role="dialog"
3
+ aria-modal="true"
4
+ cdkTrapFocus
5
+ [cdkTrapFocusAutoCapture]="true"
6
+ aria-labelledby="confirm-close-title"
7
+ [attr.aria-label]="translationMap?.get('CONFIRM_CLOSE_CHAT')">
2
8
  <div class="header">
3
9
  <!-- ICON CLOSE CHAT -->
4
- <button tabindex="-1" class="c21-header-button c21-right c21-close c21-button-clean" (click)="onBack()">
5
- <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('themeColor') }" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
10
+ <button type="button"
11
+ class="c21-header-button c21-right c21-close c21-button-clean"
12
+ [attr.aria-label]="translationMap?.get('CLOSE')"
13
+ (click)="onBack()">
14
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': stylesMap?.get('themeColor') }" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
6
15
  <path fill="none" d="M0 0h24v24H0V0z" />
7
16
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
8
- <title id="altIconTitle">{{ translationMap?.get('CLOSE') }}</title>
9
17
  </svg>
10
18
  </button>
11
19
  </div>
12
20
  <div class="content">
13
- <div class="text">{{ translationMap?.get('CONFIRM_CLOSE_CHAT') }}</div>
21
+ <h2 id="confirm-close-title" class="text">{{ translationMap?.get('CONFIRM_CLOSE_CHAT') }}</h2>
14
22
  <div class="options">
15
23
 
16
24
  <!-- BUTTON CANCEL-->
17
- <span class="v-align-center c21-label-button back-button" [class.disabled]="isLoadingActive" (click)="onBack()">
25
+ <button type="button"
26
+ class="c21-button-clean v-align-center c21-label-button back-button"
27
+ [class.disabled]="isLoadingActive"
28
+ [attr.disabled]="isLoadingActive ? true : null"
29
+ (click)="onBack()">
18
30
  {{translationMap?.get('BACK')}}
19
- </span>
31
+ </button>
20
32
 
21
33
  <!-- BUTTON CLOSE-->
22
- <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="onConfirm()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
34
+ <button type="button" aflistconv #aflistconv class="c21-button-primary" (click)="onConfirm()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
23
35
  <span *ngIf="isLoadingActive" class="spinner-container">
24
36
  <svg xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="25" height="25" [ngStyle]="{'fill': stylesMap?.get('foregroundColor') }"
25
37
  viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
@@ -16,6 +16,9 @@
16
16
  gap: 15px;
17
17
  .text{
18
18
  max-width: calc(100% - 30px);
19
+ margin: 0;
20
+ font-size: 1em;
21
+ font-weight: 500;
19
22
  }
20
23
  .options{
21
24
  display: flex;
@@ -1,4 +1,8 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
1
+ import { A11yModule } from '@angular/cdk/a11y';
2
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
3
+
4
+ import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
5
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
2
6
 
3
7
  import { ConfirmCloseComponent } from './confirm-close.component';
4
8
 
@@ -6,12 +10,17 @@ describe('ConfirmCloseComponent', () => {
6
10
  let component: ConfirmCloseComponent;
7
11
  let fixture: ComponentFixture<ConfirmCloseComponent>;
8
12
 
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
13
+ beforeEach(waitForAsync(() => {
14
+ const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
15
+ LoggerInstance.setInstance(new CustomLogger(ngxlogger));
16
+ TestBed.configureTestingModule({
17
+ imports: [A11yModule],
11
18
  declarations: [ ConfirmCloseComponent ]
12
19
  })
13
- .compileComponents();
20
+ .compileComponents();
21
+ }));
14
22
 
23
+ beforeEach(() => {
15
24
  fixture = TestBed.createComponent(ConfirmCloseComponent);
16
25
  component = fixture.componentInstance;
17
26
  fixture.detectChanges();