@cboxdk/cbox-ui 0.14.1 → 0.15.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 +13 -3
- package/dist/index.d.ts +24 -0
- package/dist/index.js +536 -274
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/shell.css +57 -38
package/README.md
CHANGED
|
@@ -364,7 +364,7 @@ moves focus to `<main id={mainId}>` (default `main-content`).
|
|
|
364
364
|
| `palette.gotoUrl` | `GET ?q=` | `{ data: [{ title, subtitle?, levels?: { organization, project, … }, url? }] }` across organizations. |
|
|
365
365
|
| `apps.catalogUrl` | `GET` | The catalog below, plus `in_organization`, `admission_url`, `purpose` and `hue` per app. |
|
|
366
366
|
| `help.updatesUrl` | `GET`; `POST {updatesUrl}/{id}/read` | `{ data: [{ id, kind: "ticket" \| "chat", title, excerpt?, at, unread, url? }] }` |
|
|
367
|
-
| `help.searchUrl` | `GET ?q=&topic=` | `{ data: [{ id, title, excerpt?, body?, url?, source? }] }` |
|
|
367
|
+
| `help.searchUrl` | `GET ?q=&topic=` | `{ data: [{ id, title, excerpt?, body?, url?, source? }] }`, or Assistant's `{ groups: [{ source, data }] }` |
|
|
368
368
|
| `help.articlesUrl` | `GET` (template, `{topic}`) | The same shape; the first three are shown. |
|
|
369
369
|
|
|
370
370
|
Every link the shell follows from these answers (`url`, `detailsUrl`) must be `http(s)://` or
|
|
@@ -399,11 +399,21 @@ until they open it, so a phone or a narrow window never lands under the overlay.
|
|
|
399
399
|
updates are per organization: they load again when the organization or `updatesUrl` changes.
|
|
400
400
|
Closing Help gives focus back to what opened it.
|
|
401
401
|
|
|
402
|
-
|
|
402
|
+
An app that sends no `help.searchUrl`, `articlesUrl` or `updatesUrl` (console-kit sends none) still
|
|
403
|
+
gets all three: Help fetches `help.sessionUrl` in the browser after the page has painted and uses
|
|
404
|
+
the session's `search_url`, `topics_url`, `article_url` and `updates_url` on Cbox Assistant, with
|
|
405
|
+
its `identity` as a bearer token (no cookies), and a new session when the identity runs out. The
|
|
406
|
+
app's CSP must allow the Assistant API origin in `connect-src`. A session without those URLs means
|
|
407
|
+
no search field and no article list; the chat still works.
|
|
408
|
+
|
|
409
|
+
The chat is the Assistant SDK's `<cbox-support session-url inline>` element (laravel-assistant-client,
|
|
403
410
|
`/ai-assistant/support.js` by default, loaded the first time Help opens). The shell sets
|
|
404
411
|
`element.intent = { route, title, context, url }` (and an `intent` JSON attribute) on every
|
|
405
412
|
page, and calls `element.ask(question, intent)` / `element.handover()` when the SDK has them,
|
|
406
|
-
else `element.open()`.
|
|
413
|
+
else `element.open()`. From laravel-assistant-client 0.2.3 the chat fills the column
|
|
414
|
+
(`cbox-support:open` with `detail.inline`), `ask()` answers whether the chat opened so the question
|
|
415
|
+
is never lost, and a product link raises `cbox-support:navigate`, which the shell turns into an app
|
|
416
|
+
visit so the conversation stays open.
|
|
407
417
|
|
|
408
418
|
A page's own `?` button uses `useShellHelp()?.toggleHelp()`, or `<PageHeader help />`. The page's
|
|
409
419
|
help topic is `shell.help.topic`, set on the server per route (console-kit's `helpTopic`), not
|
package/dist/index.d.ts
CHANGED
|
@@ -235,9 +235,29 @@ type HelpArticle = {
|
|
|
235
235
|
title: string;
|
|
236
236
|
excerpt?: string;
|
|
237
237
|
body?: string;
|
|
238
|
+
/** The body as HTML from Assistant's article endpoint. Shown only after `cleanArticleHtml`. */
|
|
239
|
+
bodyHtml?: string;
|
|
238
240
|
url?: string;
|
|
239
241
|
source?: string;
|
|
240
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* The support session Help reads Assistant's API with, when the app has no URL of its own for an
|
|
245
|
+
* endpoint (see `help-api.ts`). `key` is the session URL and organization it belongs to.
|
|
246
|
+
*/
|
|
247
|
+
type HelpSession = {
|
|
248
|
+
key: string;
|
|
249
|
+
status: 'loading' | 'ready';
|
|
250
|
+
/** The short-lived bearer token. Absent when the session could not be loaded. */
|
|
251
|
+
identity?: string;
|
|
252
|
+
/** When `identity` runs out, in milliseconds. */
|
|
253
|
+
expiresAt?: number;
|
|
254
|
+
searchUrl?: string;
|
|
255
|
+
/** Articles for a topic, as a template: `{topic}` is replaced. */
|
|
256
|
+
articlesUrl?: string;
|
|
257
|
+
/** One article with its body, as a template: `{id}` is replaced. */
|
|
258
|
+
articleUrl?: string;
|
|
259
|
+
updatesUrl?: string;
|
|
260
|
+
};
|
|
241
261
|
type SupportUpdate = {
|
|
242
262
|
id: string;
|
|
243
263
|
kind: 'ticket' | 'chat';
|
|
@@ -258,6 +278,10 @@ type HelpState = {
|
|
|
258
278
|
updatesStatus: HelpStatus;
|
|
259
279
|
/** A question waiting for the chat to be ready ("Ask Cbox: …" from the palette). */
|
|
260
280
|
pendingQuestion: string | null;
|
|
281
|
+
/** The chat fills the column instead of the home view (an SDK that renders it inline). */
|
|
282
|
+
chat: boolean;
|
|
283
|
+
/** The support session, once Help has asked for it. */
|
|
284
|
+
session: HelpSession | null;
|
|
261
285
|
/** Whether `open` was taken from the person's saved preference yet. */
|
|
262
286
|
seeded: boolean;
|
|
263
287
|
/**
|