@webority/chat-react 0.29.0 → 0.31.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
@@ -119,10 +119,11 @@ Otherwise the response is `text/event-stream`:
119
119
 
120
120
  Exactly one `done` or `error` ends each stream.
121
121
 
122
- ### Read endpoints the product implements
122
+ ### Read endpoints
123
123
 
124
- The chat endpoint writes one turn. The product hosts these beside it, in this shape, for the
125
- allowance, past chats and ratings:
124
+ The chat endpoint writes one turn. `MapAiChat` from `Webority.Ai.Chat.AspNetCore` 0.11.0 maps
125
+ these beside it, under the same prefix, for the allowance, past chats and ratings. They are the
126
+ shape the client reads:
126
127
 
127
128
  | Request | Response |
128
129
  |---|---|
@@ -142,6 +143,17 @@ A support card's Confirm calls the `confirmAction(token)` it is given. With
142
143
  `POST {supportBase}/actions/confirm` with `{ token }` and resolves to the ticket it acted on. Nothing
143
144
  reaches support until the person confirms.
144
145
 
146
+ ## On a Razor site
147
+
148
+ A server-rendered Razor site uses `<app-chat base="/api/assistant" />` from `Webority.Ui.Razor`
149
+ instead. It wraps the `<wui-chat>` element from `@webority/ui-elements/chat`, which reads the same
150
+ routes with this package's client, labels and reply parser, and shows the launcher, the panel and
151
+ the conversation. Its attributes are this package's props in kebab case: `base`, `position`,
152
+ `icon`, `compact`, `panel-title`, `disclaimer`, `max-length`, `allowance-threshold`, `rating`,
153
+ `labels` (JSON) and `page-context` (JSON). `title` is `panel-title` there, because `title` is a
154
+ global HTML attribute. The past-chats list, support action cards, the rating note, `linkComponent`
155
+ and `renderReply` are not in the element.
156
+
145
157
  ## The hook
146
158
 
147
159
  `useChat({ client, pageContext })` returns:
@@ -172,9 +184,20 @@ Every component takes `labels`, any subset of `DEFAULT_CHAT_LABELS`, to change i
172
184
  ### `<ChatLauncher />`
173
185
 
174
186
  The floating pill that opens the panel. `onClick`, `open` (announced on the button), `position`
175
- (`end` or `start`, the bottom corner), `icon`, and `className` and `style` on the floating
176
- wrapper to move it clear of other fixed controls, such as `ReportIssue`. The launcher is left out
177
- of `ReportIssue`'s page capture.
187
+ (`end` or `start`, the bottom corner), `icon`, `compact`, and `className` and `style` on the
188
+ floating wrapper to move it clear of other fixed controls, such as `ReportIssue`. The launcher is
189
+ left out of `ReportIssue`'s page capture.
190
+
191
+ `compact` makes it a 48px icon-only circle with the label as its tooltip and accessible name. It
192
+ joins the shared floating stack (`useFloatingStack` from `@webority/ui-react`), one fixed container
193
+ per corner that the compact `ReportIssue` from `@webority/support-react` also uses: the launcher
194
+ sits in the corner and the report button stacks above it with a gap, so neither needs an offset.
195
+ `className` and `style` then land on the item inside the stack, which is not itself fixed.
196
+
197
+ ```jsx
198
+ <ChatLauncher compact open={open} onClick={() => setOpen(true)} />
199
+ <ReportIssue floating compact />
200
+ ```
178
201
 
179
202
  ### `<ChatPanel />`
180
203