@adzen/doohbot 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.editorconfig +17 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +26 -0
  4. package/.vscode/settings.json +13 -0
  5. package/.vscode/tasks.json +42 -0
  6. package/README.md +58 -0
  7. package/adzen-doohbot-0.0.1.tgz +0 -0
  8. package/adzen-doohbot-1.0.0.tgz +0 -0
  9. package/angular.json +119 -0
  10. package/package.json +57 -0
  11. package/projects/doohbot/README.md +63 -0
  12. package/projects/doohbot/ng-package.json +16 -0
  13. package/projects/doohbot/package.json +12 -0
  14. package/projects/doohbot/src/lib/directives/draggable/draggable-dialog.directive.ts +62 -0
  15. package/projects/doohbot/src/lib/directives/draggable/draggable-dialog.module.ts +9 -0
  16. package/projects/doohbot/src/lib/directives/resizable/resizable-dialog.directive.ts +163 -0
  17. package/projects/doohbot/src/lib/directives/resizable/resizable-dialog.module.ts +9 -0
  18. package/projects/doohbot/src/lib/doohbot.html +216 -0
  19. package/projects/doohbot/src/lib/doohbot.scss +568 -0
  20. package/projects/doohbot/src/lib/doohbot.spec.ts +21 -0
  21. package/projects/doohbot/src/lib/doohbot.ts +345 -0
  22. package/projects/doohbot/src/lib/elements/elements.ts +25 -0
  23. package/projects/doohbot/src/lib/helpers/predefined_messages.ts +2 -0
  24. package/projects/doohbot/src/lib/inputs/doohbot-input.ts +25 -0
  25. package/projects/doohbot/src/lib/model/doohbot.intents.ts +24 -0
  26. package/projects/doohbot/src/lib/model/message.ts +13 -0
  27. package/projects/doohbot/src/lib/model/token.ts +3 -0
  28. package/projects/doohbot/src/lib/services/messaging.service.ts +76 -0
  29. package/projects/doohbot/src/lib/shared/chips/chips.html +9 -0
  30. package/projects/doohbot/src/lib/shared/chips/chips.scss +27 -0
  31. package/projects/doohbot/src/lib/shared/chips/chips.spec.ts +23 -0
  32. package/projects/doohbot/src/lib/shared/chips/chips.ts +18 -0
  33. package/projects/doohbot/src/lib/shared/snackbar/snackbar.html +7 -0
  34. package/projects/doohbot/src/lib/shared/snackbar/snackbar.scss +73 -0
  35. package/projects/doohbot/src/lib/shared/snackbar/snackbar.spec.ts +21 -0
  36. package/projects/doohbot/src/lib/shared/snackbar/snackbar.ts +44 -0
  37. package/projects/doohbot/src/lib/utils/material-override.scss +312 -0
  38. package/projects/doohbot/src/lib/utils/utility.scss +536 -0
  39. package/projects/doohbot/src/public-api.ts +5 -0
  40. package/projects/doohbot/tsconfig.lib.json +19 -0
  41. package/projects/doohbot/tsconfig.lib.prod.json +11 -0
  42. package/projects/doohbot/tsconfig.spec.json +14 -0
  43. package/projects/doohbot-element/public/favicon.ico +0 -0
  44. package/projects/doohbot-element/src/app/app.config.ts +12 -0
  45. package/projects/doohbot-element/src/app/app.html +1 -0
  46. package/projects/doohbot-element/src/app/app.routes.ts +3 -0
  47. package/projects/doohbot-element/src/app/app.scss +0 -0
  48. package/projects/doohbot-element/src/app/app.spec.ts +23 -0
  49. package/projects/doohbot-element/src/app/app.ts +10 -0
  50. package/projects/doohbot-element/src/index.html +15 -0
  51. package/projects/doohbot-element/src/main.ts +6 -0
  52. package/projects/doohbot-element/src/styles.scss +15 -0
  53. package/projects/doohbot-element/tsconfig.app.json +15 -0
  54. package/projects/doohbot-element/tsconfig.spec.json +14 -0
  55. package/tsconfig.json +43 -0
@@ -0,0 +1,9 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { ResizableDialogDirective } from './resizable-dialog.directive';
3
+
4
+ @NgModule({
5
+ declarations: [],
6
+ imports: [ResizableDialogDirective],
7
+ exports: [ResizableDialogDirective],
8
+ })
9
+ export default class ResizableDialogModule {}
@@ -0,0 +1,216 @@
1
+ <!-- fab -->
2
+ @if (buttonStyle === 'fab' && !isChatOpen()) {
3
+ <button class="chat-fab" (click)="toggleChat()">
4
+ <mat-icon>{{ chatIcon }}</mat-icon>
5
+ @if (unreadCount() > 0) {
6
+ <span class="alert-badge">
7
+ {{ unreadCount() > 9 ? '9+' : unreadCount() }}
8
+ </span>
9
+ }
10
+ </button>
11
+ }
12
+ <!-- sidebar button -->
13
+ @if (buttonStyle === 'sidebar' && !isChatOpen()) {
14
+ <button class="chat-sidebar" (click)="toggleChat()">
15
+ <h2 style="transform: rotate(-90deg); font-size: 16px">{{ appTitle }}</h2>
16
+ @if (unreadCount() > 0) {
17
+ <span class="alert-badge">
18
+ {{ unreadCount() > 9 ? '9+' : unreadCount() }}
19
+ </span>
20
+ }
21
+ </button>
22
+ }
23
+
24
+ <!-- ... chat window ... -->
25
+ @if (isChatOpen()) {
26
+ <div
27
+ draggableDialog
28
+ [dragHandle]="'.chat-header'"
29
+ resizableDialog
30
+ class="chat-window"
31
+ [class.fullscreen]="isFullScreen"
32
+ >
33
+ <!-- chat window -->
34
+ <div class="chat-header">
35
+ <div class="chat-title">
36
+ <img class="chat-logo" [src]="appLogoUrl" alt="Logo" />
37
+ <h2>{{ appTitle }}</h2>
38
+ </div>
39
+
40
+ <div class="chat-header-buttons">
41
+ <!-- settings Button -->
42
+ <button class="header-button" [matMenuTriggerFor]="settingsMenu" matTooltip="Menu">
43
+ <mat-icon>{{ moreIcon }}</mat-icon>
44
+ </button>
45
+
46
+ <!-- minimize Button -->
47
+ <button class="header-button" (click)="toggleChat()" matTooltip="Close">
48
+ <mat-icon>{{ minimizeIcon }}</mat-icon>
49
+ </button>
50
+ </div>
51
+ </div>
52
+
53
+ <!-- Messages / Welcome Screen -->
54
+ <div #chatMessages class="chat-messages">
55
+ <!-- Welcome Screen -->
56
+ @if (messages().length === 0 && !isBotTyping()) {
57
+ <div class="welcome-screen">
58
+ <img [src]="appLogoUrl" alt="Welcome" class="welcome-image" />
59
+ <h3>{{ appSubtitle }}</h3>
60
+ <p>{{ welcomeDesc }}</p>
61
+
62
+ <!-- Predefined messages chips -->
63
+ <app-chips
64
+ [messages]="predefinedMessages"
65
+ [disabled]="isBotTyping()"
66
+ (click)="onPredefinedClick($event)"
67
+ ></app-chips>
68
+ </div>
69
+ }
70
+
71
+ <!-- Chat Messages -->
72
+ @for (message of messages(); track message.id ?? $index; let i = $index) {
73
+ <div
74
+ class="message-wrapper"
75
+ [class.user]="message.sender === 'user'"
76
+ [class.bot]="message.sender === 'bot'"
77
+ >
78
+ <!-- Bot Avatar -->
79
+ @if (message.sender === 'bot') {
80
+ <img class="bot-avatar" [src]="botAvatarUrl" alt="Bot Avatar" />
81
+ }
82
+
83
+ <!-- Message Bubble -->
84
+ <div
85
+ class="message"
86
+ [class.user]="message.sender === 'user'"
87
+ [class.bot]="message.sender === 'bot'"
88
+ >
89
+ {{ message.text }}
90
+ <!-- Show time below message -->
91
+ @if (message.sender === 'bot') {
92
+ <div class="message-time">
93
+ {{ message.timestamp | date: 'shortTime' }}
94
+ </div>
95
+ }
96
+ </div>
97
+
98
+ <!-- User Avatar -->
99
+ @if (message.sender === 'user') {
100
+ <img class="user-avatar" [src]="userAvatarUrl" alt="User Avatar" />
101
+ }
102
+ </div>
103
+ }
104
+
105
+ <!-- Typing Indicator -->
106
+ @if (isBotTyping()) {
107
+ <div class="message-wrapper bot">
108
+ <img class="bot-avatar" [src]="botAvatarUrl" alt="Bot Avatar" />
109
+ <div class="message bot">
110
+ <div class="typing-indicator">
111
+ <span></span>
112
+ <span></span>
113
+ <span></span>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ }
118
+ </div>
119
+
120
+ <!-- SUGGESTED CHIPS: Show only if last bot message was fallback -->
121
+ @if (showSuggestionChips()) {
122
+ <app-chips
123
+ [messages]="predefinedMessages"
124
+ [disabled]="isBotTyping()"
125
+ (click)="onPredefinedClick($event)"
126
+ ></app-chips>
127
+ }
128
+
129
+ <!-- Inline error message -->
130
+ @if (messageError()) {
131
+ <app-snackbar
132
+ [message]="messageError()"
133
+ [show]="!messageError()"
134
+ (closed)="clearMessageError()"
135
+ ></app-snackbar>
136
+ }
137
+
138
+ <!-- Chat Input -->
139
+ <div class="chat-input">
140
+ <input
141
+ #messageInput
142
+ type="text"
143
+ [disabled]="isBotTyping()"
144
+ (keydown.enter)="sendMessage(messageInput.value); messageInput.value = ''"
145
+ placeholder="{{ hintText }}"
146
+ />
147
+ <button (click)="sendMessage(messageInput.value); messageInput.value = ''">
148
+ <mat-icon>{{ sendIcon }}</mat-icon>
149
+ </button>
150
+ </div>
151
+
152
+ <!-- footer -->
153
+ <div class="terms-conditions">
154
+ <a href="#">Terms and Conditions</a>
155
+ </div>
156
+ </div>
157
+ }
158
+
159
+ <mat-menu #settingsMenu="matMenu" class="mat-menu-override">
160
+ <!-- Change Theme -->
161
+ <div class="theme-selector">
162
+ <!-- <span>Theme</span> -->
163
+
164
+ <!-- System Theme -->
165
+ <button
166
+ mat-icon-button
167
+ class="theme-btn"
168
+ [class.selected]="theme === 'system'"
169
+ (click)="changeTheme('system')"
170
+ >
171
+ <mat-icon>brightness_6</mat-icon>
172
+ </button>
173
+
174
+ <!-- Light Theme -->
175
+ <button
176
+ mat-icon-button
177
+ class="theme-btn"
178
+ [class.selected]="theme === 'light'"
179
+ (click)="changeTheme('light')"
180
+ >
181
+ <mat-icon>light_mode</mat-icon>
182
+ </button>
183
+
184
+ <!-- Dark Theme -->
185
+ <button
186
+ mat-icon-button
187
+ class="theme-btn"
188
+ [class.selected]="theme === 'dark'"
189
+ (click)="changeTheme('dark')"
190
+ >
191
+ <mat-icon>dark_mode</mat-icon>
192
+ </button>
193
+ </div>
194
+
195
+ <!-- Full-Screen Button -->
196
+ <button mat-menu-item (click)="toggleFullScreen()" style="display: flex; align-items: center">
197
+ <mat-icon>{{ isFullScreen ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon>
198
+ <span> {{ isFullScreen ? 'Minimize' : 'Expand' }}</span>
199
+ </button>
200
+
201
+ <!-- Pop-out Screen -->
202
+ <!-- <button
203
+ mat-menu-item
204
+ (click)="isPoppedOut ? popIn() : popOut()"
205
+ style="display: flex; align-items: center"
206
+ >
207
+ <mat-icon>{{ isPoppedOut ? 'open_in_new_off' : 'open_in_new' }}</mat-icon>
208
+ <span>{{ isPoppedOut ? 'Pop-in Screen' : 'Pop-out Screen' }}</span>
209
+ </button> -->
210
+
211
+ <!-- Clear Chat -->
212
+ <button mat-menu-item (click)="clearChat()" style="display: flex; align-items: center">
213
+ <mat-icon>clear_all</mat-icon>
214
+ <span>Clear Chat</span>
215
+ </button>
216
+ </mat-menu>