@aiden-voice/widget 0.5.3 → 0.6.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 +92 -1
- package/dist/components/Launcher.d.ts +5 -1
- package/dist/components/icons.d.ts +6 -0
- package/dist/config.d.ts +33 -1
- package/dist/controller.d.ts +2 -0
- package/dist/index.d.ts +4 -3
- package/dist/layout.d.ts +2 -0
- package/dist/theme.d.ts +21 -2
- package/dist/themeRoles.d.ts +5 -0
- package/dist/types.d.ts +76 -1
- package/dist/version.d.ts +1 -1
- package/dist/widget.iife.js +7 -7
- package/dist/widget.js +779 -440
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,7 +103,9 @@ throws synchronously, at call time, if you pass both or neither.
|
|
|
103
103
|
| `accentColor` | Link color in replies. Darkened automatically if needed to stay readable. Overrides the color configured in whoo-aiden; omit it to use that one. | whoo-aiden's, else `'#0000ee'` |
|
|
104
104
|
| `name` | Agent name for the panel header and the dialog's screen-reader label ("Chat with {name}"). Overrides the name configured in whoo-aiden; omit it to use that one. | whoo-aiden's, else `'Aiden'` |
|
|
105
105
|
| `greeting` | Welcome text shown in the panel before the first message. | none |
|
|
106
|
-
| `launcherIconUrl` | Image shown on the launcher bubble instead of the default chat icon. `https:` or `data:image/` only. Until it loads, and permanently if it fails, the default icon shows. | none (default icon) |
|
|
106
|
+
| `launcherIconUrl` | Image shown on the launcher bubble instead of the default chat icon. `https:` or `data:image/` only. Until it loads, and permanently if it fails, the default icon shows. Alias of `theme.launcher.iconUrl`. | none (default icon) |
|
|
107
|
+
| `theme` | Colors, font and launcher icons. See [Theming](#theming). | defaults |
|
|
108
|
+
| `layout` | Launcher position and size, and panel size. See [Layout](#layout). | defaults |
|
|
107
109
|
| `emptyStateImageUrl` | Image (e.g. a brand lockup) shown above the greeting while the conversation is empty. `https:` or `data:image/` only. Removed if it fails to load. | none |
|
|
108
110
|
| `emptyStateImageAlt` | Alt text for `emptyStateImageUrl`. Set it when the image carries meaning (e.g. your brand name); omit it for a purely decorative image. | none (decorative) |
|
|
109
111
|
| `showFeedback` | Show thumbs up/down controls under each reply so visitors can rate answers (a thumbs-down opens an optional correction form). | `false` (hidden) |
|
|
@@ -114,6 +116,82 @@ throws synchronously, at call time, if you pass both or neither.
|
|
|
114
116
|
|
|
115
117
|
Some third-party overlays (accessibility toolbars, chat or cookie widgets) sit at the maximum possible z-index, `2147483647`, in the same corner. No `zIndex` value can beat that: at an equal level, whichever element comes later in the page wins, and those overlays are usually injected after the widget. Move the widget to the other corner with `position: 'bottom-left'` instead.
|
|
116
118
|
|
|
119
|
+
## Theming
|
|
120
|
+
|
|
121
|
+
`color`, `inkColor` and `accentColor` set the brand colors, and the widget calculates the rest (the text on your color, the header text, and so on) so everything stays readable. When an edge case breaks that, the `theme` option overrides any individual color, the font, and the launcher icons.
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
init({
|
|
125
|
+
publishableKey: 'pk_live_...',
|
|
126
|
+
theme: {
|
|
127
|
+
colors: {
|
|
128
|
+
// A dark theme: every surface is overridden together with the roles drawn on it.
|
|
129
|
+
primary: '#0a7d5a',
|
|
130
|
+
onPrimary: '#ffffff', // text on `primary`; calculated if you leave it out
|
|
131
|
+
panel: '#0f172a',
|
|
132
|
+
border: '#334155',
|
|
133
|
+
headerHover: '#1e293b',
|
|
134
|
+
primaryText: '#f1f5f9', // header buttons, on `panel` and `headerHover`
|
|
135
|
+
text: '#f8fafc', // inputs and feedback buttons
|
|
136
|
+
focusRing: '#f8fafc', // keyboard focus outline, on `panel`
|
|
137
|
+
assistantBubble: '#1e293b',
|
|
138
|
+
ink: '#f8fafc',
|
|
139
|
+
link: '#7dd3fc',
|
|
140
|
+
muted: '#cbd5e1',
|
|
141
|
+
},
|
|
142
|
+
fonts: { family: '"Inter", system-ui, sans-serif' },
|
|
143
|
+
launcher: { icon: 'sparkle', openIcon: 'close' },
|
|
144
|
+
},
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Colors.** An override is used exactly as you give it: the widget does not darken it or fix its contrast, and only logs a `console.warn` when the contrast looks too low. You own the result for every role you override. An unusable value (a typo, `currentColor`, a CSS variable) is ignored with a warning and the calculated color is used instead. A role you don't set keeps the widget's calculated color. `theme.colors.primary`, `.ink` and `.link` beat `color`, `inkColor` and `accentColor`, which beat the agent's colors configured in whoo-aiden.
|
|
149
|
+
|
|
150
|
+
| Role | What it colors | Default |
|
|
151
|
+
| --- | --- | --- |
|
|
152
|
+
| `primary` | Launcher, your visitor's bubbles, Send and Submit buttons | `#4f46e5` |
|
|
153
|
+
| `onPrimary` | Text and icons on `primary` | black or white, whichever reads best |
|
|
154
|
+
| `primaryText` | `primary` used as text on the panel (header controls) | `primary`, darkened until readable |
|
|
155
|
+
| `ink` | Header title and replies | `#111111` |
|
|
156
|
+
| `link` | Links in replies | `#0000ee` |
|
|
157
|
+
| `text` | Form-control and feedback-button text | `#111111` |
|
|
158
|
+
| `panel` | Panel background | `#ffffff` |
|
|
159
|
+
| `border` | Dividers | `#e5e5e5` |
|
|
160
|
+
| `headerHover` | Header control hover fill | `#f3f4f6` |
|
|
161
|
+
| `assistantBubble` | Reply bubble background | `#f0f0f0` |
|
|
162
|
+
| `muted` | Secondary text on replies | `#4b5563` |
|
|
163
|
+
| `typingDots` | "Waiting for a reply" dots | `#6b7280` |
|
|
164
|
+
| `errorBackground`, `errorText` | Error banner | `#fee2e2`, `#991b1b` |
|
|
165
|
+
| `inputBorder` | Input and form borders | `#6b7280` |
|
|
166
|
+
| `focusRing` | Dark tone of the keyboard focus outline | `#111827` |
|
|
167
|
+
|
|
168
|
+
If you override a surface (`panel`, `assistantBubble`, ...), also override the roles drawn on it: the defaults are made for the default surfaces, and an override of one is never adjusted to fit another. The roles drawn on each surface are `panel`: `primaryText`, `text`, `focusRing`, `border`, `inputBorder`; `headerHover`: `primaryText`; `assistantBubble`: `ink`, `link`, `muted`, `typingDots`, `text`; `errorBackground`: `errorText`. (The example above leaves `inputBorder`, `typingDots` and the error colors at their defaults, which already read well on it.)
|
|
169
|
+
|
|
170
|
+
**Fonts.** `theme.fonts.family` takes a CSS font-family stack. The widget never loads fonts, so the font must already be available: a system font, or one your page loads (a Google Fonts `<link>`, or your own `@font-face`). A stack that is over 200 characters or contains `url(`, `@`, `;`, `{`, `}` or `\` is ignored with a warning.
|
|
171
|
+
|
|
172
|
+
**Launcher icons.** `theme.launcher.icon` picks a built-in icon for the closed launcher (`'chat'`, `'message'`, `'sparkle'`); `theme.launcher.openIcon` picks the open one (`'chevron-down'`, `'close'`). `theme.launcher.iconUrl` and `theme.launcher.openIconUrl` show your own image instead (`https:` or `data:image/` only; the built-in icon shows until the image loads, and for good if it fails).
|
|
173
|
+
|
|
174
|
+
## Layout
|
|
175
|
+
|
|
176
|
+
`position` picks the corner. `layout` fine-tunes where the launcher sits and how big the launcher and panel are. All values are in px.
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
init({
|
|
180
|
+
publishableKey: 'pk_live_...',
|
|
181
|
+
position: 'bottom-right',
|
|
182
|
+
layout: {
|
|
183
|
+
offset: { x: 24, y: 96 }, // distance from the chosen corner (default 20, 20)
|
|
184
|
+
launcherSize: 64, // launcher diameter, 24-120 (default 56)
|
|
185
|
+
panel: { width: 420, height: 640 }, // preferred panel size (default 360×480, minimum 280×320)
|
|
186
|
+
},
|
|
187
|
+
})
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- The launcher can't be moved off-screen, and not so far from its corner that the chat panel loses its room: an offset that doesn't leave space for the launcher and a minimum-size panel is held back (a warning is logged if that applies when the page loads). A smaller offset than the 20px default is always honored.
|
|
191
|
+
- A `launcherSize` outside 24-120 is clamped (the 24px floor is WCAG 2.2's minimum target size).
|
|
192
|
+
- The panel is always placed above the launcher, whatever its size or offset, and is capped to the viewport. `panel` is a preferred size: it can never run past the screen, and on very small screens (a viewport 400px wide or less, or 420px tall or less) it fills the viewport as before. A `panel.width` or `panel.height` below 280×320 is raised to that minimum, with a warning.
|
|
193
|
+
- A value that isn't a non-negative number is ignored with a warning and the default is used.
|
|
194
|
+
|
|
117
195
|
## Theme helper
|
|
118
196
|
|
|
119
197
|
`resolveTheme` (npm package only) returns the exact colors the widget will render for a set of brand colors, the same computation the widget runs internally. Use it to preview branding without mounting the widget:
|
|
@@ -129,6 +207,19 @@ const theme = resolveTheme({ color: '#3b82f6', inkColor: '#1f2937', accentColor:
|
|
|
129
207
|
// opaque look over white doesn't count.
|
|
130
208
|
```
|
|
131
209
|
|
|
210
|
+
`resolveTheme` also accepts `overrides`, the same per-role object as `theme.colors`, and returns three more fields:
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
const dark = resolveTheme({ overrides: { panel: '#0f172a', ink: '#f8fafc' } })
|
|
214
|
+
// dark.roles: every color the widget renders, by role (all 16 of them).
|
|
215
|
+
// dark.overridden: which roles came from `overrides`.
|
|
216
|
+
// dark.contrastWarnings: overridden roles whose contrast against the surface
|
|
217
|
+
// they are drawn on is below 4.5:1 (text) or 3:1 (icons, borders, focus ring),
|
|
218
|
+
// each with { role, against, value, ratio, required }.
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
An override is never adjusted (an opaque one is only normalized to `#rrggbb`). In particular a *translucent* override (`rgba(…, 0.5)`, `#rrggbbaa`) is kept as given, not flattened to its look over white the way `color` is, so a translucent `primary` or `panel` is see-through over the host page, and the host owns the result. `resolveTheme` never logs; read `contrastWarnings` instead.
|
|
222
|
+
|
|
132
223
|
It needs a DOM (a browser, or jsdom in tests).
|
|
133
224
|
|
|
134
225
|
## Versions
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { RefObject } from 'preact';
|
|
2
|
-
|
|
2
|
+
import { LauncherIcon, LauncherOpenIcon } from '../types';
|
|
3
|
+
export declare function Launcher({ isOpen, onClick, iconUrl, icon, openIconUrl, openIcon, buttonRef, }: {
|
|
3
4
|
isOpen: boolean;
|
|
4
5
|
onClick: () => void;
|
|
5
6
|
iconUrl?: string;
|
|
7
|
+
icon?: LauncherIcon;
|
|
8
|
+
openIconUrl?: string;
|
|
9
|
+
openIcon?: LauncherOpenIcon;
|
|
6
10
|
buttonRef?: RefObject<HTMLButtonElement | null>;
|
|
7
11
|
}): import('preact').JSX.Element;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export declare function ChatIcon({ size }: {
|
|
2
2
|
size?: number;
|
|
3
3
|
}): import('preact').JSX.Element;
|
|
4
|
+
export declare function MessageIcon({ size }: {
|
|
5
|
+
size?: number;
|
|
6
|
+
}): import('preact').JSX.Element;
|
|
7
|
+
export declare function SparkleIcon({ size }: {
|
|
8
|
+
size?: number;
|
|
9
|
+
}): import('preact').JSX.Element;
|
|
4
10
|
export declare function ChevronDownIcon({ size }: {
|
|
5
11
|
size?: number;
|
|
6
12
|
}): import('preact').JSX.Element;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThemeColorOverrides } from './themeRoles';
|
|
2
|
+
import { LauncherIcon, LauncherOpenIcon, WidgetConfig } from './types';
|
|
2
3
|
export declare const DEFAULT_API_BASE_URL = "https://api.aidenvoice.com";
|
|
3
4
|
export declare const DEFAULT_Z_INDEX = 2147483000;
|
|
4
5
|
export declare function resolveZIndex(zIndex: unknown): number;
|
|
5
6
|
export declare const DEFAULT_AGENT_NAME = "Aiden";
|
|
6
7
|
export declare function trimmedName(name: unknown): string;
|
|
7
8
|
export declare function validateConfig(config: WidgetConfig): void;
|
|
9
|
+
export declare function safeFontFamily(value: unknown): string | undefined;
|
|
10
|
+
export interface NormalizedTheme {
|
|
11
|
+
colors: ThemeColorOverrides;
|
|
12
|
+
fontFamily: string | undefined;
|
|
13
|
+
launcher: {
|
|
14
|
+
icon?: LauncherIcon;
|
|
15
|
+
iconUrl?: string;
|
|
16
|
+
openIcon?: LauncherOpenIcon;
|
|
17
|
+
openIconUrl?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function normalizeTheme(theme: unknown): NormalizedTheme;
|
|
21
|
+
export declare const LAYOUT_DEFAULTS: {
|
|
22
|
+
readonly offsetX: 20;
|
|
23
|
+
readonly offsetY: 20;
|
|
24
|
+
readonly launcherSize: 56;
|
|
25
|
+
readonly panelWidth: 360;
|
|
26
|
+
readonly panelHeight: 480;
|
|
27
|
+
};
|
|
28
|
+
export declare const LAUNCHER_SIZE_MIN = 24;
|
|
29
|
+
export declare const LAUNCHER_SIZE_MAX = 120;
|
|
30
|
+
export declare const PANEL_MIN_WIDTH = 280;
|
|
31
|
+
export declare const PANEL_MIN_HEIGHT = 320;
|
|
32
|
+
export interface NormalizedLayout {
|
|
33
|
+
offsetX: number;
|
|
34
|
+
offsetY: number;
|
|
35
|
+
launcherSize: number;
|
|
36
|
+
panelWidth: number;
|
|
37
|
+
panelHeight: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function normalizeLayout(layout: unknown): NormalizedLayout;
|
package/dist/controller.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NormalizedTheme } from './config';
|
|
1
2
|
import { WidgetConfig } from './types';
|
|
2
3
|
export declare const SLOW_RESPONSE_DELAY_MS = 8000;
|
|
3
4
|
export declare const BRANDING_LOOKUP_WAIT_MS = 3000;
|
|
@@ -40,6 +41,7 @@ export declare class WidgetController {
|
|
|
40
41
|
private activeRequestController;
|
|
41
42
|
private slowResponseTimer;
|
|
42
43
|
private readonly prefersReducedMotion;
|
|
44
|
+
readonly launcher: NormalizedTheme['launcher'];
|
|
43
45
|
readonly launcherIconUrl: string | undefined;
|
|
44
46
|
readonly emptyStateImageUrl: string | undefined;
|
|
45
47
|
readonly emptyStateImageAlt: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { WidgetConfig, WidgetHandle } from './types';
|
|
1
|
+
import { LauncherIcon, LauncherOpenIcon, WidgetConfig, WidgetHandle, WidgetLayout, WidgetTheme } from './types';
|
|
2
2
|
export declare function init(config: WidgetConfig): WidgetHandle;
|
|
3
|
-
export type { ResolvedTheme, ThemeInput } from './theme';
|
|
3
|
+
export type { ContrastWarning, ResolvedTheme, ThemeInput } from './theme';
|
|
4
4
|
export { resolveTheme } from './theme';
|
|
5
|
-
export type {
|
|
5
|
+
export type { ThemeColorOverrides, ThemeColorRole } from './themeRoles';
|
|
6
|
+
export type { LauncherIcon, LauncherOpenIcon, WidgetConfig, WidgetHandle, WidgetLayout, WidgetTheme, };
|
package/dist/layout.d.ts
ADDED
package/dist/theme.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ThemeColorOverrides, ThemeColorRole } from './themeRoles';
|
|
1
2
|
import { WidgetConfig } from './types';
|
|
2
3
|
export declare function pickTextColor(cssColor: string): '#000000' | '#ffffff';
|
|
3
4
|
export declare function contrastRatio(cssColorA: string, cssColorB: string): number;
|
|
@@ -6,6 +7,17 @@ export interface ThemeInput {
|
|
|
6
7
|
color?: string | null;
|
|
7
8
|
inkColor?: string | null;
|
|
8
9
|
accentColor?: string | null;
|
|
10
|
+
/** Per-role replacements. Used verbatim; they win over `color`/`inkColor`/`accentColor`. */
|
|
11
|
+
overrides?: ThemeColorOverrides;
|
|
12
|
+
}
|
|
13
|
+
export interface ContrastWarning {
|
|
14
|
+
role: ThemeColorRole;
|
|
15
|
+
/** The role whose color this one is drawn on. */
|
|
16
|
+
against: ThemeColorRole;
|
|
17
|
+
/** The overridden value. */
|
|
18
|
+
value: string;
|
|
19
|
+
ratio: number;
|
|
20
|
+
required: number;
|
|
9
21
|
}
|
|
10
22
|
export interface ResolvedTheme {
|
|
11
23
|
/** Launcher, visitor bubbles, Send and Submit button fill. */
|
|
@@ -23,19 +35,26 @@ export interface ResolvedTheme {
|
|
|
23
35
|
* Flattening a translucent color to its opaque look over white doesn't
|
|
24
36
|
* count -- that's compositing, not a readability adjustment, and it
|
|
25
37
|
* lightens rather than darkens, so a "shown a little darker" note would
|
|
26
|
-
* be wrong for it.
|
|
38
|
+
* be wrong for it. An explicit override is never adjusted.
|
|
27
39
|
*/
|
|
28
40
|
adjusted: {
|
|
29
41
|
primary: boolean;
|
|
30
42
|
ink: boolean;
|
|
31
43
|
link: boolean;
|
|
32
44
|
};
|
|
45
|
+
/** Every color the widget renders, by role. */
|
|
46
|
+
roles: Record<ThemeColorRole, string>;
|
|
47
|
+
/** Which roles came from `overrides` (and so were used verbatim). */
|
|
48
|
+
overridden: Record<ThemeColorRole, boolean>;
|
|
49
|
+
/** Overridden roles whose contrast is below what their surface needs. */
|
|
50
|
+
contrastWarnings: ContrastWarning[];
|
|
33
51
|
}
|
|
34
52
|
export declare function usableHex(color: unknown): string | null;
|
|
35
|
-
export declare function resolveTheme({ color, inkColor, accentColor }: ThemeInput): ResolvedTheme;
|
|
53
|
+
export declare function resolveTheme({ color, inkColor, accentColor, overrides, }: ThemeInput): ResolvedTheme;
|
|
36
54
|
export declare function applyThemeColor(root: HTMLElement, color: string, fallback?: string): void;
|
|
37
55
|
export declare function applyPalette(root: HTMLElement, { inkColor, accentColor }: {
|
|
38
56
|
inkColor?: string | null;
|
|
39
57
|
accentColor?: string | null;
|
|
40
58
|
}): void;
|
|
59
|
+
export declare function applyColorOverrides(root: HTMLElement, overrides: ThemeColorOverrides): void;
|
|
41
60
|
export declare function applyTheme(root: HTMLElement, config: WidgetConfig): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const THEME_COLOR_ROLES: readonly ["primary", "onPrimary", "primaryText", "ink", "link", "text", "panel", "border", "headerHover", "assistantBubble", "muted", "typingDots", "errorBackground", "errorText", "inputBorder", "focusRing"];
|
|
2
|
+
export type ThemeColorRole = (typeof THEME_COLOR_ROLES)[number];
|
|
3
|
+
export type ThemeColorOverrides = Partial<Record<ThemeColorRole, string>>;
|
|
4
|
+
export declare const ROLE_DEFAULTS: Readonly<Record<ThemeColorRole, string>>;
|
|
5
|
+
export declare const ROLE_CSS_VARS: Readonly<Record<ThemeColorRole, string>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
+
export type LauncherIcon = 'chat' | 'message' | 'sparkle';
|
|
2
|
+
export type LauncherOpenIcon = 'chevron-down' | 'close';
|
|
3
|
+
export interface WidgetTheme {
|
|
4
|
+
/**
|
|
5
|
+
* Replace any color the widget renders. Used exactly as given: no
|
|
6
|
+
* darkening, no contrast correction (a low-contrast value only logs a
|
|
7
|
+
* warning). Omit a role to keep the widget's calculated color.
|
|
8
|
+
*/
|
|
9
|
+
colors?: {
|
|
10
|
+
/** Launcher, visitor bubbles, Send/Submit fill. Beats `color`. */
|
|
11
|
+
primary?: string;
|
|
12
|
+
/** Text and icons on `primary`. Calculated (black or white) when omitted. */
|
|
13
|
+
onPrimary?: string;
|
|
14
|
+
/** `primary` used as text on the panel (header controls). Calculated when omitted. */
|
|
15
|
+
primaryText?: string;
|
|
16
|
+
/** Header title and reply text. Beats `inkColor`. */
|
|
17
|
+
ink?: string;
|
|
18
|
+
/** Links in replies. Beats `accentColor`. */
|
|
19
|
+
link?: string;
|
|
20
|
+
/** Form-control and feedback-button text. */
|
|
21
|
+
text?: string;
|
|
22
|
+
/** Panel background (also the header and sticky action surfaces). */
|
|
23
|
+
panel?: string;
|
|
24
|
+
/** Dividers. */
|
|
25
|
+
border?: string;
|
|
26
|
+
/** Header control hover fill. */
|
|
27
|
+
headerHover?: string;
|
|
28
|
+
/** Reply bubble background. */
|
|
29
|
+
assistantBubble?: string;
|
|
30
|
+
/** Secondary text on the reply bubble. */
|
|
31
|
+
muted?: string;
|
|
32
|
+
/** Waiting-for-reply indicator. */
|
|
33
|
+
typingDots?: string;
|
|
34
|
+
errorBackground?: string;
|
|
35
|
+
errorText?: string;
|
|
36
|
+
inputBorder?: string;
|
|
37
|
+
/** The dark tone of the focus outline. */
|
|
38
|
+
focusRing?: string;
|
|
39
|
+
};
|
|
40
|
+
fonts?: {
|
|
41
|
+
/**
|
|
42
|
+
* A CSS font-family stack. The font must already be available: a system
|
|
43
|
+
* font, or one your page loaded. The widget never loads fonts.
|
|
44
|
+
*/
|
|
45
|
+
family?: string;
|
|
46
|
+
};
|
|
47
|
+
launcher?: {
|
|
48
|
+
/** Built-in icon on the closed launcher. */
|
|
49
|
+
icon?: LauncherIcon;
|
|
50
|
+
/** Image on the closed launcher; wins over `icon` and over `launcherIconUrl`. */
|
|
51
|
+
iconUrl?: string;
|
|
52
|
+
/** Built-in icon on the open launcher (the minimize control). */
|
|
53
|
+
openIcon?: LauncherOpenIcon;
|
|
54
|
+
/** Image on the open launcher; wins over `openIcon`. */
|
|
55
|
+
openIconUrl?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface WidgetLayout {
|
|
59
|
+
/** Distance in px from the corner chosen by `position`. Default `{ x: 20, y: 20 }`. */
|
|
60
|
+
offset?: {
|
|
61
|
+
x?: number;
|
|
62
|
+
y?: number;
|
|
63
|
+
};
|
|
64
|
+
/** Launcher diameter in px, 24-120. Default 56. */
|
|
65
|
+
launcherSize?: number;
|
|
66
|
+
/** Preferred panel size in px (minimum 280×320, always capped to the viewport). Default 360×480. */
|
|
67
|
+
panel?: {
|
|
68
|
+
width?: number;
|
|
69
|
+
height?: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
1
72
|
export interface WidgetConfig {
|
|
2
73
|
publishableKey?: string;
|
|
3
74
|
sessionToken?: string;
|
|
@@ -19,7 +90,7 @@ export interface WidgetConfig {
|
|
|
19
90
|
accentColor?: string;
|
|
20
91
|
name?: string;
|
|
21
92
|
greeting?: string;
|
|
22
|
-
/** Image shown on the launcher bubble instead of the default chat icon. */
|
|
93
|
+
/** Image shown on the launcher bubble instead of the default chat icon. Alias of `theme.launcher.iconUrl`, which wins if both are set. */
|
|
23
94
|
launcherIconUrl?: string;
|
|
24
95
|
/** Image shown above the greeting while the conversation is empty. */
|
|
25
96
|
emptyStateImageUrl?: string;
|
|
@@ -33,6 +104,10 @@ export interface WidgetConfig {
|
|
|
33
104
|
*/
|
|
34
105
|
zIndex?: number;
|
|
35
106
|
apiBaseUrl?: string;
|
|
107
|
+
/** Colors, font and launcher icons. See `WidgetTheme`. */
|
|
108
|
+
theme?: WidgetTheme;
|
|
109
|
+
/** Launcher position/size and panel size. See `WidgetLayout`. */
|
|
110
|
+
layout?: WidgetLayout;
|
|
36
111
|
}
|
|
37
112
|
export interface WidgetHandle {
|
|
38
113
|
unmount(): void;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const WIDGET_VERSION = "0.
|
|
1
|
+
export declare const WIDGET_VERSION = "0.6.0";
|