@hachther/akilio-widget 0.6.6 → 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.
- package/README.md +359 -16
- package/dist/_headers +16 -0
- package/dist/akilio-widget.min.js +44 -44
- package/dist/assets/EmailIcon.d.ts +2 -0
- package/dist/assets/FormIcon.d.ts +2 -0
- package/dist/assets/PhoneIcon.d.ts +2 -0
- package/dist/components/BrandLogo.d.ts +7 -1
- package/dist/components/CartPanel.d.ts +13 -0
- package/dist/components/CommerceActions.d.ts +11 -0
- package/dist/components/Composer.d.ts +7 -1
- package/dist/components/ContactActions.d.ts +8 -0
- package/dist/components/ContextualPrompt.d.ts +7 -0
- package/dist/components/EmptyState.d.ts +3 -1
- package/dist/components/Icons.d.ts +1 -0
- package/dist/components/InlineDecisionCard.d.ts +2 -0
- package/dist/components/Launcher.d.ts +8 -1
- package/dist/components/MessageBubble.d.ts +10 -1
- package/dist/components/MessageList.d.ts +1 -1
- package/dist/components/ProductCard.d.ts +4 -2
- package/dist/components/ProductCards.d.ts +6 -1
- package/dist/components/ProductDetail.d.ts +12 -0
- package/dist/components/SectionPrompt.d.ts +2 -0
- package/dist/components/TextSelectionPrompt.d.ts +2 -0
- package/dist/hooks/page-end.d.ts +1 -0
- package/dist/hooks/proactive-summary.d.ts +1 -0
- package/dist/hooks/response-sound.d.ts +9 -0
- package/dist/hooks/storage.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.min.js +9343 -6663
- package/dist/index.umd.min.cjs +36 -36
- package/dist/lib/client.d.ts +23 -2
- package/dist/lib/copy.d.ts +8 -2
- package/dist/loader.js +46 -0
- package/dist/locales/en.d.ts +127 -0
- package/dist/locales/fr.d.ts +127 -0
- package/dist/locales/index.d.ts +3 -0
- package/dist/releases/1.0.0/akilio-widget.min.js +45 -0
- package/dist/style.css +2334 -151
- package/dist/types.d.ts +554 -20
- package/dist/vanilla.d.ts +1 -0
- package/dist/widget-manifest.json +8 -0
- package/package.json +5 -3
package/dist/types.d.ts
CHANGED
|
@@ -2,15 +2,21 @@ 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' | 'summarize_conversation' | 'contact';
|
|
11
|
+
export type AkilioCapabilitySurface = 'widget' | 'public_api';
|
|
9
12
|
export type AkilioWidgetBranding = 'akilio_required' | 'removable' | 'white_label';
|
|
10
|
-
export type AkilioCommerceCapabilityType = 'product_search' | 'product_recommendation';
|
|
13
|
+
export type AkilioCommerceCapabilityType = 'product_search' | 'product_recommendation' | 'product_comparison' | 'compatibility_check' | 'bundle_building' | 'upsell' | 'cross_sell' | 'shipping_estimate' | 'cart_actions' | (string & {});
|
|
14
|
+
export type AkilioCommerceActionType = 'view_product' | 'compare' | 'add_to_cart';
|
|
15
|
+
export type AkilioCartActionType = 'update_quantity' | 'remove_from_cart' | (string & {});
|
|
11
16
|
export type AkilioCommerceEventType = 'search' | 'recommendation' | 'compare' | 'add_to_cart' | 'checkout' | 'purchase';
|
|
12
17
|
export type AkilioCredentialsMode = 'omit' | 'same-origin' | 'include';
|
|
13
18
|
export type StreamEventType = 'open' | 'close' | 'answer-complete' | 'question' | 'answer-start' | 'answer-delta' | 'error' | 'typing-cancel' | 'draft-change' | 'typing-start' | 'typing-complete' | 'reset' | 'ready';
|
|
19
|
+
export type ConfidentLevel = 'high' | 'medium' | 'low' | 'none';
|
|
14
20
|
export type AkilioTokenProvider = () => string | null | undefined | Promise<string | null | undefined>;
|
|
15
21
|
export interface AkilioIssuedWidgetToken {
|
|
16
22
|
token: string;
|
|
@@ -52,15 +58,94 @@ export interface AkilioThemeConfig {
|
|
|
52
58
|
logo_url?: string;
|
|
53
59
|
brand_name?: string;
|
|
54
60
|
color_mode?: AkilioColorMode;
|
|
61
|
+
launcher_position?: AkilioLauncherPosition;
|
|
55
62
|
}
|
|
56
63
|
export interface AkilioPageContext {
|
|
57
64
|
url?: string;
|
|
58
65
|
title?: string;
|
|
59
|
-
audience?: string;
|
|
60
66
|
productArea?: string;
|
|
61
67
|
channel?: string;
|
|
62
68
|
metadata?: Record<string, unknown>;
|
|
63
69
|
}
|
|
70
|
+
export type AkilioEntrySurface = 'widget_launcher' | 'inline_widget' | 'product_card' | 'product_detail' | 'pricing' | 'cart' | 'checkout' | 'help_center' | 'portal' | 'demo' | 'integration' | 'api';
|
|
71
|
+
export type AkilioEntryTrigger = 'manual_open' | 'inline_cta' | 'section_prompt' | 'text_selection' | 'product_question' | 'plan_question' | 'comparison' | 'cart_question' | 'checkout_help' | 'error_help' | 'proactive_suggestion' | 'external_handoff';
|
|
72
|
+
export type AkilioEntrySubjectType = 'product' | 'product_variant' | 'plan' | 'cart' | 'order' | 'article' | 'faq' | 'knowledge_document' | 'workspace_offering';
|
|
73
|
+
export interface AkilioEntryContext {
|
|
74
|
+
schema_version?: '1.0';
|
|
75
|
+
origin: {
|
|
76
|
+
surface: AkilioEntrySurface;
|
|
77
|
+
trigger: AkilioEntryTrigger;
|
|
78
|
+
};
|
|
79
|
+
page?: {
|
|
80
|
+
url: string;
|
|
81
|
+
title?: string;
|
|
82
|
+
section?: {
|
|
83
|
+
id?: string;
|
|
84
|
+
title?: string;
|
|
85
|
+
anchor?: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
subject?: {
|
|
89
|
+
type: AkilioEntrySubjectType;
|
|
90
|
+
id: string;
|
|
91
|
+
parent_id?: string;
|
|
92
|
+
};
|
|
93
|
+
selection?: {
|
|
94
|
+
text: string;
|
|
95
|
+
start_offset?: number;
|
|
96
|
+
end_offset?: number;
|
|
97
|
+
selector?: string;
|
|
98
|
+
};
|
|
99
|
+
state?: {
|
|
100
|
+
cart_id?: string;
|
|
101
|
+
order_id?: string;
|
|
102
|
+
error_code?: string;
|
|
103
|
+
error_message?: string;
|
|
104
|
+
};
|
|
105
|
+
metadata?: {
|
|
106
|
+
referrer?: string;
|
|
107
|
+
campaign?: string;
|
|
108
|
+
experiment?: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export type AkilioWidgetAnalyticsEventType = 'contextual_entry_impression' | 'contextual_entry_open' | 'contextual_entry_dismissed' | 'contextual_entry_question_submitted' | 'widget_opened' | 'widget_closed' | 'suggestion_clicked';
|
|
112
|
+
export interface AkilioWidgetAnalyticsEvent {
|
|
113
|
+
event_id: string;
|
|
114
|
+
event_type: AkilioWidgetAnalyticsEventType;
|
|
115
|
+
entry_context?: AkilioEntryContext;
|
|
116
|
+
metadata: Record<string, string | undefined>;
|
|
117
|
+
}
|
|
118
|
+
export interface AkilioInlineDecisionSubject {
|
|
119
|
+
type: 'product' | 'product_variant' | 'plan' | 'workspace_offering';
|
|
120
|
+
id: string;
|
|
121
|
+
parent_id?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface AkilioInlineDecisionCardProps {
|
|
124
|
+
title: string;
|
|
125
|
+
description: string;
|
|
126
|
+
subject?: AkilioInlineDecisionSubject;
|
|
127
|
+
page?: AkilioEntryContext['page'];
|
|
128
|
+
primaryQuestion: string;
|
|
129
|
+
followUpQuestions?: string[];
|
|
130
|
+
onStartConversation?: (question: string, entryContext: AkilioEntryContext) => void;
|
|
131
|
+
className?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface AkilioSectionPromptProps {
|
|
134
|
+
sectionTitle: string;
|
|
135
|
+
sectionId?: string;
|
|
136
|
+
question: string;
|
|
137
|
+
page?: AkilioEntryContext['page'];
|
|
138
|
+
onStartConversation?: (question: string, entryContext: AkilioEntryContext) => void;
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface AkilioTextSelectionPromptProps {
|
|
142
|
+
container: HTMLElement | null;
|
|
143
|
+
sectionTitle?: string;
|
|
144
|
+
sectionId?: string;
|
|
145
|
+
minCharacters?: number;
|
|
146
|
+
question: string;
|
|
147
|
+
onStartConversation?: (question: string, entryContext: AkilioEntryContext) => void;
|
|
148
|
+
}
|
|
64
149
|
export interface AkilioSource {
|
|
65
150
|
title?: string | null;
|
|
66
151
|
url?: string | null;
|
|
@@ -77,9 +162,16 @@ export interface AkilioProductVariant {
|
|
|
77
162
|
compare_at_price?: string | null;
|
|
78
163
|
currency?: string;
|
|
79
164
|
inventory_quantity?: number;
|
|
80
|
-
options?:
|
|
165
|
+
options?: {
|
|
166
|
+
Size?: string;
|
|
167
|
+
};
|
|
81
168
|
available: boolean;
|
|
82
169
|
}
|
|
170
|
+
export interface AkilioProductAttribute {
|
|
171
|
+
key: string;
|
|
172
|
+
label: string;
|
|
173
|
+
value: string;
|
|
174
|
+
}
|
|
83
175
|
export interface AkilioProduct {
|
|
84
176
|
id: string;
|
|
85
177
|
external_id: string;
|
|
@@ -89,15 +181,53 @@ export interface AkilioProduct {
|
|
|
89
181
|
product_type?: string;
|
|
90
182
|
url?: string;
|
|
91
183
|
image_url?: string;
|
|
92
|
-
tags?:
|
|
93
|
-
attributes?:
|
|
94
|
-
available:
|
|
184
|
+
tags?: string[];
|
|
185
|
+
attributes?: AkilioProductAttribute[];
|
|
186
|
+
available: boolean;
|
|
95
187
|
variants: AkilioProductVariant[];
|
|
96
|
-
business_rule_decision?:
|
|
188
|
+
business_rule_decision?: {
|
|
189
|
+
allowed: boolean;
|
|
190
|
+
score_adjustment: number;
|
|
191
|
+
reasons: string[];
|
|
192
|
+
required_product_ids: string[];
|
|
193
|
+
};
|
|
194
|
+
search_relevance?: number;
|
|
97
195
|
}
|
|
98
196
|
export interface AkilioCommerceCapability {
|
|
99
197
|
capability: AkilioCommerceCapabilityType;
|
|
100
198
|
products: AkilioProduct[];
|
|
199
|
+
suggestedProducts?: AkilioProduct[];
|
|
200
|
+
actions?: AkilioCommercePublicAction[];
|
|
201
|
+
/** Controls the presentation of a trusted product-detail response. */
|
|
202
|
+
display?: 'list' | 'detail';
|
|
203
|
+
}
|
|
204
|
+
export interface AkilioCommercePublicAction {
|
|
205
|
+
type: AkilioCommerceActionType;
|
|
206
|
+
product_id?: string;
|
|
207
|
+
variant_id?: string;
|
|
208
|
+
label_key?: string;
|
|
209
|
+
label_parameters?: Record<string, string>;
|
|
210
|
+
requires_confirmation?: boolean;
|
|
211
|
+
confirmation?: {
|
|
212
|
+
capability_id: string;
|
|
213
|
+
request_endpoint: string;
|
|
214
|
+
approve_endpoint_template: string;
|
|
215
|
+
execution_endpoint: string;
|
|
216
|
+
payload: {
|
|
217
|
+
items: {
|
|
218
|
+
variant_id: string;
|
|
219
|
+
quantity: number;
|
|
220
|
+
}[];
|
|
221
|
+
};
|
|
222
|
+
idempotency_key_required?: boolean;
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/** OpenAPI `CommercePublicResponse`; its product/action payloads are extensible. */
|
|
226
|
+
export interface AkilioCommercePublicResponse {
|
|
227
|
+
capability: AkilioCommerceCapabilityType;
|
|
228
|
+
products: AkilioProduct[];
|
|
229
|
+
suggested_products?: AkilioProduct[];
|
|
230
|
+
actions?: AkilioCommercePublicAction[];
|
|
101
231
|
}
|
|
102
232
|
export interface AkilioCommerceEvent {
|
|
103
233
|
event_type: AkilioCommerceEventType;
|
|
@@ -109,6 +239,83 @@ export interface AkilioCommerceEvent {
|
|
|
109
239
|
currency?: string;
|
|
110
240
|
metadata?: Record<string, unknown>;
|
|
111
241
|
}
|
|
242
|
+
/** Compact cart summary returned alongside a chat response. */
|
|
243
|
+
export interface AkilioCartState {
|
|
244
|
+
id: string;
|
|
245
|
+
provider_cart_id: string;
|
|
246
|
+
provider: string;
|
|
247
|
+
status: string;
|
|
248
|
+
item_count: number;
|
|
249
|
+
updated_at: string;
|
|
250
|
+
}
|
|
251
|
+
export interface AkilioCartLine {
|
|
252
|
+
id: string;
|
|
253
|
+
line_id: string;
|
|
254
|
+
product_id?: string | null;
|
|
255
|
+
/** Product snapshot returned with the cart line, when available. */
|
|
256
|
+
product?: {
|
|
257
|
+
id: string;
|
|
258
|
+
title: string;
|
|
259
|
+
vendor?: string | null;
|
|
260
|
+
image_url?: string | null;
|
|
261
|
+
url?: string | null;
|
|
262
|
+
} | null;
|
|
263
|
+
/** Variant snapshot returned with the cart line, when available. */
|
|
264
|
+
variant?: {
|
|
265
|
+
id: string;
|
|
266
|
+
title?: string | null;
|
|
267
|
+
sku?: string | null;
|
|
268
|
+
options?: Record<string, string> | null;
|
|
269
|
+
} | null;
|
|
270
|
+
variant_id?: string | null;
|
|
271
|
+
title: string;
|
|
272
|
+
quantity: number;
|
|
273
|
+
price: string;
|
|
274
|
+
currency: string;
|
|
275
|
+
/** Provider-approved actions appropriate for this cart's current state. */
|
|
276
|
+
actions?: AkilioCartAction[];
|
|
277
|
+
}
|
|
278
|
+
export interface AkilioCartCheckout {
|
|
279
|
+
mode: 'provider' | 'internal' | 'external_redirect' | string;
|
|
280
|
+
status: string;
|
|
281
|
+
next_action?: {
|
|
282
|
+
type: 'contact_request' | 'external_redirect' | string;
|
|
283
|
+
url?: string;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* A widget-safe action supplied with the current cart. Cart actions are
|
|
288
|
+
* intentionally independent from chat product actions: they may not target a
|
|
289
|
+
* product and their destination is supplied by the cart provider.
|
|
290
|
+
*/
|
|
291
|
+
export interface AkilioCartAction {
|
|
292
|
+
id?: string;
|
|
293
|
+
type: AkilioCartActionType;
|
|
294
|
+
label?: string;
|
|
295
|
+
label_key?: string;
|
|
296
|
+
label_parameters?: Record<string, string>;
|
|
297
|
+
requires_confirmation?: boolean;
|
|
298
|
+
confirmation?: {
|
|
299
|
+
capability_id: string;
|
|
300
|
+
request_endpoint: string;
|
|
301
|
+
approve_endpoint_template: string;
|
|
302
|
+
execution_endpoint: string;
|
|
303
|
+
payload: Record<string, unknown>;
|
|
304
|
+
idempotency_key_required?: boolean;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
export interface AkilioCart {
|
|
308
|
+
id: string;
|
|
309
|
+
provider: string;
|
|
310
|
+
provider_cart_id: string;
|
|
311
|
+
checkout_url?: string;
|
|
312
|
+
checkout: AkilioCartCheckout;
|
|
313
|
+
status: 'active' | 'checkout_started' | 'completed' | 'expired' | string;
|
|
314
|
+
lines: AkilioCartLine[];
|
|
315
|
+
}
|
|
316
|
+
export interface AkilioCurrentCartResponse {
|
|
317
|
+
cart: AkilioCart | null;
|
|
318
|
+
}
|
|
112
319
|
export interface AkilioProjectConfig {
|
|
113
320
|
project_key: string;
|
|
114
321
|
name: string;
|
|
@@ -116,14 +323,105 @@ export interface AkilioProjectConfig {
|
|
|
116
323
|
title: string;
|
|
117
324
|
placeholder: string;
|
|
118
325
|
starter_questions: string[];
|
|
326
|
+
welcome_message?: string;
|
|
119
327
|
theme_config: AkilioThemeConfig;
|
|
120
328
|
default_language: string;
|
|
121
329
|
supported_languages: string[];
|
|
122
330
|
widget_policy?: AkilioWidgetPolicy;
|
|
331
|
+
capabilities?: AkilioPublicRuntimeCapabilities;
|
|
123
332
|
privacy_notice?: string;
|
|
124
333
|
privacy_notice_url?: string;
|
|
125
334
|
require_consent?: boolean;
|
|
126
335
|
}
|
|
336
|
+
export interface AkilioChatIntentCapability {
|
|
337
|
+
code: AkilioChatIntent | string;
|
|
338
|
+
enabled: boolean;
|
|
339
|
+
requirements: string[];
|
|
340
|
+
surfaces: AkilioCapabilitySurface[];
|
|
341
|
+
}
|
|
342
|
+
export interface AkilioChatIntentCatalog {
|
|
343
|
+
intents_schema_version: string;
|
|
344
|
+
default_intent: AkilioChatIntent | string;
|
|
345
|
+
intents: AkilioChatIntentCapability[];
|
|
346
|
+
contact_request?: AkilioContactRequestCapability;
|
|
347
|
+
}
|
|
348
|
+
export interface AkilioContactRequestCapability {
|
|
349
|
+
enabled: boolean;
|
|
350
|
+
endpoint: string;
|
|
351
|
+
method: string;
|
|
352
|
+
consent_required: boolean;
|
|
353
|
+
consent_text: string;
|
|
354
|
+
required_fields: string[];
|
|
355
|
+
}
|
|
356
|
+
export type AkilioQuickActionType = 'email' | 'phone' | 'form';
|
|
357
|
+
export interface AkilioQuickActionOption {
|
|
358
|
+
type: AkilioQuickActionType;
|
|
359
|
+
label: string;
|
|
360
|
+
value?: string;
|
|
361
|
+
url: string;
|
|
362
|
+
}
|
|
363
|
+
export type AkilioCustomerActionType = 'start_contact_request' | 'start_human_handoff';
|
|
364
|
+
export interface AkilioCustomerAction {
|
|
365
|
+
type: AkilioCustomerActionType;
|
|
366
|
+
label: string;
|
|
367
|
+
prompt: string;
|
|
368
|
+
endpoint: string;
|
|
369
|
+
method: string;
|
|
370
|
+
requires_confirmation: boolean;
|
|
371
|
+
confirmation_mode?: 'form_consent' | string;
|
|
372
|
+
fields: string[];
|
|
373
|
+
quickActions?: AkilioQuickActionOption[];
|
|
374
|
+
}
|
|
375
|
+
export interface AkilioProactiveAction {
|
|
376
|
+
type: 'summarize_conversation' | string;
|
|
377
|
+
label?: string;
|
|
378
|
+
intent: 'summarize_conversation' | string;
|
|
379
|
+
message?: string;
|
|
380
|
+
}
|
|
381
|
+
export type AkilioContextRelation = 'initial' | 'continuation' | 'new_topic' | 'explicit_reset';
|
|
382
|
+
export interface AkilioMarketContext {
|
|
383
|
+
scope_type: string;
|
|
384
|
+
code?: string;
|
|
385
|
+
name?: string;
|
|
386
|
+
parent_code?: string;
|
|
387
|
+
source?: string;
|
|
388
|
+
confidence?: number;
|
|
389
|
+
approximate?: boolean;
|
|
390
|
+
}
|
|
391
|
+
export interface AkilioChatHumanEscalation {
|
|
392
|
+
id: string;
|
|
393
|
+
status?: string;
|
|
394
|
+
reason: 'customer_request' | 'insufficient_evidence' | 'sensitive_question' | 'invalid_citation' | 'policy_review';
|
|
395
|
+
}
|
|
396
|
+
export type AkilioPreferredContactMethod = 'email' | 'phone' | 'either';
|
|
397
|
+
export interface AkilioContactRequest {
|
|
398
|
+
conversation_id: string;
|
|
399
|
+
source_message_id: string;
|
|
400
|
+
name?: string;
|
|
401
|
+
email?: string;
|
|
402
|
+
phone?: string;
|
|
403
|
+
preferred_contact_method: AkilioPreferredContactMethod;
|
|
404
|
+
preferred_contact_time?: string;
|
|
405
|
+
message: string;
|
|
406
|
+
consent_given: boolean;
|
|
407
|
+
website?: string;
|
|
408
|
+
}
|
|
409
|
+
export interface AkilioContactRequestResponse {
|
|
410
|
+
id: string;
|
|
411
|
+
status?: string;
|
|
412
|
+
created_at: string;
|
|
413
|
+
handoff: AkilioHumanHandoff;
|
|
414
|
+
}
|
|
415
|
+
export type AkilioHumanHandoffStatus = 'queued' | 'delivering' | 'delivered' | 'failed' | 'cancelled';
|
|
416
|
+
/** Browser-safe status returned by the server-owned human-handoff workflow. */
|
|
417
|
+
export interface AkilioHumanHandoff {
|
|
418
|
+
id: string;
|
|
419
|
+
status: AkilioHumanHandoffStatus;
|
|
420
|
+
created_at: string;
|
|
421
|
+
}
|
|
422
|
+
export interface AkilioPublicRuntimeCapabilities {
|
|
423
|
+
chat: AkilioChatIntentCatalog;
|
|
424
|
+
}
|
|
127
425
|
export interface AkilioWidgetPolicy {
|
|
128
426
|
/** Whether the widget may currently accept user interactions. */
|
|
129
427
|
available: boolean;
|
|
@@ -137,10 +435,15 @@ export interface AkilioWidgetPolicy {
|
|
|
137
435
|
export interface AkilioChatRequest {
|
|
138
436
|
project_key: string;
|
|
139
437
|
conversation_id?: string;
|
|
438
|
+
context_id?: string;
|
|
439
|
+
reset_context?: boolean;
|
|
440
|
+
capability_confirmation_id?: string;
|
|
441
|
+
clarification_response?: AkilioClarificationResponse;
|
|
140
442
|
message: string;
|
|
443
|
+
/** Explicit action selected from the public config capability catalog. */
|
|
444
|
+
intent?: AkilioChatIntent;
|
|
141
445
|
locale?: string;
|
|
142
446
|
channel?: string;
|
|
143
|
-
audience?: string;
|
|
144
447
|
product_area?: string;
|
|
145
448
|
assistant_mode?: AkilioAssistantMode | null;
|
|
146
449
|
page?: {
|
|
@@ -148,6 +451,7 @@ export interface AkilioChatRequest {
|
|
|
148
451
|
title?: string;
|
|
149
452
|
[key: string]: unknown;
|
|
150
453
|
};
|
|
454
|
+
entry_context?: AkilioEntryContext;
|
|
151
455
|
anonymous_id?: string;
|
|
152
456
|
external_user_id?: string;
|
|
153
457
|
consent?: {
|
|
@@ -160,24 +464,102 @@ export interface AkilioWidgetTokenResponse {
|
|
|
160
464
|
token: string;
|
|
161
465
|
token_type?: string;
|
|
162
466
|
expires_in: number;
|
|
467
|
+
continuation_token?: string;
|
|
468
|
+
continuation_expires_in?: number;
|
|
469
|
+
}
|
|
470
|
+
export interface AkilioCapability {
|
|
471
|
+
id: string;
|
|
472
|
+
code?: string;
|
|
473
|
+
name?: string;
|
|
474
|
+
input_schema?: Record<string, unknown>;
|
|
475
|
+
output_schema?: Record<string, unknown>;
|
|
476
|
+
requires_confirmation?: boolean;
|
|
477
|
+
risk_level?: string;
|
|
478
|
+
provider?: string;
|
|
479
|
+
executable?: boolean;
|
|
480
|
+
}
|
|
481
|
+
export interface AkilioCapabilityConfirmation {
|
|
482
|
+
id: string;
|
|
483
|
+
capability_id: string;
|
|
484
|
+
expires_at?: string;
|
|
485
|
+
action?: string;
|
|
486
|
+
}
|
|
487
|
+
export interface AkilioCustomerServiceToolResponse {
|
|
488
|
+
tool_id: string;
|
|
489
|
+
result: unknown;
|
|
490
|
+
}
|
|
491
|
+
export interface AkilioAgentTool {
|
|
492
|
+
tool_id: string;
|
|
493
|
+
requires_confirmation?: boolean;
|
|
494
|
+
action?: 'confirm_human_request' | 'start_contact_request' | string;
|
|
495
|
+
payload?: Record<string, unknown>;
|
|
496
|
+
result?: {
|
|
497
|
+
escalation_id?: string;
|
|
498
|
+
[key: string]: unknown;
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
export interface AkilioIntentDecision {
|
|
502
|
+
schema_version?: string;
|
|
503
|
+
intent_id?: string;
|
|
504
|
+
confidence?: number;
|
|
505
|
+
source?: string;
|
|
506
|
+
reason?: string;
|
|
507
|
+
entities?: Record<string, unknown>;
|
|
508
|
+
clarification?: AkilioClarification | null;
|
|
509
|
+
}
|
|
510
|
+
export interface AkilioClarificationOption {
|
|
511
|
+
value: string;
|
|
512
|
+
label: string;
|
|
513
|
+
}
|
|
514
|
+
export interface AkilioClarificationField {
|
|
515
|
+
key: string;
|
|
516
|
+
label: string;
|
|
517
|
+
type: 'text' | 'email' | 'tel' | 'number' | 'select' | string;
|
|
518
|
+
required: boolean;
|
|
519
|
+
options?: AkilioClarificationOption[];
|
|
520
|
+
}
|
|
521
|
+
export interface AkilioClarification {
|
|
522
|
+
question: string;
|
|
523
|
+
submission_template: string;
|
|
524
|
+
reason?: string;
|
|
525
|
+
missing_entities?: string[];
|
|
526
|
+
fields?: AkilioClarificationField[];
|
|
527
|
+
options?: AkilioClarificationOption[];
|
|
528
|
+
}
|
|
529
|
+
export interface AkilioClarificationResponse {
|
|
530
|
+
source_message_id: string;
|
|
531
|
+
values: Record<string, string>;
|
|
163
532
|
}
|
|
164
533
|
export interface AkilioChatResponse {
|
|
165
534
|
schema_version?: string;
|
|
166
535
|
conversation_id: string;
|
|
536
|
+
context_id: string;
|
|
537
|
+
context_relation: AkilioContextRelation;
|
|
538
|
+
context_changed: boolean;
|
|
167
539
|
message_id: string;
|
|
168
|
-
response_type
|
|
169
|
-
|
|
540
|
+
response_type: string;
|
|
541
|
+
/** Canonical response body. Use markdown for the rich widget surface. */
|
|
542
|
+
content: {
|
|
543
|
+
plain_text: string;
|
|
544
|
+
markdown: string;
|
|
545
|
+
};
|
|
546
|
+
/** @deprecated Compatibility field. The widget renders `content` instead. */
|
|
170
547
|
answer?: string;
|
|
171
|
-
confidence?:
|
|
172
|
-
sources
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
cost_usd?: string;
|
|
176
|
-
commerce?: AkilioCommerceCapability | null;
|
|
548
|
+
confidence?: ConfidentLevel;
|
|
549
|
+
sources?: AkilioSource[];
|
|
550
|
+
commerce?: AkilioCommercePublicResponse | null;
|
|
551
|
+
cart_state?: AkilioCartState | null;
|
|
177
552
|
suggestions?: string[];
|
|
553
|
+
intent?: AkilioChatIntent;
|
|
178
554
|
warnings?: string[];
|
|
179
|
-
|
|
180
|
-
|
|
555
|
+
effective_market?: AkilioMarketContext | null;
|
|
556
|
+
grounded?: boolean;
|
|
557
|
+
refused?: boolean;
|
|
558
|
+
escalation?: AkilioChatHumanEscalation | null;
|
|
559
|
+
actions?: AkilioCustomerAction[];
|
|
560
|
+
proactive_actions?: AkilioProactiveAction[];
|
|
561
|
+
agent_tool?: Record<string, unknown> | null;
|
|
562
|
+
intent_decision?: AkilioIntentDecision;
|
|
181
563
|
}
|
|
182
564
|
export type AkilioStreamEventName = 'status' | 'conversation' | 'answer.delta' | 'final' | 'error' | 'done';
|
|
183
565
|
export interface AkilioStreamEvent {
|
|
@@ -216,6 +598,7 @@ export interface AkilioPublicApi {
|
|
|
216
598
|
cancelTyping(): void;
|
|
217
599
|
submit(): Promise<AkilioChatResponse>;
|
|
218
600
|
ask(text: string, options?: AkilioDraftOptions): Promise<AkilioChatResponse>;
|
|
601
|
+
startConversation(text: string, entryContext: AkilioEntryContext): Promise<AkilioChatResponse>;
|
|
219
602
|
reset(): Promise<void>;
|
|
220
603
|
getState(): AkilioPublicState;
|
|
221
604
|
}
|
|
@@ -233,7 +616,7 @@ export interface AkilioConversationMessageResponse {
|
|
|
233
616
|
role: AkilioMessageRole;
|
|
234
617
|
content: string;
|
|
235
618
|
sources?: AkilioSource[];
|
|
236
|
-
confidence?:
|
|
619
|
+
confidence?: ConfidentLevel;
|
|
237
620
|
metadata?: Record<string, unknown>;
|
|
238
621
|
structured_content?: string;
|
|
239
622
|
created_at: string;
|
|
@@ -260,11 +643,16 @@ export interface AkilioChatMessage {
|
|
|
260
643
|
model?: string;
|
|
261
644
|
costUsd?: string;
|
|
262
645
|
commerce?: AkilioCommerceCapability | null;
|
|
646
|
+
agentTool?: AkilioAgentTool | null;
|
|
647
|
+
clarification?: AkilioClarification | null;
|
|
263
648
|
suggestions?: string[];
|
|
264
649
|
/** True while answer deltas are still arriving. */
|
|
265
650
|
streaming?: boolean;
|
|
266
651
|
error?: boolean;
|
|
267
652
|
feedback?: AkilioFeedbackRating;
|
|
653
|
+
actions?: AkilioCustomerAction[];
|
|
654
|
+
proactiveActions?: AkilioProactiveAction[];
|
|
655
|
+
intentDecision?: AkilioIntentDecision;
|
|
268
656
|
}
|
|
269
657
|
export interface AkilioCopyOverrides {
|
|
270
658
|
launcher?: string;
|
|
@@ -286,6 +674,39 @@ export interface AkilioCopyOverrides {
|
|
|
286
674
|
online?: string;
|
|
287
675
|
feedbackQuestion?: string;
|
|
288
676
|
feedbackThanks?: string;
|
|
677
|
+
feedbackSending?: string;
|
|
678
|
+
contextualPlaceholder?: string;
|
|
679
|
+
contextualDismiss?: string;
|
|
680
|
+
contact?: string;
|
|
681
|
+
contactName?: string;
|
|
682
|
+
contactEmail?: string;
|
|
683
|
+
contactPhone?: string;
|
|
684
|
+
contactMethod?: string;
|
|
685
|
+
contactMethodEmail?: string;
|
|
686
|
+
contactMethodPhone?: string;
|
|
687
|
+
contactMethodEither?: string;
|
|
688
|
+
contactTime?: string;
|
|
689
|
+
contactMessage?: string;
|
|
690
|
+
contactConsent?: string;
|
|
691
|
+
contactSubmit?: string;
|
|
692
|
+
contactSending?: string;
|
|
693
|
+
contactSuccess?: string;
|
|
694
|
+
handoffQueued?: string;
|
|
695
|
+
handoffDelivering?: string;
|
|
696
|
+
handoffDelivered?: string;
|
|
697
|
+
handoffFailed?: string;
|
|
698
|
+
handoffCancelled?: string;
|
|
699
|
+
contactFailed?: string;
|
|
700
|
+
humanRequestTitle?: string;
|
|
701
|
+
humanRequestDescription?: string;
|
|
702
|
+
humanRequestConsequences?: string;
|
|
703
|
+
humanRequestConfirm?: string;
|
|
704
|
+
humanRequestCancel?: string;
|
|
705
|
+
humanRequestSending?: string;
|
|
706
|
+
humanRequestFailed?: string;
|
|
707
|
+
humanRequestSuccess?: string;
|
|
708
|
+
clarificationNeeded?: string;
|
|
709
|
+
clarificationSubmit?: string;
|
|
289
710
|
voteUp?: string;
|
|
290
711
|
voteDown?: string;
|
|
291
712
|
requestFailed?: string;
|
|
@@ -304,15 +725,52 @@ export interface AkilioCopyOverrides {
|
|
|
304
725
|
tourMessage?: string;
|
|
305
726
|
tourAction?: string;
|
|
306
727
|
tourDismiss?: string;
|
|
728
|
+
summarizePage?: string;
|
|
729
|
+
summarizeConversation?: string;
|
|
730
|
+
proactiveSummaryTitle?: string;
|
|
731
|
+
proactiveSummaryMessage?: string;
|
|
732
|
+
proactiveSummaryDismiss?: string;
|
|
307
733
|
privacyDefaultNotice?: string;
|
|
308
734
|
switchToLightMode?: string;
|
|
309
735
|
switchToDarkMode?: string;
|
|
310
736
|
products?: string;
|
|
737
|
+
suggestedProducts?: string;
|
|
738
|
+
matchedProducts?: string;
|
|
739
|
+
productRecommendations?: string;
|
|
740
|
+
productComparison?: string;
|
|
741
|
+
compatibleProducts?: string;
|
|
742
|
+
bundleProducts?: string;
|
|
743
|
+
upgradeOptions?: string;
|
|
744
|
+
complementaryProducts?: string;
|
|
745
|
+
commerceActionConfirm?: string;
|
|
746
|
+
commerceActionCancel?: string;
|
|
747
|
+
commerceActionWorking?: string;
|
|
748
|
+
commerceActionComplete?: string;
|
|
749
|
+
commerceActionFailed?: string;
|
|
750
|
+
addToCart?: string;
|
|
751
|
+
compareProduct?: string;
|
|
752
|
+
updateQuantity?: string;
|
|
753
|
+
removeFromCart?: string;
|
|
754
|
+
cart?: string;
|
|
755
|
+
cartEmpty?: string;
|
|
756
|
+
cartItems?: string;
|
|
757
|
+
checkout?: string;
|
|
758
|
+
cartUnavailable?: string;
|
|
759
|
+
refreshCart?: string;
|
|
311
760
|
viewProduct?: string;
|
|
312
761
|
fromPrice?: string;
|
|
313
762
|
unavailable?: string;
|
|
314
763
|
inStock?: string;
|
|
315
764
|
outOfStock?: string;
|
|
765
|
+
rateLimited?: string;
|
|
766
|
+
launcherAnswerReady?: string;
|
|
767
|
+
launcherContact?: string;
|
|
768
|
+
launcherPageHelp?: string;
|
|
769
|
+
launcherProductHelp?: string;
|
|
770
|
+
launcherPlanHelp?: string;
|
|
771
|
+
productDetails?: string;
|
|
772
|
+
productVariants?: string;
|
|
773
|
+
productSpecifications?: string;
|
|
316
774
|
}
|
|
317
775
|
export interface AkilioLauncherRenderProps {
|
|
318
776
|
open: boolean;
|
|
@@ -321,12 +779,54 @@ export interface AkilioLauncherRenderProps {
|
|
|
321
779
|
toggleChat: () => void;
|
|
322
780
|
}
|
|
323
781
|
export type AkilioLauncher = 'default' | 'hidden' | ((controls: AkilioLauncherRenderProps) => ReactNode);
|
|
782
|
+
/** Visual behaviour for the built-in launcher. */
|
|
783
|
+
export type AkilioLauncherExperience = 'adaptive' | 'static';
|
|
324
784
|
export type AkilioStyleIsolation = 'shadow' | 'scoped' | 'none';
|
|
785
|
+
export interface AkilioContextualPromptOptions {
|
|
786
|
+
enabled?: boolean;
|
|
787
|
+
trigger?: 'near-page-end';
|
|
788
|
+
/** Distance from the document end that reveals the prompt. Defaults to 320px. */
|
|
789
|
+
threshold?: number;
|
|
790
|
+
placeholder?: string;
|
|
791
|
+
dismissible?: boolean;
|
|
792
|
+
}
|
|
793
|
+
export interface AkilioProactiveSummaryOptions {
|
|
794
|
+
enabled?: boolean;
|
|
795
|
+
/** Score required to show the prompt. Defaults to 4. */
|
|
796
|
+
threshold?: number;
|
|
797
|
+
/** Change this value when page content changes and the prompt should reappear. */
|
|
798
|
+
version?: string;
|
|
799
|
+
}
|
|
325
800
|
export type IntegrationType = 'shopify' | 'woocommerce' | 'wordpress' | 'prestashop' | 'magento' | 'wix' | 'webflow' | 'squarespace' | 'nextjs' | 'react' | 'vue' | 'angular' | 'vanilla' | 'unknown';
|
|
801
|
+
/** Complete dictionary: TypeScript reports missing keys when adding built-in languages. */
|
|
802
|
+
export interface AkilioLanguagePack {
|
|
803
|
+
direction: 'ltr' | 'rtl';
|
|
804
|
+
messages: Required<AkilioCopyOverrides> & {
|
|
805
|
+
suggestions: string[];
|
|
806
|
+
};
|
|
807
|
+
whiteLabel: Pick<Required<AkilioCopyOverrides>, 'launcher' | 'title' | 'configFailed'>;
|
|
808
|
+
}
|
|
809
|
+
/** Partial dictionaries inherit missing strings from their parent locale, then English. */
|
|
810
|
+
export interface AkilioLanguagePackOverrides {
|
|
811
|
+
direction?: 'ltr' | 'rtl';
|
|
812
|
+
messages?: AkilioCopyOverrides & {
|
|
813
|
+
suggestions?: string[];
|
|
814
|
+
};
|
|
815
|
+
whiteLabel?: Partial<AkilioLanguagePack['whiteLabel']>;
|
|
816
|
+
}
|
|
817
|
+
export type AkilioTranslations = Record<string, AkilioLanguagePackOverrides>;
|
|
326
818
|
export interface AkilioWidgetProps {
|
|
819
|
+
/** Business display name; copy.title takes precedence. */
|
|
820
|
+
agentName?: string;
|
|
821
|
+
/** Introductory text shown before the first message. */
|
|
822
|
+
welcomeMessage?: string;
|
|
823
|
+
/** Initial prompts. An empty list hides prompts; capability actions remain available. */
|
|
824
|
+
starterPrompts?: string[];
|
|
327
825
|
apiBaseUrl?: string;
|
|
328
826
|
projectKey: string;
|
|
329
827
|
locale?: AkilioLocale;
|
|
828
|
+
/** Per-widget language dictionaries, also accepted by Akilio.mount(). */
|
|
829
|
+
translations?: AkilioTranslations;
|
|
330
830
|
mode?: AkilioMode;
|
|
331
831
|
colorMode?: AkilioColorMode;
|
|
332
832
|
/** Show a header control that lets visitors override the configured/system theme. */
|
|
@@ -338,6 +838,10 @@ export interface AkilioWidgetProps {
|
|
|
338
838
|
showAkilioBranding?: boolean;
|
|
339
839
|
/** Use the authenticated SSE chat endpoint. Set false for synchronous compatibility. */
|
|
340
840
|
streaming?: boolean;
|
|
841
|
+
/** Play a short notification chime after a successful final response. */
|
|
842
|
+
enableResponseSound?: boolean;
|
|
843
|
+
/** Notification volume from 0 to 1. Defaults to 0.22. */
|
|
844
|
+
responseSoundVolume?: number;
|
|
341
845
|
/** Isolate widget CSS from the host page. Shadow DOM is the safest default. */
|
|
342
846
|
styleIsolation?: AkilioStyleIsolation;
|
|
343
847
|
defaultOpen?: boolean;
|
|
@@ -345,6 +849,14 @@ export interface AkilioWidgetProps {
|
|
|
345
849
|
open?: boolean;
|
|
346
850
|
/** Built-in launcher, no launcher, or a custom React launcher renderer. */
|
|
347
851
|
launcher?: AkilioLauncher;
|
|
852
|
+
/** Position of the built-in launcher. right-middle opens a desktop drawer. */
|
|
853
|
+
launcherPosition?: AkilioLauncherPosition;
|
|
854
|
+
/** Use the adaptive Akilio launcher or retain the original static capsule. */
|
|
855
|
+
launcherExperience?: AkilioLauncherExperience;
|
|
856
|
+
/** Show a question prompt as the reader approaches the end of the page. */
|
|
857
|
+
contextualPrompt?: boolean | AkilioContextualPromptOptions;
|
|
858
|
+
/** Offer a one-click page summary when the visitor shows meaningful reading intent. */
|
|
859
|
+
proactiveSummary?: boolean | AkilioProactiveSummaryOptions;
|
|
348
860
|
persistOpenState?: boolean;
|
|
349
861
|
/** Show a one-time, dependency-free coachmark beside the default launcher. */
|
|
350
862
|
enableTour?: boolean;
|
|
@@ -357,11 +869,12 @@ export interface AkilioWidgetProps {
|
|
|
357
869
|
anonymousId?: string;
|
|
358
870
|
externalUserId?: string;
|
|
359
871
|
channel?: string;
|
|
360
|
-
audience?: string;
|
|
361
872
|
productArea?: string;
|
|
362
873
|
/** Optional routing hint sent to the chat endpoint as assistant_mode. */
|
|
363
874
|
assistantMode?: AkilioAssistantMode;
|
|
364
875
|
pageContext?: AkilioPageContext | (() => AkilioPageContext);
|
|
876
|
+
/** Context supplied when this widget instance is opened from a decision surface. */
|
|
877
|
+
entryContext?: AkilioEntryContext;
|
|
365
878
|
auth?: AkilioAuthConfig;
|
|
366
879
|
/** Convenience alias for auth.accessToken. */
|
|
367
880
|
accessToken?: string;
|
|
@@ -381,6 +894,7 @@ export interface AkilioWidgetProps {
|
|
|
381
894
|
integration?: IntegrationType;
|
|
382
895
|
}
|
|
383
896
|
export interface ChatPanelProps {
|
|
897
|
+
panelId: string;
|
|
384
898
|
open: boolean;
|
|
385
899
|
isDesktop: boolean;
|
|
386
900
|
inline: boolean;
|
|
@@ -388,10 +902,12 @@ export interface ChatPanelProps {
|
|
|
388
902
|
allowColorModeToggle: boolean;
|
|
389
903
|
widgetAvailable: boolean;
|
|
390
904
|
showBranding: boolean;
|
|
905
|
+
businessLogo?: string;
|
|
391
906
|
showPoweredBy: boolean;
|
|
392
907
|
copy: AkilioResolvedCopy;
|
|
393
908
|
locale: string;
|
|
394
909
|
messages: AkilioChatMessage[];
|
|
910
|
+
feedbackPending: Record<string, AkilioFeedbackRating | undefined>;
|
|
395
911
|
streamingMessage?: AkilioChatMessage | null;
|
|
396
912
|
loading: boolean;
|
|
397
913
|
loadingLabel?: string;
|
|
@@ -407,9 +923,27 @@ export interface ChatPanelProps {
|
|
|
407
923
|
onSubmit: (query: string) => Promise<AkilioChatResponse>;
|
|
408
924
|
onDraftChange?: (draft: string, manual: boolean) => void;
|
|
409
925
|
onFeedback: (message: AkilioChatMessage, rating: AkilioFeedbackRating) => void;
|
|
926
|
+
contactRequestCapability?: AkilioContactRequestCapability;
|
|
927
|
+
onContactRequest: (request: AkilioContactRequest, actionType: AkilioCustomerActionType) => Promise<AkilioContactRequestResponse>;
|
|
928
|
+
onConfirmHumanRequest: (message: AkilioChatMessage, tool: AkilioAgentTool, request: AkilioContactRequest) => Promise<void>;
|
|
929
|
+
onClarificationSubmit: (message: AkilioChatMessage, values: Record<string, string>, submission: string) => Promise<void>;
|
|
410
930
|
onSuggestion: (suggestion: string) => void;
|
|
931
|
+
onProactiveAction: (action: AkilioProactiveAction) => void;
|
|
932
|
+
/** Resolved starter prompts for the empty chat state. */
|
|
933
|
+
starterQuestions?: string[];
|
|
934
|
+
intentActions?: Array<{
|
|
935
|
+
intent: AkilioChatIntent;
|
|
936
|
+
label: string;
|
|
937
|
+
}>;
|
|
938
|
+
onIntentAction: (intent: AkilioChatIntent, label: string) => void;
|
|
411
939
|
onProductClick: (message: AkilioChatMessage, product: AkilioProduct, variant?: AkilioProductVariant) => void;
|
|
940
|
+
onCommerceAction: (message: AkilioChatMessage, action: AkilioCommercePublicAction) => Promise<void>;
|
|
412
941
|
primaryColor?: string;
|
|
942
|
+
slug?: string;
|
|
943
|
+
cart: AkilioCart | null;
|
|
944
|
+
cartLoading?: boolean;
|
|
945
|
+
onRefreshCart: () => void;
|
|
946
|
+
onCartAction: (line: AkilioCartLine, action: AkilioCartAction, quantity?: number) => Promise<void>;
|
|
413
947
|
}
|
|
414
948
|
export type IntegrationDetection = {
|
|
415
949
|
integration: IntegrationType;
|