@aakash58/chatbot 1.1.21 → 1.1.22

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 (351) hide show
  1. package/README.md +22 -298
  2. package/esm2022/aakash58-chatbot.mjs +5 -0
  3. package/esm2022/lib/app/chat/chat-ui-state.service.mjs +170 -0
  4. package/esm2022/lib/app/chat/chat.service.mjs +445 -0
  5. package/esm2022/lib/app/chat/components/chat-button/chat-button.component.mjs +50 -0
  6. package/esm2022/lib/app/chat/components/chat-footer/chat-footer.component.mjs +12 -0
  7. package/esm2022/lib/app/chat/components/chat-header/chat-header.component.mjs +66 -0
  8. package/esm2022/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.mjs +186 -0
  9. package/esm2022/lib/app/chat/components/chat-window/chat-window.component.mjs +312 -0
  10. package/esm2022/lib/app/chat/components/message-input/message-input.component.mjs +36 -0
  11. package/esm2022/lib/app/chat/components/message-list/message-list.component.mjs +115 -0
  12. package/esm2022/lib/app/chat/model/chat-history.model.mjs +2 -0
  13. package/esm2022/lib/app/chat/model/chat-request.model.mjs +2 -0
  14. package/esm2022/lib/app/chat/model/chat-response.model.mjs +2 -0
  15. package/esm2022/lib/app/chat/model/chat-session.model.mjs +2 -0
  16. package/esm2022/lib/app/chat/model/chat-stream-message.model.mjs +2 -0
  17. package/esm2022/lib/app/chat/model/chat-stream-response.model.mjs +2 -0
  18. package/esm2022/lib/app/chat/services/chat-api.service.mjs +61 -0
  19. package/esm2022/lib/app/chat/services/chat-audio.service.mjs +50 -0
  20. package/esm2022/lib/app/chat/services/chat-history.service.mjs +252 -0
  21. package/esm2022/lib/app/login/login-form.component.mjs +46 -0
  22. package/esm2022/lib/app/personalization/personalization-dialog.component.mjs +194 -0
  23. package/esm2022/lib/app/personalization/personalization.service.mjs +149 -0
  24. package/esm2022/lib/app/personalization/sections/account/account-section.component.mjs +122 -0
  25. package/esm2022/lib/app/personalization/sections/preferences/color-picker-dialog.component.mjs +86 -0
  26. package/esm2022/lib/app/personalization/sections/preferences/preferences-section.component.mjs +115 -0
  27. package/esm2022/lib/app/personalization/sections/profile/profile-section.component.mjs +29 -0
  28. package/esm2022/lib/app/personalization/sections/settings/setting-section.component.mjs +30 -0
  29. package/esm2022/lib/app/personalization/sections/terms/terms-section.component.mjs +12 -0
  30. package/esm2022/lib/constant/doohbot-constant.mjs +28 -0
  31. package/esm2022/lib/constant/html-entities.mjs +9 -0
  32. package/esm2022/lib/constant/utf8.mjs +10 -0
  33. package/esm2022/lib/core/app-const.mjs +61 -0
  34. package/esm2022/lib/core/auth/account-api.service.mjs +40 -0
  35. package/esm2022/lib/core/auth/auth.service.mjs +391 -0
  36. package/esm2022/lib/core/auth/models/auth-result.model.mjs +3 -0
  37. package/esm2022/lib/core/auth/models/federated-login-request.model.mjs +6 -0
  38. package/esm2022/lib/core/auth/models/login-request.model.mjs +6 -0
  39. package/esm2022/lib/core/auth/storage.service.mjs +110 -0
  40. package/esm2022/lib/core/directives/draggable/draggable-dialog.directive.mjs +112 -0
  41. package/esm2022/lib/core/directives/fullscreen/fullscreen.directive.mjs +55 -0
  42. package/esm2022/lib/core/directives/resizable/resizable-dialog.directive.mjs +179 -0
  43. package/esm2022/lib/core/environments/environment.mjs +15 -0
  44. package/esm2022/lib/core/environments/environment.prod.mjs +15 -0
  45. package/esm2022/lib/core/helpers/crypto-helper.service.mjs +52 -0
  46. package/esm2022/lib/core/http/http-stream.service.mjs +97 -0
  47. package/esm2022/lib/core/http/http.service.mjs +103 -0
  48. package/esm2022/lib/core/interceptors/auth.interceptor.mjs +96 -0
  49. package/esm2022/lib/core/interceptors/license.interceptor.mjs +44 -0
  50. package/esm2022/lib/core/models/api-config.model.mjs +18 -0
  51. package/esm2022/lib/core/models/api-request.model.mjs +2 -0
  52. package/esm2022/lib/core/models/api-response.model.mjs +8 -0
  53. package/esm2022/lib/core/models/doohbot-config.model.mjs +18 -0
  54. package/esm2022/lib/core/models/license.model.mjs +2 -0
  55. package/esm2022/lib/core/models/message.mjs +2 -0
  56. package/esm2022/lib/core/models/theme-config.model.mjs +2 -0
  57. package/esm2022/lib/core/services/core-config.service.mjs +52 -0
  58. package/esm2022/lib/core/services/license.service.mjs +145 -0
  59. package/esm2022/lib/core/services/markdown.service.mjs +64 -0
  60. package/esm2022/lib/core/services/theme.service.mjs +248 -0
  61. package/esm2022/lib/core/types/auth-mode.type.mjs +2 -0
  62. package/esm2022/lib/core/types/auth-status.type.mjs +5 -0
  63. package/esm2022/lib/core/types/chat-stream.type.mjs +2 -0
  64. package/esm2022/lib/core/types/message-role.type.mjs +2 -0
  65. package/esm2022/lib/core/types/prompt-mode.type.mjs +5 -0
  66. package/esm2022/lib/core/types/snackbar-error.type.mjs +5 -0
  67. package/esm2022/lib/core/types/tenant-resolution-strategy.type.mjs +2 -0
  68. package/esm2022/lib/core/utils/logger.service.mjs +42 -0
  69. package/esm2022/lib/doohbot-input.mjs +20 -0
  70. package/esm2022/lib/doohbot.component.mjs +444 -0
  71. package/esm2022/lib/predefined_messages.mjs +15 -0
  72. package/esm2022/lib/shared/chips/chips.component.mjs +28 -0
  73. package/esm2022/lib/shared/dialog/dialog.component.mjs +36 -0
  74. package/esm2022/lib/shared/dialog/dialog.service.mjs +64 -0
  75. package/esm2022/lib/shared/dialog/dialog.utils.mjs +85 -0
  76. package/esm2022/lib/shared/dropdown-menu/dropdown-menu.component.mjs +29 -0
  77. package/esm2022/lib/shared/input-dialog/input-dialog.component.mjs +38 -0
  78. package/esm2022/lib/shared/menu-item/menu-item.component.mjs +24 -0
  79. package/esm2022/lib/shared/pipes/simple-markdown.pipe.mjs +27 -0
  80. package/esm2022/lib/shared/snackbar/snackbar.component.mjs +43 -0
  81. package/esm2022/lib/shared/snackbar/snackbar.service.mjs +46 -0
  82. package/esm2022/lib/shared/snackbar/snackbar.utils.mjs +43 -0
  83. package/esm2022/public-api.mjs +37 -0
  84. package/fesm2022/aakash58-chatbot.mjs +5193 -0
  85. package/fesm2022/aakash58-chatbot.mjs.map +1 -0
  86. package/index.d.ts +5 -0
  87. package/lib/app/chat/chat-ui-state.service.d.ts +96 -0
  88. package/lib/app/chat/chat.service.d.ts +88 -0
  89. package/lib/app/chat/components/chat-button/chat-button.component.d.ts +16 -0
  90. package/lib/app/chat/components/chat-footer/chat-footer.component.d.ts +5 -0
  91. package/lib/app/chat/components/chat-header/chat-header.component.d.ts +24 -0
  92. package/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.d.ts +49 -0
  93. package/lib/app/chat/components/chat-window/chat-window.component.d.ts +107 -0
  94. package/lib/app/chat/components/message-input/message-input.component.d.ts +12 -0
  95. package/lib/app/chat/components/message-list/message-list.component.d.ts +40 -0
  96. package/lib/app/chat/model/chat-history.model.d.ts +51 -0
  97. package/lib/app/chat/model/chat-request.model.d.ts +10 -0
  98. package/lib/app/chat/model/chat-response.model.d.ts +9 -0
  99. package/lib/app/chat/model/chat-session.model.d.ts +12 -0
  100. package/{projects/doohbot/src/lib/app/chat/model/chat-stream-message.model.ts → lib/app/chat/model/chat-stream-message.model.d.ts} +5 -6
  101. package/lib/app/chat/model/chat-stream-response.model.d.ts +10 -0
  102. package/lib/app/chat/services/chat-api.service.d.ts +30 -0
  103. package/lib/app/chat/services/chat-audio.service.d.ts +19 -0
  104. package/lib/app/chat/services/chat-history.service.d.ts +53 -0
  105. package/lib/app/login/login-form.component.d.ts +20 -0
  106. package/lib/app/personalization/personalization-dialog.component.d.ts +53 -0
  107. package/lib/app/personalization/personalization.service.d.ts +66 -0
  108. package/lib/app/personalization/sections/account/account-section.component.d.ts +30 -0
  109. package/lib/app/personalization/sections/preferences/color-picker-dialog.component.d.ts +17 -0
  110. package/lib/app/personalization/sections/preferences/preferences-section.component.d.ts +27 -0
  111. package/lib/app/personalization/sections/profile/profile-section.component.d.ts +17 -0
  112. package/lib/app/personalization/sections/settings/setting-section.component.d.ts +10 -0
  113. package/lib/app/personalization/sections/terms/terms-section.component.d.ts +5 -0
  114. package/lib/constant/doohbot-constant.d.ts +12 -0
  115. package/lib/constant/html-entities.d.ts +8 -0
  116. package/lib/constant/utf8.d.ts +9 -0
  117. package/lib/core/app-const.d.ts +11 -0
  118. package/lib/core/auth/account-api.service.d.ts +20 -0
  119. package/lib/core/auth/auth.service.d.ts +90 -0
  120. package/lib/core/auth/models/auth-result.model.d.ts +4 -0
  121. package/lib/core/auth/models/federated-login-request.model.d.ts +5 -0
  122. package/lib/core/auth/models/login-request.model.d.ts +6 -0
  123. package/lib/core/auth/storage.service.d.ts +21 -0
  124. package/lib/core/directives/draggable/draggable-dialog.directive.d.ts +23 -0
  125. package/lib/core/directives/fullscreen/fullscreen.directive.d.ts +14 -0
  126. package/lib/core/directives/resizable/resizable-dialog.directive.d.ts +30 -0
  127. package/lib/core/environments/environment.d.ts +7 -0
  128. package/lib/core/environments/environment.prod.d.ts +7 -0
  129. package/lib/core/helpers/crypto-helper.service.d.ts +12 -0
  130. package/lib/core/http/http-stream.service.d.ts +18 -0
  131. package/lib/core/http/http.service.d.ts +20 -0
  132. package/lib/core/interceptors/auth.interceptor.d.ts +18 -0
  133. package/lib/core/interceptors/license.interceptor.d.ts +11 -0
  134. package/lib/core/models/api-config.model.d.ts +58 -0
  135. package/lib/core/models/api-request.model.d.ts +77 -0
  136. package/lib/core/models/api-response.model.d.ts +6 -0
  137. package/lib/core/models/doohbot-config.model.d.ts +81 -0
  138. package/{projects/doohbot/src/lib/core/models/license.model.ts → lib/core/models/license.model.d.ts} +23 -27
  139. package/lib/core/models/message.d.ts +16 -0
  140. package/lib/core/models/theme-config.model.d.ts +28 -0
  141. package/lib/core/services/core-config.service.d.ts +23 -0
  142. package/lib/core/services/license.service.d.ts +33 -0
  143. package/lib/core/services/markdown.service.d.ts +8 -0
  144. package/lib/core/services/theme.service.d.ts +40 -0
  145. package/{projects/doohbot/src/lib/core/types/auth-mode.type.ts → lib/core/types/auth-mode.type.d.ts} +4 -4
  146. package/{projects/doohbot/src/lib/core/types/auth-status.type.ts → lib/core/types/auth-status.type.d.ts} +4 -5
  147. package/{projects/doohbot/src/lib/core/types/chat-stream.type.ts → lib/core/types/chat-stream.type.d.ts} +4 -4
  148. package/{projects/doohbot/src/lib/core/types/message-role.type.ts → lib/core/types/message-role.type.d.ts} +4 -4
  149. package/{projects/doohbot/src/lib/core/types/prompt-mode.type.ts → lib/core/types/prompt-mode.type.d.ts} +4 -5
  150. package/{projects/doohbot/src/lib/core/types/snackbar-error.type.ts → lib/core/types/snackbar-error.type.d.ts} +4 -5
  151. package/{projects/doohbot/src/lib/core/types/tenant-resolution-strategy.type.ts → lib/core/types/tenant-resolution-strategy.type.d.ts} +4 -4
  152. package/lib/core/utils/logger.service.d.ts +11 -0
  153. package/lib/doohbot-input.d.ts +19 -0
  154. package/lib/doohbot.component.d.ts +108 -0
  155. package/lib/predefined_messages.d.ts +2 -0
  156. package/lib/shared/chips/chips.component.d.ts +10 -0
  157. package/lib/shared/dialog/dialog.component.d.ts +19 -0
  158. package/lib/shared/dialog/dialog.service.d.ts +29 -0
  159. package/lib/shared/dialog/dialog.utils.d.ts +41 -0
  160. package/lib/shared/dropdown-menu/dropdown-menu.component.d.ts +11 -0
  161. package/lib/shared/input-dialog/input-dialog.component.d.ts +20 -0
  162. package/lib/shared/menu-item/menu-item.component.d.ts +9 -0
  163. package/lib/shared/pipes/simple-markdown.pipe.d.ts +10 -0
  164. package/lib/shared/snackbar/snackbar.component.d.ts +14 -0
  165. package/lib/shared/snackbar/snackbar.service.d.ts +19 -0
  166. package/{projects/doohbot/src/lib/shared/snackbar/snackbar.utils.ts → lib/shared/snackbar/snackbar.utils.d.ts} +33 -49
  167. package/package.json +29 -75
  168. package/public-api.d.ts +11 -0
  169. package/.editorconfig +0 -17
  170. package/.vscode/extensions.json +0 -4
  171. package/.vscode/launch.json +0 -41
  172. package/.vscode/settings.json +0 -14
  173. package/.vscode/tasks.json +0 -60
  174. package/angular.json +0 -132
  175. package/docs/PUBLISHING_GUIDE.md +0 -104
  176. package/projects/app-doohbot/public/assets/const/app-const.json +0 -15
  177. package/projects/app-doohbot/public/assets/const/doohclick_license.json +0 -6
  178. package/projects/app-doohbot/public/favicon.ico +0 -0
  179. package/projects/app-doohbot/src/app/app.config.ts +0 -13
  180. package/projects/app-doohbot/src/app/app.html +0 -31
  181. package/projects/app-doohbot/src/app/app.routes.ts +0 -3
  182. package/projects/app-doohbot/src/app/app.scss +0 -279
  183. package/projects/app-doohbot/src/app/app.spec.ts +0 -23
  184. package/projects/app-doohbot/src/app/app.ts +0 -72
  185. package/projects/app-doohbot/src/index.html +0 -15
  186. package/projects/app-doohbot/src/main.ts +0 -6
  187. package/projects/app-doohbot/src/styles.scss +0 -15
  188. package/projects/app-doohbot/tsconfig.app.json +0 -15
  189. package/projects/app-doohbot/tsconfig.spec.json +0 -14
  190. package/projects/doohbot/README.md +0 -64
  191. package/projects/doohbot/docs/README.md +0 -140
  192. package/projects/doohbot/ng-package.json +0 -10
  193. package/projects/doohbot/package.json +0 -16
  194. package/projects/doohbot/src/lib/app/chat/chat-ui-state.service.ts +0 -194
  195. package/projects/doohbot/src/lib/app/chat/chat.service.ts +0 -547
  196. package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.html +0 -27
  197. package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.scss +0 -115
  198. package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.ts +0 -35
  199. package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.html +0 -3
  200. package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.scss +0 -20
  201. package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.ts +0 -12
  202. package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.html +0 -34
  203. package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.scss +0 -78
  204. package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.ts +0 -52
  205. package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.html +0 -77
  206. package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.scss +0 -346
  207. package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.ts +0 -188
  208. package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.html +0 -146
  209. package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.scss +0 -187
  210. package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.ts +0 -256
  211. package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.html +0 -17
  212. package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.scss +0 -59
  213. package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.ts +0 -28
  214. package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.html +0 -138
  215. package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.scss +0 -436
  216. package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.ts +0 -106
  217. package/projects/doohbot/src/lib/app/chat/model/chat-history.model.ts +0 -57
  218. package/projects/doohbot/src/lib/app/chat/model/chat-request.model.ts +0 -17
  219. package/projects/doohbot/src/lib/app/chat/model/chat-response.model.ts +0 -9
  220. package/projects/doohbot/src/lib/app/chat/model/chat-session.model.ts +0 -14
  221. package/projects/doohbot/src/lib/app/chat/model/chat-stream-response.model.ts +0 -12
  222. package/projects/doohbot/src/lib/app/chat/services/chat-api.service.ts +0 -82
  223. package/projects/doohbot/src/lib/app/chat/services/chat-audio.service.ts +0 -44
  224. package/projects/doohbot/src/lib/app/chat/services/chat-history.service.ts +0 -303
  225. package/projects/doohbot/src/lib/app/login/login-form.component.html +0 -80
  226. package/projects/doohbot/src/lib/app/login/login-form.component.scss +0 -189
  227. package/projects/doohbot/src/lib/app/login/login-form.component.ts +0 -45
  228. package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.html +0 -81
  229. package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.scss +0 -179
  230. package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.ts +0 -217
  231. package/projects/doohbot/src/lib/app/personalization/personalization.service.ts +0 -197
  232. package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.html +0 -111
  233. package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.scss +0 -218
  234. package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.ts +0 -121
  235. package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.html +0 -46
  236. package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.scss +0 -138
  237. package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.ts +0 -28
  238. package/projects/doohbot/src/lib/app/personalization/sections/preferences/color-picker-dialog.component.ts +0 -92
  239. package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.html +0 -198
  240. package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.scss +0 -107
  241. package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.ts +0 -103
  242. package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.html +0 -46
  243. package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.scss +0 -131
  244. package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.ts +0 -23
  245. package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.html +0 -33
  246. package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.scss +0 -61
  247. package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.ts +0 -20
  248. package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.html +0 -30
  249. package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.scss +0 -59
  250. package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.ts +0 -12
  251. package/projects/doohbot/src/lib/constant/doohbot-constant.ts +0 -40
  252. package/projects/doohbot/src/lib/constant/html-entities.ts +0 -8
  253. package/projects/doohbot/src/lib/constant/utf8.ts +0 -9
  254. package/projects/doohbot/src/lib/core/app-const.ts +0 -63
  255. package/projects/doohbot/src/lib/core/auth/account-api.service.ts +0 -53
  256. package/projects/doohbot/src/lib/core/auth/auth.service.ts +0 -478
  257. package/projects/doohbot/src/lib/core/auth/models/auth-result.model.ts +0 -4
  258. package/projects/doohbot/src/lib/core/auth/models/federated-login-request.model.ts +0 -5
  259. package/projects/doohbot/src/lib/core/auth/models/login-request.model.ts +0 -6
  260. package/projects/doohbot/src/lib/core/auth/storage.service.ts +0 -113
  261. package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.directive.ts +0 -123
  262. package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.module.ts +0 -9
  263. package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.directive.ts +0 -58
  264. package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.module.ts +0 -9
  265. package/projects/doohbot/src/lib/core/directives/popout/popout.directive.ts +0 -169
  266. package/projects/doohbot/src/lib/core/directives/popout/popout.module.ts +0 -9
  267. package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.directive.ts +0 -197
  268. package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.module.ts +0 -9
  269. package/projects/doohbot/src/lib/core/enums/api-request-state.enum.ts +0 -9
  270. package/projects/doohbot/src/lib/core/environments/environment.prod.ts +0 -14
  271. package/projects/doohbot/src/lib/core/environments/environment.ts +0 -14
  272. package/projects/doohbot/src/lib/core/helpers/crypto-helper.service.ts +0 -72
  273. package/projects/doohbot/src/lib/core/http/http-stream.service.ts +0 -105
  274. package/projects/doohbot/src/lib/core/http/http.service.ts +0 -148
  275. package/projects/doohbot/src/lib/core/interceptors/auth.interceptor.ts +0 -118
  276. package/projects/doohbot/src/lib/core/interceptors/license.interceptor.ts +0 -50
  277. package/projects/doohbot/src/lib/core/models/api-config.model.ts +0 -82
  278. package/projects/doohbot/src/lib/core/models/api-request.model.ts +0 -92
  279. package/projects/doohbot/src/lib/core/models/api-response.model.ts +0 -13
  280. package/projects/doohbot/src/lib/core/models/doohbot-config.model.ts +0 -109
  281. package/projects/doohbot/src/lib/core/models/message.ts +0 -18
  282. package/projects/doohbot/src/lib/core/models/theme-config.model.ts +0 -48
  283. package/projects/doohbot/src/lib/core/services/core-config.service.ts +0 -53
  284. package/projects/doohbot/src/lib/core/services/doohbot-api.service.ts +0 -207
  285. package/projects/doohbot/src/lib/core/services/license.service.ts +0 -171
  286. package/projects/doohbot/src/lib/core/services/markdown.service.ts +0 -73
  287. package/projects/doohbot/src/lib/core/services/theme.service.ts +0 -305
  288. package/projects/doohbot/src/lib/core/utils/error-handler.util.ts +0 -31
  289. package/projects/doohbot/src/lib/core/utils/logger.service.ts +0 -45
  290. package/projects/doohbot/src/lib/doohbot-input.ts +0 -19
  291. package/projects/doohbot/src/lib/doohbot.component.html +0 -34
  292. package/projects/doohbot/src/lib/doohbot.component.scss +0 -17
  293. package/projects/doohbot/src/lib/doohbot.component.spec.ts +0 -31
  294. package/projects/doohbot/src/lib/doohbot.component.ts +0 -545
  295. package/projects/doohbot/src/lib/elements.ts +0 -25
  296. package/projects/doohbot/src/lib/predefined_messages.ts +0 -14
  297. package/projects/doohbot/src/lib/shared/chips/chips.component.html +0 -9
  298. package/projects/doohbot/src/lib/shared/chips/chips.component.scss +0 -29
  299. package/projects/doohbot/src/lib/shared/chips/chips.component.spec.ts +0 -22
  300. package/projects/doohbot/src/lib/shared/chips/chips.component.ts +0 -20
  301. package/projects/doohbot/src/lib/shared/dialog/dialog.component.html +0 -29
  302. package/projects/doohbot/src/lib/shared/dialog/dialog.component.scss +0 -100
  303. package/projects/doohbot/src/lib/shared/dialog/dialog.component.ts +0 -42
  304. package/projects/doohbot/src/lib/shared/dialog/dialog.service.ts +0 -62
  305. package/projects/doohbot/src/lib/shared/dialog/dialog.utils.ts +0 -102
  306. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.html +0 -30
  307. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.scss +0 -53
  308. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.spec.ts +0 -22
  309. package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.ts +0 -35
  310. package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.html +0 -16
  311. package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.scss +0 -45
  312. package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.ts +0 -46
  313. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.html +0 -5
  314. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.scss +0 -0
  315. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.spec.ts +0 -22
  316. package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.ts +0 -20
  317. package/projects/doohbot/src/lib/shared/pipes/simple-markdown.pipe.ts +0 -19
  318. package/projects/doohbot/src/lib/shared/popout/popout.html +0 -1
  319. package/projects/doohbot/src/lib/shared/popout/popout.scss +0 -0
  320. package/projects/doohbot/src/lib/shared/popout/popout.spec.ts +0 -23
  321. package/projects/doohbot/src/lib/shared/popout/popout.ts +0 -11
  322. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.html +0 -7
  323. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.scss +0 -125
  324. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.spec.ts +0 -21
  325. package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.ts +0 -44
  326. package/projects/doohbot/src/lib/shared/snackbar/snackbar.service.ts +0 -54
  327. package/projects/doohbot/src/lib/styles/_theme.scss +0 -132
  328. package/projects/doohbot/src/lib/styles/material-override.scss +0 -302
  329. package/projects/doohbot/src/lib/styles/utility.scss +0 -588
  330. package/projects/doohbot/src/public-api.ts +0 -42
  331. package/projects/doohbot/tsconfig.lib.json +0 -15
  332. package/projects/doohbot/tsconfig.lib.prod.json +0 -11
  333. package/projects/doohbot/tsconfig.spec.json +0 -10
  334. package/proxy.conf.json +0 -8
  335. package/publish.config.js +0 -25
  336. package/scripts/publishing/index.ts +0 -67
  337. package/scripts/publishing/pipeline/01-clean.ts +0 -11
  338. package/scripts/publishing/pipeline/02-validate-pre.ts +0 -8
  339. package/scripts/publishing/pipeline/03-build.ts +0 -7
  340. package/scripts/publishing/pipeline/04-validate-post.ts +0 -8
  341. package/scripts/publishing/pipeline/05-prepare-package.ts +0 -29
  342. package/scripts/publishing/pipeline/06-version.ts +0 -23
  343. package/scripts/publishing/pipeline/07-publish.ts +0 -14
  344. package/scripts/publishing/pipeline/08-cleanup.ts +0 -5
  345. package/scripts/publishing/types.ts +0 -36
  346. package/scripts/publishing/utils/command.ts +0 -15
  347. package/scripts/publishing/utils/config.ts +0 -17
  348. package/scripts/validate.ts +0 -166
  349. package/tsconfig.json +0 -45
  350. package/tsconfig.scripts.json +0 -15
  351. /package/{projects/doohbot/src → src}/assets/bot.mp3 +0 -0
package/README.md CHANGED
@@ -1,16 +1,6 @@
1
- # DoohBot
1
+ # Doohbot
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.7.
4
-
5
- ## Development server
6
-
7
- To start a local development server, run:
8
-
9
- ```bash
10
- ng serve
11
- ```
12
-
13
- Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
14
4
 
15
5
  ## Code scaffolding
16
6
 
@@ -28,313 +18,47 @@ ng generate --help
28
18
 
29
19
  ## Building
30
20
 
31
- To build the projects, run:
21
+ To build the library, run:
32
22
 
33
23
  ```bash
34
- # Build the application
35
- ng build
36
-
37
- # Build the library (doohbot)
38
- npm run build-lib
24
+ ng build doohbot
39
25
  ```
40
26
 
41
- This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
42
28
 
43
- ## Running unit tests
29
+ ### Publishing the Library
44
30
 
45
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
31
+ Once the project is built, you can publish your library by following these steps:
46
32
 
47
- ```bash
48
- ng test
49
- ```
33
+ 1. Navigate to the `dist` directory:
50
34
 
51
- ## Running end-to-end tests
52
-
53
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
35
+ ```bash
36
+ cd dist/doohbot
37
+ ```
54
38
 
55
- ## Library Publishing
39
+ 2. Run the `npm publish` command to publish your library to the npm registry:
40
+ ```bash
41
+ npm publish
42
+ ```
56
43
 
57
- This project includes a specialized publishing system to prevent `NG0400` runtime errors (dual Angular runtime conflicts).
58
-
59
- ### 1. Validate the Package
60
-
61
- Before publishing, always run validation to ensure the library follows peer dependency rules and doesn't contain platform-creation code.
62
-
63
- ```bash
64
- npm run validate -- doohbot
65
- ```
66
-
67
- ### 2. Publish (Dry Run)
44
+ ## Running unit tests
68
45
 
69
- Test the entire 8-step publishing pipeline (build, validate, pack) without actually pushing to npm.
46
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
70
47
 
71
48
  ```bash
72
- npm run publish -- doohbot --dry-run
49
+ ng test
73
50
  ```
74
51
 
75
- ### 3. Actual Publish
52
+ ## Running end-to-end tests
76
53
 
77
- Execute the full publishing pipeline. This will build the library in **Ivy Partial Compilation mode**, run all validations, and publish to the registry.
54
+ For end-to-end (e2e) testing, run:
78
55
 
79
56
  ```bash
80
- # Publish current version
81
- npm run publish -- doohbot
82
-
83
- # Auto-increment version and publish
84
- npm run publish -- doohbot --patch
85
- npm run publish -- doohbot --minor
86
- npm run publish -- doohbot --major
57
+ ng e2e
87
58
  ```
88
59
 
89
- > [!TIP]
90
- > Detailed instructions and troubleshooting can be found in the [Publishing Guide](file:///d:/doohbot-copy/doohbot-ui/docs/PUBLISHING_GUIDE.md).
60
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
91
61
 
92
62
  ## Additional Resources
93
63
 
94
64
  For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
95
-
96
- # DoohBot Project Analysis & Structure
97
-
98
- ## Overview
99
-
100
- This project is an Angular workspace designed to build and maintain the `doohbot` conversational UI library. It follows a multi-project workspace structure, separating the core library logic from the wrapper/application layer.
101
-
102
- ## 📁 Project Structure
103
-
104
- ```text
105
- root/
106
- ├── .vscode/ 🛠️ VS Code settings (launch, tasks)
107
- ├── projects/
108
- │ ├── doohbot/ 📦 Core Chatbot UI Library
109
- │ │ ├── src/
110
- │ │ │ ├── lib/
111
- │ │ │ │ ├── components/ 🎨 Feature Components
112
- │ │ │ │ │ ├── chat-button/ ✨ Floating launcher button
113
- │ │ │ │ │ ├── chat-history-sidebar/ ✨ Sidebar for past chats
114
- │ │ │ │ │ ├── chat-window/ ✨ Main chat interface container
115
- │ │ │ │ │ ├── message-input/ ✨ Input area & send logic
116
- │ │ │ │ │ └── message-list/ ✨ Scrollable message stream
117
- │ │ │ │ ├── core/ 🧠 Core Logic & Services
118
- │ │ │ │ │ ├── helpers/
119
- │ │ │ │ │ │ └── crypto-helper.service.ts
120
- │ │ │ │ │ ├── interceptors/
121
- │ │ │ │ │ │ └── auth.interceptor.ts ✨ Token injection
122
- │ │ │ │ │ ├── models/ 📋 Interfaces & Types
123
- │ │ │ │ │ │ ├── api-response.model.ts
124
- │ │ │ │ │ │ ├── auth-result.model.ts
125
- │ │ │ │ │ │ ├── login-request.model.ts
126
- │ │ │ │ │ │ └── user-context.model.ts
127
- │ │ │ │ │ ├── services/ ⚙️ Singleton Services
128
- │ │ │ │ │ │ ├── account.service.ts
129
- │ │ │ │ │ │ ├── auth.service.ts ✨ Authentication mgmt
130
- │ │ │ │ │ │ ├── chat-facade.service.ts ✨ Main interaction API
131
- │ │ │ │ │ │ ├── chat-history.service.ts
132
- │ │ │ │ │ │ ├── chat-ui-state.service.ts ✨ UI visibility state
133
- │ │ │ │ │ │ ├── doohbot-api.service.ts ✨ Backend API wrapper
134
- │ │ │ │ │ │ ├── http.service.ts
135
- │ │ │ │ │ │ ├── storage.service.ts
136
- │ │ │ │ │ │ ├── tenant-context.service.ts
137
- │ │ │ │ │ │ └── theme.service.ts ✨ Dynamic theming
138
- │ │ │ │ │ └── app-const.ts
139
- │ │ │ │ ├── directives/ 🎮 DOM Behaviors
140
- │ │ │ │ │ ├── draggable/ ✨ Drag window logic
141
- │ │ │ │ │ ├── fullscreen/ ✨ Fullscreen toggle
142
- │ │ │ │ │ ├── popout/ ✨ Popout window logic
143
- │ │ │ │ │ └── resizable/ ✨ Resize window logic
144
- │ │ │ │ ├── shared/ 🧩 Reusable UI Elements
145
- │ │ │ │ │ ├── chips/ ✨ Suggestion chips
146
- │ │ │ │ │ ├── dialog/ ✨ Modal dialogs
147
- │ │ │ │ │ ├── dropdown-menu/ ✨ Custom options menu
148
- │ │ │ │ │ ├── menu-item/
149
- │ │ │ │ │ ├── popout/ ✨ Popout wrapper component
150
- │ │ │ │ │ └── snackbar/ ✨ Toast notifications
151
- │ │ │ │ ├── styles/ 💅 Global Styles
152
- │ │ │ │ │ ├── _theme.scss ✨ Theming mixins
153
- │ │ │ │ │ ├── material-override.scss ✨ Material design tweaks
154
- │ │ │ │ │ ├── utility.scss
155
- │ │ │ │ │ └── variables.scss
156
- │ │ │ │ ├── elements/ 🧱 Custom Elements Config
157
- │ │ │ │ └── model/ 📋 Library-wide Models
158
- │ │ │ │ └── doohbot-config.model.ts
159
- │ │ │ └── public-api.ts ✨ Library Entry Point
160
- │ └── doohbot-element/ 🔧 Wrapper Application
161
- │ └── src/
162
- ├── dist/ 📂 Build Artifacts
163
- ├── docs/ 📚 Project Documentation
164
- ├── examples/ 💡 Usage Examples
165
- ├── angular.json ⚙️ Workspace Configuration
166
- ├── package.json 📦 Dependencies & Scripts
167
- ├── tsconfig.json ⚙️ TypeScript Config
168
- └── README.md 📄 Documentation
169
- ```
170
-
171
- ---
172
-
173
- # DoohBot Project Analysis & Structure
174
-
175
- ## Overview
176
-
177
- This project is an Angular workspace designed to build and maintain the `doohbot` conversational UI library. It follows a multi-project workspace structure, separating the core library logic from the wrapper/application layer.
178
-
179
- ## Project Architecture
180
-
181
- ### Workspace Structure
182
-
183
- The workspace root contains configuration files that manage the build, linting, and development environment for all projects within the repository.
184
-
185
- #### Root Configuration Files
186
-
187
- - **`angular.json`**: The workspace configuration file. Defines the projects (`doohbot`, `doohbot-element`), build architectures, file replacements, and default project settings.
188
- - **`package.json`**: Lists npm dependencies (Angular, Material, etc.), build scripts, and package metadata.
189
- - **`tsconfig.json`**: Base TypeScript configuration for the entire workspace.
190
- - **`.editorconfig`**: Defines consistent coding styles (indentation, charset, etc.) for different IDEs.
191
- - **`.gitignore`**: Specifies files and directories ignored by Git.
192
-
193
- #### Root Directories
194
-
195
- - **`projects/`**: The core directory containing the source code for the library and applications.
196
- - **`doohbot/`**: The main Angular Library project.
197
- - **`doohbot-element/`**: The wrapper application project.
198
- - **`.vscode/`**: VS Code specific settings.
199
- - `launch.json`: Debugging configurations.
200
- - `tasks.json`: Task definitions (e.g., build commands).
201
- - `extensions.json`: Recommended extensions for this workspace.
202
- - **`dist/`**: The output directory where build artifacts (compiled code) are generated.
203
- - **`docs/`**: Documentation files for the project.
204
- - **`examples/`**: Contains example implementations or usage scenarios.
205
-
206
- ### 1. DoohBot Library (`projects/doohbot`)
207
-
208
- This is the heart of the repository. It contains the reusable Angular components, services, and directives that make up the chat interface.
209
-
210
- The following is a detailed breakdown of every file in the library:
211
-
212
- #### Component Layer (`src/lib/components`)
213
-
214
- High-level structural components that compose the chat application.
215
-
216
- - **chat-window/**: The main container for the chat interface.
217
- - `chat-window.component.ts`: Logic for window state (open/close, minimize), layout, and event handling.
218
- - `chat-window.component.html`: Template structure for the chat window.
219
- - `chat-window.component.scss`: Styles for the chat window container.
220
- - **message-list/**: Renders the scrollable list of chat messages.
221
- - `message-list.component.ts`: Handles rendering messages, auto-scrolling, and message grouping.
222
- - `message-list.component.html`: Template loop for displaying messages.
223
- - `message-list.component.scss`: Styles for the message container and bubbles.
224
- - **message-input/**: The area where users type and send messages.
225
- - `message-input.component.ts`: Logic for text input, auto-resizing textarea, and send actions.
226
- - `message-input.component.html`: Template for the input field and send button.
227
- - `message-input.component.scss`: Styles for the input area.
228
- - `messaging.service.ts`: Local service for message input state or helper logic.
229
- - **chat-history-sidebar/**: Sidebar displaying a list of previous chat sessions.
230
- - `chat-history-sidebar.component.ts`: Logic for fetching and displaying history items.
231
- - `chat-history-sidebar.component.html`: Template for the sidebar list.
232
- - `chat-history-sidebar.component.scss`: Styles for the sidebar and history items.
233
- - **chat-button/**: The floating action button (FAB) to toggle the chat.
234
- - `chat-button.component.ts`: Logic for the floating launcher button.
235
- - `chat-button.component.html`: Template for the button icon.
236
- - `chat-button.component.scss`: Styles for positioning and animating the button.
237
-
238
- #### Core Layer (`src/lib/core`)
239
-
240
- Singleton services and core business logic.
241
-
242
- - **services/**:
243
- - `auth.service.ts`: Manages user authentication, login/logout, and token storage.
244
- - `chat-facade.service.ts`: The primary API for components to interact with chat logic (Facade pattern).
245
- - `chat-history.service.ts`: Handles API calls to fetch/store chat history.
246
- - `chat-ui-state.service.ts`: Manages UI state (open, closed, loading) across components.
247
- - `doohbot-api.service.ts`: Low-level wrapper for backend API endpoints.
248
- - `http.service.ts`: Custom wrapper around HttpClient for standardized requests/error handling.
249
- - `storage.service.ts`: Wrapper for LocalStorage/SessionStorage interactions.
250
- - `tenant-context.service.ts`: Manages tenant-specific configuration and context.
251
- - `theme.service.ts`: Dynamically applies themes by manipulating CSS variables.
252
- - `account.service.ts`: logic related to user account management.
253
- - **models/**:
254
- - `api-response.model.ts`: Interface for standard API response structure.
255
- - `auth-result.model.ts`: Interface for authentication results.
256
- - `login-request.model.ts`: Interface for login payloads.
257
- - `user-context.model.ts`: Interface for user session data.
258
- - **interceptors/**:
259
- - `auth.interceptor.ts`: HTTP interceptor to inject Auth tokens into requests.
260
- - **helpers/**:
261
- - `crypto-helper.service.ts`: Utilities for encryption/decryption (if used).
262
- - **roots**:
263
- - `app-const.ts`: Application-wide constants.
264
-
265
- #### Shared Layer (`src/lib/shared`)
266
-
267
- Reusable UI components used within the larger feature components.
268
-
269
- - **chips/**:
270
- - `chips.component.ts/html/scss`: Renders clickable suggestion chips.
271
- - **dialog/**:
272
- - `dialog.component.ts/html/scss`: A reusable modal/dialog component.
273
- - `dialog.service.ts`: Service to dynamically open dialogs.
274
- - **dropdown-menu/**:
275
- - `dropdown-menu.component.ts/html/scss`: A custom dropdown menu UI.
276
- - **menu-item/**:
277
- - `menu-item.component.ts/html/scss`: Individual items within a menu.
278
- - **snackbar/**:
279
- - `snackbar.component.ts/html/scss`: Toast notification component.
280
- - **popout/**:
281
- - `popout.ts/html/scss`: Component wrapper for popped-out windows.
282
-
283
- #### Directives (`src/lib/directives`)
284
-
285
- Custom behaviors applied to DOM elements.
286
-
287
- - **draggable/**:
288
- - `draggable-dialog.directive.ts`: Makes the chat window draggable.
289
- - `draggable-dialog.module.ts`: Module declaring the directive.
290
- - **resizable/**:
291
- - `resizable-dialog.directive.ts`: Allows resizing the chat window.
292
- - `resizable-dialog.module.ts`: Module declaring the directive.
293
- - **fullscreen/**:
294
- - `fullscreen.directive.ts`: Toggles fullscreen mode for an element.
295
- - `fullscreen.module.ts`: Module declaring the directive.
296
- - **popout/**:
297
- - `popout.directive.ts`: Handles the logic for detecting popout actions.
298
- - `popout.module.ts`: Module declaring the directive.
299
-
300
- #### Models (`src/lib/model`)
301
-
302
- TypeScript interfaces and types.
303
-
304
- - `doohbot-config.model.ts`: Configuration interface for the library.
305
- - `api-config.model.ts`: Configuration for API endpoints.
306
- - `chat-session.model.ts`: Model for a chat session.
307
- - `message.ts`: Model for a single chat message.
308
- - `doohbot.intents.ts`: Enum or types for chatbot intents.
309
- - `theme-config.model.ts`: Interface for theming options.
310
- - `token.ts`: Interface for auth tokens.
311
- - `tenant-config.model.ts`: Interface for tenant settings.
312
-
313
- #### Styles (`src/lib/styles`)
314
-
315
- Global styles and variables.
316
-
317
- - `variables.scss`: SCSS variables for colors, spacing, etc.
318
- - `_theme.scss`: Mixins and logic for generating themes.
319
- - `utility.scss`: General utility classes.
320
- - `material-override.scss`: Overrides for Angular Material styles.
321
-
322
- #### Elements (`src/lib/elements`)
323
-
324
- - `elements.ts`: Logic/definitions for Custom Elements.
325
-
326
- #### Inputs (`src/lib/inputs`)
327
-
328
- - `doohbot-input.ts`: Input definitions or configurations.
329
-
330
- #### Constants (`src/lib/constant`)
331
-
332
- - `app-constants.ts`: Global application constants.
333
- - `constant.ts`: General constants.
334
- - `utf8.ts`: UTF8 encoding/decoding utilities or constants.
335
-
336
- ### 2. DoohBot Element (`projects/doohbot-element`)
337
-
338
- This project serves as a wrapper to package the `doohbot` library as a standalone Web Component (Angular Element), enabling integration into non-Angular environments.
339
-
340
- ---
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWFrYXNoNTgtY2hhdGJvdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2Rvb2hib3Qvc3JjL2Fha2FzaDU4LWNoYXRib3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,170 @@
1
+ import { Injectable, signal, computed, effect } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * ChatUIStateService - Centralized UI state management
5
+ *
6
+ * Manages all UI-related state for the chat component including:
7
+ * - Chat window open/close state
8
+ * - History sidebar visibility
9
+ * - Unread message tracking
10
+ * - Fullscreen state
11
+ *
12
+ * This service uses Angular signals for reactive state management,
13
+ * allowing components to subscribe to state changes efficiently.
14
+ */
15
+ export class ChatUIStateService {
16
+ constructor() {
17
+ //! ===================== UI STATE SIGNALS============================
18
+ /**
19
+ * Whether the chat window is currently open
20
+ */
21
+ this.isChatOpen = signal(false);
22
+ /**
23
+ * Whether the history sidebar is currently open
24
+ */
25
+ this.isHistorySidebarOpen = signal(false);
26
+ /**
27
+ * Whether the chat is in fullscreen mode
28
+ */
29
+ this.isFullScreen = signal(false);
30
+ /**
31
+ * ID of the last message that was read by the user
32
+ */
33
+ this.lastReadMessageId = signal(null);
34
+ /**
35
+ * Reference to current messages (injected from outside)
36
+ */
37
+ this.messagesSignal = signal([]);
38
+ //! ===================== COMPUTED SIGNALS ======================
39
+ /**
40
+ * Computed number of unread bot messages
41
+ */
42
+ this.unreadCount = computed(() => {
43
+ if (this.isChatOpen()) {
44
+ return 0; // No unread when chat is open
45
+ }
46
+ const messages = this.messagesSignal();
47
+ if (messages.length === 0)
48
+ return 0;
49
+ const lastReadId = this.lastReadMessageId();
50
+ let lastReadIndex = -1;
51
+ if (lastReadId !== null) {
52
+ lastReadIndex = messages.findIndex((msg) => msg.id === lastReadId);
53
+ }
54
+ // Count unread bot messages after last read position
55
+ const unreadBotMessages = messages
56
+ .slice(lastReadIndex + 1)
57
+ .filter((msg) => msg.sender === 'assistant');
58
+ return unreadBotMessages.length;
59
+ });
60
+ //! ===================== EFFECTS ========================
61
+ /**
62
+ * Effect to automatically mark messages as read when chat is opened
63
+ */
64
+ this.markAsReadEffect = effect(() => {
65
+ const isOpen = this.isChatOpen();
66
+ const msgs = this.messagesSignal();
67
+ if (isOpen && msgs.length > 0) {
68
+ const lastMessage = msgs[msgs.length - 1];
69
+ if (lastMessage?.id) {
70
+ const currentLastRead = this.lastReadMessageId();
71
+ if (lastMessage.id !== currentLastRead) {
72
+ this.lastReadMessageId.set(lastMessage.id);
73
+ }
74
+ }
75
+ }
76
+ }, { allowSignalWrites: true });
77
+ }
78
+ //! =================== PUBLIC METHODS ===========================
79
+ /**
80
+ * Set the messages signal reference from an external source
81
+ * This allows the UI state service to track messages from MessageService
82
+ */
83
+ setMessagesSignal(messagesSignal) {
84
+ this.messagesSignal = messagesSignal;
85
+ }
86
+ /**
87
+ * Toggle the chat window open/close state
88
+ */
89
+ toggleChat() {
90
+ const currentlyOpen = this.isChatOpen();
91
+ this.isChatOpen.update((open) => !open);
92
+ // Mark messages as read when opening chat
93
+ if (!currentlyOpen) {
94
+ const messages = this.messagesSignal();
95
+ if (messages.length > 0) {
96
+ const lastMessage = messages[messages.length - 1];
97
+ this.lastReadMessageId.set(lastMessage.id ?? null);
98
+ }
99
+ }
100
+ }
101
+ /**
102
+ * Toggle the history sidebar open/close state
103
+ */
104
+ toggleHistorySidebar() {
105
+ this.isHistorySidebarOpen.update((open) => !open);
106
+ }
107
+ /**
108
+ * Close the chat window
109
+ */
110
+ closeChat() {
111
+ this.isChatOpen.set(false);
112
+ }
113
+ /**
114
+ * Open the chat window
115
+ */
116
+ openChat() {
117
+ this.isChatOpen.set(true);
118
+ }
119
+ /**
120
+ * Close the history sidebar
121
+ */
122
+ closeHistorySidebar() {
123
+ this.isHistorySidebarOpen.set(false);
124
+ }
125
+ /**
126
+ * Open the history sidebar
127
+ */
128
+ openHistorySidebar() {
129
+ this.isHistorySidebarOpen.set(true);
130
+ }
131
+ /**
132
+ * Toggle fullscreen mode
133
+ */
134
+ toggleFullscreen() {
135
+ this.isFullScreen.update((fs) => !fs);
136
+ }
137
+ /**
138
+ * Set fullscreen state
139
+ */
140
+ setFullscreen(isFullscreen) {
141
+ this.isFullScreen.set(isFullscreen);
142
+ }
143
+ /**
144
+ * Manually mark messages as read up to a specific message ID
145
+ */
146
+ markMessagesAsRead(messageId) {
147
+ this.lastReadMessageId.set(messageId);
148
+ }
149
+ /**
150
+ * Reset last read message ID
151
+ */
152
+ resetLastRead() {
153
+ this.lastReadMessageId.set(null);
154
+ }
155
+ /**
156
+ * Get the last read message ID
157
+ */
158
+ getLastReadMessageId() {
159
+ return this.lastReadMessageId();
160
+ }
161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatUIStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
162
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatUIStateService, providedIn: 'root' }); }
163
+ }
164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatUIStateService, decorators: [{
165
+ type: Injectable,
166
+ args: [{
167
+ providedIn: 'root',
168
+ }]
169
+ }] });
170
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdC11aS1zdGF0ZS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZG9vaGJvdC9zcmMvbGliL2FwcC9jaGF0L2NoYXQtdWktc3RhdGUuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFVLE1BQU0sZUFBZSxDQUFDOztBQUc3RTs7Ozs7Ozs7Ozs7R0FXRztBQUlILE1BQU0sT0FBTyxrQkFBa0I7SUFIL0I7UUFJRSxzRUFBc0U7UUFFdEU7O1dBRUc7UUFDSSxlQUFVLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRWxDOztXQUVHO1FBQ0kseUJBQW9CLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRTVDOztXQUVHO1FBQ0ksaUJBQVksR0FBRyxNQ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