@hachther/akilio-widget 0.7.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +331 -26
  2. package/dist/_headers +16 -0
  3. package/dist/akilio-widget.min.js +45 -44
  4. package/dist/assets/EmailIcon.d.ts +2 -0
  5. package/dist/assets/FormIcon.d.ts +2 -0
  6. package/dist/assets/PhoneIcon.d.ts +2 -0
  7. package/dist/components/BrandLogo.d.ts +7 -1
  8. package/dist/components/CartPanel.d.ts +13 -0
  9. package/dist/components/CommerceActions.d.ts +11 -0
  10. package/dist/components/Composer.d.ts +7 -1
  11. package/dist/components/ContactActions.d.ts +2 -2
  12. package/dist/components/EmptyState.d.ts +3 -7
  13. package/dist/components/Icons.d.ts +3 -0
  14. package/dist/components/IdentityVerification.d.ts +14 -0
  15. package/dist/components/InlineDecisionCard.d.ts +2 -0
  16. package/dist/components/Launcher.d.ts +6 -1
  17. package/dist/components/MessageBubble.d.ts +9 -2
  18. package/dist/components/MessageList.d.ts +1 -1
  19. package/dist/components/ProductCard.d.ts +4 -2
  20. package/dist/components/ProductCards.d.ts +6 -1
  21. package/dist/components/ProductDetail.d.ts +12 -0
  22. package/dist/components/ProductVariantSelector.d.ts +9 -0
  23. package/dist/components/SectionPrompt.d.ts +2 -0
  24. package/dist/components/TextSelectionPrompt.d.ts +2 -0
  25. package/dist/components/VoiceRecorder.d.ts +11 -0
  26. package/dist/hooks/current-cart.d.ts +14 -0
  27. package/dist/hooks/proactive-summary.d.ts +1 -0
  28. package/dist/hooks/storage.d.ts +2 -0
  29. package/dist/index.d.ts +5 -1
  30. package/dist/index.min.js +10412 -7169
  31. package/dist/index.umd.min.cjs +37 -36
  32. package/dist/lib/cart-capabilities.d.ts +4 -0
  33. package/dist/lib/client.d.ts +35 -2
  34. package/dist/lib/copy.d.ts +8 -2
  35. package/dist/lib/storefront-cart.d.ts +5 -0
  36. package/dist/loader.js +46 -0
  37. package/dist/locales/en.d.ts +161 -0
  38. package/dist/locales/fr.d.ts +161 -0
  39. package/dist/locales/index.d.ts +3 -0
  40. package/dist/releases/1.1.0/akilio-widget.min.js +46 -0
  41. package/dist/style.css +1842 -81
  42. package/dist/types.d.ts +569 -31
  43. package/dist/vanilla.d.ts +1 -0
  44. package/dist/widget-manifest.json +8 -0
  45. 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,128 @@ export interface AkilioThemeConfig {
55
58
  logo_url?: string;
56
59
  brand_name?: string;
57
60
  color_mode?: AkilioColorMode;
61
+ launcher_position?: AkilioLauncherPosition;
62
+ }
63
+ /** Widget presentation settings persisted by Akilio. Brand identity lives in
64
+ * the business profile; host applications may still use AkilioThemeConfig
65
+ * props for explicit one-off visual overrides. */
66
+ export type AkilioWidgetThemeConfig = Omit<AkilioThemeConfig, 'primary_color' | 'accent_color' | 'logo_url' | 'brand_name'> & {
67
+ widget_mode?: AkilioMode;
68
+ launcher_experience?: 'adaptive' | 'static';
69
+ enable_tour?: boolean;
70
+ tour_delay_ms?: number;
71
+ allow_color_mode_toggle?: boolean;
72
+ enable_response_sound?: boolean;
73
+ response_sound_volume?: number;
74
+ contextual_prompt_enabled?: boolean;
75
+ contextual_prompt_threshold?: number;
76
+ contextual_prompt_placeholder?: string;
77
+ contextual_prompt_dismissible?: boolean;
78
+ };
79
+ export interface AkilioPublicBusinessBrand {
80
+ display_name: string;
81
+ tagline: string;
82
+ logo_url: string;
83
+ primary_color: string;
84
+ secondary_color: string;
85
+ }
86
+ export interface AkilioPublicBusinessProfile {
87
+ name: string;
88
+ description: string;
89
+ website: string;
90
+ industry: string | null;
91
+ brand: AkilioPublicBusinessBrand | null;
92
+ languages: Array<{
93
+ language: string;
94
+ is_default: boolean;
95
+ }>;
58
96
  }
59
97
  export interface AkilioPageContext {
60
98
  url?: string;
61
99
  title?: string;
62
- audience?: string;
63
100
  productArea?: string;
64
101
  channel?: string;
65
102
  metadata?: Record<string, unknown>;
66
103
  }
104
+ export type AkilioEntrySurface = 'widget_launcher' | 'inline_widget' | 'product_card' | 'product_detail' | 'pricing' | 'cart' | 'checkout' | 'help_center' | 'portal' | 'demo' | 'integration' | 'api';
105
+ 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';
106
+ export type AkilioEntrySubjectType = 'product' | 'product_variant' | 'plan' | 'cart' | 'order' | 'article' | 'faq' | 'knowledge_document' | 'workspace_offering';
107
+ export interface AkilioEntryContext {
108
+ schema_version?: '1.0';
109
+ origin: {
110
+ surface: AkilioEntrySurface;
111
+ trigger: AkilioEntryTrigger;
112
+ };
113
+ page?: {
114
+ url: string;
115
+ title?: string;
116
+ section?: {
117
+ id?: string;
118
+ title?: string;
119
+ anchor?: string;
120
+ };
121
+ };
122
+ subject?: {
123
+ type: AkilioEntrySubjectType;
124
+ id: string;
125
+ parent_id?: string;
126
+ };
127
+ selection?: {
128
+ text: string;
129
+ start_offset?: number;
130
+ end_offset?: number;
131
+ selector?: string;
132
+ };
133
+ state?: {
134
+ cart_id?: string;
135
+ order_id?: string;
136
+ error_code?: string;
137
+ error_message?: string;
138
+ };
139
+ metadata?: {
140
+ referrer?: string;
141
+ campaign?: string;
142
+ experiment?: string;
143
+ };
144
+ }
145
+ export type AkilioWidgetAnalyticsEventType = 'contextual_entry_impression' | 'contextual_entry_open' | 'contextual_entry_dismissed' | 'contextual_entry_question_submitted' | 'widget_opened' | 'widget_closed' | 'suggestion_clicked';
146
+ export interface AkilioWidgetAnalyticsEvent {
147
+ event_id: string;
148
+ event_type: AkilioWidgetAnalyticsEventType;
149
+ entry_context?: AkilioEntryContext;
150
+ metadata: Record<string, string | undefined>;
151
+ }
152
+ export interface AkilioInlineDecisionSubject {
153
+ type: 'product' | 'product_variant' | 'plan' | 'workspace_offering';
154
+ id: string;
155
+ parent_id?: string;
156
+ }
157
+ export interface AkilioInlineDecisionCardProps {
158
+ title: string;
159
+ description: string;
160
+ subject?: AkilioInlineDecisionSubject;
161
+ page?: AkilioEntryContext['page'];
162
+ primaryQuestion: string;
163
+ followUpQuestions?: string[];
164
+ onStartConversation?: (question: string, entryContext: AkilioEntryContext) => void;
165
+ className?: string;
166
+ }
167
+ export interface AkilioSectionPromptProps {
168
+ sectionTitle: string;
169
+ sectionId?: string;
170
+ question: string;
171
+ page?: AkilioEntryContext['page'];
172
+ onStartConversation?: (question: string, entryContext: AkilioEntryContext) => void;
173
+ className?: string;
174
+ }
175
+ export interface AkilioTextSelectionPromptProps {
176
+ container: HTMLElement | null;
177
+ sectionTitle?: string;
178
+ sectionId?: string;
179
+ minCharacters?: number;
180
+ question: string;
181
+ onStartConversation?: (question: string, entryContext: AkilioEntryContext) => void;
182
+ }
67
183
  export interface AkilioSource {
68
184
  title?: string | null;
69
185
  url?: string | null;
@@ -80,10 +196,16 @@ export interface AkilioProductVariant {
80
196
  compare_at_price?: string | null;
81
197
  currency?: string;
82
198
  inventory_quantity?: number;
83
- options?: unknown;
199
+ options?: Record<string, string>;
84
200
  available: boolean;
85
201
  }
202
+ export interface AkilioProductAttribute {
203
+ key: string;
204
+ label: string;
205
+ value: string;
206
+ }
86
207
  export interface AkilioProduct {
208
+ cart_provider?: 'shopify' | null;
87
209
  id: string;
88
210
  external_id: string;
89
211
  title: string;
@@ -92,15 +214,55 @@ export interface AkilioProduct {
92
214
  product_type?: string;
93
215
  url?: string;
94
216
  image_url?: string;
95
- tags?: unknown;
96
- attributes?: unknown;
97
- available: string;
217
+ tags?: string[];
218
+ attributes?: AkilioProductAttribute[];
219
+ available: boolean;
98
220
  variants: AkilioProductVariant[];
99
- business_rule_decision?: Record<string, unknown>;
221
+ business_rule_decision?: {
222
+ allowed: boolean;
223
+ score_adjustment: number;
224
+ reasons: string[];
225
+ required_product_ids: string[];
226
+ };
227
+ search_relevance?: number;
100
228
  }
101
229
  export interface AkilioCommerceCapability {
102
230
  capability: AkilioCommerceCapabilityType;
103
231
  products: AkilioProduct[];
232
+ suggestedProducts?: AkilioProduct[];
233
+ actions?: AkilioCommercePublicAction[];
234
+ /** Controls the presentation of a trusted product-detail response. */
235
+ display?: 'list' | 'detail';
236
+ }
237
+ export interface AkilioCommercePublicAction {
238
+ /** Direct storefront action; the customer's button click supplies consent. */
239
+ storefront?: 'shopify';
240
+ type: AkilioCommerceActionType;
241
+ product_id?: string;
242
+ variant_id?: string;
243
+ label_key?: string;
244
+ label_parameters?: Record<string, string>;
245
+ requires_confirmation?: boolean;
246
+ confirmation?: {
247
+ capability_id: string;
248
+ request_endpoint: string;
249
+ approve_endpoint_template: string;
250
+ execution_endpoint: string;
251
+ payload: {
252
+ items: {
253
+ variant_id: string;
254
+ quantity: number;
255
+ }[];
256
+ };
257
+ idempotency_key_required?: boolean;
258
+ };
259
+ }
260
+ /** OpenAPI `CommercePublicResponse`; its product/action payloads are extensible. */
261
+ export interface AkilioCommercePublicResponse {
262
+ capability: AkilioCommerceCapabilityType;
263
+ products: AkilioProduct[];
264
+ suggested_products?: AkilioProduct[];
265
+ actions?: AkilioCommercePublicAction[];
104
266
  }
105
267
  export interface AkilioCommerceEvent {
106
268
  event_type: AkilioCommerceEventType;
@@ -112,14 +274,94 @@ export interface AkilioCommerceEvent {
112
274
  currency?: string;
113
275
  metadata?: Record<string, unknown>;
114
276
  }
277
+ /** Compact cart summary returned alongside a chat response. */
278
+ export interface AkilioCartState {
279
+ id: string;
280
+ provider_cart_id: string;
281
+ provider: string;
282
+ status: string;
283
+ item_count: number;
284
+ updated_at: string;
285
+ }
286
+ export interface AkilioCartLine {
287
+ id: string;
288
+ line_id: string;
289
+ product_id?: string | null;
290
+ /** Product snapshot returned with the cart line, when available. */
291
+ product?: {
292
+ id: string;
293
+ title: string;
294
+ vendor?: string | null;
295
+ image_url?: string | null;
296
+ url?: string | null;
297
+ } | null;
298
+ /** Variant snapshot returned with the cart line, when available. */
299
+ variant?: {
300
+ id: string;
301
+ title?: string | null;
302
+ sku?: string | null;
303
+ options?: Record<string, string> | null;
304
+ } | null;
305
+ variant_id?: string | null;
306
+ title: string;
307
+ quantity: number;
308
+ price: string;
309
+ currency: string;
310
+ /** Provider-approved actions appropriate for this cart's current state. */
311
+ actions?: AkilioCartAction[];
312
+ }
313
+ export interface AkilioCartCheckout {
314
+ mode: 'provider' | 'internal' | 'external_redirect' | string;
315
+ status: string;
316
+ next_action?: {
317
+ type: 'contact_request' | 'external_redirect' | string;
318
+ url?: string;
319
+ };
320
+ }
321
+ /**
322
+ * A widget-safe action supplied with the current cart. Cart actions are
323
+ * intentionally independent from chat product actions: they may not target a
324
+ * product and their destination is supplied by the cart provider.
325
+ */
326
+ export interface AkilioCartAction {
327
+ id?: string;
328
+ type: AkilioCartActionType;
329
+ label?: string;
330
+ label_key?: string;
331
+ label_parameters?: Record<string, string>;
332
+ requires_confirmation?: boolean;
333
+ confirmation?: {
334
+ capability_id: string;
335
+ request_endpoint: string;
336
+ approve_endpoint_template: string;
337
+ execution_endpoint: string;
338
+ payload: Record<string, unknown>;
339
+ idempotency_key_required?: boolean;
340
+ };
341
+ }
342
+ export interface AkilioCart {
343
+ id: string;
344
+ provider: string;
345
+ provider_cart_id: string;
346
+ checkout_url?: string;
347
+ checkout: AkilioCartCheckout;
348
+ status: 'active' | 'checkout_started' | 'completed' | 'expired' | string;
349
+ lines: AkilioCartLine[];
350
+ }
351
+ export interface AkilioCurrentCartResponse {
352
+ cart: AkilioCart | null;
353
+ }
115
354
  export interface AkilioProjectConfig {
355
+ identity_verification_methods?: ('email' | 'phone')[];
116
356
  project_key: string;
117
357
  name: string;
118
358
  slug: string;
119
359
  title: string;
120
360
  placeholder: string;
121
361
  starter_questions: string[];
122
- theme_config: AkilioThemeConfig;
362
+ welcome_message?: string;
363
+ theme_config: AkilioWidgetThemeConfig;
364
+ business_profile?: AkilioPublicBusinessProfile;
123
365
  default_language: string;
124
366
  supported_languages: string[];
125
367
  widget_policy?: AkilioWidgetPolicy;
@@ -148,21 +390,45 @@ export interface AkilioContactRequestCapability {
148
390
  consent_text: string;
149
391
  required_fields: string[];
150
392
  }
151
- export type AkilioContactOptionType = 'email' | 'phone' | 'form';
152
- export interface AkilioContactOption {
153
- type: AkilioContactOptionType;
393
+ export type AkilioQuickActionType = 'email' | 'phone' | 'form';
394
+ export interface AkilioQuickActionOption {
395
+ type: AkilioQuickActionType;
154
396
  label: string;
155
397
  value?: string;
156
398
  url: string;
157
399
  }
400
+ export type AkilioCustomerActionType = 'start_contact_request' | 'start_human_handoff';
158
401
  export interface AkilioCustomerAction {
159
- type: 'start_contact_request';
402
+ type: AkilioCustomerActionType;
160
403
  label: string;
161
404
  prompt: string;
162
405
  endpoint: string;
163
406
  method: string;
164
407
  requires_confirmation: boolean;
408
+ confirmation_mode?: 'form_consent' | string;
165
409
  fields: string[];
410
+ quickActions?: AkilioQuickActionOption[];
411
+ }
412
+ export interface AkilioProactiveAction {
413
+ type: 'summarize_conversation' | string;
414
+ label?: string;
415
+ intent: 'summarize_conversation' | string;
416
+ message?: string;
417
+ }
418
+ export type AkilioContextRelation = 'initial' | 'continuation' | 'new_topic' | 'explicit_reset';
419
+ export interface AkilioMarketContext {
420
+ scope_type: string;
421
+ code?: string;
422
+ name?: string;
423
+ parent_code?: string;
424
+ source?: string;
425
+ confidence?: number;
426
+ approximate?: boolean;
427
+ }
428
+ export interface AkilioChatHumanEscalation {
429
+ id: string;
430
+ status?: string;
431
+ reason: 'customer_request' | 'insufficient_evidence' | 'sensitive_question' | 'invalid_citation' | 'policy_review';
166
432
  }
167
433
  export type AkilioPreferredContactMethod = 'email' | 'phone' | 'either';
168
434
  export interface AkilioContactRequest {
@@ -175,11 +441,20 @@ export interface AkilioContactRequest {
175
441
  preferred_contact_time?: string;
176
442
  message: string;
177
443
  consent_given: boolean;
444
+ website?: string;
178
445
  }
179
446
  export interface AkilioContactRequestResponse {
180
447
  id: string;
181
448
  status?: string;
182
449
  created_at: string;
450
+ handoff: AkilioHumanHandoff;
451
+ }
452
+ export type AkilioHumanHandoffStatus = 'queued' | 'delivering' | 'delivered' | 'failed' | 'cancelled';
453
+ /** Browser-safe status returned by the server-owned human-handoff workflow. */
454
+ export interface AkilioHumanHandoff {
455
+ id: string;
456
+ status: AkilioHumanHandoffStatus;
457
+ created_at: string;
183
458
  }
184
459
  export interface AkilioPublicRuntimeCapabilities {
185
460
  chat: AkilioChatIntentCatalog;
@@ -191,18 +466,25 @@ export interface AkilioWidgetPolicy {
191
466
  assistant_mode: AkilioAssistantMode;
192
467
  /** Whether product results and commerce events may be used. */
193
468
  commerce_enabled: boolean;
469
+ /** Whether the workspace plan allows voice input. */
470
+ audio_enabled?: boolean;
194
471
  /** Branding treatment the widget must apply. */
195
472
  branding: AkilioWidgetBranding;
196
473
  }
197
474
  export interface AkilioChatRequest {
475
+ external_resume_token?: string;
476
+ voice_transcription_id?: string;
198
477
  project_key: string;
199
478
  conversation_id?: string;
479
+ context_id?: string;
480
+ reset_context?: boolean;
481
+ capability_confirmation_id?: string;
482
+ clarification_response?: AkilioClarificationResponse;
200
483
  message: string;
201
484
  /** Explicit action selected from the public config capability catalog. */
202
485
  intent?: AkilioChatIntent;
203
486
  locale?: string;
204
487
  channel?: string;
205
- audience?: string;
206
488
  product_area?: string;
207
489
  assistant_mode?: AkilioAssistantMode | null;
208
490
  page?: {
@@ -210,6 +492,7 @@ export interface AkilioChatRequest {
210
492
  title?: string;
211
493
  [key: string]: unknown;
212
494
  };
495
+ entry_context?: AkilioEntryContext;
213
496
  anonymous_id?: string;
214
497
  external_user_id?: string;
215
498
  consent?: {
@@ -222,27 +505,131 @@ export interface AkilioWidgetTokenResponse {
222
505
  token: string;
223
506
  token_type?: string;
224
507
  expires_in: number;
508
+ continuation_token?: string;
509
+ continuation_expires_in?: number;
510
+ }
511
+ export interface AkilioCapability {
512
+ id: string;
513
+ code?: string;
514
+ name?: string;
515
+ input_schema?: Record<string, unknown>;
516
+ output_schema?: Record<string, unknown>;
517
+ requires_confirmation?: boolean;
518
+ risk_level?: string;
519
+ provider?: string;
520
+ executable?: boolean;
521
+ }
522
+ export interface AkilioCapabilityConfirmation {
523
+ id: string;
524
+ capability_id: string;
525
+ expires_at?: string;
526
+ action?: string;
527
+ }
528
+ export interface AkilioCustomerServiceToolResponse {
529
+ tool_id: string;
530
+ result: unknown;
531
+ }
532
+ export interface AkilioAgentTool {
533
+ resume_token?: string;
534
+ tool_id: string;
535
+ requires_confirmation?: boolean;
536
+ confirmation_id?: string;
537
+ error?: string;
538
+ expires_at?: string;
539
+ question?: string;
540
+ entry_context?: AkilioEntryContext;
541
+ action?: 'confirm_human_request' | 'start_contact_request' | string;
542
+ payload?: Record<string, unknown>;
543
+ result?: {
544
+ escalation_id?: string;
545
+ [key: string]: unknown;
546
+ };
547
+ }
548
+ export interface AkilioIntentDecision {
549
+ schema_version?: string;
550
+ intent_id?: string;
551
+ confidence?: number;
552
+ source?: string;
553
+ reason?: string;
554
+ entities?: Record<string, unknown>;
555
+ clarification?: AkilioClarification | null;
556
+ }
557
+ export interface AkilioClarificationOption {
558
+ value: string;
559
+ label: string;
560
+ }
561
+ export interface AkilioClarificationField {
562
+ key: string;
563
+ label: string;
564
+ type: 'text' | 'email' | 'tel' | 'number' | 'select' | string;
565
+ required: boolean;
566
+ options?: AkilioClarificationOption[];
567
+ }
568
+ export interface AkilioClarification {
569
+ question: string;
570
+ submission_template?: string | null;
571
+ reason?: string;
572
+ missing_entities?: string[];
573
+ fields?: AkilioClarificationField[];
574
+ options?: AkilioClarificationOption[];
575
+ }
576
+ export interface AkilioClarificationResponse {
577
+ source_message_id: string;
578
+ values: Record<string, string>;
579
+ }
580
+ export interface AkilioIdentityVerification {
581
+ identifier_type?: 'email' | 'phone';
582
+ verification_id: string;
583
+ status: string;
584
+ masked_identifier: string;
585
+ expires_at: string;
586
+ }
587
+ export interface AkilioIdentitySession {
588
+ authenticated: boolean;
589
+ identity_id: string | null;
590
+ assurance_level: string | null;
591
+ verified_at: string | null;
592
+ expires_at: string | null;
593
+ }
594
+ export interface AkilioIdentityRequirement {
595
+ methods: string[];
596
+ purpose?: 'identity' | 'step_up';
225
597
  }
226
598
  export interface AkilioChatResponse {
599
+ external_operation_resume?: {
600
+ token: string;
601
+ question: string;
602
+ };
603
+ identity_verification_required?: AkilioIdentityRequirement;
227
604
  schema_version?: string;
228
605
  conversation_id: string;
606
+ context_id: string;
607
+ context_relation: AkilioContextRelation;
608
+ context_changed: boolean;
229
609
  message_id: string;
230
- response_type?: string;
231
- content?: Record<string, unknown>;
610
+ response_type: string;
611
+ /** Canonical response body. Use markdown for the rich widget surface. */
612
+ content: {
613
+ plain_text: string;
614
+ markdown: string;
615
+ };
616
+ /** @deprecated Compatibility field. The widget renders `content` instead. */
232
617
  answer?: string;
233
- confidence?: string | number | null;
234
- sources: AkilioSource[];
235
- provider?: string;
236
- model?: string;
237
- cost_usd?: string;
238
- commerce?: AkilioCommerceCapability | null;
618
+ confidence?: ConfidentLevel;
619
+ sources?: AkilioSource[];
620
+ commerce?: AkilioCommercePublicResponse | null;
621
+ cart_state?: AkilioCartState | null;
239
622
  suggestions?: string[];
240
623
  intent?: AkilioChatIntent;
241
- contact_options?: AkilioContactOption[];
242
- actions?: AkilioCustomerAction[];
243
624
  warnings?: string[];
244
- assistant_mode?: string;
245
- active_route?: string;
625
+ effective_market?: AkilioMarketContext | null;
626
+ grounded?: boolean;
627
+ refused?: boolean;
628
+ escalation?: AkilioChatHumanEscalation | null;
629
+ actions?: AkilioCustomerAction[];
630
+ proactive_actions?: AkilioProactiveAction[];
631
+ agent_tool?: Record<string, unknown> | null;
632
+ intent_decision?: AkilioIntentDecision;
246
633
  }
247
634
  export type AkilioStreamEventName = 'status' | 'conversation' | 'answer.delta' | 'final' | 'error' | 'done';
248
635
  export interface AkilioStreamEvent {
@@ -281,6 +668,7 @@ export interface AkilioPublicApi {
281
668
  cancelTyping(): void;
282
669
  submit(): Promise<AkilioChatResponse>;
283
670
  ask(text: string, options?: AkilioDraftOptions): Promise<AkilioChatResponse>;
671
+ startConversation(text: string, entryContext: AkilioEntryContext): Promise<AkilioChatResponse>;
284
672
  reset(): Promise<void>;
285
673
  getState(): AkilioPublicState;
286
674
  }
@@ -298,7 +686,7 @@ export interface AkilioConversationMessageResponse {
298
686
  role: AkilioMessageRole;
299
687
  content: string;
300
688
  sources?: AkilioSource[];
301
- confidence?: string | number | null;
689
+ confidence?: ConfidentLevel;
302
690
  metadata?: Record<string, unknown>;
303
691
  structured_content?: string;
304
692
  created_at: string;
@@ -325,15 +713,45 @@ export interface AkilioChatMessage {
325
713
  model?: string;
326
714
  costUsd?: string;
327
715
  commerce?: AkilioCommerceCapability | null;
716
+ agentTool?: AkilioAgentTool | null;
717
+ clarification?: AkilioClarification | null;
328
718
  suggestions?: string[];
329
719
  /** True while answer deltas are still arriving. */
330
720
  streaming?: boolean;
331
721
  error?: boolean;
332
722
  feedback?: AkilioFeedbackRating;
333
- contactOptions?: AkilioContactOption[];
334
723
  actions?: AkilioCustomerAction[];
724
+ proactiveActions?: AkilioProactiveAction[];
725
+ intentDecision?: AkilioIntentDecision;
335
726
  }
336
727
  export interface AkilioCopyOverrides {
728
+ identityTitle?: string;
729
+ identityEmail?: string;
730
+ identityCode?: string;
731
+ identitySend?: string;
732
+ identityConfirm?: string;
733
+ identityResend?: string;
734
+ identityCancel?: string;
735
+ identitySent?: string;
736
+ identityVerified?: string;
737
+ identityInvalid?: string;
738
+ identityExpired?: string;
739
+ identityUnavailable?: string;
740
+ identityLimited?: string;
741
+ identityChangeEmail?: string;
742
+ identityBusy?: string;
743
+ identityGenericTitle?: string;
744
+ identityPhone?: string;
745
+ identityPhoneHint?: string;
746
+ identityPhoneSent?: string;
747
+ identityPhoneCodeTitle?: string;
748
+ identityPhoneCodeHint?: string;
749
+ identityPhoneVerified?: string;
750
+ identityChangePhone?: string;
751
+ identityCodeTitle?: string;
752
+ identityDescription?: string;
753
+ identityCodeHint?: string;
754
+ identitySending?: string;
337
755
  launcher?: string;
338
756
  title?: string;
339
757
  description?: string;
@@ -370,7 +788,29 @@ export interface AkilioCopyOverrides {
370
788
  contactSubmit?: string;
371
789
  contactSending?: string;
372
790
  contactSuccess?: string;
791
+ handoffQueued?: string;
792
+ handoffDelivering?: string;
793
+ handoffDelivered?: string;
794
+ handoffFailed?: string;
795
+ handoffCancelled?: string;
373
796
  contactFailed?: string;
797
+ humanRequestTitle?: string;
798
+ humanRequestDescription?: string;
799
+ humanRequestConsequences?: string;
800
+ humanRequestConfirm?: string;
801
+ humanRequestCancel?: string;
802
+ humanRequestSending?: string;
803
+ humanRequestFailed?: string;
804
+ humanRequestSuccess?: string;
805
+ clarificationNeeded?: string;
806
+ clarificationSubmit?: string;
807
+ recordVoice?: string;
808
+ stopVoice?: string;
809
+ sendVoice?: string;
810
+ cancelVoice?: string;
811
+ voiceTranscribing?: string;
812
+ voiceFailure?: string;
813
+ voicePermissionError?: string;
374
814
  voteUp?: string;
375
815
  voteDown?: string;
376
816
  requestFailed?: string;
@@ -390,15 +830,51 @@ export interface AkilioCopyOverrides {
390
830
  tourAction?: string;
391
831
  tourDismiss?: string;
392
832
  summarizePage?: string;
833
+ summarizeConversation?: string;
834
+ proactiveSummaryTitle?: string;
835
+ proactiveSummaryMessage?: string;
836
+ proactiveSummaryDismiss?: string;
393
837
  privacyDefaultNotice?: string;
394
838
  switchToLightMode?: string;
395
839
  switchToDarkMode?: string;
396
840
  products?: string;
841
+ suggestedProducts?: string;
842
+ matchedProducts?: string;
843
+ productRecommendations?: string;
844
+ productComparison?: string;
845
+ compatibleProducts?: string;
846
+ bundleProducts?: string;
847
+ upgradeOptions?: string;
848
+ complementaryProducts?: string;
849
+ commerceActionConfirm?: string;
850
+ commerceActionCancel?: string;
851
+ commerceActionWorking?: string;
852
+ commerceActionComplete?: string;
853
+ commerceActionFailed?: string;
854
+ addToCart?: string;
855
+ compareProduct?: string;
856
+ updateQuantity?: string;
857
+ removeFromCart?: string;
858
+ cart?: string;
859
+ cartEmpty?: string;
860
+ cartItems?: string;
861
+ checkout?: string;
862
+ cartUnavailable?: string;
863
+ refreshCart?: string;
397
864
  viewProduct?: string;
398
865
  fromPrice?: string;
399
866
  unavailable?: string;
400
867
  inStock?: string;
401
868
  outOfStock?: string;
869
+ rateLimited?: string;
870
+ launcherAnswerReady?: string;
871
+ launcherContact?: string;
872
+ launcherPageHelp?: string;
873
+ launcherProductHelp?: string;
874
+ launcherPlanHelp?: string;
875
+ productDetails?: string;
876
+ productVariants?: string;
877
+ productSpecifications?: string;
402
878
  }
403
879
  export interface AkilioLauncherRenderProps {
404
880
  open: boolean;
@@ -407,6 +883,8 @@ export interface AkilioLauncherRenderProps {
407
883
  toggleChat: () => void;
408
884
  }
409
885
  export type AkilioLauncher = 'default' | 'hidden' | ((controls: AkilioLauncherRenderProps) => ReactNode);
886
+ /** Visual behaviour for the built-in launcher. */
887
+ export type AkilioLauncherExperience = 'adaptive' | 'static';
410
888
  export type AkilioStyleIsolation = 'shadow' | 'scoped' | 'none';
411
889
  export interface AkilioContextualPromptOptions {
412
890
  enabled?: boolean;
@@ -416,11 +894,46 @@ export interface AkilioContextualPromptOptions {
416
894
  placeholder?: string;
417
895
  dismissible?: boolean;
418
896
  }
897
+ export interface AkilioProactiveSummaryOptions {
898
+ enabled?: boolean;
899
+ /** Score required to show the prompt. Defaults to 4. */
900
+ threshold?: number;
901
+ /** Change this value when page content changes and the prompt should reappear. */
902
+ version?: string;
903
+ }
419
904
  export type IntegrationType = 'shopify' | 'woocommerce' | 'wordpress' | 'prestashop' | 'magento' | 'wix' | 'webflow' | 'squarespace' | 'nextjs' | 'react' | 'vue' | 'angular' | 'vanilla' | 'unknown';
905
+ /** Complete dictionary: TypeScript reports missing keys when adding built-in languages. */
906
+ export interface AkilioLanguagePack {
907
+ direction: 'ltr' | 'rtl';
908
+ messages: Required<AkilioCopyOverrides> & {
909
+ suggestions: string[];
910
+ };
911
+ whiteLabel: Pick<Required<AkilioCopyOverrides>, 'launcher' | 'title' | 'configFailed'>;
912
+ }
913
+ /** Partial dictionaries inherit missing strings from their parent locale, then English. */
914
+ export interface AkilioLanguagePackOverrides {
915
+ direction?: 'ltr' | 'rtl';
916
+ messages?: AkilioCopyOverrides & {
917
+ suggestions?: string[];
918
+ };
919
+ whiteLabel?: Partial<AkilioLanguagePack['whiteLabel']>;
920
+ }
921
+ export type AkilioTranslations = Record<string, AkilioLanguagePackOverrides>;
420
922
  export interface AkilioWidgetProps {
923
+ /** Business display name; copy.title takes precedence. */
924
+ agentName?: string;
925
+ /** Introductory text shown before the first message. */
926
+ welcomeMessage?: string;
927
+ /** Initial prompts. An empty list hides prompts; capability actions remain available. */
928
+ starterPrompts?: string[];
421
929
  apiBaseUrl?: string;
422
- projectKey: string;
930
+ /** Installation public key. */
931
+ widgetKey?: string;
932
+ /** @deprecated Use widgetKey; existing installations remain supported. */
933
+ projectKey?: string;
423
934
  locale?: AkilioLocale;
935
+ /** Per-widget language dictionaries, also accepted by Akilio.mount(). */
936
+ translations?: AkilioTranslations;
424
937
  mode?: AkilioMode;
425
938
  colorMode?: AkilioColorMode;
426
939
  /** Show a header control that lets visitors override the configured/system theme. */
@@ -445,8 +958,12 @@ export interface AkilioWidgetProps {
445
958
  launcher?: AkilioLauncher;
446
959
  /** Position of the built-in launcher. right-middle opens a desktop drawer. */
447
960
  launcherPosition?: AkilioLauncherPosition;
961
+ /** Use the adaptive Akilio launcher or retain the original static capsule. */
962
+ launcherExperience?: AkilioLauncherExperience;
448
963
  /** Show a question prompt as the reader approaches the end of the page. */
449
964
  contextualPrompt?: boolean | AkilioContextualPromptOptions;
965
+ /** Offer a one-click page summary when the visitor shows meaningful reading intent. */
966
+ proactiveSummary?: boolean | AkilioProactiveSummaryOptions;
450
967
  persistOpenState?: boolean;
451
968
  /** Show a one-time, dependency-free coachmark beside the default launcher. */
452
969
  enableTour?: boolean;
@@ -459,11 +976,12 @@ export interface AkilioWidgetProps {
459
976
  anonymousId?: string;
460
977
  externalUserId?: string;
461
978
  channel?: string;
462
- audience?: string;
463
979
  productArea?: string;
464
980
  /** Optional routing hint sent to the chat endpoint as assistant_mode. */
465
981
  assistantMode?: AkilioAssistantMode;
466
982
  pageContext?: AkilioPageContext | (() => AkilioPageContext);
983
+ /** Context supplied when this widget instance is opened from a decision surface. */
984
+ entryContext?: AkilioEntryContext;
467
985
  auth?: AkilioAuthConfig;
468
986
  /** Convenience alias for auth.accessToken. */
469
987
  accessToken?: string;
@@ -478,11 +996,18 @@ export interface AkilioWidgetProps {
478
996
  className?: string;
479
997
  onOpenChange?: (open: boolean) => void;
480
998
  onMessage?: (message: AkilioChatMessage) => void;
999
+ /** Final canonical response for host diagnostics; never changes widget rendering. */
1000
+ onResponse?: (response: AkilioChatResponse) => void;
1001
+ /** Disable cached configuration in authenticated previews that switch versions. */
1002
+ cacheProjectConfig?: boolean;
1003
+ /** Optional host transport; defaults to the browser fetch implementation. */
1004
+ fetchImpl?: typeof fetch;
481
1005
  onProductClick?: (product: AkilioProduct, variant?: AkilioProductVariant) => void;
482
1006
  onError?: (error: Error) => void;
483
1007
  integration?: IntegrationType;
484
1008
  }
485
1009
  export interface ChatPanelProps {
1010
+ identityVerification?: ReactNode;
486
1011
  panelId: string;
487
1012
  open: boolean;
488
1013
  isDesktop: boolean;
@@ -491,6 +1016,7 @@ export interface ChatPanelProps {
491
1016
  allowColorModeToggle: boolean;
492
1017
  widgetAvailable: boolean;
493
1018
  showBranding: boolean;
1019
+ businessLogo?: string;
494
1020
  showPoweredBy: boolean;
495
1021
  copy: AkilioResolvedCopy;
496
1022
  locale: string;
@@ -509,19 +1035,31 @@ export interface ChatPanelProps {
509
1035
  onToggleColorMode: () => void;
510
1036
  onClear: () => void;
511
1037
  onSubmit: (query: string) => Promise<AkilioChatResponse>;
1038
+ onVoiceSubmit?: (audio: Blob, signal: AbortSignal) => Promise<void>;
512
1039
  onDraftChange?: (draft: string, manual: boolean) => void;
513
1040
  onFeedback: (message: AkilioChatMessage, rating: AkilioFeedbackRating) => void;
514
1041
  contactRequestCapability?: AkilioContactRequestCapability;
515
- onContactRequest: (request: AkilioContactRequest) => Promise<AkilioContactRequestResponse>;
1042
+ onContactRequest: (request: AkilioContactRequest, actionType: AkilioCustomerActionType) => Promise<AkilioContactRequestResponse>;
1043
+ onConfirmExternalOperation?: (message: AkilioChatMessage, tool: AkilioAgentTool) => Promise<void>;
1044
+ onConfirmHumanRequest: (message: AkilioChatMessage, tool: AkilioAgentTool, request: AkilioContactRequest) => Promise<void>;
1045
+ onClarificationSubmit: (message: AkilioChatMessage, values: Record<string, string>, submission: string) => Promise<void>;
516
1046
  onSuggestion: (suggestion: string) => void;
1047
+ onProactiveAction: (action: AkilioProactiveAction) => void;
1048
+ /** Resolved starter prompts for the empty chat state. */
1049
+ starterQuestions?: string[];
517
1050
  intentActions?: Array<{
518
1051
  intent: AkilioChatIntent;
519
1052
  label: string;
520
1053
  }>;
521
1054
  onIntentAction: (intent: AkilioChatIntent, label: string) => void;
522
1055
  onProductClick: (message: AkilioChatMessage, product: AkilioProduct, variant?: AkilioProductVariant) => void;
1056
+ onCommerceAction: (message: AkilioChatMessage, action: AkilioCommercePublicAction) => Promise<void>;
523
1057
  primaryColor?: string;
524
1058
  slug?: string;
1059
+ cart: AkilioCart | null;
1060
+ cartLoading?: boolean;
1061
+ onRefreshCart: () => void;
1062
+ onCartAction: (line: AkilioCartLine, action: AkilioCartAction, quantity?: number) => Promise<void>;
525
1063
  }
526
1064
  export type IntegrationDetection = {
527
1065
  integration: IntegrationType;