@chat21/chat21-web-widget 5.1.32-rc8 → 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.
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 +68 -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.config.ts +41 -0
  80. package/src/app/app.component.html +2 -2
  81. package/src/app/app.component.scss +25 -14
  82. package/src/app/app.component.spec.ts +21 -6
  83. package/src/app/app.module.ts +4 -0
  84. package/src/app/component/conversation-detail/conversation/conversation.component.html +19 -11
  85. package/src/app/component/conversation-detail/conversation/conversation.component.scss +28 -0
  86. package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +644 -75
  87. package/src/app/component/conversation-detail/conversation/conversation.component.ts +63 -17
  88. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +25 -13
  89. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.spec.ts +123 -5
  90. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.ts +1 -0
  91. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +22 -9
  92. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +23 -1
  93. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +242 -149
  94. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +7 -6
  95. package/src/app/component/conversation-detail/conversation-emojii/conversation-emojii.component.spec.ts +53 -3
  96. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component copy.html +172 -0
  97. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +112 -61
  98. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +133 -16
  99. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.spec.ts +452 -78
  100. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +199 -79
  101. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +113 -53
  102. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +12 -4
  103. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +274 -29
  104. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +23 -9
  105. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.spec.ts +80 -8
  106. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +29 -23
  107. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.spec.ts +185 -16
  108. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +34 -14
  109. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.html +46 -19
  110. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.scss +67 -10
  111. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.ts +142 -12
  112. package/src/app/component/error-alert/error-alert.component.spec.ts +65 -5
  113. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +16 -7
  114. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +21 -0
  115. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.spec.ts +89 -7
  116. package/src/app/component/form/form-builder/form-builder.component.html +1 -1
  117. package/src/app/component/form/form-builder/form-builder.component.spec.ts +163 -21
  118. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.html +8 -4
  119. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +10 -5
  120. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.spec.ts +90 -16
  121. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +26 -0
  122. package/src/app/component/form/inputs/form-label/form-label.component.spec.ts +45 -11
  123. package/src/app/component/form/inputs/form-radio-button/form-radio-button.component.spec.ts +24 -6
  124. package/src/app/component/form/inputs/form-select/form-select.component.spec.ts +14 -5
  125. package/src/app/component/form/inputs/form-text/form-text.component.html +14 -12
  126. package/src/app/component/form/inputs/form-text/form-text.component.scss +11 -1
  127. package/src/app/component/form/inputs/form-text/form-text.component.spec.ts +113 -17
  128. package/src/app/component/form/inputs/form-text/form-text.component.ts +35 -3
  129. package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +13 -11
  130. package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +6 -5
  131. package/src/app/component/form/inputs/form-textarea/form-textarea.component.spec.ts +149 -13
  132. package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +26 -0
  133. package/src/app/component/form/prechat-form/prechat-form.component.html +14 -11
  134. package/src/app/component/form/prechat-form/prechat-form.component.spec.ts +102 -10
  135. package/src/app/component/form/prechat-form/prechat-form.component.ts +8 -1
  136. package/src/app/component/form/prechat-form-test-mock.ts +35 -0
  137. package/src/app/component/home/home.component.html +38 -31
  138. package/src/app/component/home/home.component.scss +4 -2
  139. package/src/app/component/home/home.component.spec.ts +226 -11
  140. package/src/app/component/home-conversations/home-conversations.component.html +30 -26
  141. package/src/app/component/home-conversations/home-conversations.component.scss +3 -0
  142. package/src/app/component/home-conversations/home-conversations.component.spec.ts +212 -36
  143. package/src/app/component/last-message/last-message.component.html +15 -9
  144. package/src/app/component/last-message/last-message.component.scss +16 -2
  145. package/src/app/component/last-message/last-message.component.spec.ts +204 -23
  146. package/src/app/component/launcher-button/launcher-button.component.html +8 -13
  147. package/src/app/component/launcher-button/launcher-button.component.spec.ts +104 -8
  148. package/src/app/component/list-all-conversations/list-all-conversations.component.html +12 -17
  149. package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -0
  150. package/src/app/component/list-conversations/list-conversations.component.html +22 -22
  151. package/src/app/component/menu-options/menu-options.component.html +30 -20
  152. package/src/app/component/menu-options/menu-options.component.spec.ts +125 -9
  153. package/src/app/component/message/audio/audio.component.html +13 -15
  154. package/src/app/component/message/audio/audio.component.spec.ts +140 -5
  155. package/src/app/component/message/audio/audio.component.ts +1 -0
  156. package/src/app/component/message/audio-sync/audio-sync.component.scss +1 -1
  157. package/src/app/component/message/audio-sync/audio-sync.component.spec.ts +81 -1
  158. package/src/app/component/message/audio-sync/audio-sync.component.ts +134 -24
  159. package/src/app/component/message/avatar/avatar.component.html +2 -2
  160. package/src/app/component/message/avatar/avatar.component.spec.ts +99 -7
  161. package/src/app/component/message/bubble-message/bubble-message.component.html +39 -52
  162. package/src/app/component/message/bubble-message/bubble-message.component.scss +59 -1
  163. package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +154 -57
  164. package/src/app/component/message/bubble-message/bubble-message.component.ts +152 -110
  165. package/src/app/component/message/buttons/action-button/action-button.component.html +3 -4
  166. package/src/app/component/message/buttons/action-button/action-button.component.spec.ts +49 -5
  167. package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -8
  168. package/src/app/component/message/buttons/link-button/link-button.component.spec.ts +50 -5
  169. package/src/app/component/message/buttons/text-button/text-button.component.spec.ts +44 -5
  170. package/src/app/component/message/carousel/carousel.component.html +29 -16
  171. package/src/app/component/message/carousel/carousel.component.scss +20 -8
  172. package/src/app/component/message/carousel/carousel.component.spec.ts +80 -3
  173. package/src/app/component/message/carousel/carousel.component.ts +16 -0
  174. package/src/app/component/message/frame/frame.component.html +9 -4
  175. package/src/app/component/message/frame/frame.component.spec.ts +34 -15
  176. package/src/app/component/message/frame/frame.component.ts +7 -2
  177. package/src/app/component/message/html/html.component.html +1 -1
  178. package/src/app/component/message/html/html.component.scss +1 -1
  179. package/src/app/component/message/html/html.component.spec.ts +24 -7
  180. package/src/app/component/message/image/image.component.html +12 -10
  181. package/src/app/component/message/image/image.component.scss +16 -0
  182. package/src/app/component/message/image/image.component.spec.ts +101 -15
  183. package/src/app/component/message/image/image.component.ts +90 -51
  184. package/src/app/component/message/info-message/info-message.component.spec.ts +26 -14
  185. package/src/app/component/message/json-sources/json-sources.component.html +38 -0
  186. package/src/app/component/message/json-sources/json-sources.component.scss +201 -0
  187. package/src/app/component/message/json-sources/json-sources.component.ts +89 -0
  188. package/src/app/component/message/like-unlike/like-unlike.component.html +7 -9
  189. package/src/app/component/message/like-unlike/like-unlike.component.spec.ts +31 -3
  190. package/src/app/component/message/return-receipt/return-receipt.component.spec.ts +38 -17
  191. package/src/app/component/message/text/text.component.html +3 -3
  192. package/src/app/component/message/text/text.component.scss +80 -86
  193. package/src/app/component/message/text/text.component.spec.ts +106 -13
  194. package/src/app/component/message-attachment/message-attachment.component.spec.ts +134 -13
  195. package/src/app/component/selection-department/selection-department.component.html +21 -23
  196. package/src/app/component/selection-department/selection-department.component.spec.ts +159 -14
  197. package/src/app/component/selection-department/selection-department.component.ts +8 -1
  198. package/src/app/component/send-button/send-button.component.html +5 -13
  199. package/src/app/component/send-button/send-button.component.spec.ts +2 -2
  200. package/src/app/component/star-rating-widget/star-rating-widget.component.html +51 -81
  201. package/src/app/directives/tooltip.directive.spec.ts +8 -4
  202. package/src/app/modals/confirm-close/confirm-close.component.html +20 -8
  203. package/src/app/modals/confirm-close/confirm-close.component.scss +3 -0
  204. package/src/app/modals/confirm-close/confirm-close.component.spec.ts +13 -4
  205. package/src/app/modals/confirm-close/confirm-close.component.ts +8 -1
  206. package/src/app/pipe/html-entites-encode.pipe.spec.ts +35 -2
  207. package/src/app/pipe/marked.pipe.spec.ts +38 -2
  208. package/src/app/pipe/marked.pipe.ts +51 -41
  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 +59 -2
  214. package/src/app/providers/json-sources-parser.service.ts +175 -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 +702 -0
  222. package/src/app/providers/voice/voice-streaming.types.ts +112 -0
  223. package/src/app/providers/voice/voice.service.spec.ts +170 -3
  224. package/src/app/providers/voice/voice.service.ts +695 -16
  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 +14 -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 +106 -100
  232. package/src/assets/i18n/es.json +107 -101
  233. package/src/assets/i18n/fr.json +107 -101
  234. package/src/assets/i18n/it.json +107 -99
  235. package/src/assets/sounds/keyboard.mp3 +0 -0
  236. package/src/assets/twp/index-dev.html +18 -0
  237. package/src/assets/twp/tiledesk_widget_files/widget-css-override-example.css +14 -0
  238. package/src/chat21-core/providers/chat-manager.spec.ts +72 -0
  239. package/src/chat21-core/providers/scripts/script.service.spec.ts +12 -2
  240. package/src/chat21-core/utils/constants.ts +4 -0
  241. package/src/chat21-core/utils/utils-message.ts +23 -1
  242. package/src/widget-config-template.json +3 -1
  243. package/src/widget-config.json +28 -27
  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,59 +1,235 @@
1
- import { CustomTranslateService } from './../../../chat21-core/providers/custom-translate.service';
2
- import { TranslatorService } from './../../providers/translator.service';
3
- import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
4
- import { AppConfigService } from './../../providers/app-config.service';
5
- import { WaitingService } from './../../providers/waiting.service';
6
- import { ChatManager } from './../../../chat21-core/providers/chat-manager';
7
- import { Globals } from './../../utils/globals';
8
1
  import { NO_ERRORS_SCHEMA } from '@angular/core';
9
- import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
3
+ import { By } from '@angular/platform-browser';
4
+ import { of, Subscription } from 'rxjs';
10
5
 
11
- import { HomeConversationsComponent } from './home-conversations.component';
12
- import { ImageRepoService } from '../../../chat21-core/providers/abstract/image-repo.service';
13
- import { ConversationsHandlerService } from '../../../chat21-core/providers/abstract/conversations-handler.service';
14
- import { ArchivedConversationsHandlerService } from '../../../chat21-core/providers/abstract/archivedconversations-handler.service';
15
- import { TranslateModule } from '@ngx-translate/core';
16
- import { NGXLogger } from 'ngx-logger';
6
+ import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
7
+ import { TranslatorService } from 'src/app/providers/translator.service';
8
+ import { ChatManager } from 'src/chat21-core/providers/chat-manager';
9
+ import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
17
10
  import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
18
11
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
12
+ import { ConversationModel } from 'src/chat21-core/models/conversation';
13
+ import { UserAgent } from 'src/models/userAgent';
14
+
15
+ import { WaitingService } from 'src/app/providers/waiting.service';
16
+ import { Globals } from '../../utils/globals';
17
+ import { HomeConversationsComponent } from './home-conversations.component';
19
18
 
20
19
  describe('HomeConversationsComponent', () => {
21
20
  let component: HomeConversationsComponent;
22
21
  let fixture: ComponentFixture<HomeConversationsComponent>;
23
- let ngxlogger: NGXLogger;
24
- let customLogger = new CustomLogger(ngxlogger)
25
-
22
+ let globals: Globals;
23
+ const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
24
+
25
+ const waitingStub = {
26
+ getCurrent: jasmine.createSpy('getCurrent').and.returnValue(of([{ waiting_time_avg: 45000 }])),
27
+ };
28
+
29
+ const imageRepoStub = {
30
+ getImagePhotoUrl: jasmine.createSpy('getImagePhotoUrl').and.returnValue('https://cdn.example/photo.png'),
31
+ checkImageExists: jasmine.createSpy('checkImageExists'),
32
+ };
33
+
34
+ const translateStub = {
35
+ translateLanguage: jasmine.createSpy('translateLanguage').and.callFake((keys: string[]) => {
36
+ const m = new Map<string, string>();
37
+ keys.forEach((k) => m.set(k, `T:${k}`));
38
+ return m;
39
+ }),
40
+ };
41
+
26
42
  beforeEach(waitForAsync(() => {
43
+ LoggerInstance.setInstance(new CustomLogger(ngxlogger));
27
44
  TestBed.configureTestingModule({
28
- declarations: [HomeConversationsComponent],
29
- schemas: [NO_ERRORS_SCHEMA],
30
- imports: [TranslateModule.forRoot()],
31
- providers: [
45
+ declarations: [HomeConversationsComponent],
46
+ schemas: [NO_ERRORS_SCHEMA],
47
+ providers: [
32
48
  Globals,
33
- ImageRepoService,
34
- ChatManager,
35
- ConversationsHandlerService,
36
- ArchivedConversationsHandlerService,
37
- WaitingService,
38
- AppConfigService,
39
- TranslatorService,
40
- CustomTranslateService,
41
- provideHttpClient(withInterceptorsFromDi())
42
- ]
43
- })
44
- .compileComponents();
49
+ { provide: ImageRepoService, useValue: imageRepoStub },
50
+ { provide: ChatManager, useValue: {} },
51
+ { provide: TranslatorService, useValue: { getLanguage: () => 'en' } },
52
+ { provide: CustomTranslateService, useValue: translateStub },
53
+ { provide: WaitingService, useValue: waitingStub },
54
+ ],
55
+ }).compileComponents();
45
56
  }));
46
57
 
47
58
  beforeEach(() => {
59
+ globals = TestBed.inject(Globals);
60
+ globals.initDefafultParameters();
61
+ globals.projectid = 'proj-1';
62
+ globals.WAITING_TIME_FOUND = 'Tempo stimato $reply_time';
63
+ globals.dynamicWaitTimeReply = true;
64
+ globals.showWaitTime = true;
65
+ globals.PREV_CONVERSATIONS = 'Le tue conversazioni';
66
+ globals.NO_CONVERSATION = 'Nessuna';
67
+ globals.SHOW_ALL_CONV = 'Vedi tutte';
68
+ globals.LABEL_START_NW_CONV = 'Nuova';
69
+ globals.themeColor = '#00f';
70
+ globals.themeForegroundColor = '#fff';
71
+ globals.showAllConversations = true;
72
+ globals.showAvailableAgents = false;
73
+ globals.availableAgents = [{ id: 'a1', firstname: 'Ada', imageurl: '' } as UserAgent];
74
+
48
75
  fixture = TestBed.createComponent(HomeConversationsComponent);
49
76
  component = fixture.componentInstance;
50
- LoggerInstance.setInstance(customLogger)
51
- let logger = LoggerInstance.getInstance()
52
- component['logger']= logger
77
+ component.stylesMap = new Map();
78
+ component.listConversations = [];
79
+ component.archivedConversations = [];
80
+ component.hideNewConversationButton = false;
81
+
53
82
  fixture.detectChanges();
54
83
  });
55
84
 
56
85
  it('should create', () => {
57
86
  expect(component).toBeTruthy();
58
87
  });
88
+
89
+ describe('initialize and waiting time', () => {
90
+ it('should load translations and agent image URLs', () => {
91
+ expect(translateStub.translateLanguage).toHaveBeenCalled();
92
+ expect(imageRepoStub.getImagePhotoUrl).toHaveBeenCalledWith('a1');
93
+ expect(component.availableAgents.length).toBe(1);
94
+ });
95
+
96
+ it('should set waitingTime and placeholder when API returns averages', fakeAsync(() => {
97
+ tick(0);
98
+ expect(waitingStub.getCurrent).toHaveBeenCalledWith('proj-1');
99
+ expect(component.waitingTime).toBe(45000);
100
+ expect(component.humanWaitingTime).toBeTruthy();
101
+ expect(component.WAITING_TIME_FOUND_WITH_REPLYTIME_PLACEHOLDER).toContain(component.humanWaitingTime);
102
+ }));
103
+
104
+ it('should render root container id', () => {
105
+ const root = fixture.debugElement.query(By.css('#c21-app-list-conversations'));
106
+ expect(root).toBeTruthy();
107
+ });
108
+ });
109
+
110
+ /** Allineato a twp/index + tiledesk_open: lista vuota, CTA primaria, footer tempo attesa */
111
+ describe('empty state UI (widget integration)', () => {
112
+ beforeEach(() => {
113
+ globals.NO_CONVERSATION = 'Nessuna conversazione attiva';
114
+ globals.LABEL_START_NW_CONV = 'Nuova conversazione';
115
+ globals.showAvailableAgents = false;
116
+ globals.availableAgents = [{ id: 'solo', firstname: 'Ada', imageurl: 'https://cdn.example/photo.png' } as UserAgent];
117
+ component.listConversations = [];
118
+ component.archivedConversations = [];
119
+ fixture.detectChanges();
120
+ });
121
+
122
+ it('should show NO_CONVERSATION title in header when both lists are empty', () => {
123
+ const titleEl = fixture.nativeElement.querySelector('.c21-header .c21-title') as HTMLElement;
124
+ expect(titleEl.textContent?.trim()).toBe('Nessuna conversazione attiva');
125
+ });
126
+
127
+ it('should render primary new-conversation button with theme label and paper-plane icon', () => {
128
+ const btn = fixture.nativeElement.querySelector('.c21-new-conversation .c21-button-primary') as HTMLButtonElement;
129
+ expect(btn).toBeTruthy();
130
+ expect(btn.getAttribute('aria-label')).toBe('Nuova conversazione');
131
+ expect(btn.textContent).toContain('Nuova conversazione');
132
+ expect(btn.querySelector('svg')).toBeTruthy();
133
+ });
134
+
135
+ it('should surface waiting footer copy when showWaitTime and API returned average', fakeAsync(() => {
136
+ tick(0);
137
+ fixture.detectChanges();
138
+ const footer = fixture.nativeElement.querySelector('.c21-footer .c21-waiting-time') as HTMLElement;
139
+ expect(footer).toBeTruthy();
140
+ expect(footer.textContent).toContain(component.humanWaitingTime);
141
+ }));
142
+ });
143
+
144
+ describe('checkShowAllConversation', () => {
145
+ it('should return true when archived list has items', () => {
146
+ component.archivedConversations = [{ uid: 'x' } as ConversationModel];
147
+ expect(component.checkShowAllConversation()).toBe(true);
148
+ });
149
+
150
+ it('should return true when active list has items', () => {
151
+ component.archivedConversations = [];
152
+ component.listConversations = [{ uid: 'y' } as ConversationModel];
153
+ expect(component.checkShowAllConversation()).toBe(true);
154
+ });
155
+
156
+ it('should return false when both lists are empty', () => {
157
+ component.archivedConversations = [];
158
+ component.listConversations = [];
159
+ expect(component.checkShowAllConversation()).toBe(false);
160
+ });
161
+ });
162
+
163
+ describe('outputs and selection', () => {
164
+ it('openNewConversation should emit onNewConversation', () => {
165
+ spyOn(component.onNewConversation, 'emit');
166
+ component.openNewConversation();
167
+ expect(component.onNewConversation.emit).toHaveBeenCalled();
168
+ });
169
+
170
+ it('returnOpenAllConversation should emit onOpenAllConvesations', () => {
171
+ spyOn(component.onOpenAllConvesations, 'emit');
172
+ component.returnOpenAllConversation();
173
+ expect(component.onOpenAllConvesations.emit).toHaveBeenCalled();
174
+ });
175
+
176
+ it('onConversationSelectedFN should emit when conversation is defined', () => {
177
+ spyOn(component.onConversationSelected, 'emit');
178
+ const c = { uid: 'c1' } as ConversationModel;
179
+ component.onConversationSelectedFN(c);
180
+ expect(component.onConversationSelected.emit).toHaveBeenCalledWith(c);
181
+ });
182
+
183
+ it('onConversationSelectedFN should not emit for falsy conversation', () => {
184
+ spyOn(component.onConversationSelected, 'emit');
185
+ component.onConversationSelectedFN(null as any);
186
+ expect(component.onConversationSelected.emit).not.toHaveBeenCalled();
187
+ });
188
+
189
+ it('onImageLoadedFN / onConversationLoadedFN should forward', () => {
190
+ spyOn(component.onImageLoaded, 'emit');
191
+ spyOn(component.onConversationLoaded, 'emit');
192
+ const c = { uid: 'z' } as ConversationModel;
193
+ component.onImageLoadedFN(c);
194
+ component.onConversationLoadedFN(c);
195
+ expect(component.onImageLoaded.emit).toHaveBeenCalledWith(c);
196
+ expect(component.onConversationLoaded.emit).toHaveBeenCalledWith(c);
197
+ });
198
+ });
199
+
200
+ describe('agent image map', () => {
201
+ it('isImageLoaded should be false without url or before load', () => {
202
+ const agent = { id: 'x2', firstname: 'B', imageurl: '' } as UserAgent;
203
+ expect(component.isImageLoaded(agent)).toBe(false);
204
+ });
205
+
206
+ it('onImageLoad should mark agent as loaded', () => {
207
+ const agent = { id: 'x3', imageurl: 'https://x' } as UserAgent;
208
+ component.onImageLoad(agent);
209
+ expect(component.isImageLoaded(agent)).toBe(true);
210
+ });
211
+
212
+ it('onImageError should mark agent as not loaded', () => {
213
+ const agent = { id: 'x4', imageurl: 'https://x' } as UserAgent;
214
+ component.onImageError(agent);
215
+ expect(component.imageLoadedMap.get('x4')).toBe(false);
216
+ });
217
+ });
218
+
219
+ describe('ngOnDestroy and unsubscribe', () => {
220
+ it('unsubscribe should clear subscription list', () => {
221
+ const sub = new Subscription();
222
+ spyOn(sub, 'unsubscribe');
223
+ component.subscriptions.push(sub);
224
+ component.unsubscribe();
225
+ expect(sub.unsubscribe).toHaveBeenCalled();
226
+ expect(component.subscriptions.length).toBe(0);
227
+ });
228
+
229
+ it('ngOnDestroy should call unsubscribe', () => {
230
+ spyOn(component, 'unsubscribe');
231
+ component.ngOnDestroy();
232
+ expect(component.unsubscribe).toHaveBeenCalled();
233
+ });
234
+ });
59
235
  });
@@ -10,14 +10,17 @@
10
10
  <span>View more</span>
11
11
  </div> -->
12
12
 
13
- <div aria-label="Dismiss" role="button" tabindex="0" class="buttonClose" (click)="closeMessagePreview()">
13
+ <button type="button"
14
+ aria-label="Dismiss"
15
+ class="buttonClose c21-button-clean"
16
+ (click)="closeMessagePreview()">
14
17
  <span>
15
- <svg aria-labelledby="altIconTitle" height="20px" role="img" viewBox="0 0 24 24" width="20px" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(255, 255, 255);">
18
+ <svg aria-hidden="true" focusable="false" height="20px" viewBox="0 0 24 24" width="20px" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(255, 255, 255);">
16
19
  <path d="M0 0h24v24H0V0z" fill="none"></path>
17
20
  <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"></path>
18
21
  </svg>
19
22
  </span>
20
- </div>
23
+ </button>
21
24
 
22
25
  </div>
23
26
 
@@ -26,8 +29,11 @@
26
29
 
27
30
  <div class="container">
28
31
 
29
- <div class="previewNewMessagge" (click)="openConversationByID(conversation)"
30
- [class.left-indicator]="isFirst && (!isImage(message) || isFrame(message))"
32
+ <button type="button"
33
+ class="previewNewMessagge c21-button-clean"
34
+ [attr.aria-label]="g.START_A_CONVERSATION"
35
+ (click)="openConversationByID(conversation)"
36
+ [class.left-indicator]="isFirst && (!isImage(message) || isFrame(message))"
31
37
  [class.no-background]="(isImage(message) || isFrame(message)) && message?.text?.trim() === ''">
32
38
 
33
39
  <chat-bubble-message class="messages no-background"
@@ -49,9 +55,9 @@
49
55
  </chat-avatar-image>
50
56
  </div>
51
57
  </div>
52
-
53
- </div>
54
-
58
+
59
+ </button>
60
+
55
61
  <div *ngIf="message?.attributes && message?.attributes?.attachment && last" class="conversations-buttons">
56
62
  <chat-message-attachment
57
63
  style="height: 100%; display: block;"
@@ -64,6 +70,6 @@
64
70
  </div>
65
71
 
66
72
  </div>
67
-
73
+
68
74
  </div>
69
75
  </div>
@@ -7,8 +7,9 @@
7
7
  min-height: 38px;
8
8
  }
9
9
  }
10
- :host .previewNewMessagge ::ng-deep > chat-bubble-message > #bubble-message > div > div > chat-text {
11
- p {
10
+ :host .previewNewMessagge ::ng-deep > chat-bubble-message > .bubble-message > div > div > chat-text {
11
+ p,
12
+ .message_innerhtml {
12
13
  overflow: hidden;
13
14
  text-overflow: ellipsis;
14
15
  display: -webkit-box;
@@ -111,6 +112,19 @@
111
112
  padding: 0px 5px;
112
113
  }
113
114
 
115
+ button.previewNewMessagge {
116
+ display: block;
117
+ align-self: stretch;
118
+ max-width: 100%;
119
+ text-align: left;
120
+ font: inherit;
121
+ -webkit-appearance: none;
122
+ appearance: none;
123
+ border: none;
124
+ cursor: pointer;
125
+ color: inherit;
126
+ }
127
+
114
128
  .previewNewMessagge.no-background{
115
129
  background-color: transparent;
116
130
  box-shadow: unset;
@@ -1,41 +1,222 @@
1
- import { MarkedPipe } from './../../pipe/marked.pipe';
2
- import { NO_ERRORS_SCHEMA } from '@angular/core';
3
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
4
- import { ImageRepoService } from '../../../chat21-core/providers/abstract/image-repo.service';
1
+ import { Injectable, NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core';
2
+ import { ComponentFixture, fakeAsync, flush, TestBed, tick, waitForAsync } from '@angular/core/testing';
3
+ import { By } from '@angular/platform-browser';
4
+ import { NGXLogger } from 'ngx-logger';
5
+ import { ConversationModel } from 'src/chat21-core/models/conversation';
6
+ import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
7
+ import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
8
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
9
+ import { EventsService } from '../../providers/events.service';
10
+ import { HtmlEntitiesEncodePipe } from '../../pipe/html-entities-encode.pipe';
11
+ import { MarkedPipe } from '../../pipe/marked.pipe';
5
12
  import { Globals } from '../../utils/globals';
6
-
13
+ import { MIN_WIDTH_IMAGES } from '../../utils/constants';
7
14
  import { LastMessageComponent } from './last-message.component';
8
- import { HtmlEntitiesEncodePipe } from '../../pipe/html-entities-encode.pipe';
15
+
16
+ @Injectable()
17
+ class ImageRepoStub extends ImageRepoService {
18
+ getImagePhotoUrl(): string {
19
+ return '';
20
+ }
21
+ checkImageExists(_uid: string, callback: (exist: boolean) => void): void {
22
+ callback(false);
23
+ }
24
+ }
9
25
 
10
26
  describe('LastMessageComponent', () => {
11
- let component: LastMessageComponent;
12
27
  let fixture: ComponentFixture<LastMessageComponent>;
28
+ let component: LastMessageComponent;
29
+ let globals: Globals;
30
+ let events: EventsService;
31
+ const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
32
+
33
+ function makeConversation(overrides: Partial<ConversationModel> = {}): ConversationModel {
34
+ return {
35
+ uid: 'conv-1',
36
+ attributes: {},
37
+ channel_type: 'direct',
38
+ conversation_with_fullname: 'Agent',
39
+ conversation_with: 'agent-1',
40
+ recipient: 'user-1',
41
+ recipient_fullname: 'User',
42
+ image: '',
43
+ is_new: true,
44
+ last_message_text: 'Messaggio mock in anteprima',
45
+ text: '',
46
+ sender: 'agent-1',
47
+ senderAuthInfo: null,
48
+ sender_fullname: 'Agent Name',
49
+ status: '200',
50
+ timestamp: '1',
51
+ selected: false,
52
+ color: '',
53
+ avatar: '',
54
+ archived: false,
55
+ type: 'text',
56
+ sound: true,
57
+ ...overrides,
58
+ } as ConversationModel;
59
+ }
13
60
 
14
- beforeEach(async(() => {
61
+ beforeEach(waitForAsync(() => {
62
+ LoggerInstance.setInstance(new CustomLogger(ngxlogger));
15
63
  TestBed.configureTestingModule({
16
- declarations: [
17
- LastMessageComponent,
18
- MarkedPipe,
19
- HtmlEntitiesEncodePipe
20
- ],
21
- imports: [
22
- ],
23
- providers: [
24
- Globals,
25
- ImageRepoService,
26
- ],
27
- schemas: [NO_ERRORS_SCHEMA]
28
- })
29
- .compileComponents();
64
+ declarations: [LastMessageComponent, MarkedPipe, HtmlEntitiesEncodePipe],
65
+ providers: [Globals, EventsService, { provide: ImageRepoService, useClass: ImageRepoStub }],
66
+ schemas: [NO_ERRORS_SCHEMA],
67
+ }).compileComponents();
30
68
  }));
31
69
 
32
70
  beforeEach(() => {
33
71
  fixture = TestBed.createComponent(LastMessageComponent);
34
72
  component = fixture.componentInstance;
35
- fixture.detectChanges();
73
+ globals = TestBed.inject(Globals);
74
+ events = TestBed.inject(EventsService);
75
+ globals.initDefafultParameters();
76
+ globals.senderId = 'user-1';
77
+ globals.isOpen = false;
78
+ globals.isOpenNewMessage = true;
79
+ spyOn(globals, 'setWidgetPreviewContainerSize').and.stub();
80
+ component.baseLocation = 'https://widget.test/';
81
+ component.stylesMap = new Map([['bubbleReceivedTextColor', '#111']]);
36
82
  });
37
83
 
38
84
  it('should create', () => {
39
85
  expect(component).toBeTruthy();
40
86
  });
87
+
88
+ it('con widget chiuso (isOpen=false) e anteprima attiva: mostra il bubble con il testo del messaggio mockato', fakeAsync(() => {
89
+ const conv = makeConversation();
90
+ component.conversation = conv;
91
+ component.ngOnChanges({
92
+ conversation: new SimpleChange(undefined, conv, true),
93
+ });
94
+ fixture.detectChanges();
95
+
96
+ const preview = fixture.debugElement.query(By.css('#messagePreview'));
97
+ expect(preview).toBeTruthy();
98
+ expect(component.messages.length).toBe(1);
99
+ expect(component.messages[0].text).toContain('Messaggio mock in anteprima');
100
+ expect(globals.isOpen).toBe(false);
101
+ flush();
102
+ }));
103
+
104
+ it('closeMessagePreview azzera conversazione, isOpenNewMessage e emette onCloseMessagePreview', () => {
105
+ const conv = makeConversation();
106
+ component.conversation = conv;
107
+ component.ngOnChanges({ conversation: new SimpleChange(undefined, conv, true) });
108
+ fixture.detectChanges();
109
+
110
+ spyOn(component.onCloseMessagePreview, 'emit');
111
+ component.closeMessagePreview();
112
+ expect(component.conversation).toBeNull();
113
+ expect(globals.isOpenNewMessage).toBe(false);
114
+ expect(component.onCloseMessagePreview.emit).toHaveBeenCalled();
115
+ });
116
+
117
+ it('openConversationByID emette onSelectedConversation e azzera isOpenNewMessage', () => {
118
+ const conv = makeConversation();
119
+ spyOn(component.onSelectedConversation, 'emit');
120
+ component.openConversationByID(conv);
121
+ expect(component.onSelectedConversation.emit).toHaveBeenCalledWith(conv as any);
122
+ expect(globals.isOpenNewMessage).toBe(false);
123
+ expect(component.conversation).toBeNull();
124
+ });
125
+
126
+ it('onAttachmentButtonClicked apre la conversazione e pubblica lastMessage:attachmentButtonClicked', fakeAsync(() => {
127
+ spyOn(events, 'publish');
128
+ const conv = makeConversation({
129
+ attributes: { attachment: { a: 1 } },
130
+ last_message_text: 'file',
131
+ });
132
+ component.conversation = conv;
133
+ component.ngOnChanges({ conversation: new SimpleChange(undefined, conv, true) });
134
+ fixture.detectChanges();
135
+
136
+ const payload = { kind: 'test' };
137
+ component.onAttachmentButtonClicked(payload);
138
+ tick(600);
139
+ expect(events.publish).toHaveBeenCalledWith('lastMessage:attachmentButtonClicked', payload);
140
+ }));
141
+
142
+ it('conversation con attributes.commands usa addCommandMessage', fakeAsync(() => {
143
+ const conv = makeConversation({
144
+ attributes: {
145
+ commands: [
146
+ {
147
+ type: 'message',
148
+ message: { text: ' cmd-a ', type: 'text', metadata: {} },
149
+ },
150
+ { type: 'wait', time: 5 },
151
+ {
152
+ type: 'message',
153
+ message: { text: ' cmd-b ', type: 'text', metadata: {} },
154
+ },
155
+ ],
156
+ },
157
+ last_message_text: 'ignored',
158
+ });
159
+ component.conversation = conv;
160
+ component.ngOnChanges({ conversation: new SimpleChange(undefined, conv, true) });
161
+ tick(0);
162
+ expect(component.messages.length).toBe(1);
163
+ tick(5);
164
+ expect(component.messages.length).toBe(2);
165
+ expect(component.messages[0].text).toContain('cmd-a');
166
+ expect(component.messages[1].text).toContain('cmd-b');
167
+ }));
168
+
169
+ it('getMetadataSize scala larghezza oltre il massimo', () => {
170
+ const meta = { width: 400, height: 100 };
171
+ const out = component.getMetadataSize(meta);
172
+ expect(out.width).toBe(230);
173
+ expect(out.height).toBeLessThan(100);
174
+ });
175
+
176
+ it('getMetadataSize alza immagini molto strette al minimo', () => {
177
+ const meta = { width: 40, height: 80 };
178
+ const out = component.getMetadataSize(meta);
179
+ expect(out.width).toBe(MIN_WIDTH_IMAGES);
180
+ });
181
+
182
+ it('getMetadataSize scala altezza oltre il massimo verticale', () => {
183
+ const meta = { width: 100, height: 400 };
184
+ const out = component.getMetadataSize(meta);
185
+ expect(out.height).toBe(150);
186
+ });
187
+
188
+ it('isSameSender delega a utils-message', () => {
189
+ component.messages = [{ sender: 'a' } as any, { sender: 'a' } as any];
190
+ expect(component.isSameSender('a', 1)).toBe(true);
191
+ });
192
+
193
+ it('onElementRenderedFN con messaggi renderizzati agenda setWidgetPreviewContainerSize', fakeAsync(() => {
194
+ const conv = makeConversation();
195
+ component.conversation = conv;
196
+ component.ngOnChanges({ conversation: new SimpleChange(undefined, conv, true) });
197
+ fixture.detectChanges();
198
+ component.onElementRenderedFN({});
199
+ tick(100);
200
+ flush();
201
+ expect(globals.setWidgetPreviewContainerSize).toHaveBeenCalled();
202
+ }));
203
+
204
+ it('ngOnDestroy pulisce stato', () => {
205
+ const conv = makeConversation();
206
+ component.conversation = conv;
207
+ component.messages = [{} as any];
208
+ globals.isOpenNewMessage = true;
209
+ component.ngOnDestroy();
210
+ expect(component.conversation).toBeNull();
211
+ expect(globals.isOpenNewMessage).toBe(false);
212
+ expect(component.messages.length).toBe(0);
213
+ });
214
+
215
+ it('unsubscribe svuota subscriptions', () => {
216
+ const sub = jasmine.createSpyObj('Subscription', ['unsubscribe']);
217
+ component.subscriptions = [sub];
218
+ component.unsubscribe();
219
+ expect(sub.unsubscribe).toHaveBeenCalled();
220
+ expect(component.subscriptions.length).toBe(0);
221
+ });
41
222
  });
@@ -1,20 +1,15 @@
1
- <!-- tabindex="000"-->
2
-
3
- <button aflauncherbutton #aflauncherbutton id="c21-launcher-button" class="c21-button-clean scale-in-center"
4
- *ngIf="g.isOpen == false"
1
+ <button aflauncherbutton #aflauncherbutton type="button" id="c21-launcher-button" class="c21-button-clean scale-in-center"
2
+ *ngIf="g.isOpen == false"
5
3
  [ngClass]="{'c21-align-left' : g.align === 'left', 'c21-align-right' : g.align !== 'left'}"
6
4
  [ngStyle]="{ 'background-color': g.baloonImage? null: 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}"
7
5
  (click)="openCloseWidget()"
8
- tabindex="1000"
9
- aria-label=" apri chat"
10
- >
11
-
12
- <!-- <div *ngIf="g.conversationsBadge>0" class="c21-divBudge">{{g.conversationsBadge}}</div> -->
6
+ [attr.aria-label]="g.BUTTON_OPEN_CHAT || 'Open chat'"
7
+ [attr.aria-expanded]="g.isOpen ? 'true' : 'false'">
13
8
 
14
9
  <!-- OPEN ICON -->
15
10
  <div *ngIf="!g.isOpen" class="launcher-button rotate-center" [@enterBubbleAnimation]>
16
- <img *ngIf="g.baloonImage !== '' " [src]="g.baloonImage" [ngStyle]="{'width': '100%', 'height': '100%', 'margin': 'auto', 'border-radius': g.baloonShape}">
17
- <svg role="img" [ngStyle]="{'fill': g.themeForegroundColor, 'display': (g.baloonImage==='')?'':'none' }" xmlns="http://www.w3.org/2000/svg" width="100%"
11
+ <img *ngIf="g.baloonImage !== '' " [src]="g.baloonImage" alt="" [ngStyle]="{'width': '100%', 'height': '100%', 'margin': 'auto', 'border-radius': g.baloonShape}">
12
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': g.themeForegroundColor, 'display': (g.baloonImage==='')?'':'none' }" xmlns="http://www.w3.org/2000/svg" width="100%"
18
13
  height="100%" viewBox="0 0 90 90">
19
14
  <path fill="none" d="M0 0h24v24H0V0z" />
20
15
  <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" />
@@ -28,11 +23,11 @@
28
23
 
29
24
  <!-- CLOSE ICON -->
30
25
  <div *ngIf="g.isOpen" class="launcher-button rotate-center" [@enterCloseAnimation]>
31
- <svg role="img" [ngStyle]="{'fill': g.themeForegroundColor }" xmlns="http://www.w3.org/2000/svg" width="100%"
26
+ <svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': g.themeForegroundColor }" xmlns="http://www.w3.org/2000/svg" width="100%"
32
27
  height="100%" viewBox="0 0 90 90">
33
28
  <path fill="none" d="M0 0h24v24H0V0z" />
34
29
  <path class="cls-1" d="M54.92,37.08l-2-2L45,43l-7.92-7.92-2,2L43,45l-7.92,7.92,2,2L45,47l7.92,7.92,2-2L47,45Z" />
35
30
  </svg>
36
31
  </div>
37
32
 
38
- </button>
33
+ </button>