@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.
- package/README.md +22 -298
- package/esm2022/aakash58-chatbot.mjs +5 -0
- package/esm2022/lib/app/chat/chat-ui-state.service.mjs +170 -0
- package/esm2022/lib/app/chat/chat.service.mjs +445 -0
- package/esm2022/lib/app/chat/components/chat-button/chat-button.component.mjs +50 -0
- package/esm2022/lib/app/chat/components/chat-footer/chat-footer.component.mjs +12 -0
- package/esm2022/lib/app/chat/components/chat-header/chat-header.component.mjs +66 -0
- package/esm2022/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.mjs +186 -0
- package/esm2022/lib/app/chat/components/chat-window/chat-window.component.mjs +312 -0
- package/esm2022/lib/app/chat/components/message-input/message-input.component.mjs +36 -0
- package/esm2022/lib/app/chat/components/message-list/message-list.component.mjs +115 -0
- package/esm2022/lib/app/chat/model/chat-history.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-request.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-response.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-session.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-stream-message.model.mjs +2 -0
- package/esm2022/lib/app/chat/model/chat-stream-response.model.mjs +2 -0
- package/esm2022/lib/app/chat/services/chat-api.service.mjs +61 -0
- package/esm2022/lib/app/chat/services/chat-audio.service.mjs +50 -0
- package/esm2022/lib/app/chat/services/chat-history.service.mjs +252 -0
- package/esm2022/lib/app/login/login-form.component.mjs +46 -0
- package/esm2022/lib/app/personalization/personalization-dialog.component.mjs +194 -0
- package/esm2022/lib/app/personalization/personalization.service.mjs +149 -0
- package/esm2022/lib/app/personalization/sections/account/account-section.component.mjs +122 -0
- package/esm2022/lib/app/personalization/sections/preferences/color-picker-dialog.component.mjs +86 -0
- package/esm2022/lib/app/personalization/sections/preferences/preferences-section.component.mjs +115 -0
- package/esm2022/lib/app/personalization/sections/profile/profile-section.component.mjs +29 -0
- package/esm2022/lib/app/personalization/sections/settings/setting-section.component.mjs +30 -0
- package/esm2022/lib/app/personalization/sections/terms/terms-section.component.mjs +12 -0
- package/esm2022/lib/constant/doohbot-constant.mjs +28 -0
- package/esm2022/lib/constant/html-entities.mjs +9 -0
- package/esm2022/lib/constant/utf8.mjs +10 -0
- package/esm2022/lib/core/app-const.mjs +61 -0
- package/esm2022/lib/core/auth/account-api.service.mjs +40 -0
- package/esm2022/lib/core/auth/auth.service.mjs +391 -0
- package/esm2022/lib/core/auth/models/auth-result.model.mjs +3 -0
- package/esm2022/lib/core/auth/models/federated-login-request.model.mjs +6 -0
- package/esm2022/lib/core/auth/models/login-request.model.mjs +6 -0
- package/esm2022/lib/core/auth/storage.service.mjs +110 -0
- package/esm2022/lib/core/directives/draggable/draggable-dialog.directive.mjs +112 -0
- package/esm2022/lib/core/directives/fullscreen/fullscreen.directive.mjs +55 -0
- package/esm2022/lib/core/directives/resizable/resizable-dialog.directive.mjs +179 -0
- package/esm2022/lib/core/environments/environment.mjs +15 -0
- package/esm2022/lib/core/environments/environment.prod.mjs +15 -0
- package/esm2022/lib/core/helpers/crypto-helper.service.mjs +52 -0
- package/esm2022/lib/core/http/http-stream.service.mjs +97 -0
- package/esm2022/lib/core/http/http.service.mjs +103 -0
- package/esm2022/lib/core/interceptors/auth.interceptor.mjs +96 -0
- package/esm2022/lib/core/interceptors/license.interceptor.mjs +44 -0
- package/esm2022/lib/core/models/api-config.model.mjs +18 -0
- package/esm2022/lib/core/models/api-request.model.mjs +2 -0
- package/esm2022/lib/core/models/api-response.model.mjs +8 -0
- package/esm2022/lib/core/models/doohbot-config.model.mjs +18 -0
- package/esm2022/lib/core/models/license.model.mjs +2 -0
- package/esm2022/lib/core/models/message.mjs +2 -0
- package/esm2022/lib/core/models/theme-config.model.mjs +2 -0
- package/esm2022/lib/core/services/core-config.service.mjs +52 -0
- package/esm2022/lib/core/services/license.service.mjs +145 -0
- package/esm2022/lib/core/services/markdown.service.mjs +64 -0
- package/esm2022/lib/core/services/theme.service.mjs +248 -0
- package/esm2022/lib/core/types/auth-mode.type.mjs +2 -0
- package/esm2022/lib/core/types/auth-status.type.mjs +5 -0
- package/esm2022/lib/core/types/chat-stream.type.mjs +2 -0
- package/esm2022/lib/core/types/message-role.type.mjs +2 -0
- package/esm2022/lib/core/types/prompt-mode.type.mjs +5 -0
- package/esm2022/lib/core/types/snackbar-error.type.mjs +5 -0
- package/esm2022/lib/core/types/tenant-resolution-strategy.type.mjs +2 -0
- package/esm2022/lib/core/utils/logger.service.mjs +42 -0
- package/esm2022/lib/doohbot-input.mjs +20 -0
- package/esm2022/lib/doohbot.component.mjs +444 -0
- package/esm2022/lib/predefined_messages.mjs +15 -0
- package/esm2022/lib/shared/chips/chips.component.mjs +28 -0
- package/esm2022/lib/shared/dialog/dialog.component.mjs +36 -0
- package/esm2022/lib/shared/dialog/dialog.service.mjs +64 -0
- package/esm2022/lib/shared/dialog/dialog.utils.mjs +85 -0
- package/esm2022/lib/shared/dropdown-menu/dropdown-menu.component.mjs +29 -0
- package/esm2022/lib/shared/input-dialog/input-dialog.component.mjs +38 -0
- package/esm2022/lib/shared/menu-item/menu-item.component.mjs +24 -0
- package/esm2022/lib/shared/pipes/simple-markdown.pipe.mjs +27 -0
- package/esm2022/lib/shared/snackbar/snackbar.component.mjs +43 -0
- package/esm2022/lib/shared/snackbar/snackbar.service.mjs +46 -0
- package/esm2022/lib/shared/snackbar/snackbar.utils.mjs +43 -0
- package/esm2022/public-api.mjs +37 -0
- package/fesm2022/aakash58-chatbot.mjs +5193 -0
- package/fesm2022/aakash58-chatbot.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/app/chat/chat-ui-state.service.d.ts +96 -0
- package/lib/app/chat/chat.service.d.ts +88 -0
- package/lib/app/chat/components/chat-button/chat-button.component.d.ts +16 -0
- package/lib/app/chat/components/chat-footer/chat-footer.component.d.ts +5 -0
- package/lib/app/chat/components/chat-header/chat-header.component.d.ts +24 -0
- package/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.d.ts +49 -0
- package/lib/app/chat/components/chat-window/chat-window.component.d.ts +107 -0
- package/lib/app/chat/components/message-input/message-input.component.d.ts +12 -0
- package/lib/app/chat/components/message-list/message-list.component.d.ts +40 -0
- package/lib/app/chat/model/chat-history.model.d.ts +51 -0
- package/lib/app/chat/model/chat-request.model.d.ts +10 -0
- package/lib/app/chat/model/chat-response.model.d.ts +9 -0
- package/lib/app/chat/model/chat-session.model.d.ts +12 -0
- 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
- package/lib/app/chat/model/chat-stream-response.model.d.ts +10 -0
- package/lib/app/chat/services/chat-api.service.d.ts +30 -0
- package/lib/app/chat/services/chat-audio.service.d.ts +19 -0
- package/lib/app/chat/services/chat-history.service.d.ts +53 -0
- package/lib/app/login/login-form.component.d.ts +20 -0
- package/lib/app/personalization/personalization-dialog.component.d.ts +53 -0
- package/lib/app/personalization/personalization.service.d.ts +66 -0
- package/lib/app/personalization/sections/account/account-section.component.d.ts +30 -0
- package/lib/app/personalization/sections/preferences/color-picker-dialog.component.d.ts +17 -0
- package/lib/app/personalization/sections/preferences/preferences-section.component.d.ts +27 -0
- package/lib/app/personalization/sections/profile/profile-section.component.d.ts +17 -0
- package/lib/app/personalization/sections/settings/setting-section.component.d.ts +10 -0
- package/lib/app/personalization/sections/terms/terms-section.component.d.ts +5 -0
- package/lib/constant/doohbot-constant.d.ts +12 -0
- package/lib/constant/html-entities.d.ts +8 -0
- package/lib/constant/utf8.d.ts +9 -0
- package/lib/core/app-const.d.ts +11 -0
- package/lib/core/auth/account-api.service.d.ts +20 -0
- package/lib/core/auth/auth.service.d.ts +90 -0
- package/lib/core/auth/models/auth-result.model.d.ts +4 -0
- package/lib/core/auth/models/federated-login-request.model.d.ts +5 -0
- package/lib/core/auth/models/login-request.model.d.ts +6 -0
- package/lib/core/auth/storage.service.d.ts +21 -0
- package/lib/core/directives/draggable/draggable-dialog.directive.d.ts +23 -0
- package/lib/core/directives/fullscreen/fullscreen.directive.d.ts +14 -0
- package/lib/core/directives/resizable/resizable-dialog.directive.d.ts +30 -0
- package/lib/core/environments/environment.d.ts +7 -0
- package/lib/core/environments/environment.prod.d.ts +7 -0
- package/lib/core/helpers/crypto-helper.service.d.ts +12 -0
- package/lib/core/http/http-stream.service.d.ts +18 -0
- package/lib/core/http/http.service.d.ts +20 -0
- package/lib/core/interceptors/auth.interceptor.d.ts +18 -0
- package/lib/core/interceptors/license.interceptor.d.ts +11 -0
- package/lib/core/models/api-config.model.d.ts +58 -0
- package/lib/core/models/api-request.model.d.ts +77 -0
- package/lib/core/models/api-response.model.d.ts +6 -0
- package/lib/core/models/doohbot-config.model.d.ts +81 -0
- package/{projects/doohbot/src/lib/core/models/license.model.ts → lib/core/models/license.model.d.ts} +23 -27
- package/lib/core/models/message.d.ts +16 -0
- package/lib/core/models/theme-config.model.d.ts +28 -0
- package/lib/core/services/core-config.service.d.ts +23 -0
- package/lib/core/services/license.service.d.ts +33 -0
- package/lib/core/services/markdown.service.d.ts +8 -0
- package/lib/core/services/theme.service.d.ts +40 -0
- package/{projects/doohbot/src/lib/core/types/auth-mode.type.ts → lib/core/types/auth-mode.type.d.ts} +4 -4
- package/{projects/doohbot/src/lib/core/types/auth-status.type.ts → lib/core/types/auth-status.type.d.ts} +4 -5
- package/{projects/doohbot/src/lib/core/types/chat-stream.type.ts → lib/core/types/chat-stream.type.d.ts} +4 -4
- package/{projects/doohbot/src/lib/core/types/message-role.type.ts → lib/core/types/message-role.type.d.ts} +4 -4
- package/{projects/doohbot/src/lib/core/types/prompt-mode.type.ts → lib/core/types/prompt-mode.type.d.ts} +4 -5
- package/{projects/doohbot/src/lib/core/types/snackbar-error.type.ts → lib/core/types/snackbar-error.type.d.ts} +4 -5
- package/{projects/doohbot/src/lib/core/types/tenant-resolution-strategy.type.ts → lib/core/types/tenant-resolution-strategy.type.d.ts} +4 -4
- package/lib/core/utils/logger.service.d.ts +11 -0
- package/lib/doohbot-input.d.ts +19 -0
- package/lib/doohbot.component.d.ts +108 -0
- package/lib/predefined_messages.d.ts +2 -0
- package/lib/shared/chips/chips.component.d.ts +10 -0
- package/lib/shared/dialog/dialog.component.d.ts +19 -0
- package/lib/shared/dialog/dialog.service.d.ts +29 -0
- package/lib/shared/dialog/dialog.utils.d.ts +41 -0
- package/lib/shared/dropdown-menu/dropdown-menu.component.d.ts +11 -0
- package/lib/shared/input-dialog/input-dialog.component.d.ts +20 -0
- package/lib/shared/menu-item/menu-item.component.d.ts +9 -0
- package/lib/shared/pipes/simple-markdown.pipe.d.ts +10 -0
- package/lib/shared/snackbar/snackbar.component.d.ts +14 -0
- package/lib/shared/snackbar/snackbar.service.d.ts +19 -0
- package/{projects/doohbot/src/lib/shared/snackbar/snackbar.utils.ts → lib/shared/snackbar/snackbar.utils.d.ts} +33 -49
- package/package.json +29 -75
- package/public-api.d.ts +11 -0
- package/.editorconfig +0 -17
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -41
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -60
- package/angular.json +0 -132
- package/docs/PUBLISHING_GUIDE.md +0 -104
- package/projects/app-doohbot/public/assets/const/app-const.json +0 -15
- package/projects/app-doohbot/public/assets/const/doohclick_license.json +0 -6
- package/projects/app-doohbot/public/favicon.ico +0 -0
- package/projects/app-doohbot/src/app/app.config.ts +0 -13
- package/projects/app-doohbot/src/app/app.html +0 -31
- package/projects/app-doohbot/src/app/app.routes.ts +0 -3
- package/projects/app-doohbot/src/app/app.scss +0 -279
- package/projects/app-doohbot/src/app/app.spec.ts +0 -23
- package/projects/app-doohbot/src/app/app.ts +0 -72
- package/projects/app-doohbot/src/index.html +0 -15
- package/projects/app-doohbot/src/main.ts +0 -6
- package/projects/app-doohbot/src/styles.scss +0 -15
- package/projects/app-doohbot/tsconfig.app.json +0 -15
- package/projects/app-doohbot/tsconfig.spec.json +0 -14
- package/projects/doohbot/README.md +0 -64
- package/projects/doohbot/docs/README.md +0 -140
- package/projects/doohbot/ng-package.json +0 -10
- package/projects/doohbot/package.json +0 -16
- package/projects/doohbot/src/lib/app/chat/chat-ui-state.service.ts +0 -194
- package/projects/doohbot/src/lib/app/chat/chat.service.ts +0 -547
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.html +0 -27
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.scss +0 -115
- package/projects/doohbot/src/lib/app/chat/components/chat-button/chat-button.component.ts +0 -35
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.html +0 -3
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.scss +0 -20
- package/projects/doohbot/src/lib/app/chat/components/chat-footer/chat-footer.component.ts +0 -12
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.html +0 -34
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.scss +0 -78
- package/projects/doohbot/src/lib/app/chat/components/chat-header/chat-header.component.ts +0 -52
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.html +0 -77
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.scss +0 -346
- package/projects/doohbot/src/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.ts +0 -188
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.html +0 -146
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.scss +0 -187
- package/projects/doohbot/src/lib/app/chat/components/chat-window/chat-window.component.ts +0 -256
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.html +0 -17
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.scss +0 -59
- package/projects/doohbot/src/lib/app/chat/components/message-input/message-input.component.ts +0 -28
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.html +0 -138
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.scss +0 -436
- package/projects/doohbot/src/lib/app/chat/components/message-list/message-list.component.ts +0 -106
- package/projects/doohbot/src/lib/app/chat/model/chat-history.model.ts +0 -57
- package/projects/doohbot/src/lib/app/chat/model/chat-request.model.ts +0 -17
- package/projects/doohbot/src/lib/app/chat/model/chat-response.model.ts +0 -9
- package/projects/doohbot/src/lib/app/chat/model/chat-session.model.ts +0 -14
- package/projects/doohbot/src/lib/app/chat/model/chat-stream-response.model.ts +0 -12
- package/projects/doohbot/src/lib/app/chat/services/chat-api.service.ts +0 -82
- package/projects/doohbot/src/lib/app/chat/services/chat-audio.service.ts +0 -44
- package/projects/doohbot/src/lib/app/chat/services/chat-history.service.ts +0 -303
- package/projects/doohbot/src/lib/app/login/login-form.component.html +0 -80
- package/projects/doohbot/src/lib/app/login/login-form.component.scss +0 -189
- package/projects/doohbot/src/lib/app/login/login-form.component.ts +0 -45
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.html +0 -81
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.scss +0 -179
- package/projects/doohbot/src/lib/app/personalization/personalization-dialog.component.ts +0 -217
- package/projects/doohbot/src/lib/app/personalization/personalization.service.ts +0 -197
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.html +0 -111
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.scss +0 -218
- package/projects/doohbot/src/lib/app/personalization/sections/account/account-section.component.ts +0 -121
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.html +0 -46
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.scss +0 -138
- package/projects/doohbot/src/lib/app/personalization/sections/instructions/instructions-section.component.ts +0 -28
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/color-picker-dialog.component.ts +0 -92
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.html +0 -198
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.scss +0 -107
- package/projects/doohbot/src/lib/app/personalization/sections/preferences/preferences-section.component.ts +0 -103
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.html +0 -46
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.scss +0 -131
- package/projects/doohbot/src/lib/app/personalization/sections/profile/profile-section.component.ts +0 -23
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.html +0 -33
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.scss +0 -61
- package/projects/doohbot/src/lib/app/personalization/sections/settings/setting-section.component.ts +0 -20
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.html +0 -30
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.scss +0 -59
- package/projects/doohbot/src/lib/app/personalization/sections/terms/terms-section.component.ts +0 -12
- package/projects/doohbot/src/lib/constant/doohbot-constant.ts +0 -40
- package/projects/doohbot/src/lib/constant/html-entities.ts +0 -8
- package/projects/doohbot/src/lib/constant/utf8.ts +0 -9
- package/projects/doohbot/src/lib/core/app-const.ts +0 -63
- package/projects/doohbot/src/lib/core/auth/account-api.service.ts +0 -53
- package/projects/doohbot/src/lib/core/auth/auth.service.ts +0 -478
- package/projects/doohbot/src/lib/core/auth/models/auth-result.model.ts +0 -4
- package/projects/doohbot/src/lib/core/auth/models/federated-login-request.model.ts +0 -5
- package/projects/doohbot/src/lib/core/auth/models/login-request.model.ts +0 -6
- package/projects/doohbot/src/lib/core/auth/storage.service.ts +0 -113
- package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.directive.ts +0 -123
- package/projects/doohbot/src/lib/core/directives/draggable/draggable-dialog.module.ts +0 -9
- package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.directive.ts +0 -58
- package/projects/doohbot/src/lib/core/directives/fullscreen/fullscreen.module.ts +0 -9
- package/projects/doohbot/src/lib/core/directives/popout/popout.directive.ts +0 -169
- package/projects/doohbot/src/lib/core/directives/popout/popout.module.ts +0 -9
- package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.directive.ts +0 -197
- package/projects/doohbot/src/lib/core/directives/resizable/resizable-dialog.module.ts +0 -9
- package/projects/doohbot/src/lib/core/enums/api-request-state.enum.ts +0 -9
- package/projects/doohbot/src/lib/core/environments/environment.prod.ts +0 -14
- package/projects/doohbot/src/lib/core/environments/environment.ts +0 -14
- package/projects/doohbot/src/lib/core/helpers/crypto-helper.service.ts +0 -72
- package/projects/doohbot/src/lib/core/http/http-stream.service.ts +0 -105
- package/projects/doohbot/src/lib/core/http/http.service.ts +0 -148
- package/projects/doohbot/src/lib/core/interceptors/auth.interceptor.ts +0 -118
- package/projects/doohbot/src/lib/core/interceptors/license.interceptor.ts +0 -50
- package/projects/doohbot/src/lib/core/models/api-config.model.ts +0 -82
- package/projects/doohbot/src/lib/core/models/api-request.model.ts +0 -92
- package/projects/doohbot/src/lib/core/models/api-response.model.ts +0 -13
- package/projects/doohbot/src/lib/core/models/doohbot-config.model.ts +0 -109
- package/projects/doohbot/src/lib/core/models/message.ts +0 -18
- package/projects/doohbot/src/lib/core/models/theme-config.model.ts +0 -48
- package/projects/doohbot/src/lib/core/services/core-config.service.ts +0 -53
- package/projects/doohbot/src/lib/core/services/doohbot-api.service.ts +0 -207
- package/projects/doohbot/src/lib/core/services/license.service.ts +0 -171
- package/projects/doohbot/src/lib/core/services/markdown.service.ts +0 -73
- package/projects/doohbot/src/lib/core/services/theme.service.ts +0 -305
- package/projects/doohbot/src/lib/core/utils/error-handler.util.ts +0 -31
- package/projects/doohbot/src/lib/core/utils/logger.service.ts +0 -45
- package/projects/doohbot/src/lib/doohbot-input.ts +0 -19
- package/projects/doohbot/src/lib/doohbot.component.html +0 -34
- package/projects/doohbot/src/lib/doohbot.component.scss +0 -17
- package/projects/doohbot/src/lib/doohbot.component.spec.ts +0 -31
- package/projects/doohbot/src/lib/doohbot.component.ts +0 -545
- package/projects/doohbot/src/lib/elements.ts +0 -25
- package/projects/doohbot/src/lib/predefined_messages.ts +0 -14
- package/projects/doohbot/src/lib/shared/chips/chips.component.html +0 -9
- package/projects/doohbot/src/lib/shared/chips/chips.component.scss +0 -29
- package/projects/doohbot/src/lib/shared/chips/chips.component.spec.ts +0 -22
- package/projects/doohbot/src/lib/shared/chips/chips.component.ts +0 -20
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.html +0 -29
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.scss +0 -100
- package/projects/doohbot/src/lib/shared/dialog/dialog.component.ts +0 -42
- package/projects/doohbot/src/lib/shared/dialog/dialog.service.ts +0 -62
- package/projects/doohbot/src/lib/shared/dialog/dialog.utils.ts +0 -102
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.html +0 -30
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.scss +0 -53
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.spec.ts +0 -22
- package/projects/doohbot/src/lib/shared/dropdown-menu/dropdown-menu.component.ts +0 -35
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.html +0 -16
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.scss +0 -45
- package/projects/doohbot/src/lib/shared/input-dialog/input-dialog.component.ts +0 -46
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.html +0 -5
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.scss +0 -0
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.spec.ts +0 -22
- package/projects/doohbot/src/lib/shared/menu-item/menu-item.component.ts +0 -20
- package/projects/doohbot/src/lib/shared/pipes/simple-markdown.pipe.ts +0 -19
- package/projects/doohbot/src/lib/shared/popout/popout.html +0 -1
- package/projects/doohbot/src/lib/shared/popout/popout.scss +0 -0
- package/projects/doohbot/src/lib/shared/popout/popout.spec.ts +0 -23
- package/projects/doohbot/src/lib/shared/popout/popout.ts +0 -11
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.html +0 -7
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.scss +0 -125
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.spec.ts +0 -21
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.component.ts +0 -44
- package/projects/doohbot/src/lib/shared/snackbar/snackbar.service.ts +0 -54
- package/projects/doohbot/src/lib/styles/_theme.scss +0 -132
- package/projects/doohbot/src/lib/styles/material-override.scss +0 -302
- package/projects/doohbot/src/lib/styles/utility.scss +0 -588
- package/projects/doohbot/src/public-api.ts +0 -42
- package/projects/doohbot/tsconfig.lib.json +0 -15
- package/projects/doohbot/tsconfig.lib.prod.json +0 -11
- package/projects/doohbot/tsconfig.spec.json +0 -10
- package/proxy.conf.json +0 -8
- package/publish.config.js +0 -25
- package/scripts/publishing/index.ts +0 -67
- package/scripts/publishing/pipeline/01-clean.ts +0 -11
- package/scripts/publishing/pipeline/02-validate-pre.ts +0 -8
- package/scripts/publishing/pipeline/03-build.ts +0 -7
- package/scripts/publishing/pipeline/04-validate-post.ts +0 -8
- package/scripts/publishing/pipeline/05-prepare-package.ts +0 -29
- package/scripts/publishing/pipeline/06-version.ts +0 -23
- package/scripts/publishing/pipeline/07-publish.ts +0 -14
- package/scripts/publishing/pipeline/08-cleanup.ts +0 -5
- package/scripts/publishing/types.ts +0 -36
- package/scripts/publishing/utils/command.ts +0 -15
- package/scripts/publishing/utils/config.ts +0 -17
- package/scripts/validate.ts +0 -166
- package/tsconfig.json +0 -45
- package/tsconfig.scripts.json +0 -15
- /package/{projects/doohbot/src → src}/assets/bot.mp3 +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// /* You can add global styles to this file, and also import other style files */
|
|
2
|
-
// :root {
|
|
3
|
-
// --primary-color: #4F46E5;
|
|
4
|
-
// --secondary-color: #6c757d;
|
|
5
|
-
// --background-color: #f8f9fa;
|
|
6
|
-
// --white: #ffffff;
|
|
7
|
-
// --text-color: #333;
|
|
8
|
-
// --font-family: Arial, sans-serif;
|
|
9
|
-
// }
|
|
10
|
-
|
|
11
|
-
// body {
|
|
12
|
-
// font-family: var(--font-family);
|
|
13
|
-
// background-color: var(--background-color);
|
|
14
|
-
// color: var(--text-color);
|
|
15
|
-
// }
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/app",
|
|
7
|
-
"types": []
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"src/**/*.ts"
|
|
11
|
-
],
|
|
12
|
-
"exclude": [
|
|
13
|
-
"src/**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/spec",
|
|
7
|
-
"types": [
|
|
8
|
-
"jasmine"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*.ts"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# Doohbot
|
|
2
|
-
|
|
3
|
-
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
ng generate --help
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Building
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
ng build doohbot
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
-
|
|
29
|
-
### Publishing the Library
|
|
30
|
-
|
|
31
|
-
Once the project is built, you can publish your library by following these steps:
|
|
32
|
-
|
|
33
|
-
1. Navigate to the `dist` directory:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
cd dist/doohbot
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Running unit tests
|
|
45
|
-
|
|
46
|
-
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
ng test
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Running end-to-end tests
|
|
53
|
-
|
|
54
|
-
For end-to-end (e2e) testing, run:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
ng e2e
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
61
|
-
|
|
62
|
-
## Additional Resources
|
|
63
|
-
|
|
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.
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
# Authentication & Authorization System
|
|
2
|
-
|
|
3
|
-
This document outlines the authentication and authorization mechanisms in the project, including token handling, session management, and security practices.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Authentication Flow
|
|
8
|
-
|
|
9
|
-
The system supports both **Standard Login** (username/password) and **Federated Login** (external credentials).
|
|
10
|
-
|
|
11
|
-
### Flow Steps:
|
|
12
|
-
|
|
13
|
-
1. **Triggering Login**
|
|
14
|
-
- The UI (e.g., `Doohbot` component) triggers login via `ChatFacadeService`.
|
|
15
|
-
- `ChatFacadeService` delegates the API call to `AccountService`.
|
|
16
|
-
|
|
17
|
-
2. **Session Initialization**
|
|
18
|
-
- On successful login, `AuthService.setSession()` is called.
|
|
19
|
-
- Responsibilities of `setSession()`:
|
|
20
|
-
- Decode the JWT `access_token` to extract user details (`user_id`, `roles`, etc.).
|
|
21
|
-
- Securely save `access_token` and `refresh_token`.
|
|
22
|
-
- Set the application state to **authenticated**.
|
|
23
|
-
- Start a **Proactive Refresh Timer** to refresh tokens automatically.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## 2. Token Storage & Security
|
|
28
|
-
|
|
29
|
-
The project uses a dedicated **TokenStorageService** for persistence and security.
|
|
30
|
-
|
|
31
|
-
- **Encrypted Storage**
|
|
32
|
-
- All sensitive data in `localStorage` is encrypted using **AES (Advanced Encryption Standard)** via CryptoJS.
|
|
33
|
-
- Prevents tokens and user information from being visible in plain text in browser developer tools.
|
|
34
|
-
- **Unified Key**
|
|
35
|
-
- All authentication-related data is stored under a single configuration-defined key for consistency and easier management.
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 3. Authorization
|
|
40
|
-
|
|
41
|
-
Authorization relies on **user metadata** decoded from the JWT.
|
|
42
|
-
|
|
43
|
-
- **Roles & Permissions**
|
|
44
|
-
- During login, user roles and permissions are extracted and saved securely.
|
|
45
|
-
- **Contextual Data**
|
|
46
|
-
- Tracks `organization_id`, `company_id`, and `office_id`.
|
|
47
|
-
- Used to scope API requests and filter data appropriately.
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 4. Token Refresh Mechanism
|
|
52
|
-
|
|
53
|
-
Ensures uninterrupted login via **two strategies**:
|
|
54
|
-
|
|
55
|
-
### 4.1 Proactive Refresh
|
|
56
|
-
|
|
57
|
-
- `AuthService` schedules a timer to automatically call `/auth/refresh`.
|
|
58
|
-
- Triggered **5 minutes before the current `access_token` expires**.
|
|
59
|
-
|
|
60
|
-
### 4.2 Reactive Refresh (Interceptor)
|
|
61
|
-
|
|
62
|
-
- Handles edge cases like 401 errors if the proactive timer is missed.
|
|
63
|
-
- Steps:
|
|
64
|
-
1. Intercept the `401 Unauthorized` response.
|
|
65
|
-
2. Pause all outgoing requests.
|
|
66
|
-
3. Refresh the token using the `refresh_token`.
|
|
67
|
-
4. Retry the original request with the new token.
|
|
68
|
-
5. Resume all paused requests.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## 5. Application Bootstrapping
|
|
73
|
-
|
|
74
|
-
On application startup, the `Doohbot` component calls `AuthService.validateStoredToken()`. This method checks if a valid token exists:
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
AuthService.validateStoredToken();
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
- If valid, it restores the session.
|
|
81
|
-
- If expired but a `refresh_token` exists, it attempts an immediate refresh.
|
|
82
|
-
- If no valid session can be restored, it sets the state to unauthenticated.
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## 6. Logout Process
|
|
87
|
-
|
|
88
|
-
The `logout()` process (via `ChatFacadeService`) ensures a clean exit:
|
|
89
|
-
|
|
90
|
-
- Calls the backend logout endpoint to invalidate the `refresh_token`.
|
|
91
|
-
- Clears all encrypted `localStorage`, `sessionStorage`, and reactive states.
|
|
92
|
-
- Resets the UI and chat history.
|
|
93
|
-
|
|
94
|
-
This architecture provides a secure, seamless, and reactive authentication experience while keeping sensitive data protected.
|
|
95
|
-
|
|
96
|
-
## 7. Flow Diagram
|
|
97
|
-
|
|
98
|
-
flowchart TD
|
|
99
|
-
%% Login Flow
|
|
100
|
-
A[User opens app] --> B[Doohbot component triggers login]
|
|
101
|
-
B --> C[ChatFacadeService calls AccountService]
|
|
102
|
-
C --> D{Login Success?}
|
|
103
|
-
D -->|Yes| E["AuthService.setSession()"]
|
|
104
|
-
E --> F["Decode JWT access_token"]
|
|
105
|
-
F --> G["Save access_token & refresh_token securely"]
|
|
106
|
-
G --> H[Set app state to authenticated]
|
|
107
|
-
H --> I[Start proactive refresh timer]
|
|
108
|
-
D -->|No| J[Show login error]
|
|
109
|
-
|
|
110
|
-
%% Token Refresh
|
|
111
|
-
I --> K{Token about to expire?}
|
|
112
|
-
K -->|Yes| L["Proactive Refresh: Call /auth/refresh"]
|
|
113
|
-
K -->|No| M[Wait]
|
|
114
|
-
|
|
115
|
-
%% Reactive Refresh (401 Unauthorized)
|
|
116
|
-
N[Outgoing API Request] --> O{401 Unauthorized?}
|
|
117
|
-
O -->|Yes| P[Pause outgoing requests]
|
|
118
|
-
P --> Q["Refresh token using refresh_token"]
|
|
119
|
-
Q --> R[Retry original request with new token]
|
|
120
|
-
R --> S[Resume paused requests]
|
|
121
|
-
O -->|No| T[Process request normally]
|
|
122
|
-
|
|
123
|
-
%% Application Bootstrapping
|
|
124
|
-
U[App Startup] --> V["AuthService.validateStoredToken()"]
|
|
125
|
-
V --> W{Token valid?}
|
|
126
|
-
W -->|Yes| H
|
|
127
|
-
W -->|Expired but refresh_token exists| L
|
|
128
|
-
W -->|No valid session| X[Set app state to unauthenticated]
|
|
129
|
-
|
|
130
|
-
%% Logout Flow
|
|
131
|
-
Y[User clicks logout] --> Z["ChatFacadeService.logout()"]
|
|
132
|
-
Z --> ZA[Call backend logout endpoint]
|
|
133
|
-
ZA --> ZB[Clear localStorage & sessionStorage]
|
|
134
|
-
ZB --> ZC[Reset UI and chat history]
|
|
135
|
-
|
|
136
|
-
## Flow Diagram Preview
|
|
137
|
-
|
|
138
|
-
### [View](https://mermaid.live/edit#pako:eNplVWtT2zoQ_Ss7mumddiakeVLiD70TEij0AWkCpcVm7gh7sT04kivJPBr473cl2Umg-ZCxpXOOdo921ysWywRZwG4KeR9nXBk4m0bizRv4KtNcwCEtR2IcnmtUIEsUGnhZXsHOzkfYD6dSZtfSQCyXpRQoDBiVpykqDYWlX0Vi30En4STj5pDHPMEFqrs8Roh5UWgYx7GshKkXiTBxhOnKn7-o4hi1_vc5ElO78fQL9RMchBEbVyarWW2NJKB1LsXbdxEjkQMnckiwKdoE4fPFGXAn9Z-Rtygc6tChPhFqwe_wxT78AwpvFOqsftcYVwqLR0f85IhH4QKNtQO04QbBSOAUFNmQx_SeEPDIAY_DhbHOlkry2OR0VK0NJl-iumpyO5FP8DlcZPLe2weolLTbkQD60aWcuVjmnu1Xj90RX1Z-i1_LythI8KHMFVrfLOjLxruvlO5sHUgtFcCEbgPe2_jf18G5TDdkG9y38ILnZjugOb4UgreDThfOhRWSKv-DyTuPPQlPK5PKXKQwnh0T_HeF2vhCOl29JjVxn27inoUzXmkE2cgoL6HrKGdO6jtl14TiL67SHrx1mevMvjvOPJyjUY9AR5PpvGiU4T43GQi890o1Z-44C-LoaolQ2qCS18Gcri07C8lsW1drVSHVksx-3LZxXJaFLRqqYNiX0mijqK4ocI84DwkAroiquvl-vGqBO17kCVXdwkiFiSuGuheswA_HuaiLxGEbiy82Fh9trxy4AkrgmurpZSvgQ06ZUiVtw0-kl6VGcY34BD__bo9KvG6QtQPU7rZy_byxa7_8zInJl1s3Tmjbp35Jqf81TtoesZXzpQePQ1fa1zym2JNaCOixpCoyDXbswfvhpECuCEXTyVrJU6RRUOdULzQcP9ouJ7YUKNPzY-B0AA1RAxk5JJW9YtZiqcoTFhhVYYtRuy-5fWUrqxIxsmOJEQvoMeHqNmKReCZOycWllMuGpmSVZiy44YWmt6q0Nz3Near4BkIpoZrYYcqC_shJsGDFHljQ7fTbg15_MNwddYb93odRr8UeWbDT6w3anT79dwbDTnfU_TB8brE_7thue68z7Ax3B3v93d1Rb284bDFMckrqm_9euM_G8__P7w-4)
|
|
139
|
-
|
|
140
|
-
---
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
-
"dest": "../../dist/doohbot",
|
|
4
|
-
"lib": {
|
|
5
|
-
"entryFile": "src/public-api.ts",
|
|
6
|
-
"styleIncludePaths": ["src/lib"]
|
|
7
|
-
},
|
|
8
|
-
"assets": ["src/assets"],
|
|
9
|
-
"allowedNonPeerDependencies": ["crypto-js", "@auth0/angular-jwt"]
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@aakash58/chatbot",
|
|
3
|
-
"version": "1.1.19",
|
|
4
|
-
"description": "version support 17+",
|
|
5
|
-
"peerDependencies": {
|
|
6
|
-
"@angular/common": ">=17.0.0",
|
|
7
|
-
"@angular/core": ">=17.0.0",
|
|
8
|
-
"@angular/material": ">=17.0.0",
|
|
9
|
-
"@angular/cdk": ">=17.0.0"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"crypto-js": "^4.2.0",
|
|
13
|
-
"@auth0/angular-jwt": "^5.2.0"
|
|
14
|
-
},
|
|
15
|
-
"sideEffects": false
|
|
16
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { Injectable, signal, computed, effect, Signal } from '@angular/core';
|
|
2
|
-
import { Message } from '../../core/models/message';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ChatUIStateService - Centralized UI state management
|
|
6
|
-
*
|
|
7
|
-
* Manages all UI-related state for the chat component including:
|
|
8
|
-
* - Chat window open/close state
|
|
9
|
-
* - History sidebar visibility
|
|
10
|
-
* - Unread message tracking
|
|
11
|
-
* - Fullscreen state
|
|
12
|
-
*
|
|
13
|
-
* This service uses Angular signals for reactive state management,
|
|
14
|
-
* allowing components to subscribe to state changes efficiently.
|
|
15
|
-
*/
|
|
16
|
-
@Injectable({
|
|
17
|
-
providedIn: 'root',
|
|
18
|
-
})
|
|
19
|
-
export class ChatUIStateService {
|
|
20
|
-
//! ===================== UI STATE SIGNALS============================
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Whether the chat window is currently open
|
|
24
|
-
*/
|
|
25
|
-
public isChatOpen = signal(false);
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Whether the history sidebar is currently open
|
|
29
|
-
*/
|
|
30
|
-
public isHistorySidebarOpen = signal(false);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Whether the chat is in fullscreen mode
|
|
34
|
-
*/
|
|
35
|
-
public isFullScreen = signal(false);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* ID of the last message that was read by the user
|
|
39
|
-
*/
|
|
40
|
-
private lastReadMessageId = signal<string | null>(null);
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Reference to current messages (injected from outside)
|
|
44
|
-
*/
|
|
45
|
-
private messagesSignal: Signal<Message[]> = signal<Message[]>([]);
|
|
46
|
-
|
|
47
|
-
//! ===================== COMPUTED SIGNALS ======================
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Computed number of unread bot messages
|
|
51
|
-
*/
|
|
52
|
-
public unreadCount = computed(() => {
|
|
53
|
-
if (this.isChatOpen()) {
|
|
54
|
-
return 0; // No unread when chat is open
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const messages = this.messagesSignal();
|
|
58
|
-
if (messages.length === 0) return 0;
|
|
59
|
-
|
|
60
|
-
const lastReadId = this.lastReadMessageId();
|
|
61
|
-
let lastReadIndex = -1;
|
|
62
|
-
|
|
63
|
-
if (lastReadId !== null) {
|
|
64
|
-
lastReadIndex = messages.findIndex((msg) => msg.id === lastReadId);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Count unread bot messages after last read position
|
|
68
|
-
const unreadBotMessages = messages
|
|
69
|
-
.slice(lastReadIndex + 1)
|
|
70
|
-
.filter((msg) => msg.sender === 'assistant');
|
|
71
|
-
|
|
72
|
-
return unreadBotMessages.length;
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
//! ===================== EFFECTS ========================
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Effect to automatically mark messages as read when chat is opened
|
|
79
|
-
*/
|
|
80
|
-
public markAsReadEffect = effect(
|
|
81
|
-
() => {
|
|
82
|
-
const isOpen = this.isChatOpen();
|
|
83
|
-
const msgs = this.messagesSignal();
|
|
84
|
-
|
|
85
|
-
if (isOpen && msgs.length > 0) {
|
|
86
|
-
const lastMessage = msgs[msgs.length - 1];
|
|
87
|
-
if (lastMessage?.id) {
|
|
88
|
-
const currentLastRead = this.lastReadMessageId();
|
|
89
|
-
if (lastMessage.id !== currentLastRead) {
|
|
90
|
-
this.lastReadMessageId.set(lastMessage.id);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
{ allowSignalWrites: true }, // TODO
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
//! =================== PUBLIC METHODS ===========================
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Set the messages signal reference from an external source
|
|
102
|
-
* This allows the UI state service to track messages from MessageService
|
|
103
|
-
*/
|
|
104
|
-
setMessagesSignal(messagesSignal: Signal<Message[]>): void {
|
|
105
|
-
this.messagesSignal = messagesSignal;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Toggle the chat window open/close state
|
|
110
|
-
*/
|
|
111
|
-
toggleChat(): void {
|
|
112
|
-
const currentlyOpen = this.isChatOpen();
|
|
113
|
-
this.isChatOpen.update((open) => !open);
|
|
114
|
-
|
|
115
|
-
// Mark messages as read when opening chat
|
|
116
|
-
if (!currentlyOpen) {
|
|
117
|
-
const messages = this.messagesSignal();
|
|
118
|
-
if (messages.length > 0) {
|
|
119
|
-
const lastMessage = messages[messages.length - 1];
|
|
120
|
-
this.lastReadMessageId.set(lastMessage.id ?? null);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Toggle the history sidebar open/close state
|
|
127
|
-
*/
|
|
128
|
-
toggleHistorySidebar(): void {
|
|
129
|
-
this.isHistorySidebarOpen.update((open) => !open);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Close the chat window
|
|
134
|
-
*/
|
|
135
|
-
closeChat(): void {
|
|
136
|
-
this.isChatOpen.set(false);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Open the chat window
|
|
141
|
-
*/
|
|
142
|
-
openChat(): void {
|
|
143
|
-
this.isChatOpen.set(true);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Close the history sidebar
|
|
148
|
-
*/
|
|
149
|
-
closeHistorySidebar(): void {
|
|
150
|
-
this.isHistorySidebarOpen.set(false);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Open the history sidebar
|
|
155
|
-
*/
|
|
156
|
-
openHistorySidebar(): void {
|
|
157
|
-
this.isHistorySidebarOpen.set(true);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Toggle fullscreen mode
|
|
162
|
-
*/
|
|
163
|
-
toggleFullscreen(): void {
|
|
164
|
-
this.isFullScreen.update((fs) => !fs);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Set fullscreen state
|
|
169
|
-
*/
|
|
170
|
-
setFullscreen(isFullscreen: boolean): void {
|
|
171
|
-
this.isFullScreen.set(isFullscreen);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Manually mark messages as read up to a specific message ID
|
|
176
|
-
*/
|
|
177
|
-
markMessagesAsRead(messageId: string): void {
|
|
178
|
-
this.lastReadMessageId.set(messageId);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Reset last read message ID
|
|
183
|
-
*/
|
|
184
|
-
resetLastRead(): void {
|
|
185
|
-
this.lastReadMessageId.set(null);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Get the last read message ID
|
|
190
|
-
*/
|
|
191
|
-
getLastReadMessageId(): string | null {
|
|
192
|
-
return this.lastReadMessageId();
|
|
193
|
-
}
|
|
194
|
-
}
|