@hachther/akilio-widget 0.6.6 → 0.7.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.
- package/README.md +88 -0
- package/dist/akilio-widget.min.js +39 -39
- package/dist/components/Composer.d.ts +1 -0
- package/dist/components/ContactActions.d.ts +8 -0
- package/dist/components/ContextualPrompt.d.ts +7 -0
- package/dist/components/EmptyState.d.ts +7 -1
- package/dist/components/Launcher.d.ts +3 -1
- package/dist/components/MessageBubble.d.ts +4 -1
- package/dist/components/MessageList.d.ts +1 -1
- package/dist/hooks/page-end.d.ts +1 -0
- package/dist/hooks/response-sound.d.ts +9 -0
- package/dist/index.min.js +4794 -4327
- package/dist/index.umd.min.cjs +27 -27
- package/dist/lib/client.d.ts +2 -1
- package/dist/style.css +528 -1
- package/dist/types.d.ts +112 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -2,10 +2,13 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import type { AkilioResolvedCopy } from './lib/copy';
|
|
3
3
|
export type AkilioMode = 'floating' | 'inline' | 'side-panel' | 'drawer' | 'hybrid';
|
|
4
4
|
export type AkilioColorMode = 'light' | 'dark' | 'system';
|
|
5
|
+
export type AkilioLauncherPosition = 'bottom-right' | 'bottom-left' | 'right-middle';
|
|
5
6
|
export type AkilioLocale = string;
|
|
6
7
|
export type AkilioMessageRole = 'user' | 'assistant';
|
|
7
8
|
export type AkilioFeedbackRating = 'up' | 'down';
|
|
8
9
|
export type AkilioAssistantMode = 'auto' | 'general' | 'knowledge' | 'ecommerce' | 'hybrid';
|
|
10
|
+
export type AkilioChatIntent = 'answer' | 'summarize_page' | 'contact';
|
|
11
|
+
export type AkilioCapabilitySurface = 'widget' | 'public_api';
|
|
9
12
|
export type AkilioWidgetBranding = 'akilio_required' | 'removable' | 'white_label';
|
|
10
13
|
export type AkilioCommerceCapabilityType = 'product_search' | 'product_recommendation';
|
|
11
14
|
export type AkilioCommerceEventType = 'search' | 'recommendation' | 'compare' | 'add_to_cart' | 'checkout' | 'purchase';
|
|
@@ -120,10 +123,67 @@ export interface AkilioProjectConfig {
|
|
|
120
123
|
default_language: string;
|
|
121
124
|
supported_languages: string[];
|
|
122
125
|
widget_policy?: AkilioWidgetPolicy;
|
|
126
|
+
capabilities?: AkilioPublicRuntimeCapabilities;
|
|
123
127
|
privacy_notice?: string;
|
|
124
128
|
privacy_notice_url?: string;
|
|
125
129
|
require_consent?: boolean;
|
|
126
130
|
}
|
|
131
|
+
export interface AkilioChatIntentCapability {
|
|
132
|
+
code: AkilioChatIntent | string;
|
|
133
|
+
enabled: boolean;
|
|
134
|
+
requirements: string[];
|
|
135
|
+
surfaces: AkilioCapabilitySurface[];
|
|
136
|
+
}
|
|
137
|
+
export interface AkilioChatIntentCatalog {
|
|
138
|
+
intents_schema_version: string;
|
|
139
|
+
default_intent: AkilioChatIntent | string;
|
|
140
|
+
intents: AkilioChatIntentCapability[];
|
|
141
|
+
contact_request?: AkilioContactRequestCapability;
|
|
142
|
+
}
|
|
143
|
+
export interface AkilioContactRequestCapability {
|
|
144
|
+
enabled: boolean;
|
|
145
|
+
endpoint: string;
|
|
146
|
+
method: string;
|
|
147
|
+
consent_required: boolean;
|
|
148
|
+
consent_text: string;
|
|
149
|
+
required_fields: string[];
|
|
150
|
+
}
|
|
151
|
+
export type AkilioContactOptionType = 'email' | 'phone' | 'form';
|
|
152
|
+
export interface AkilioContactOption {
|
|
153
|
+
type: AkilioContactOptionType;
|
|
154
|
+
label: string;
|
|
155
|
+
value?: string;
|
|
156
|
+
url: string;
|
|
157
|
+
}
|
|
158
|
+
export interface AkilioCustomerAction {
|
|
159
|
+
type: 'start_contact_request';
|
|
160
|
+
label: string;
|
|
161
|
+
prompt: string;
|
|
162
|
+
endpoint: string;
|
|
163
|
+
method: string;
|
|
164
|
+
requires_confirmation: boolean;
|
|
165
|
+
fields: string[];
|
|
166
|
+
}
|
|
167
|
+
export type AkilioPreferredContactMethod = 'email' | 'phone' | 'either';
|
|
168
|
+
export interface AkilioContactRequest {
|
|
169
|
+
conversation_id: string;
|
|
170
|
+
source_message_id: string;
|
|
171
|
+
name?: string;
|
|
172
|
+
email?: string;
|
|
173
|
+
phone?: string;
|
|
174
|
+
preferred_contact_method: AkilioPreferredContactMethod;
|
|
175
|
+
preferred_contact_time?: string;
|
|
176
|
+
message: string;
|
|
177
|
+
consent_given: boolean;
|
|
178
|
+
}
|
|
179
|
+
export interface AkilioContactRequestResponse {
|
|
180
|
+
id: string;
|
|
181
|
+
status?: string;
|
|
182
|
+
created_at: string;
|
|
183
|
+
}
|
|
184
|
+
export interface AkilioPublicRuntimeCapabilities {
|
|
185
|
+
chat: AkilioChatIntentCatalog;
|
|
186
|
+
}
|
|
127
187
|
export interface AkilioWidgetPolicy {
|
|
128
188
|
/** Whether the widget may currently accept user interactions. */
|
|
129
189
|
available: boolean;
|
|
@@ -138,6 +198,8 @@ export interface AkilioChatRequest {
|
|
|
138
198
|
project_key: string;
|
|
139
199
|
conversation_id?: string;
|
|
140
200
|
message: string;
|
|
201
|
+
/** Explicit action selected from the public config capability catalog. */
|
|
202
|
+
intent?: AkilioChatIntent;
|
|
141
203
|
locale?: string;
|
|
142
204
|
channel?: string;
|
|
143
205
|
audience?: string;
|
|
@@ -175,6 +237,9 @@ export interface AkilioChatResponse {
|
|
|
175
237
|
cost_usd?: string;
|
|
176
238
|
commerce?: AkilioCommerceCapability | null;
|
|
177
239
|
suggestions?: string[];
|
|
240
|
+
intent?: AkilioChatIntent;
|
|
241
|
+
contact_options?: AkilioContactOption[];
|
|
242
|
+
actions?: AkilioCustomerAction[];
|
|
178
243
|
warnings?: string[];
|
|
179
244
|
assistant_mode?: string;
|
|
180
245
|
active_route?: string;
|
|
@@ -265,6 +330,8 @@ export interface AkilioChatMessage {
|
|
|
265
330
|
streaming?: boolean;
|
|
266
331
|
error?: boolean;
|
|
267
332
|
feedback?: AkilioFeedbackRating;
|
|
333
|
+
contactOptions?: AkilioContactOption[];
|
|
334
|
+
actions?: AkilioCustomerAction[];
|
|
268
335
|
}
|
|
269
336
|
export interface AkilioCopyOverrides {
|
|
270
337
|
launcher?: string;
|
|
@@ -286,6 +353,24 @@ export interface AkilioCopyOverrides {
|
|
|
286
353
|
online?: string;
|
|
287
354
|
feedbackQuestion?: string;
|
|
288
355
|
feedbackThanks?: string;
|
|
356
|
+
feedbackSending?: string;
|
|
357
|
+
contextualPlaceholder?: string;
|
|
358
|
+
contextualDismiss?: string;
|
|
359
|
+
contact?: string;
|
|
360
|
+
contactName?: string;
|
|
361
|
+
contactEmail?: string;
|
|
362
|
+
contactPhone?: string;
|
|
363
|
+
contactMethod?: string;
|
|
364
|
+
contactMethodEmail?: string;
|
|
365
|
+
contactMethodPhone?: string;
|
|
366
|
+
contactMethodEither?: string;
|
|
367
|
+
contactTime?: string;
|
|
368
|
+
contactMessage?: string;
|
|
369
|
+
contactConsent?: string;
|
|
370
|
+
contactSubmit?: string;
|
|
371
|
+
contactSending?: string;
|
|
372
|
+
contactSuccess?: string;
|
|
373
|
+
contactFailed?: string;
|
|
289
374
|
voteUp?: string;
|
|
290
375
|
voteDown?: string;
|
|
291
376
|
requestFailed?: string;
|
|
@@ -304,6 +389,7 @@ export interface AkilioCopyOverrides {
|
|
|
304
389
|
tourMessage?: string;
|
|
305
390
|
tourAction?: string;
|
|
306
391
|
tourDismiss?: string;
|
|
392
|
+
summarizePage?: string;
|
|
307
393
|
privacyDefaultNotice?: string;
|
|
308
394
|
switchToLightMode?: string;
|
|
309
395
|
switchToDarkMode?: string;
|
|
@@ -322,6 +408,14 @@ export interface AkilioLauncherRenderProps {
|
|
|
322
408
|
}
|
|
323
409
|
export type AkilioLauncher = 'default' | 'hidden' | ((controls: AkilioLauncherRenderProps) => ReactNode);
|
|
324
410
|
export type AkilioStyleIsolation = 'shadow' | 'scoped' | 'none';
|
|
411
|
+
export interface AkilioContextualPromptOptions {
|
|
412
|
+
enabled?: boolean;
|
|
413
|
+
trigger?: 'near-page-end';
|
|
414
|
+
/** Distance from the document end that reveals the prompt. Defaults to 320px. */
|
|
415
|
+
threshold?: number;
|
|
416
|
+
placeholder?: string;
|
|
417
|
+
dismissible?: boolean;
|
|
418
|
+
}
|
|
325
419
|
export type IntegrationType = 'shopify' | 'woocommerce' | 'wordpress' | 'prestashop' | 'magento' | 'wix' | 'webflow' | 'squarespace' | 'nextjs' | 'react' | 'vue' | 'angular' | 'vanilla' | 'unknown';
|
|
326
420
|
export interface AkilioWidgetProps {
|
|
327
421
|
apiBaseUrl?: string;
|
|
@@ -338,6 +432,10 @@ export interface AkilioWidgetProps {
|
|
|
338
432
|
showAkilioBranding?: boolean;
|
|
339
433
|
/** Use the authenticated SSE chat endpoint. Set false for synchronous compatibility. */
|
|
340
434
|
streaming?: boolean;
|
|
435
|
+
/** Play a short notification chime after a successful final response. */
|
|
436
|
+
enableResponseSound?: boolean;
|
|
437
|
+
/** Notification volume from 0 to 1. Defaults to 0.22. */
|
|
438
|
+
responseSoundVolume?: number;
|
|
341
439
|
/** Isolate widget CSS from the host page. Shadow DOM is the safest default. */
|
|
342
440
|
styleIsolation?: AkilioStyleIsolation;
|
|
343
441
|
defaultOpen?: boolean;
|
|
@@ -345,6 +443,10 @@ export interface AkilioWidgetProps {
|
|
|
345
443
|
open?: boolean;
|
|
346
444
|
/** Built-in launcher, no launcher, or a custom React launcher renderer. */
|
|
347
445
|
launcher?: AkilioLauncher;
|
|
446
|
+
/** Position of the built-in launcher. right-middle opens a desktop drawer. */
|
|
447
|
+
launcherPosition?: AkilioLauncherPosition;
|
|
448
|
+
/** Show a question prompt as the reader approaches the end of the page. */
|
|
449
|
+
contextualPrompt?: boolean | AkilioContextualPromptOptions;
|
|
348
450
|
persistOpenState?: boolean;
|
|
349
451
|
/** Show a one-time, dependency-free coachmark beside the default launcher. */
|
|
350
452
|
enableTour?: boolean;
|
|
@@ -381,6 +483,7 @@ export interface AkilioWidgetProps {
|
|
|
381
483
|
integration?: IntegrationType;
|
|
382
484
|
}
|
|
383
485
|
export interface ChatPanelProps {
|
|
486
|
+
panelId: string;
|
|
384
487
|
open: boolean;
|
|
385
488
|
isDesktop: boolean;
|
|
386
489
|
inline: boolean;
|
|
@@ -392,6 +495,7 @@ export interface ChatPanelProps {
|
|
|
392
495
|
copy: AkilioResolvedCopy;
|
|
393
496
|
locale: string;
|
|
394
497
|
messages: AkilioChatMessage[];
|
|
498
|
+
feedbackPending: Record<string, AkilioFeedbackRating | undefined>;
|
|
395
499
|
streamingMessage?: AkilioChatMessage | null;
|
|
396
500
|
loading: boolean;
|
|
397
501
|
loadingLabel?: string;
|
|
@@ -407,9 +511,17 @@ export interface ChatPanelProps {
|
|
|
407
511
|
onSubmit: (query: string) => Promise<AkilioChatResponse>;
|
|
408
512
|
onDraftChange?: (draft: string, manual: boolean) => void;
|
|
409
513
|
onFeedback: (message: AkilioChatMessage, rating: AkilioFeedbackRating) => void;
|
|
514
|
+
contactRequestCapability?: AkilioContactRequestCapability;
|
|
515
|
+
onContactRequest: (request: AkilioContactRequest) => Promise<AkilioContactRequestResponse>;
|
|
410
516
|
onSuggestion: (suggestion: string) => void;
|
|
517
|
+
intentActions?: Array<{
|
|
518
|
+
intent: AkilioChatIntent;
|
|
519
|
+
label: string;
|
|
520
|
+
}>;
|
|
521
|
+
onIntentAction: (intent: AkilioChatIntent, label: string) => void;
|
|
411
522
|
onProductClick: (message: AkilioChatMessage, product: AkilioProduct, variant?: AkilioProductVariant) => void;
|
|
412
523
|
primaryColor?: string;
|
|
524
|
+
slug?: string;
|
|
413
525
|
}
|
|
414
526
|
export type IntegrationDetection = {
|
|
415
527
|
integration: IntegrationType;
|