@hachther/akilio-widget 0.7.0 → 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 +281 -26
- package/dist/_headers +16 -0
- package/dist/akilio-widget.min.js +43 -43
- 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 +6 -1
- package/dist/components/ContactActions.d.ts +2 -2
- package/dist/components/EmptyState.d.ts +3 -7
- package/dist/components/Icons.d.ts +1 -0
- package/dist/components/InlineDecisionCard.d.ts +2 -0
- package/dist/components/Launcher.d.ts +6 -1
- package/dist/components/MessageBubble.d.ts +8 -2
- 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/proactive-summary.d.ts +1 -0
- package/dist/hooks/storage.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.min.js +9286 -7073
- package/dist/index.umd.min.cjs +36 -36
- package/dist/lib/client.d.ts +22 -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 +1744 -88
- package/dist/types.d.ts +451 -29
- 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
|
@@ -7,13 +7,16 @@ export type AkilioLocale = string;
|
|
|
7
7
|
export type AkilioMessageRole = 'user' | 'assistant';
|
|
8
8
|
export type AkilioFeedbackRating = 'up' | 'down';
|
|
9
9
|
export type AkilioAssistantMode = 'auto' | 'general' | 'knowledge' | 'ecommerce' | 'hybrid';
|
|
10
|
-
export type AkilioChatIntent = 'answer' | 'summarize_page' | 'contact';
|
|
10
|
+
export type AkilioChatIntent = 'answer' | 'summarize_page' | 'summarize_conversation' | 'contact';
|
|
11
11
|
export type AkilioCapabilitySurface = 'widget' | 'public_api';
|
|
12
12
|
export type AkilioWidgetBranding = 'akilio_required' | 'removable' | 'white_label';
|
|
13
|
-
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 & {});
|
|
14
16
|
export type AkilioCommerceEventType = 'search' | 'recommendation' | 'compare' | 'add_to_cart' | 'checkout' | 'purchase';
|
|
15
17
|
export type AkilioCredentialsMode = 'omit' | 'same-origin' | 'include';
|
|
16
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';
|
|
17
20
|
export type AkilioTokenProvider = () => string | null | undefined | Promise<string | null | undefined>;
|
|
18
21
|
export interface AkilioIssuedWidgetToken {
|
|
19
22
|
token: string;
|
|
@@ -55,15 +58,94 @@ export interface AkilioThemeConfig {
|
|
|
55
58
|
logo_url?: string;
|
|
56
59
|
brand_name?: string;
|
|
57
60
|
color_mode?: AkilioColorMode;
|
|
61
|
+
launcher_position?: AkilioLauncherPosition;
|
|
58
62
|
}
|
|
59
63
|
export interface AkilioPageContext {
|
|
60
64
|
url?: string;
|
|
61
65
|
title?: string;
|
|
62
|
-
audience?: string;
|
|
63
66
|
productArea?: string;
|
|
64
67
|
channel?: string;
|
|
65
68
|
metadata?: Record<string, unknown>;
|
|
66
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
|
+
}
|
|
67
149
|
export interface AkilioSource {
|
|
68
150
|
title?: string | null;
|
|
69
151
|
url?: string | null;
|
|
@@ -80,9 +162,16 @@ export interface AkilioProductVariant {
|
|
|
80
162
|
compare_at_price?: string | null;
|
|
81
163
|
currency?: string;
|
|
82
164
|
inventory_quantity?: number;
|
|
83
|
-
options?:
|
|
165
|
+
options?: {
|
|
166
|
+
Size?: string;
|
|
167
|
+
};
|
|
84
168
|
available: boolean;
|
|
85
169
|
}
|
|
170
|
+
export interface AkilioProductAttribute {
|
|
171
|
+
key: string;
|
|
172
|
+
label: string;
|
|
173
|
+
value: string;
|
|
174
|
+
}
|
|
86
175
|
export interface AkilioProduct {
|
|
87
176
|
id: string;
|
|
88
177
|
external_id: string;
|
|
@@ -92,15 +181,53 @@ export interface AkilioProduct {
|
|
|
92
181
|
product_type?: string;
|
|
93
182
|
url?: string;
|
|
94
183
|
image_url?: string;
|
|
95
|
-
tags?:
|
|
96
|
-
attributes?:
|
|
97
|
-
available:
|
|
184
|
+
tags?: string[];
|
|
185
|
+
attributes?: AkilioProductAttribute[];
|
|
186
|
+
available: boolean;
|
|
98
187
|
variants: AkilioProductVariant[];
|
|
99
|
-
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;
|
|
100
195
|
}
|
|
101
196
|
export interface AkilioCommerceCapability {
|
|
102
197
|
capability: AkilioCommerceCapabilityType;
|
|
103
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[];
|
|
104
231
|
}
|
|
105
232
|
export interface AkilioCommerceEvent {
|
|
106
233
|
event_type: AkilioCommerceEventType;
|
|
@@ -112,6 +239,83 @@ export interface AkilioCommerceEvent {
|
|
|
112
239
|
currency?: string;
|
|
113
240
|
metadata?: Record<string, unknown>;
|
|
114
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
|
+
}
|
|
115
319
|
export interface AkilioProjectConfig {
|
|
116
320
|
project_key: string;
|
|
117
321
|
name: string;
|
|
@@ -119,6 +323,7 @@ export interface AkilioProjectConfig {
|
|
|
119
323
|
title: string;
|
|
120
324
|
placeholder: string;
|
|
121
325
|
starter_questions: string[];
|
|
326
|
+
welcome_message?: string;
|
|
122
327
|
theme_config: AkilioThemeConfig;
|
|
123
328
|
default_language: string;
|
|
124
329
|
supported_languages: string[];
|
|
@@ -148,21 +353,45 @@ export interface AkilioContactRequestCapability {
|
|
|
148
353
|
consent_text: string;
|
|
149
354
|
required_fields: string[];
|
|
150
355
|
}
|
|
151
|
-
export type
|
|
152
|
-
export interface
|
|
153
|
-
type:
|
|
356
|
+
export type AkilioQuickActionType = 'email' | 'phone' | 'form';
|
|
357
|
+
export interface AkilioQuickActionOption {
|
|
358
|
+
type: AkilioQuickActionType;
|
|
154
359
|
label: string;
|
|
155
360
|
value?: string;
|
|
156
361
|
url: string;
|
|
157
362
|
}
|
|
363
|
+
export type AkilioCustomerActionType = 'start_contact_request' | 'start_human_handoff';
|
|
158
364
|
export interface AkilioCustomerAction {
|
|
159
|
-
type:
|
|
365
|
+
type: AkilioCustomerActionType;
|
|
160
366
|
label: string;
|
|
161
367
|
prompt: string;
|
|
162
368
|
endpoint: string;
|
|
163
369
|
method: string;
|
|
164
370
|
requires_confirmation: boolean;
|
|
371
|
+
confirmation_mode?: 'form_consent' | string;
|
|
165
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';
|
|
166
395
|
}
|
|
167
396
|
export type AkilioPreferredContactMethod = 'email' | 'phone' | 'either';
|
|
168
397
|
export interface AkilioContactRequest {
|
|
@@ -175,11 +404,20 @@ export interface AkilioContactRequest {
|
|
|
175
404
|
preferred_contact_time?: string;
|
|
176
405
|
message: string;
|
|
177
406
|
consent_given: boolean;
|
|
407
|
+
website?: string;
|
|
178
408
|
}
|
|
179
409
|
export interface AkilioContactRequestResponse {
|
|
180
410
|
id: string;
|
|
181
411
|
status?: string;
|
|
182
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;
|
|
183
421
|
}
|
|
184
422
|
export interface AkilioPublicRuntimeCapabilities {
|
|
185
423
|
chat: AkilioChatIntentCatalog;
|
|
@@ -197,12 +435,15 @@ export interface AkilioWidgetPolicy {
|
|
|
197
435
|
export interface AkilioChatRequest {
|
|
198
436
|
project_key: string;
|
|
199
437
|
conversation_id?: string;
|
|
438
|
+
context_id?: string;
|
|
439
|
+
reset_context?: boolean;
|
|
440
|
+
capability_confirmation_id?: string;
|
|
441
|
+
clarification_response?: AkilioClarificationResponse;
|
|
200
442
|
message: string;
|
|
201
443
|
/** Explicit action selected from the public config capability catalog. */
|
|
202
444
|
intent?: AkilioChatIntent;
|
|
203
445
|
locale?: string;
|
|
204
446
|
channel?: string;
|
|
205
|
-
audience?: string;
|
|
206
447
|
product_area?: string;
|
|
207
448
|
assistant_mode?: AkilioAssistantMode | null;
|
|
208
449
|
page?: {
|
|
@@ -210,6 +451,7 @@ export interface AkilioChatRequest {
|
|
|
210
451
|
title?: string;
|
|
211
452
|
[key: string]: unknown;
|
|
212
453
|
};
|
|
454
|
+
entry_context?: AkilioEntryContext;
|
|
213
455
|
anonymous_id?: string;
|
|
214
456
|
external_user_id?: string;
|
|
215
457
|
consent?: {
|
|
@@ -222,27 +464,102 @@ export interface AkilioWidgetTokenResponse {
|
|
|
222
464
|
token: string;
|
|
223
465
|
token_type?: string;
|
|
224
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>;
|
|
225
532
|
}
|
|
226
533
|
export interface AkilioChatResponse {
|
|
227
534
|
schema_version?: string;
|
|
228
535
|
conversation_id: string;
|
|
536
|
+
context_id: string;
|
|
537
|
+
context_relation: AkilioContextRelation;
|
|
538
|
+
context_changed: boolean;
|
|
229
539
|
message_id: string;
|
|
230
|
-
response_type
|
|
231
|
-
|
|
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. */
|
|
232
547
|
answer?: string;
|
|
233
|
-
confidence?:
|
|
234
|
-
sources
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
cost_usd?: string;
|
|
238
|
-
commerce?: AkilioCommerceCapability | null;
|
|
548
|
+
confidence?: ConfidentLevel;
|
|
549
|
+
sources?: AkilioSource[];
|
|
550
|
+
commerce?: AkilioCommercePublicResponse | null;
|
|
551
|
+
cart_state?: AkilioCartState | null;
|
|
239
552
|
suggestions?: string[];
|
|
240
553
|
intent?: AkilioChatIntent;
|
|
241
|
-
contact_options?: AkilioContactOption[];
|
|
242
|
-
actions?: AkilioCustomerAction[];
|
|
243
554
|
warnings?: string[];
|
|
244
|
-
|
|
245
|
-
|
|
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;
|
|
246
563
|
}
|
|
247
564
|
export type AkilioStreamEventName = 'status' | 'conversation' | 'answer.delta' | 'final' | 'error' | 'done';
|
|
248
565
|
export interface AkilioStreamEvent {
|
|
@@ -281,6 +598,7 @@ export interface AkilioPublicApi {
|
|
|
281
598
|
cancelTyping(): void;
|
|
282
599
|
submit(): Promise<AkilioChatResponse>;
|
|
283
600
|
ask(text: string, options?: AkilioDraftOptions): Promise<AkilioChatResponse>;
|
|
601
|
+
startConversation(text: string, entryContext: AkilioEntryContext): Promise<AkilioChatResponse>;
|
|
284
602
|
reset(): Promise<void>;
|
|
285
603
|
getState(): AkilioPublicState;
|
|
286
604
|
}
|
|
@@ -298,7 +616,7 @@ export interface AkilioConversationMessageResponse {
|
|
|
298
616
|
role: AkilioMessageRole;
|
|
299
617
|
content: string;
|
|
300
618
|
sources?: AkilioSource[];
|
|
301
|
-
confidence?:
|
|
619
|
+
confidence?: ConfidentLevel;
|
|
302
620
|
metadata?: Record<string, unknown>;
|
|
303
621
|
structured_content?: string;
|
|
304
622
|
created_at: string;
|
|
@@ -325,13 +643,16 @@ export interface AkilioChatMessage {
|
|
|
325
643
|
model?: string;
|
|
326
644
|
costUsd?: string;
|
|
327
645
|
commerce?: AkilioCommerceCapability | null;
|
|
646
|
+
agentTool?: AkilioAgentTool | null;
|
|
647
|
+
clarification?: AkilioClarification | null;
|
|
328
648
|
suggestions?: string[];
|
|
329
649
|
/** True while answer deltas are still arriving. */
|
|
330
650
|
streaming?: boolean;
|
|
331
651
|
error?: boolean;
|
|
332
652
|
feedback?: AkilioFeedbackRating;
|
|
333
|
-
contactOptions?: AkilioContactOption[];
|
|
334
653
|
actions?: AkilioCustomerAction[];
|
|
654
|
+
proactiveActions?: AkilioProactiveAction[];
|
|
655
|
+
intentDecision?: AkilioIntentDecision;
|
|
335
656
|
}
|
|
336
657
|
export interface AkilioCopyOverrides {
|
|
337
658
|
launcher?: string;
|
|
@@ -370,7 +691,22 @@ export interface AkilioCopyOverrides {
|
|
|
370
691
|
contactSubmit?: string;
|
|
371
692
|
contactSending?: string;
|
|
372
693
|
contactSuccess?: string;
|
|
694
|
+
handoffQueued?: string;
|
|
695
|
+
handoffDelivering?: string;
|
|
696
|
+
handoffDelivered?: string;
|
|
697
|
+
handoffFailed?: string;
|
|
698
|
+
handoffCancelled?: string;
|
|
373
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;
|
|
374
710
|
voteUp?: string;
|
|
375
711
|
voteDown?: string;
|
|
376
712
|
requestFailed?: string;
|
|
@@ -390,15 +726,51 @@ export interface AkilioCopyOverrides {
|
|
|
390
726
|
tourAction?: string;
|
|
391
727
|
tourDismiss?: string;
|
|
392
728
|
summarizePage?: string;
|
|
729
|
+
summarizeConversation?: string;
|
|
730
|
+
proactiveSummaryTitle?: string;
|
|
731
|
+
proactiveSummaryMessage?: string;
|
|
732
|
+
proactiveSummaryDismiss?: string;
|
|
393
733
|
privacyDefaultNotice?: string;
|
|
394
734
|
switchToLightMode?: string;
|
|
395
735
|
switchToDarkMode?: string;
|
|
396
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;
|
|
397
760
|
viewProduct?: string;
|
|
398
761
|
fromPrice?: string;
|
|
399
762
|
unavailable?: string;
|
|
400
763
|
inStock?: string;
|
|
401
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;
|
|
402
774
|
}
|
|
403
775
|
export interface AkilioLauncherRenderProps {
|
|
404
776
|
open: boolean;
|
|
@@ -407,6 +779,8 @@ export interface AkilioLauncherRenderProps {
|
|
|
407
779
|
toggleChat: () => void;
|
|
408
780
|
}
|
|
409
781
|
export type AkilioLauncher = 'default' | 'hidden' | ((controls: AkilioLauncherRenderProps) => ReactNode);
|
|
782
|
+
/** Visual behaviour for the built-in launcher. */
|
|
783
|
+
export type AkilioLauncherExperience = 'adaptive' | 'static';
|
|
410
784
|
export type AkilioStyleIsolation = 'shadow' | 'scoped' | 'none';
|
|
411
785
|
export interface AkilioContextualPromptOptions {
|
|
412
786
|
enabled?: boolean;
|
|
@@ -416,11 +790,43 @@ export interface AkilioContextualPromptOptions {
|
|
|
416
790
|
placeholder?: string;
|
|
417
791
|
dismissible?: boolean;
|
|
418
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
|
+
}
|
|
419
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>;
|
|
420
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[];
|
|
421
825
|
apiBaseUrl?: string;
|
|
422
826
|
projectKey: string;
|
|
423
827
|
locale?: AkilioLocale;
|
|
828
|
+
/** Per-widget language dictionaries, also accepted by Akilio.mount(). */
|
|
829
|
+
translations?: AkilioTranslations;
|
|
424
830
|
mode?: AkilioMode;
|
|
425
831
|
colorMode?: AkilioColorMode;
|
|
426
832
|
/** Show a header control that lets visitors override the configured/system theme. */
|
|
@@ -445,8 +851,12 @@ export interface AkilioWidgetProps {
|
|
|
445
851
|
launcher?: AkilioLauncher;
|
|
446
852
|
/** Position of the built-in launcher. right-middle opens a desktop drawer. */
|
|
447
853
|
launcherPosition?: AkilioLauncherPosition;
|
|
854
|
+
/** Use the adaptive Akilio launcher or retain the original static capsule. */
|
|
855
|
+
launcherExperience?: AkilioLauncherExperience;
|
|
448
856
|
/** Show a question prompt as the reader approaches the end of the page. */
|
|
449
857
|
contextualPrompt?: boolean | AkilioContextualPromptOptions;
|
|
858
|
+
/** Offer a one-click page summary when the visitor shows meaningful reading intent. */
|
|
859
|
+
proactiveSummary?: boolean | AkilioProactiveSummaryOptions;
|
|
450
860
|
persistOpenState?: boolean;
|
|
451
861
|
/** Show a one-time, dependency-free coachmark beside the default launcher. */
|
|
452
862
|
enableTour?: boolean;
|
|
@@ -459,11 +869,12 @@ export interface AkilioWidgetProps {
|
|
|
459
869
|
anonymousId?: string;
|
|
460
870
|
externalUserId?: string;
|
|
461
871
|
channel?: string;
|
|
462
|
-
audience?: string;
|
|
463
872
|
productArea?: string;
|
|
464
873
|
/** Optional routing hint sent to the chat endpoint as assistant_mode. */
|
|
465
874
|
assistantMode?: AkilioAssistantMode;
|
|
466
875
|
pageContext?: AkilioPageContext | (() => AkilioPageContext);
|
|
876
|
+
/** Context supplied when this widget instance is opened from a decision surface. */
|
|
877
|
+
entryContext?: AkilioEntryContext;
|
|
467
878
|
auth?: AkilioAuthConfig;
|
|
468
879
|
/** Convenience alias for auth.accessToken. */
|
|
469
880
|
accessToken?: string;
|
|
@@ -491,6 +902,7 @@ export interface ChatPanelProps {
|
|
|
491
902
|
allowColorModeToggle: boolean;
|
|
492
903
|
widgetAvailable: boolean;
|
|
493
904
|
showBranding: boolean;
|
|
905
|
+
businessLogo?: string;
|
|
494
906
|
showPoweredBy: boolean;
|
|
495
907
|
copy: AkilioResolvedCopy;
|
|
496
908
|
locale: string;
|
|
@@ -512,16 +924,26 @@ export interface ChatPanelProps {
|
|
|
512
924
|
onDraftChange?: (draft: string, manual: boolean) => void;
|
|
513
925
|
onFeedback: (message: AkilioChatMessage, rating: AkilioFeedbackRating) => void;
|
|
514
926
|
contactRequestCapability?: AkilioContactRequestCapability;
|
|
515
|
-
onContactRequest: (request: AkilioContactRequest) => Promise<AkilioContactRequestResponse>;
|
|
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>;
|
|
516
930
|
onSuggestion: (suggestion: string) => void;
|
|
931
|
+
onProactiveAction: (action: AkilioProactiveAction) => void;
|
|
932
|
+
/** Resolved starter prompts for the empty chat state. */
|
|
933
|
+
starterQuestions?: string[];
|
|
517
934
|
intentActions?: Array<{
|
|
518
935
|
intent: AkilioChatIntent;
|
|
519
936
|
label: string;
|
|
520
937
|
}>;
|
|
521
938
|
onIntentAction: (intent: AkilioChatIntent, label: string) => void;
|
|
522
939
|
onProductClick: (message: AkilioChatMessage, product: AkilioProduct, variant?: AkilioProductVariant) => void;
|
|
940
|
+
onCommerceAction: (message: AkilioChatMessage, action: AkilioCommercePublicAction) => Promise<void>;
|
|
523
941
|
primaryColor?: string;
|
|
524
942
|
slug?: string;
|
|
943
|
+
cart: AkilioCart | null;
|
|
944
|
+
cartLoading?: boolean;
|
|
945
|
+
onRefreshCart: () => void;
|
|
946
|
+
onCartAction: (line: AkilioCartLine, action: AkilioCartAction, quantity?: number) => Promise<void>;
|
|
525
947
|
}
|
|
526
948
|
export type IntegrationDetection = {
|
|
527
949
|
integration: IntegrationType;
|