@aslaluroba/help-center 4.0.13 → 4.0.15
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 +0 -0
- package/assets/Shape.png +0 -0
- package/assets/favicon.ico +0 -0
- package/fesm2022/aslaluroba-help-center.mjs +1619 -2287
- package/fesm2022/aslaluroba-help-center.mjs.map +1 -1
- package/package.json +9 -8
- package/styles/styles.css +17 -51
- package/types/aslaluroba-help-center.d.ts +207 -258
- package/types/aslaluroba-help-center.d.ts.map +1 -0
|
@@ -1,197 +1,115 @@
|
|
|
1
|
+
import { HelpScreenData as HelpScreenData$1, HelpScreenOption, Message as Message$1, Option, SenderType, TokenResponse, ActionHandler } from '@aslaluroba/help-center-core';
|
|
2
|
+
export { Assistant, HelpScreenFile, HelpScreenOption, Option, PresignDownloadResponse, PresignUploadRequestDto, PresignUploadResponse, SelectedFileDto, Tenant, TokenResponse, UploadResult } from '@aslaluroba/help-center-core';
|
|
1
3
|
import * as _angular_core from '@angular/core';
|
|
2
4
|
import { OnInit, OnDestroy, ElementRef, InjectionToken, PipeTransform } from '@angular/core';
|
|
3
|
-
import {
|
|
5
|
+
import { ApiConfig as ApiConfig$1 } from '@/app/types';
|
|
4
6
|
|
|
5
7
|
type Language = 'en' | 'ar';
|
|
6
|
-
interface
|
|
7
|
-
token: string;
|
|
8
|
-
expiresIn: number;
|
|
9
|
-
}
|
|
10
|
-
interface Option {
|
|
11
|
-
id: string;
|
|
12
|
-
helpScreenId: string;
|
|
13
|
-
parentOptionId: string | null;
|
|
14
|
-
nestedOptions: Option[];
|
|
15
|
-
title: string;
|
|
16
|
-
paragraphs: string[];
|
|
17
|
-
chatWithUs: boolean;
|
|
18
|
-
assistantId?: string;
|
|
19
|
-
assistant?: {
|
|
20
|
-
id: string;
|
|
21
|
-
tenantId: string;
|
|
22
|
-
tenant: {
|
|
23
|
-
id: string;
|
|
24
|
-
name: string;
|
|
25
|
-
key: string;
|
|
26
|
-
};
|
|
27
|
-
name: string;
|
|
28
|
-
openAIAssistantId: string;
|
|
29
|
-
greeting: string;
|
|
30
|
-
closing: string;
|
|
31
|
-
};
|
|
32
|
-
hasNestedOptions: boolean;
|
|
33
|
-
order: number;
|
|
34
|
-
icon?: string;
|
|
35
|
-
}
|
|
36
|
-
interface Message {
|
|
8
|
+
interface Message extends Omit<Message$1, 'id'> {
|
|
37
9
|
id: string | number;
|
|
38
10
|
sender: 'user' | 'assistant' | 'agent';
|
|
39
|
-
senderType: number;
|
|
40
|
-
messageContent: string;
|
|
41
|
-
sentAt: Date;
|
|
42
|
-
isSeen: boolean;
|
|
43
|
-
attachmentIds?: string[];
|
|
44
11
|
isReviewMessage?: boolean;
|
|
45
12
|
}
|
|
46
|
-
interface
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
key: string;
|
|
50
|
-
logoUrl?: string | null;
|
|
51
|
-
autoCloseSessions?: boolean;
|
|
52
|
-
autoCloseSessionsAfter?: number;
|
|
53
|
-
settings?: {
|
|
54
|
-
description?: string;
|
|
55
|
-
theme?: {
|
|
56
|
-
primaryColor?: string;
|
|
57
|
-
secondaryColor?: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
interface Assistant {
|
|
62
|
-
id: string;
|
|
63
|
-
tenantId: string;
|
|
64
|
-
tenant: Tenant;
|
|
65
|
-
name: string;
|
|
66
|
-
openAIAssistantId: string;
|
|
67
|
-
greeting: string;
|
|
68
|
-
closing: string;
|
|
69
|
-
}
|
|
70
|
-
interface HelpScreenFile {
|
|
71
|
-
id: string;
|
|
72
|
-
name: string;
|
|
73
|
-
url: string;
|
|
74
|
-
type: string;
|
|
75
|
-
size?: number;
|
|
76
|
-
}
|
|
77
|
-
interface HelpScreenOption {
|
|
78
|
-
id: string;
|
|
79
|
-
helpScreenId: string;
|
|
80
|
-
parentOptionId: string | null;
|
|
81
|
-
nestedOptions: HelpScreenOption[];
|
|
82
|
-
title: string;
|
|
83
|
-
paragraphs: string[];
|
|
84
|
-
files: HelpScreenFile[];
|
|
85
|
-
chatWithUs: boolean;
|
|
86
|
-
assistantId?: string;
|
|
87
|
-
assistant?: Assistant;
|
|
88
|
-
hasNestedOptions: boolean;
|
|
89
|
-
order: number;
|
|
90
|
-
icon?: string;
|
|
91
|
-
}
|
|
92
|
-
interface HelpScreenData {
|
|
93
|
-
id: string;
|
|
94
|
-
tenantId: string;
|
|
95
|
-
tenant: Tenant;
|
|
96
|
-
title: string;
|
|
97
|
-
description: string;
|
|
13
|
+
interface HelpScreenData extends Omit<HelpScreenData$1, 'options'> {
|
|
98
14
|
options: HelpScreenOption[];
|
|
99
|
-
chatWithUs: boolean;
|
|
100
|
-
}
|
|
101
|
-
interface PresignUploadRequestDto {
|
|
102
|
-
name: string;
|
|
103
|
-
contentType: string;
|
|
104
|
-
sizeBytes: number;
|
|
105
|
-
pathData: {
|
|
106
|
-
type: number;
|
|
107
|
-
chatSessionId: string;
|
|
108
|
-
};
|
|
109
15
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
expiresAt: string;
|
|
16
|
+
|
|
17
|
+
interface ApiConfig {
|
|
18
|
+
getToken: () => Promise<string>;
|
|
19
|
+
baseUrl?: string;
|
|
115
20
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Owns all state and logic for fetching and displaying the help screen.
|
|
24
|
+
* Provided at the widget level (component-scoped) alongside ChatStateService.
|
|
25
|
+
*/
|
|
26
|
+
declare class HelpScreenStateService {
|
|
27
|
+
private apiService;
|
|
28
|
+
private translationSvc;
|
|
29
|
+
helpScreenData: _angular_core.WritableSignal<HelpScreenData | null>;
|
|
30
|
+
status: _angular_core.WritableSignal<"idle" | "loading" | "succeeded" | "failed">;
|
|
31
|
+
error: _angular_core.WritableSignal<string | null>;
|
|
32
|
+
showHelpScreenData: _angular_core.WritableSignal<boolean>;
|
|
33
|
+
fetchHelpScreenData(helpScreenId: string, currentLang: string): Promise<void>;
|
|
34
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HelpScreenStateService, never>;
|
|
35
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<HelpScreenStateService>;
|
|
122
36
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
37
|
+
|
|
38
|
+
interface ReviewCallbacks {
|
|
39
|
+
/** Called when review is submitted or skipped from the standalone dialog (post-chat). */
|
|
40
|
+
onReviewDone: () => void;
|
|
41
|
+
/** Called when review is submitted or skipped from inside the chat window. */
|
|
42
|
+
onInChatReviewDone: () => void;
|
|
129
43
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Owns the review dialog state and submission logic.
|
|
46
|
+
* Provided at the widget level (component-scoped) alongside ChatStateService.
|
|
47
|
+
* Delegates session API calls to ChatSessionService.
|
|
48
|
+
* Calls back into ChatStateService via ReviewCallbacks for post-review state resets.
|
|
49
|
+
*/
|
|
50
|
+
declare class ReviewStateService {
|
|
51
|
+
private chatSessionSvc;
|
|
52
|
+
private translationSvc;
|
|
53
|
+
showReviewDialog: _angular_core.WritableSignal<boolean>;
|
|
54
|
+
isSubmittingReview: _angular_core.WritableSignal<boolean>;
|
|
55
|
+
closedSessionIdForReview: _angular_core.WritableSignal<string | null>;
|
|
56
|
+
private callbacks?;
|
|
57
|
+
/** Must be called once by ChatStateService during initialization. */
|
|
58
|
+
registerCallbacks(cb: ReviewCallbacks): void;
|
|
59
|
+
handleReviewSubmit(reviewData: {
|
|
60
|
+
rating: number;
|
|
61
|
+
comment: string;
|
|
62
|
+
}, currentLang: string): Promise<void>;
|
|
63
|
+
handleReviewClose(): void;
|
|
64
|
+
handleReviewSkip(): Promise<void>;
|
|
65
|
+
handleReviewSubmitFromChat(reviewData: {
|
|
66
|
+
rating: number;
|
|
67
|
+
comment: string;
|
|
68
|
+
}, currentLang: string): Promise<void>;
|
|
69
|
+
handleReviewSkipFromChat(): Promise<void>;
|
|
70
|
+
private _doSubmitReview;
|
|
71
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ReviewStateService, never>;
|
|
72
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ReviewStateService>;
|
|
134
73
|
}
|
|
135
74
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
sessionId: _angular_core.WritableSignal<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Component-scoped service that coordinates chat, session, and review state for
|
|
77
|
+
* HelpCenterWidgetComponent. Delegates help-screen fetching to HelpScreenStateService
|
|
78
|
+
* and review flow to ReviewStateService. Provided at widget level — each widget
|
|
79
|
+
* instance gets isolated state.
|
|
80
|
+
*/
|
|
81
|
+
declare class ChatStateService {
|
|
82
|
+
private apiService;
|
|
83
|
+
private chatSessionSvc;
|
|
84
|
+
private actionHandlerSvc;
|
|
85
|
+
private fileUploadSvc;
|
|
86
|
+
private translationSvc;
|
|
87
|
+
readonly helpScreen: HelpScreenStateService;
|
|
88
|
+
readonly review: ReviewStateService;
|
|
89
|
+
readonly currentLang: _angular_core.WritableSignal<string>;
|
|
90
|
+
readonly helpScreenId: _angular_core.WritableSignal<string>;
|
|
91
|
+
sessionId: _angular_core.WritableSignal<string | null>;
|
|
153
92
|
isAblyConnected: _angular_core.WritableSignal<boolean>;
|
|
154
93
|
isChatClosed: _angular_core.WritableSignal<boolean>;
|
|
155
94
|
showChat: _angular_core.WritableSignal<boolean>;
|
|
156
95
|
messageText: _angular_core.WritableSignal<string>;
|
|
157
96
|
isTyping: _angular_core.WritableSignal<boolean>;
|
|
158
97
|
messages: _angular_core.WritableSignal<Message[]>;
|
|
159
|
-
showHelpScreenData: _angular_core.WritableSignal<boolean>;
|
|
160
98
|
chatIsLoading: _angular_core.WritableSignal<boolean>;
|
|
161
|
-
ablyToken: _angular_core.WritableSignal<string>;
|
|
99
|
+
ablyToken: _angular_core.WritableSignal<string | null>;
|
|
162
100
|
needsAgent: _angular_core.WritableSignal<boolean>;
|
|
163
|
-
assistantStatus: _angular_core.WritableSignal<"
|
|
164
|
-
selectedOption: _angular_core.WritableSignal<Option>;
|
|
165
|
-
selectedNestedOption: _angular_core.WritableSignal<Option>;
|
|
101
|
+
assistantStatus: _angular_core.WritableSignal<"typing" | "idle">;
|
|
102
|
+
selectedOption: _angular_core.WritableSignal<Option | null>;
|
|
103
|
+
selectedNestedOption: _angular_core.WritableSignal<Option | null>;
|
|
104
|
+
hasUserSentMessages: _angular_core.WritableSignal<boolean>;
|
|
105
|
+
waitingForSessionEndConfirmation: _angular_core.WritableSignal<boolean>;
|
|
166
106
|
showEndChatConfirmation: _angular_core.WritableSignal<boolean>;
|
|
167
107
|
showStartNewChatConfirmation: _angular_core.WritableSignal<boolean>;
|
|
168
|
-
|
|
169
|
-
isSubmittingReview: _angular_core.WritableSignal<boolean>;
|
|
108
|
+
pendingNewChatOption: _angular_core.WritableSignal<Option | null>;
|
|
170
109
|
isStartingNewChat: _angular_core.WritableSignal<boolean>;
|
|
171
|
-
pendingNewChatOption: _angular_core.WritableSignal<Option>;
|
|
172
|
-
hasUserSentMessages: _angular_core.WritableSignal<boolean>;
|
|
173
|
-
closedSessionIdForReview: _angular_core.WritableSignal<string>;
|
|
174
|
-
waitingForSessionEndConfirmation: _angular_core.WritableSignal<boolean>;
|
|
175
110
|
private isClosingChatSession;
|
|
176
|
-
private apiService;
|
|
177
|
-
private translationService;
|
|
178
|
-
private themeService;
|
|
179
|
-
private chatSessionService;
|
|
180
|
-
private actionHandlerService;
|
|
181
|
-
private fileUploadService;
|
|
182
|
-
private destroyRef;
|
|
183
|
-
private themeEffectRef?;
|
|
184
|
-
private languageEffectRef?;
|
|
185
111
|
constructor();
|
|
186
|
-
|
|
187
|
-
* Registers action handlers for AI response actions.
|
|
188
|
-
* This uses the ActionHandlerService for extensible, maintainable action handling.
|
|
189
|
-
*/
|
|
190
|
-
private registerActionHandlers;
|
|
191
|
-
ngOnInit(): void;
|
|
192
|
-
ngOnDestroy(): void;
|
|
193
|
-
handleTogglePopup(): Promise<void>;
|
|
194
|
-
private fetchHelpScreenData;
|
|
112
|
+
fetchHelpScreenData(): Promise<void>;
|
|
195
113
|
createChatSession(option?: Option): Promise<{
|
|
196
114
|
chatSession: {
|
|
197
115
|
id: string;
|
|
@@ -201,67 +119,97 @@ declare class HelpCenterWidgetComponent implements OnInit, OnDestroy {
|
|
|
201
119
|
sendMessage(event?: {
|
|
202
120
|
text: string;
|
|
203
121
|
attachmentIds: string[];
|
|
122
|
+
previewUrls?: string[];
|
|
204
123
|
pendingFiles?: File[];
|
|
205
124
|
} | string): Promise<void>;
|
|
206
|
-
/**
|
|
207
|
-
* Called when user attaches files but there is no session yet.
|
|
208
|
-
* Creates a session so that chat-input can upload the files; send stays disabled until upload completes.
|
|
209
|
-
*/
|
|
210
125
|
handleRequestSessionForAttachments(): Promise<void>;
|
|
211
126
|
handleReceiveMessage(message: string | {
|
|
212
127
|
content: string;
|
|
213
128
|
attachments?: string[];
|
|
214
|
-
}, senderType:
|
|
129
|
+
}, senderType: SenderType, needsAgent: boolean): void;
|
|
215
130
|
private getSenderType;
|
|
216
131
|
private hasActiveChatSession;
|
|
217
132
|
private isWelcomeMessage;
|
|
218
133
|
handleStartNewChat(option: Option): Promise<void>;
|
|
219
134
|
private startNewChatSession;
|
|
220
135
|
handleStartChat(option: Option): Promise<void>;
|
|
136
|
+
private startNewChatWithOption;
|
|
221
137
|
handleEndChat(): Promise<void>;
|
|
222
138
|
confirmEndChat(): Promise<void>;
|
|
223
|
-
handleReviewSubmit(reviewData: {
|
|
224
|
-
rating: number;
|
|
225
|
-
comment: string;
|
|
226
|
-
}): Promise<void>;
|
|
227
|
-
handleReviewClose(): void;
|
|
228
|
-
handleReviewSkip(): Promise<void>;
|
|
229
|
-
private endChatSession;
|
|
230
|
-
private closeSessionOnly;
|
|
231
139
|
cancelEndChat(): void;
|
|
232
140
|
closeEndChat(): void;
|
|
141
|
+
endChatSession(): Promise<void>;
|
|
142
|
+
private closeSessionOnly;
|
|
143
|
+
private clearCurrentChat;
|
|
144
|
+
resetChatUiState(): void;
|
|
233
145
|
confirmStartNewChat(): Promise<void>;
|
|
234
146
|
cancelStartNewChat(): void;
|
|
235
147
|
closeStartNewChat(): void;
|
|
236
|
-
|
|
237
|
-
private
|
|
148
|
+
handleEndSessionReceived(): void;
|
|
149
|
+
private handleEndSessionConfirmed;
|
|
150
|
+
addSystemMessage(messageData: unknown): void;
|
|
151
|
+
private addReviewMessageToChat;
|
|
152
|
+
handleReviewSubmit(reviewData: {
|
|
153
|
+
rating: number;
|
|
154
|
+
comment: string;
|
|
155
|
+
}): Promise<void>;
|
|
156
|
+
handleReviewSkip(): Promise<void>;
|
|
157
|
+
handleReviewClose(): void;
|
|
158
|
+
handleReviewSubmitFromChat(reviewData: {
|
|
159
|
+
rating: number;
|
|
160
|
+
comment: string;
|
|
161
|
+
}): Promise<void>;
|
|
162
|
+
handleReviewSkipFromChat(): Promise<void>;
|
|
163
|
+
cleanup(): void;
|
|
164
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatStateService, never>;
|
|
165
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ChatStateService>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
declare class HelpCenterWidgetComponent implements OnInit, OnDestroy {
|
|
169
|
+
getToken: _angular_core.InputSignal<() => Promise<string>>;
|
|
170
|
+
helpScreenId: _angular_core.InputSignal<string>;
|
|
171
|
+
showArrow: _angular_core.InputSignal<boolean>;
|
|
172
|
+
messageLabel: _angular_core.InputSignal<string | null>;
|
|
173
|
+
currentLang: _angular_core.InputSignal<string>;
|
|
174
|
+
primaryColor: _angular_core.InputSignal<string>;
|
|
175
|
+
logoUrl: _angular_core.InputSignal<string>;
|
|
176
|
+
chatMessagesContainer: ElementRef;
|
|
177
|
+
readonly chatState: ChatStateService;
|
|
178
|
+
private translationService;
|
|
179
|
+
private actionHandlerService;
|
|
180
|
+
private destroyRef;
|
|
181
|
+
isRTL: _angular_core.Signal<boolean>;
|
|
182
|
+
isPopupOpen: _angular_core.WritableSignal<boolean>;
|
|
183
|
+
showArrowAnimation: _angular_core.WritableSignal<boolean>;
|
|
184
|
+
showTooltip: _angular_core.WritableSignal<boolean>;
|
|
185
|
+
themeStyles: _angular_core.Signal<Record<string, string>>;
|
|
186
|
+
private languageEffectRef?;
|
|
187
|
+
private scrollEffectRef?;
|
|
188
|
+
private configEffectRef?;
|
|
189
|
+
private scrollTimeout?;
|
|
190
|
+
constructor();
|
|
191
|
+
private registerActionHandlers;
|
|
192
|
+
ngOnInit(): void;
|
|
193
|
+
ngOnDestroy(): void;
|
|
194
|
+
handleTogglePopup(): Promise<void>;
|
|
238
195
|
handleClosePopup(): Promise<void>;
|
|
239
196
|
handleMinimizePopup(): void;
|
|
240
197
|
handleCloseArrowAnimation(): void;
|
|
241
198
|
handleBack(): void;
|
|
242
199
|
handleShowChat(): void;
|
|
200
|
+
handleShowHelpScreenData(): void;
|
|
243
201
|
selectOption(option: Option): void;
|
|
244
202
|
selectNestedOption(nestedOption: Option): void;
|
|
245
|
-
|
|
246
|
-
private scrollTimeout?;
|
|
247
|
-
private scrollToBottom;
|
|
203
|
+
navigateToUrl(url: string): void;
|
|
248
204
|
getDirection(): "ltr" | "rtl";
|
|
249
205
|
get helpScreenDataList(): {
|
|
250
206
|
icon: string;
|
|
251
207
|
title: string;
|
|
252
208
|
description: string;
|
|
253
209
|
actionLabel: string;
|
|
254
|
-
action: () => Promise<void
|
|
210
|
+
action: (() => Promise<void>) | null;
|
|
255
211
|
}[];
|
|
256
|
-
|
|
257
|
-
private addReviewMessageToChat;
|
|
258
|
-
handleEndSessionReceived(): void;
|
|
259
|
-
private handleEndSessionConfirmed;
|
|
260
|
-
handleReviewSubmitFromChat(reviewData: {
|
|
261
|
-
rating: number;
|
|
262
|
-
comment: string;
|
|
263
|
-
}): Promise<void>;
|
|
264
|
-
handleReviewSkipFromChat(): Promise<void>;
|
|
212
|
+
private scrollToBottom;
|
|
265
213
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HelpCenterWidgetComponent, never>;
|
|
266
214
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HelpCenterWidgetComponent, "app-help-center-widget", never, { "getToken": { "alias": "getToken"; "required": true; "isSignal": true; }; "helpScreenId": { "alias": "helpScreenId"; "required": true; "isSignal": true; }; "showArrow": { "alias": "showArrow"; "required": false; "isSignal": true; }; "messageLabel": { "alias": "messageLabel"; "required": false; "isSignal": true; }; "currentLang": { "alias": "currentLang"; "required": false; "isSignal": true; }; "primaryColor": { "alias": "primaryColor"; "required": false; "isSignal": true; }; "logoUrl": { "alias": "logoUrl"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
267
215
|
}
|
|
@@ -274,6 +222,7 @@ declare class HelpCenterWidgetComponent implements OnInit, OnDestroy {
|
|
|
274
222
|
declare const HELP_CENTER_LOADING_LOGO_URL: InjectionToken<string>;
|
|
275
223
|
|
|
276
224
|
type GetTokenFn = () => Promise<string>;
|
|
225
|
+
declare const DEFAULT_API_BASE_URL = "https://babylai.net/api";
|
|
277
226
|
/**
|
|
278
227
|
* Service for managing help center configuration.
|
|
279
228
|
*
|
|
@@ -328,7 +277,7 @@ declare class ApiService {
|
|
|
328
277
|
* });
|
|
329
278
|
* ```
|
|
330
279
|
*/
|
|
331
|
-
initialize(config: ApiConfig): void;
|
|
280
|
+
initialize(config: ApiConfig$1): void;
|
|
332
281
|
/**
|
|
333
282
|
* Validate token format
|
|
334
283
|
* JWT tokens must have exactly 3 parts separated by dots (header.payload.signature)
|
|
@@ -414,52 +363,18 @@ declare class TokenService {
|
|
|
414
363
|
* @throws Error if no token function is configured
|
|
415
364
|
*/
|
|
416
365
|
getToken(): Promise<TokenResponse>;
|
|
366
|
+
private decodeJwtExpiry;
|
|
417
367
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TokenService, never>;
|
|
418
368
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TokenService>;
|
|
419
369
|
}
|
|
420
370
|
|
|
421
|
-
type TranslationKey = '
|
|
422
|
-
/**
|
|
423
|
-
* Service for managing translations and language switching.
|
|
424
|
-
*
|
|
425
|
-
* Supports multiple languages (currently English and Arabic) with RTL support.
|
|
426
|
-
* Provides reactive language changes through Observable pattern.
|
|
427
|
-
*
|
|
428
|
-
* @publicApi
|
|
429
|
-
*/
|
|
371
|
+
type TranslationKey = 'ChatNow' | 'ChatPlaceholder' | 'PoweredByBabylAI' | 'LeavingDialogTitle' | 'LeavingDialogBody' | 'CloseChat' | 'Continue' | 'StartNewChatDialogTitle' | 'StartNewChatDialogBody' | 'ReviewDialogTitle' | 'ReviewDialogDescription' | 'ReviewDialogRatingLabel' | 'ReviewDialogCommentLabel' | 'ReviewDialogCommentPlaceholder' | 'ReviewDialogSubmitButton' | 'ReviewDialogSkipButton' | 'HelpCenter' | 'Back' | 'ErrorFetchingHelpScreen' | 'ErrorSendingMessage' | 'ErrorStartingChat' | 'ErrorCreatingSession' | 'ErrorMessageEmpty' | 'ErrorMessageTooLong' | 'ErrorInvalidFileType' | 'ChatGreeting' | 'AgentJoinedSession';
|
|
430
372
|
declare class TranslationService {
|
|
431
373
|
private translations;
|
|
432
|
-
private _currentLang;
|
|
433
|
-
readonly currentLang:
|
|
434
|
-
/**
|
|
435
|
-
* Translates a translation key to the current language.
|
|
436
|
-
*
|
|
437
|
-
* @param key Translation key to look up
|
|
438
|
-
* @returns Translated string in the current language, or the key itself if translation not found
|
|
439
|
-
*
|
|
440
|
-
* @example
|
|
441
|
-
* ```typescript
|
|
442
|
-
* const message = translationService.translate('ChatNow');
|
|
443
|
-
* // Returns 'Let\'s Chat' in English or 'دعنا نتحدث' in Arabic
|
|
444
|
-
* ```
|
|
445
|
-
*/
|
|
374
|
+
private readonly _currentLang;
|
|
375
|
+
readonly currentLang: _angular_core.Signal<Language>;
|
|
446
376
|
translate(key: TranslationKey): string;
|
|
447
|
-
/**
|
|
448
|
-
* Sets the current language for translations.
|
|
449
|
-
*
|
|
450
|
-
* @param lang Language code ('en' or 'ar')
|
|
451
|
-
*
|
|
452
|
-
* @example
|
|
453
|
-
* ```typescript
|
|
454
|
-
* translationService.setLanguage('ar'); // Switch to Arabic
|
|
455
|
-
* ```
|
|
456
|
-
*/
|
|
457
377
|
setLanguage(lang: Language): void;
|
|
458
|
-
/**
|
|
459
|
-
* Gets the current language code.
|
|
460
|
-
*
|
|
461
|
-
* @returns Current language code ('en' or 'ar')
|
|
462
|
-
*/
|
|
463
378
|
getCurrentLang(): Language;
|
|
464
379
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TranslationService, never>;
|
|
465
380
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TranslationService>;
|
|
@@ -478,6 +393,7 @@ declare class TranslationService {
|
|
|
478
393
|
declare class ChatSessionService {
|
|
479
394
|
private apiService;
|
|
480
395
|
private actionHandlerService;
|
|
396
|
+
private readonly ablyService;
|
|
481
397
|
/**
|
|
482
398
|
* Creates a new chat session with the specified option.
|
|
483
399
|
*
|
|
@@ -500,15 +416,12 @@ declare class ChatSessionService {
|
|
|
500
416
|
* @param ablyToken The Ably authentication token
|
|
501
417
|
* @param onMessageReceived Callback function for received messages
|
|
502
418
|
* @param tenantId The tenant ID for the connection
|
|
503
|
-
* @param option Optional option for token refresh (needed for token renewal)
|
|
504
|
-
* @param helpScreenId Optional help screen ID for token refresh
|
|
505
|
-
* @param currentLang Optional current language for token refresh
|
|
506
419
|
* @param onActionReceived Optional callback function for handling action types
|
|
507
420
|
*/
|
|
508
421
|
establishAblyConnection(sessionId: string, ablyToken: string, onMessageReceived: (message: string | {
|
|
509
422
|
content: string;
|
|
510
423
|
attachments?: string[];
|
|
511
|
-
}, senderType: number, needsAgent: boolean) => void, tenantId: string,
|
|
424
|
+
}, senderType: number, needsAgent: boolean) => void, tenantId: string, onActionReceived?: (actionType: string, messageData: unknown) => void | Promise<void>): Promise<void>;
|
|
512
425
|
/**
|
|
513
426
|
* Sends a message in an active chat session.
|
|
514
427
|
*
|
|
@@ -551,6 +464,60 @@ declare class ChatSessionService {
|
|
|
551
464
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ChatSessionService>;
|
|
552
465
|
}
|
|
553
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Service for managing AI response action handlers in an extensible way.
|
|
469
|
+
*
|
|
470
|
+
* This service provides a registry pattern for handling different action types
|
|
471
|
+
* from realtime AI responses, making it easy to add new actions without
|
|
472
|
+
* modifying existing code.
|
|
473
|
+
*
|
|
474
|
+
* @publicApi
|
|
475
|
+
*/
|
|
476
|
+
declare class ActionHandlerService {
|
|
477
|
+
private actionHandlers;
|
|
478
|
+
private defaultHandler?;
|
|
479
|
+
constructor();
|
|
480
|
+
/**
|
|
481
|
+
* Registers a handler for a specific action type
|
|
482
|
+
*
|
|
483
|
+
* @param actionType The action type string (e.g., 'needs_agent', 'end_session')
|
|
484
|
+
* @param handler The handler function to execute when this action is received
|
|
485
|
+
*/
|
|
486
|
+
registerHandler(actionType: string, handler: ActionHandler): void;
|
|
487
|
+
/**
|
|
488
|
+
* Unregisters a handler for a specific action type
|
|
489
|
+
*
|
|
490
|
+
* @param actionType The action type to unregister
|
|
491
|
+
*/
|
|
492
|
+
unregisterHandler(actionType: string): void;
|
|
493
|
+
/**
|
|
494
|
+
* Sets the default handler for unknown action types
|
|
495
|
+
*
|
|
496
|
+
* @param handler The default handler function
|
|
497
|
+
*/
|
|
498
|
+
setDefaultHandler(handler: ActionHandler): void;
|
|
499
|
+
/**
|
|
500
|
+
* Handles an action type by executing the registered handler or default handler
|
|
501
|
+
*
|
|
502
|
+
* @param actionType The action type to handle
|
|
503
|
+
* @param messageData The message data containing the action
|
|
504
|
+
* @returns Promise that resolves when handling is complete
|
|
505
|
+
*/
|
|
506
|
+
handleAction(actionType: string | undefined | null, messageData: unknown): Promise<void>;
|
|
507
|
+
/**
|
|
508
|
+
* Gets all registered action types
|
|
509
|
+
*
|
|
510
|
+
* @returns Array of registered action type strings
|
|
511
|
+
*/
|
|
512
|
+
getRegisteredActions(): string[];
|
|
513
|
+
/**
|
|
514
|
+
* Clears all registered handlers (useful for testing or cleanup)
|
|
515
|
+
*/
|
|
516
|
+
clearHandlers(): void;
|
|
517
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ActionHandlerService, never>;
|
|
518
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ActionHandlerService>;
|
|
519
|
+
}
|
|
520
|
+
|
|
554
521
|
/**
|
|
555
522
|
* Service for managing language switching.
|
|
556
523
|
*
|
|
@@ -605,24 +572,6 @@ declare class TranslatePipe implements PipeTransform {
|
|
|
605
572
|
static ɵpipe: _angular_core.ɵɵPipeDeclaration<TranslatePipe, "translate", true>;
|
|
606
573
|
}
|
|
607
574
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
* @publicApi
|
|
612
|
-
*/
|
|
613
|
-
interface ApiConfig {
|
|
614
|
-
/**
|
|
615
|
-
* Function that returns a promise resolving to an authentication token
|
|
616
|
-
* This function is called when tokens need to be refreshed
|
|
617
|
-
*/
|
|
618
|
-
getToken: () => Promise<string>;
|
|
619
|
-
/**
|
|
620
|
-
* Optional base URL for API requests
|
|
621
|
-
* Defaults to 'https://babylai.net/api' if not provided
|
|
622
|
-
* Should use HTTPS in production environments
|
|
623
|
-
*/
|
|
624
|
-
baseUrl?: string;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
export { ApiService, ChatSessionService, HELP_CENTER_LOADING_LOGO_URL, HelpCenterConfigService, HelpCenterWidgetComponent, LanguageService, TokenService, TranslatePipe, TranslationService };
|
|
628
|
-
export type { ApiConfig, Assistant, GetTokenFn, HelpScreenData, HelpScreenFile, HelpScreenOption, Language, Message, Option, PresignDownloadResponse, PresignUploadRequestDto, PresignUploadResponse, SelectedFileDto, Tenant, TokenResponse, TranslationKey, UploadResult };
|
|
575
|
+
export { ActionHandlerService, ApiService, ChatSessionService, DEFAULT_API_BASE_URL, HELP_CENTER_LOADING_LOGO_URL, HelpCenterConfigService, HelpCenterWidgetComponent, LanguageService, TokenService, TranslatePipe, TranslationService };
|
|
576
|
+
export type { ApiConfig, GetTokenFn, HelpScreenData, Language, Message, TranslationKey };
|
|
577
|
+
//# sourceMappingURL=aslaluroba-help-center.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aslaluroba-help-center.d.ts","sources":["../../../src/app/types.ts","../../../src/app/help-center-widget/help-screen-state.service.ts","../../../src/app/help-center-widget/review-state.service.ts","../../../src/app/help-center-widget/chat-state.service.ts","../../../src/app/help-center-widget/help-center-widget.component.ts","../../../src/app/help-center-widget/tokens.ts","../../../src/app/services/help-center-config.service.ts","../../../src/app/services/api.service.ts","../../../src/app/services/token.service.ts","../../../src/app/services/translation.service.ts","../../../src/app/services/chat-session.service.ts","../../../src/app/services/action-handler.service.ts","../../../src/app/language.service.ts","../../../src/app/pipes/translate.pipe.ts"],"mappings":";;;;;;KAMY,QAAQ;AAEd,UAAW,OAAQ,SAAQ,IAAI,CAACA,SAAW;AAC/C;AACA;;AAED;AAGK,UAAW,cAAe,SAAQ,IAAI,CAACC,gBAAkB;aACpD,gBAAgB;AAC1B;;UAgBgB,SAAS;AACxB,oBAAgB,OAAO;;AAExB;;AC/BD;;;AAGG;AACH,cACa,sBAAsB;;;AAIjC,oBAAc,aAAA,CAAA,cAAA,CAAA,cAAA;AACd,YAAM,aAAA,CAAA,cAAA;AACN,WAAK,aAAA,CAAA,cAAA;AACL,wBAAkB,aAAA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