@hachther/akilio-widget 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,6 +37,74 @@ citations, products, and suggestions).
37
37
  Use `streaming={false}` or `data-streaming="false"` to use `POST /api/v1/chat/`
38
38
  for compatibility with an older backend or proxy.
39
39
 
40
+ ## Response notification sound
41
+
42
+ An optional dependency-free chime can notify visitors when the final response
43
+ arrives, including while the browser tab is in the background:
44
+
45
+ ```tsx
46
+ <AkilioWidget
47
+ projectKey='your-project-key'
48
+ enableResponseSound
49
+ responseSoundVolume={0.22}
50
+ />
51
+ ```
52
+
53
+ Standalone scripts use `data-enable-response-sound="true"` and optionally
54
+ `data-response-sound-volume="0.22"`. The sound is disabled by default. It is
55
+ prepared when the visitor sends a question to comply with browser autoplay
56
+ rules, plays only for successful final responses, downloads no audio file, and
57
+ never blocks message delivery if audio is unavailable or denied.
58
+
59
+ ## Launcher position
60
+
61
+ The built-in launcher defaults to the bottom-right corner. It can also be
62
+ placed at the bottom-left or displayed as a vertical tab in the middle of the
63
+ right viewport edge:
64
+
65
+ ```tsx
66
+ <AkilioWidget
67
+ projectKey='your-project-key'
68
+ launcherPosition='right-middle'
69
+ />
70
+ ```
71
+
72
+ Supported values are `bottom-right`, `bottom-left`, and `right-middle`. The
73
+ `right-middle` position automatically opens a full-height right drawer on
74
+ desktop, even when the configured mode is `floating`. On mobile it returns to
75
+ the compact bottom-right launcher and the normal mobile presentation.
76
+
77
+ The standalone equivalent is `data-launcher-position="right-middle"`.
78
+
79
+ ## Page-end contextual prompt
80
+
81
+ Documentation pages can show a compact “Ask about this page” input when the
82
+ reader approaches the end of the document:
83
+
84
+ ```tsx
85
+ <AkilioWidget
86
+ projectKey='your-project-key'
87
+ contextualPrompt={{
88
+ enabled: true,
89
+ trigger: 'near-page-end',
90
+ threshold: 320,
91
+ placeholder: 'Ask a question about this page...',
92
+ dismissible: true,
93
+ }}
94
+ />
95
+ ```
96
+
97
+ Submitting opens the main chat and sends the question through its normal
98
+ authenticated streaming flow with the current page URL and title. The prompt
99
+ does not steal focus, stays hidden while chat is open, supports Escape and a
100
+ dismiss button, and does not appear before required privacy consent is granted.
101
+ It uses an `IntersectionObserver` end marker with a scroll fallback.
102
+
103
+ Standalone attributes are `data-contextual-prompt="true"`,
104
+ `data-contextual-prompt-threshold="320"`,
105
+ `data-contextual-prompt-placeholder="Ask about this page..."`, and
106
+ `data-contextual-prompt-dismissible="true"`.
107
+
40
108
  ## Server widget policy
41
109
 
42
110
  The public project configuration may include an authoritative `widget_policy`.
@@ -132,6 +200,26 @@ The coachmark stays inside the widget’s style boundary, does not darken or blo
132
200
  the host page, does not steal keyboard focus, and respects reduced-motion
133
201
  preferences.
134
202
 
203
+ ## Capability-driven chat actions
204
+
205
+ The widget reads `capabilities.chat` from the public project configuration. An
206
+ enabled `summarize_page` intent that supports the `widget` surface is shown as
207
+ an explicit “Summarize this page” action when its `page.url` requirement is
208
+ available. Selecting it sends `intent: "summarize_page"` and the current page
209
+ context to the chat endpoint. Unsupported, disabled, wrong-surface, or
210
+ unmet-requirement actions are not displayed. Older API responses without the
211
+ capability catalog retain the previous suggestion behavior.
212
+
213
+ An enabled `contact` intent adds a “Contact the team” action. Contact responses
214
+ can display validated `email`, `phone`, and `form` links from `contact_options`.
215
+ When the response includes a `start_contact_request` action and public
216
+ configuration enables `capabilities.chat.contact_request`, the widget renders
217
+ the advertised fields as an inline contact form. It applies the server-provided
218
+ consent text, submits through the authenticated `/contact-requests/` endpoint,
219
+ prevents submission without required consent, and displays success, progress,
220
+ failure, dark-mode, and mobile states. Repeating the source message remains
221
+ idempotent on the API.
222
+
135
223
  Production React and standalone JavaScript widget for the Akilio backend.
136
224
 
137
225
  ## Included modes