@aakash58/chatbot 1.1.21 → 1.1.24
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,545 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
APP_INITIALIZER,
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
computed,
|
|
6
|
-
effect,
|
|
7
|
-
ElementRef,
|
|
8
|
-
inject,
|
|
9
|
-
Input,
|
|
10
|
-
OnDestroy,
|
|
11
|
-
OnInit,
|
|
12
|
-
Renderer2,
|
|
13
|
-
signal,
|
|
14
|
-
SimpleChanges,
|
|
15
|
-
ViewChild,
|
|
16
|
-
ViewEncapsulation,
|
|
17
|
-
} from '@angular/core';
|
|
18
|
-
import { DoohbotConst } from './constant/doohbot-constant';
|
|
19
|
-
import { LoginRequest } from './core/auth/models/login-request.model';
|
|
20
|
-
import { FederatedLoginRequest } from './core/auth/models/federated-login-request.model';
|
|
21
|
-
import { AuthService } from './core/auth/auth.service';
|
|
22
|
-
import logger from './core/utils/logger.service';
|
|
23
|
-
import { ThemeService } from './core/services/theme.service';
|
|
24
|
-
import { PredefinedMessages, SuggestedMessages } from './predefined_messages';
|
|
25
|
-
import { DoohbotInput } from './doohbot-input';
|
|
26
|
-
import { DoohbotApiConfig } from './core/models/api-config.model';
|
|
27
|
-
import { DoohbotThemeConfig } from './core/models/theme-config.model';
|
|
28
|
-
import { ChatButtonComponent } from './app/chat/components/chat-button/chat-button.component';
|
|
29
|
-
import { ChatWindowComponent } from './app/chat/components/chat-window/chat-window.component';
|
|
30
|
-
import { FullscreenDirective } from './core/directives/fullscreen/fullscreen.directive';
|
|
31
|
-
import { ChatHistoryService } from './app/chat/services/chat-history.service';
|
|
32
|
-
import { ChatUIStateService } from './app/chat/chat-ui-state.service';
|
|
33
|
-
import { ChatSession } from './app/chat/model/chat-session.model';
|
|
34
|
-
import { AuthStatus } from './core/types/auth-status.type';
|
|
35
|
-
import { ChatService } from './app/chat/chat.service';
|
|
36
|
-
import { DialogService } from './shared/dialog/dialog.service';
|
|
37
|
-
import { DialogUtils } from './shared/dialog/dialog.utils';
|
|
38
|
-
import { SnackbarService } from './shared/snackbar/snackbar.service';
|
|
39
|
-
import { PersonalizationService } from './app/personalization/personalization.service';
|
|
40
|
-
import { LicenseService } from './core/services/license.service';
|
|
41
|
-
import { AppConst } from './core/app-const';
|
|
42
|
-
import { LicenseInterceptor } from './core/interceptors/license.interceptor';
|
|
43
|
-
import { AuthInterceptor } from './core/interceptors/auth.interceptor';
|
|
44
|
-
import { CommonModule } from '@angular/common';
|
|
45
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
46
|
-
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
47
|
-
|
|
48
|
-
@Component({
|
|
49
|
-
selector: 'app-doohbot',
|
|
50
|
-
standalone: true,
|
|
51
|
-
imports: [CommonModule, ChatButtonComponent, ChatWindowComponent, FullscreenDirective],
|
|
52
|
-
templateUrl: './doohbot.component.html',
|
|
53
|
-
styleUrls: ['./doohbot.component.scss'],
|
|
54
|
-
encapsulation: ViewEncapsulation.None,
|
|
55
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
56
|
-
})
|
|
57
|
-
export class Doohbot extends DoohbotInput implements OnInit, OnDestroy {
|
|
58
|
-
//! ======================= INPUTS ==========================
|
|
59
|
-
|
|
60
|
-
@Input() config: DoohbotInput = new DoohbotInput();
|
|
61
|
-
@Input() override buttonStyle?: 'fab' | 'sidebar' | 'sidebar-top' | 'sidebar-bottom' = 'fab';
|
|
62
|
-
@Input() enableDrag: boolean = false;
|
|
63
|
-
@Input() enableResize: boolean = false;
|
|
64
|
-
@Input() apiConfig?: DoohbotApiConfig;
|
|
65
|
-
@Input() themeConfig: DoohbotThemeConfig | undefined;
|
|
66
|
-
|
|
67
|
-
//! ==================== SERVICES ======================
|
|
68
|
-
|
|
69
|
-
private chatHistory = inject(ChatHistoryService);
|
|
70
|
-
private uiState = inject(ChatUIStateService);
|
|
71
|
-
private themeService = inject(ThemeService);
|
|
72
|
-
private authService = inject(AuthService);
|
|
73
|
-
private chatService = inject(ChatService);
|
|
74
|
-
private dialogService = inject(DialogService);
|
|
75
|
-
private snackbarService = inject(SnackbarService);
|
|
76
|
-
private personalization = inject(PersonalizationService);
|
|
77
|
-
private licenseService = inject(LicenseService);
|
|
78
|
-
|
|
79
|
-
//! ========================= EXPOSED STATE FROM SERVICES ============================
|
|
80
|
-
|
|
81
|
-
// UI State signals
|
|
82
|
-
public isChatOpen = this.uiState.isChatOpen;
|
|
83
|
-
public isHistorySidebarOpen = this.uiState.isHistorySidebarOpen;
|
|
84
|
-
public isFullScreen = this.uiState.isFullScreen;
|
|
85
|
-
public unreadCount = this.uiState.unreadCount;
|
|
86
|
-
|
|
87
|
-
// Chat State signals
|
|
88
|
-
public messages = this.chatService.messages;
|
|
89
|
-
public isBotTyping = this.chatService.isBotTyping;
|
|
90
|
-
public isStreaming = this.chatService.isStreaming;
|
|
91
|
-
public messageError = computed(() => this.chatService.apiError()?.message || null);
|
|
92
|
-
public showSuggestionChips = this.chatService.showSuggestionChips;
|
|
93
|
-
public chatSessions = this.chatHistory.sessions;
|
|
94
|
-
public hasMoreHistory = this.chatHistory.hasMore;
|
|
95
|
-
public isLoadingMore = this.chatHistory.isLoadingMore;
|
|
96
|
-
public isLoadingSessions = this.chatHistory.isLoading;
|
|
97
|
-
public processingSessionId = this.chatHistory.processingSessionId;
|
|
98
|
-
|
|
99
|
-
// Auth State signals
|
|
100
|
-
// public isAuthenticated = this.chatFacade.isAuthenticated;
|
|
101
|
-
|
|
102
|
-
public isLoggingIn = this.authService.isLoggingIn;
|
|
103
|
-
public authError = this.authService.authError;
|
|
104
|
-
public authSuccess = this.authService.authSuccess;
|
|
105
|
-
|
|
106
|
-
// Personalization
|
|
107
|
-
public activeButtonStyle = computed(() => this.personalization.settings().appearance.buttonStyle);
|
|
108
|
-
|
|
109
|
-
//! ======================= COMPONENT-SPECIFIC STATE =====================
|
|
110
|
-
|
|
111
|
-
public userName = 'User';
|
|
112
|
-
public predefinedMessages: string[] = PredefinedMessages;
|
|
113
|
-
public suggestedMessages: string[] = SuggestedMessages;
|
|
114
|
-
|
|
115
|
-
public maxMessageLength = 1000;
|
|
116
|
-
|
|
117
|
-
// Constants
|
|
118
|
-
readonly DoohbotConst = DoohbotConst;
|
|
119
|
-
|
|
120
|
-
// Context cleanup
|
|
121
|
-
private contextCleanup?: () => void;
|
|
122
|
-
|
|
123
|
-
// Reactive state
|
|
124
|
-
public authStatus = signal<AuthStatus>(this.authService.authStatus);
|
|
125
|
-
public isAuthenticated = signal<boolean>(this.authStatus() === 'authenticated');
|
|
126
|
-
|
|
127
|
-
//! ========================= VIEW CHILDREN ======================
|
|
128
|
-
|
|
129
|
-
@ViewChild(ChatWindowComponent, { read: ElementRef }) chatWindowRef!: ElementRef;
|
|
130
|
-
@ViewChild(FullscreenDirective) fullscreenDirective!: FullscreenDirective;
|
|
131
|
-
|
|
132
|
-
//! ======================= CONSTRUCTOR ========================
|
|
133
|
-
|
|
134
|
-
constructor(
|
|
135
|
-
private elementRef: ElementRef,
|
|
136
|
-
private renderer: Renderer2,
|
|
137
|
-
) {
|
|
138
|
-
super();
|
|
139
|
-
|
|
140
|
-
// Setup messages signal ref for UI state service
|
|
141
|
-
this.uiState.setMessagesSignal(this.chatService.messages);
|
|
142
|
-
|
|
143
|
-
// Theme management effect
|
|
144
|
-
effect(() => {
|
|
145
|
-
const activeTheme = this.themeService.activeTheme();
|
|
146
|
-
const host = this.elementRef.nativeElement;
|
|
147
|
-
this.renderer.removeClass(host, 'light-theme');
|
|
148
|
-
this.renderer.removeClass(host, 'dark-theme');
|
|
149
|
-
this.renderer.addClass(host, activeTheme);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
//! ====================== LIFECYCLE HOOKS =====================
|
|
154
|
-
// Corrected structural integrity.
|
|
155
|
-
|
|
156
|
-
async ngOnInit() {
|
|
157
|
-
logger.log('Initializing Doohbot component...');
|
|
158
|
-
|
|
159
|
-
// Load license registry from file and wait for it to complete
|
|
160
|
-
if (this.config.licenseFilePath) {
|
|
161
|
-
await this.licenseService.loadLicenseFile(this.config.licenseFilePath);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Run validation once on startup
|
|
165
|
-
this.authService.validateStoredToken().subscribe();
|
|
166
|
-
|
|
167
|
-
// React to auth status changes
|
|
168
|
-
this.authService.authStatus$.subscribe((status) => {
|
|
169
|
-
const wasAuthenticated = this.isAuthenticated();
|
|
170
|
-
this.authStatus.set(status);
|
|
171
|
-
this.isAuthenticated.set(status === 'authenticated');
|
|
172
|
-
|
|
173
|
-
if (status === 'authenticated' && !wasAuthenticated) {
|
|
174
|
-
this.initializeUI();
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// Handle initial state
|
|
179
|
-
if (this.isAuthenticated()) {
|
|
180
|
-
this.initializeUI();
|
|
181
|
-
} else {
|
|
182
|
-
//! STRICT VALIDATION: Only attempt federated login if we have the necessary configuration
|
|
183
|
-
const hasAuthToken = !!this.config.authToken;
|
|
184
|
-
|
|
185
|
-
// STRICT VALIDATION: We need both Token AND Valid License Context to proceed
|
|
186
|
-
if (this.canAttemptFederatedLogin()) {
|
|
187
|
-
logger.log('Attempting federated login...');
|
|
188
|
-
await this.onFederatedLogin();
|
|
189
|
-
// If federated login failed, the login screen will be shown automatically
|
|
190
|
-
// via the auth status subscription above
|
|
191
|
-
} else {
|
|
192
|
-
logger.info(
|
|
193
|
-
'Insufficient config for federated login (Need Token + TenancyName/LicenseKey). Waiting for user login.',
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
private canAttemptFederatedLogin(): boolean {
|
|
200
|
-
const hasAuthToken = !!this.config.authToken;
|
|
201
|
-
|
|
202
|
-
const hasDirectLicenseKey = !!this.config.licenseKey;
|
|
203
|
-
const hasTenantLicenseLookup = !!this.config.tenancyName && !!this.config.licenseFilePath;
|
|
204
|
-
|
|
205
|
-
const hasValidLicenseContext = hasDirectLicenseKey || hasTenantLicenseLookup;
|
|
206
|
-
|
|
207
|
-
return hasAuthToken && hasValidLicenseContext;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
private initializeUI() {
|
|
211
|
-
// Apply theme
|
|
212
|
-
if (this.themeConfig) {
|
|
213
|
-
this.themeService.setThemeConfig(this.themeConfig, this.elementRef.nativeElement);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Set user metadata
|
|
217
|
-
this.userAvatarUrl();
|
|
218
|
-
this.updateUserName();
|
|
219
|
-
|
|
220
|
-
// Start new session
|
|
221
|
-
this.chatService.startNewSession();
|
|
222
|
-
|
|
223
|
-
// Subscribe to context changes if not already
|
|
224
|
-
if (!this.contextCleanup) {
|
|
225
|
-
this.uiState.resetLastRead();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
230
|
-
// Handle user context changes
|
|
231
|
-
if (changes['userContext']) {
|
|
232
|
-
// this.chatFacade.handleUserContextChange(this.userContext);
|
|
233
|
-
this.updateUserName();
|
|
234
|
-
|
|
235
|
-
// Reset UI state and re-authenticate
|
|
236
|
-
this.uiState.closeChat();
|
|
237
|
-
this.uiState.closeHistorySidebar();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Handle config changes
|
|
241
|
-
if (changes['config']) {
|
|
242
|
-
this.authService.updateConfig(this.config);
|
|
243
|
-
this.userAvatarUrl();
|
|
244
|
-
this.updateUserName();
|
|
245
|
-
|
|
246
|
-
if (this.config.licenseKey) {
|
|
247
|
-
this.authService.setLicenseKey(this.config.licenseKey);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (this.config.buttonStyle || this.buttonStyle) {
|
|
251
|
-
this.personalization.setDeveloperDefaults({
|
|
252
|
-
buttonStyle: this.buttonStyle || this.config.buttonStyle,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Handle dynamic config updates for authentication
|
|
257
|
-
if (!this.isAuthenticated()) {
|
|
258
|
-
const token = this.config.authToken;
|
|
259
|
-
// Validate Config before attempting
|
|
260
|
-
if (token && this.canAttemptFederatedLogin()) {
|
|
261
|
-
this.onFederatedLogin(token);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (changes['buttonStyle'] && this.buttonStyle) {
|
|
267
|
-
this.personalization.setDeveloperDefaults({ buttonStyle: this.buttonStyle });
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (changes['themeConfig']) {
|
|
271
|
-
if (this.themeConfig) {
|
|
272
|
-
this.themeService.setThemeConfig(this.themeConfig, this.elementRef.nativeElement);
|
|
273
|
-
}
|
|
274
|
-
if (this.themeConfig?.primaryColor) {
|
|
275
|
-
this.personalization.setDeveloperDefaults({ primaryColor: this.themeConfig.primaryColor });
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Handle Color Inputs
|
|
280
|
-
if (changes['config'] && (this.config.primaryColor || this.config.accentColor)) {
|
|
281
|
-
const defaults: any = {};
|
|
282
|
-
if (this.config.primaryColor) defaults.primaryColor = this.config.primaryColor;
|
|
283
|
-
if (this.config.accentColor) defaults.primaryColor = this.config.accentColor;
|
|
284
|
-
|
|
285
|
-
this.personalization.setDeveloperDefaults(defaults);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
//! ====================== AUTHENTICATION ==================
|
|
290
|
-
// Logic moved to ChatFacadeService.initialize()
|
|
291
|
-
|
|
292
|
-
onNormalLogin(credentials: LoginRequest): void {
|
|
293
|
-
// Use Tenancy Name from Config Input
|
|
294
|
-
let tenancy = this.config.tenancyName;
|
|
295
|
-
|
|
296
|
-
//! fallback: Try to resolve from global utility (Auto-detect)
|
|
297
|
-
// if (!tenancy) {
|
|
298
|
-
// tenancy = window.AppPreBootstrap?.resolveTenancyName(window.AppConsts?.appBaseUrl);
|
|
299
|
-
// }
|
|
300
|
-
|
|
301
|
-
// Resolve key from whatever tenancy we found
|
|
302
|
-
let autoKey = this.licenseService.resolveTenantLicenseKey(tenancy || undefined);
|
|
303
|
-
|
|
304
|
-
// Inject for strict validation
|
|
305
|
-
if (autoKey) {
|
|
306
|
-
credentials.license = autoKey;
|
|
307
|
-
// Also set it in service usage context for this session
|
|
308
|
-
this.authService.setLicenseKey(autoKey);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
this.authService.login(credentials, false);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
async onFederatedLogin(token?: string): Promise<void> {
|
|
315
|
-
// Resolve Key from tenancy name
|
|
316
|
-
let autoKey = this.licenseService.resolveTenantLicenseKey();
|
|
317
|
-
|
|
318
|
-
// Fallback to Config Input
|
|
319
|
-
if (!autoKey) {
|
|
320
|
-
autoKey = this.config.licenseKey || '';
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (autoKey) {
|
|
324
|
-
this.authService.setLicenseKey(autoKey);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
const request: Partial<FederatedLoginRequest> = {
|
|
328
|
-
accessToken: token,
|
|
329
|
-
rememberMe: this.config.rememberMe,
|
|
330
|
-
license: autoKey,
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
// Await the federated login result
|
|
334
|
-
const success = await this.authService.federatedLogin(request);
|
|
335
|
-
|
|
336
|
-
if (!success) {
|
|
337
|
-
logger.info('Federated login failed. User can proceed with normal login.');
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
performLogout(): void {
|
|
342
|
-
DialogUtils.confirmLogout(this.dialogService).subscribe((confirmed) => {
|
|
343
|
-
if (confirmed) {
|
|
344
|
-
// Invalidate history cache before logout
|
|
345
|
-
this.chatHistory.invalidateCache();
|
|
346
|
-
this.authService.logout();
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
//! ====================== CHAT OPERATIONS =====================
|
|
352
|
-
|
|
353
|
-
toggleChat(): void {
|
|
354
|
-
this.uiState.toggleChat();
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
async sendMessage(text: string): Promise<void> {
|
|
358
|
-
await this.chatService.sendMessage(text, this.maxMessageLength);
|
|
359
|
-
// Invalidate cache after sending message
|
|
360
|
-
this.chatHistory.invalidateCache();
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
onStopRequest(): void {
|
|
364
|
-
logger.log('Stopping chat request...');
|
|
365
|
-
this.chatService.cancelRequest();
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
clearChat(): void {
|
|
369
|
-
const userId = this.authService.getUserId() || '';
|
|
370
|
-
// this.chatService.cancelRequest();
|
|
371
|
-
this.chatService.clearMessages();
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
clearMessageError(): void {
|
|
375
|
-
this.chatService.apiError.set(null);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
//! ===================== SESSION MANAGEMENT =======================
|
|
379
|
-
|
|
380
|
-
toggleHistorySidebar(): void {
|
|
381
|
-
const isNowOpen = !this.uiState.isHistorySidebarOpen();
|
|
382
|
-
if (isNowOpen) {
|
|
383
|
-
// Only load if not already cached
|
|
384
|
-
this.loadUserSessions();
|
|
385
|
-
}
|
|
386
|
-
this.uiState.toggleHistorySidebar();
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
loadChatSession(session: ChatSession): void {
|
|
390
|
-
logger.log(`Session selected: ${session.id}. continuing session...`);
|
|
391
|
-
this.chatService.continueSession(session.id);
|
|
392
|
-
this.uiState.closeHistorySidebar();
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
deleteSession(sessionId: string): void {
|
|
396
|
-
logger.log(`Deleting session: ${sessionId}`);
|
|
397
|
-
const userId = this.authService.getUserId() || '';
|
|
398
|
-
this.chatHistory.deleteSession(sessionId, userId.toString()).subscribe(() => {
|
|
399
|
-
// Invalidate cache after deletion
|
|
400
|
-
this.chatHistory.invalidateCache();
|
|
401
|
-
|
|
402
|
-
// If deleted session is currently active, start a new one
|
|
403
|
-
const activeSession = this.chatService.getActiveSession();
|
|
404
|
-
if (activeSession?.id === sessionId) {
|
|
405
|
-
logger.log('Active session was deleted, starting a new one.');
|
|
406
|
-
this.chatService.startNewSession();
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
//! deleteAllSessions
|
|
412
|
-
|
|
413
|
-
deleteAllSessions(): void {
|
|
414
|
-
logger.log('Deleting all chat sessions');
|
|
415
|
-
const userId = this.authService.getUserId() || '';
|
|
416
|
-
this.chatHistory.deleteAllHistory(userId.toString()).subscribe({
|
|
417
|
-
next: () => {
|
|
418
|
-
this.chatService.clearMessages();
|
|
419
|
-
},
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
renameSession(event: { sessionId: string; newTitle: string }): void {
|
|
424
|
-
logger.log(`Renaming session ${event.sessionId} to ${event.newTitle}`);
|
|
425
|
-
const userId = this.authService.getUserId() || '';
|
|
426
|
-
this.chatHistory
|
|
427
|
-
.updateSessionTitle(event.sessionId, event.newTitle, userId.toString())
|
|
428
|
-
.subscribe((success) => {
|
|
429
|
-
if (success) {
|
|
430
|
-
// If updated session is currently active, update its title in ChatService
|
|
431
|
-
const activeSession = this.chatService.getActiveSession();
|
|
432
|
-
if (activeSession?.id === event.sessionId) {
|
|
433
|
-
activeSession.title = event.newTitle;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
private loadUserSessions(): void {
|
|
440
|
-
const userId = this.authService.getUserId() || '';
|
|
441
|
-
logger.log(`Initiating loadUserSessions for user: ${userId}`);
|
|
442
|
-
this.chatHistory.loadSessions(userId.toString());
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Load more sessions for infinite scroll
|
|
447
|
-
*/
|
|
448
|
-
loadMoreHistory(): void {
|
|
449
|
-
const userId = this.authService.getUserId() || '';
|
|
450
|
-
logger.log(`Loading more sessions for user: ${userId}`);
|
|
451
|
-
this.chatHistory.loadMoreSessions(userId.toString());
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Manually refresh history
|
|
456
|
-
*/
|
|
457
|
-
refreshHistory(): void {
|
|
458
|
-
const userId = this.authService.getUserId() || '';
|
|
459
|
-
logger.log(`Refreshing sessions for user: ${userId}`);
|
|
460
|
-
this.chatHistory.invalidateCache();
|
|
461
|
-
this.chatHistory.loadSessions(userId.toString(), true); // force refresh
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
//! ======================== FULLSCREEN =====================
|
|
465
|
-
|
|
466
|
-
toggleFullScreen(): void {
|
|
467
|
-
if (this.fullscreenDirective) {
|
|
468
|
-
this.fullscreenDirective.toggle();
|
|
469
|
-
const isFullscreen = this.fullscreenDirective.getFullscreenState();
|
|
470
|
-
this.uiState.setFullscreen(isFullscreen);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
//! ================== UTILITY METHODS =======================
|
|
475
|
-
|
|
476
|
-
trackByMessageId(index: number, item: any): string {
|
|
477
|
-
return item.id || index.toString();
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Resolve and update the username from all available sources
|
|
482
|
-
*/
|
|
483
|
-
private updateUserName(): void {
|
|
484
|
-
if (!this.isAuthenticated()) {
|
|
485
|
-
this.userName = '';
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
const loggedInName = this.authService.getLoggedInUserName();
|
|
490
|
-
// const contextName = this.userContext?.userName;
|
|
491
|
-
const configName = this.config.username;
|
|
492
|
-
|
|
493
|
-
if (configName) {
|
|
494
|
-
this.userName = configName;
|
|
495
|
-
} else if (loggedInName) {
|
|
496
|
-
this.userName = loggedInName;
|
|
497
|
-
} else {
|
|
498
|
-
this.userName = 'User';
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
logger.log('Resolved userName:', this.userName);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
userAvatarUrl(): string {
|
|
505
|
-
return DoohbotConst.userAvatar;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
ngOnDestroy() {
|
|
509
|
-
// Clean up subscriptions
|
|
510
|
-
if (this.contextCleanup) {
|
|
511
|
-
this.contextCleanup();
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
this.chatService.cancelRequest();
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
//! ================== INITIALIZATION =======================
|
|
519
|
-
|
|
520
|
-
export function initializeApp() {
|
|
521
|
-
const appConst = inject(AppConst);
|
|
522
|
-
return appConst.load(); // Returns a Promise
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
bootstrapApplication(Doohbot, {
|
|
526
|
-
providers: [
|
|
527
|
-
provideHttpClient(withInterceptorsFromDi()),
|
|
528
|
-
AppConst,
|
|
529
|
-
{
|
|
530
|
-
provide: APP_INITIALIZER,
|
|
531
|
-
useFactory: initializeApp,
|
|
532
|
-
multi: true,
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
provide: HTTP_INTERCEPTORS,
|
|
536
|
-
useClass: AuthInterceptor,
|
|
537
|
-
multi: true,
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
provide: HTTP_INTERCEPTORS,
|
|
541
|
-
useClass: LicenseInterceptor,
|
|
542
|
-
multi: true,
|
|
543
|
-
},
|
|
544
|
-
],
|
|
545
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { NgModule, Injector } from '@angular/core';
|
|
2
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
3
|
-
import { createCustomElement } from '@angular/elements';
|
|
4
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
-
import { platformBrowser } from '@angular/platform-browser';
|
|
6
|
-
import { Doohbot } from './doohbot.component';
|
|
7
|
-
|
|
8
|
-
@NgModule({
|
|
9
|
-
imports: [BrowserModule, MatIconModule],
|
|
10
|
-
declarations: [],
|
|
11
|
-
})
|
|
12
|
-
export class ElementModule {
|
|
13
|
-
constructor(injector: Injector) {
|
|
14
|
-
const doohbotElement = createCustomElement(Doohbot, { injector });
|
|
15
|
-
|
|
16
|
-
// Check if already defined to avoid errors
|
|
17
|
-
if (!customElements.get('app-doohbot')) {
|
|
18
|
-
customElements.define('app-doohbot', doohbotElement);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
platformBrowser()
|
|
24
|
-
.bootstrapModule(ElementModule)
|
|
25
|
-
.catch((err) => console.error(err));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const PredefinedMessages = [
|
|
2
|
-
'How do I create a new DOOH proposal in Doohclick?',
|
|
3
|
-
'Can the buyer see internal notes I add in Doohclick?',
|
|
4
|
-
// 'What happens after a buyer approves a proposal?',
|
|
5
|
-
// 'Why would an SR hide the pipeline value in a proposal?',
|
|
6
|
-
// 'Are additional services like ad formatting included in the base campaign cost?',
|
|
7
|
-
'How to create a proposal?',
|
|
8
|
-
];
|
|
9
|
-
export const SuggestedMessages = [
|
|
10
|
-
'Hi! How can I help?',
|
|
11
|
-
'Check your activity?',
|
|
12
|
-
'Need account help?',
|
|
13
|
-
'Quick tips to start.',
|
|
14
|
-
];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.predefined-chips {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
gap: 8px;
|
|
5
|
-
padding: 10px;
|
|
6
|
-
font: var(--font-family);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.chip {
|
|
10
|
-
background-color: rgba(var(--primary-color), 0.2);
|
|
11
|
-
border: 1px solid var(--primary-color);
|
|
12
|
-
border-radius: 16px;
|
|
13
|
-
padding: 6px 12px;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
font-size: 0.9rem;
|
|
16
|
-
font: var(--font-family);
|
|
17
|
-
transition: background-color 0.3s ease;
|
|
18
|
-
color: var(--text-color);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.chip:hover {
|
|
22
|
-
background-color: var(--primary-color);
|
|
23
|
-
color: var(--white);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.chip.active {
|
|
27
|
-
background-color: var(--primary-color);
|
|
28
|
-
color: var(--white);
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { Chips } from './chips.component';
|
|
4
|
-
|
|
5
|
-
describe('Chips', () => {
|
|
6
|
-
let component: Chips;
|
|
7
|
-
let fixture: ComponentFixture<Chips>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [Chips],
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
|
|
14
|
-
fixture = TestBed.createComponent(Chips);
|
|
15
|
-
component = fixture.componentInstance;
|
|
16
|
-
fixture.detectChanges();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('should create', () => {
|
|
20
|
-
expect(component).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'app-chips',
|
|
6
|
-
standalone: true,
|
|
7
|
-
imports: [CommonModule],
|
|
8
|
-
templateUrl: './chips.component.html',
|
|
9
|
-
styleUrls: ['./chips.component.scss'],
|
|
10
|
-
})
|
|
11
|
-
export class Chips {
|
|
12
|
-
@Input() messages: string[] = []; // messages array
|
|
13
|
-
@Input() disabled = false;
|
|
14
|
-
@Output() chipClick = new EventEmitter<string>(); // emit clicked chip
|
|
15
|
-
|
|
16
|
-
onChipClick(msg: string) {
|
|
17
|
-
if (this.disabled) return;
|
|
18
|
-
this.chipClick.emit(msg);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<div class="dialog-container">
|
|
2
|
-
<div class="dialog-header">
|
|
3
|
-
<mat-icon class="dialog-icon" [class.warn-icon]="data.confirmButtonColor === 'warn'">
|
|
4
|
-
{{ data.icon }}
|
|
5
|
-
</mat-icon>
|
|
6
|
-
<h2 mat-dialog-title>{{ data.title }}</h2>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<mat-dialog-content>
|
|
10
|
-
<p class="dialog-message">{{ data.message }}</p>
|
|
11
|
-
</mat-dialog-content>
|
|
12
|
-
|
|
13
|
-
<mat-dialog-actions align="end">
|
|
14
|
-
<button mat-button class="cancel-btn" (click)="onCancel()" type="button">
|
|
15
|
-
{{ data.cancelText }}
|
|
16
|
-
</button>
|
|
17
|
-
<button
|
|
18
|
-
mat-raised-button
|
|
19
|
-
class="confirm-btn"
|
|
20
|
-
[class.warn-btn]="data.confirmButtonColor === 'warn'"
|
|
21
|
-
[class.primary-btn]="data.confirmButtonColor === 'primary'"
|
|
22
|
-
[class.accent-btn]="data.confirmButtonColor === 'accent'"
|
|
23
|
-
(click)="onConfirm()"
|
|
24
|
-
type="button"
|
|
25
|
-
>
|
|
26
|
-
{{ data.confirmText }}
|
|
27
|
-
</button>
|
|
28
|
-
</mat-dialog-actions>
|
|
29
|
-
</div>
|