@botonic/webchat-react 2.35.0 β 2.37.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/CHANGELOG.md +14 -0
- package/lib/components/preview-events/hooks/use-knowledge-base-info.d.ts +1 -1
- package/lib/components/preview-events/preview-event-message/use-preview-event-message.d.ts +1 -1
- package/lib/components/webchat-messages/use-webchat-messages.d.ts +1 -51
- package/lib/components/webchat-provider/webchat-provider.d.ts +0 -1
- package/package.json +4 -4
- package/CLAUDE.md +0 -174
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 2.37.0 (2026-09-03)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for @botonic/webchat-react to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 2.36.0 (2026-09-02)
|
|
6
|
+
|
|
7
|
+
### π Features
|
|
8
|
+
|
|
9
|
+
- ts6 typecheck pass ([#1090](https://github.com/metis-ai/hubtype-product/pull/1090))
|
|
10
|
+
|
|
11
|
+
### β€οΈ Thank You
|
|
12
|
+
|
|
13
|
+
- Oriol RaventΓ³s @Iru89
|
|
14
|
+
|
|
1
15
|
## 2.35.0 (2026-08-03)
|
|
2
16
|
|
|
3
17
|
### π Features
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChunkIdsGroupedBySourceData,
|
|
1
|
+
import { ChunkIdsGroupedBySourceData, HubtypeSource, PreviewUtils } from '@botonic/shared';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
interface UseKnowledgeBaseInfoParams {
|
|
4
4
|
sourceIds: string[];
|
|
@@ -12,6 +12,6 @@ export declare function usePreviewEventMessage({ debugEvent, messageId, previewU
|
|
|
12
12
|
eventConfig: DebugEventConfig | undefined;
|
|
13
13
|
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
14
14
|
messageId: string | undefined;
|
|
15
|
-
previewUtils:
|
|
15
|
+
previewUtils: any;
|
|
16
16
|
handleContainerClick: (e: React.MouseEvent) => void;
|
|
17
17
|
};
|
|
@@ -11,57 +11,7 @@ export declare function useWebchatMessages(props: WebchatMessagesProps, state: W
|
|
|
11
11
|
style?: import('react').CSSProperties;
|
|
12
12
|
};
|
|
13
13
|
messageListProps: {
|
|
14
|
-
messageActors:
|
|
15
|
-
message: import('@botonic/webchat-core').WebchatMessage;
|
|
16
|
-
user: import('@botonic/shared').HubtypeUser;
|
|
17
|
-
status: import('@botonic/webchat-core').WebchatMessageStatus;
|
|
18
|
-
file?: File;
|
|
19
|
-
postMessageActor?: any;
|
|
20
|
-
}, {
|
|
21
|
-
type: "RETRY";
|
|
22
|
-
} | {
|
|
23
|
-
type: "UPDATE_MESSAGE_INFO";
|
|
24
|
-
message: {
|
|
25
|
-
id: string;
|
|
26
|
-
data: Record<string, string>;
|
|
27
|
-
};
|
|
28
|
-
} | {
|
|
29
|
-
type: "UPDATE_CUSTOM_PROPS";
|
|
30
|
-
props: Record<string, unknown>;
|
|
31
|
-
} | {
|
|
32
|
-
type: "BUTTON_CLICKED";
|
|
33
|
-
button: import('@botonic/shared').BotonicButtonContent;
|
|
34
|
-
}, {
|
|
35
|
-
[x: string]: import('xstate').ActorRefFromLogic<import('@botonic/webchat-core').PostMessageActor> | undefined;
|
|
36
|
-
}, "checkStatus" | "sending" | "idle" | "errorSendingMessage" | "performingPostback", string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, {
|
|
37
|
-
states: {
|
|
38
|
-
readonly checkStatus: {};
|
|
39
|
-
readonly sending: {};
|
|
40
|
-
readonly idle: {};
|
|
41
|
-
readonly performingPostback: {};
|
|
42
|
-
readonly errorSendingMessage: {};
|
|
43
|
-
};
|
|
44
|
-
}>, {
|
|
45
|
-
type: "RETRY";
|
|
46
|
-
} | {
|
|
47
|
-
type: "UPDATE_MESSAGE_INFO";
|
|
48
|
-
message: {
|
|
49
|
-
id: string;
|
|
50
|
-
data: Record<string, string>;
|
|
51
|
-
};
|
|
52
|
-
} | {
|
|
53
|
-
type: "UPDATE_CUSTOM_PROPS";
|
|
54
|
-
props: Record<string, unknown>;
|
|
55
|
-
} | {
|
|
56
|
-
type: "BUTTON_CLICKED";
|
|
57
|
-
button: import('@botonic/shared').BotonicButtonContent;
|
|
58
|
-
}, {
|
|
59
|
-
type: "PERSISTENCE.SAVE_MESSAGE";
|
|
60
|
-
} | {
|
|
61
|
-
type: "WEBVIEW.OPEN";
|
|
62
|
-
url: string;
|
|
63
|
-
title: string;
|
|
64
|
-
}>[];
|
|
14
|
+
messageActors: any[];
|
|
65
15
|
isTyping: any;
|
|
66
16
|
hasUserInteracted: boolean;
|
|
67
17
|
customMessageRenderer: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/webchat-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0",
|
|
32
32
|
"react-dom": "^18.0.0",
|
|
33
|
-
"@botonic/webchat-core": "2.
|
|
34
|
-
"@botonic/shared": "2.
|
|
35
|
-
"@lilara/ui-web-react": ">=0.11.
|
|
33
|
+
"@botonic/webchat-core": "2.37.0",
|
|
34
|
+
"@botonic/shared": "2.37.0",
|
|
35
|
+
"@lilara/ui-web-react": ">=0.11.2"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
package/CLAUDE.md
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: webchat-react conventions β hook/component split, CSS layers, webchat tokens, message components, inline SVGs, and animation patterns
|
|
3
|
-
globs: libs/botonic/webchat-react/**
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# webchat-react
|
|
8
|
-
|
|
9
|
-
Conventions specific to `libs/botonic/webchat-react`. Base rules in the root `CLAUDE.md` apply here too.
|
|
10
|
-
|
|
11
|
-
## Hook / Component Split
|
|
12
|
-
|
|
13
|
-
Every non-trivial component is split into:
|
|
14
|
-
|
|
15
|
-
- **`use-[component].ts`** β all state, refs, callbacks, derived values; returns named prop bundles
|
|
16
|
-
- **`[component].tsx`** β pure render only; spreads prop bundles from the hook
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
webchat-input/
|
|
20
|
-
βββ use-webchat-input.ts
|
|
21
|
-
βββ webchat-input.tsx
|
|
22
|
-
βββ webchat-input.module.css
|
|
23
|
-
βββ webchat-input.spec.tsx
|
|
24
|
-
βββ index.ts
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Before touching any component, check:**
|
|
28
|
-
|
|
29
|
-
1. Does a `use-[component].ts` already exist? If not, create it as part of your change.
|
|
30
|
-
2. Is all state, refs, callbacks, and derived values in the hook β not in the `.tsx` file?
|
|
31
|
-
3. Does the `.tsx` file only render β no `useState`, `useRef`, `useCallback`, or business logic?
|
|
32
|
-
|
|
33
|
-
Violating this in a PR is a blocker. When adding a feature or fixing a bug in a component that lacks a hook, refactor it in the same PR.
|
|
34
|
-
|
|
35
|
-
Hook return shape uses named bundles, not flat props:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
return {
|
|
39
|
-
inputProps: { value, onChange: handleChange, onKeyDown: handleKeyDown },
|
|
40
|
-
primaryActionProps: { onClick: handleSubmit, 'aria-label': submitLabel },
|
|
41
|
-
variants: { isDisabled, hasError, isEmpty },
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## CSS Layers
|
|
46
|
-
|
|
47
|
-
The cascade stack, from lowest to highest priority:
|
|
48
|
-
|
|
49
|
-
| Layer | Who writes it | Purpose |
|
|
50
|
-
| --------------------------- | ------------------------- | ------------------------------------------------------------ |
|
|
51
|
-
| `@layer components` | webchat-react | Base component styles |
|
|
52
|
-
| `@layer component-variants` | webchat-react | Visual variants of components (e.g. different bubble styles) |
|
|
53
|
-
| `@layer overrides` | `webchat-tokens.css` only | Library-default token values |
|
|
54
|
-
| _(unlayered)_ | Bot app consumers | Final consumer customizations β always wins |
|
|
55
|
-
|
|
56
|
-
**Component styles β `@layer components`.**
|
|
57
|
-
|
|
58
|
-
```css
|
|
59
|
-
@layer components {
|
|
60
|
-
.documentMessage {
|
|
61
|
-
width: auto;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**CSS animations:** declare `@keyframes` outside any layer (global scope), use them inside `@layer components`. Add `@media (prefers-reduced-motion: reduce)` outside any layer too.
|
|
67
|
-
|
|
68
|
-
**Token default values β `@layer overrides`** in `webchat-tokens.css` only. Bot apps override tokens with unlayered CSS in their own `webchat-tokens-overrides.css`.
|
|
69
|
-
|
|
70
|
-
```css
|
|
71
|
-
/* webchat-tokens.css */
|
|
72
|
-
@layer overrides {
|
|
73
|
-
:root {
|
|
74
|
-
--webchat-input-bg: var(--lilara-surface-foreground);
|
|
75
|
-
--webchat-send-button-color: var(--lilara-primary-500);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
> **Never add end-consumer override CSS in library code.** The `@layer overrides` in `webchat-tokens.css` is for library defaults only. Bot apps write their own overrides in `webchat-tokens-overrides.css`.
|
|
81
|
-
|
|
82
|
-
## Webchat Tokens (`--webchat-*`)
|
|
83
|
-
|
|
84
|
-
Every value a consumer might want to customize must be a `--webchat-*` token defined in `webchat-tokens.css`.
|
|
85
|
-
|
|
86
|
-
Pattern: `--webchat-{component}-{property}` with fallback to a semantic foundations token:
|
|
87
|
-
|
|
88
|
-
```css
|
|
89
|
-
--webchat-input-bg: var(--lilara-surface-foreground);
|
|
90
|
-
--webchat-send-button-color: var(--lilara-primary-500);
|
|
91
|
-
--webchat-bubble-bot-bg: var(--lilara-primary-50);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Prefer `--lilara-primary-*` / `--lilara-secondary-*` over raw `--lilara-color-purple-*` / `--lilara-color-aqua-*`.
|
|
95
|
-
Prefer `--lilara-color-focus` over `--lilara-secondary-600` directly.
|
|
96
|
-
|
|
97
|
-
## Message Components
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
components/message/[message-type]/
|
|
101
|
-
βββ [message-type]-message.tsx # forwardRef, extends MessageProps
|
|
102
|
-
βββ [message-type]-message.module.css
|
|
103
|
-
βββ [message-type]-message.stories.tsx
|
|
104
|
-
βββ index.ts
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
See the `create-new-message-type` skill for the full step-by-step guide.
|
|
108
|
-
|
|
109
|
-
## Inline SVGs
|
|
110
|
-
|
|
111
|
-
No external icon library. Rules:
|
|
112
|
-
|
|
113
|
-
1. Extract each SVG into a **React function component** in `webchat-input/icons/` (e.g. `play-icon.tsx`)
|
|
114
|
-
2. Use `currentColor` for fill/stroke
|
|
115
|
-
3. Set `role='img'` and `aria-hidden={true}` on decorative SVGs
|
|
116
|
-
4. Import and render as `<PlayIcon />` β never inline SVG markup inside a component
|
|
117
|
-
|
|
118
|
-
```tsx
|
|
119
|
-
// Good β dedicated icon component
|
|
120
|
-
// webchat-input/icons/play-icon.tsx
|
|
121
|
-
export function PlayIcon() {
|
|
122
|
-
return (
|
|
123
|
-
<svg viewBox='0 0 24 24' fill='currentColor' role='img' aria-hidden={true}>
|
|
124
|
-
<polygon points='5,3 19,12 5,21' />
|
|
125
|
-
</svg>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Good β import and use
|
|
130
|
-
import { PlayIcon } from '../icons/play-icon'
|
|
131
|
-
const MyButton = () => (
|
|
132
|
-
<button>
|
|
133
|
-
<PlayIcon />
|
|
134
|
-
</button>
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
// Bad β SVG inlined directly inside a component
|
|
138
|
-
const MyButton = () => (
|
|
139
|
-
<button>
|
|
140
|
-
<svg viewBox='0 0 24 24'>...</svg>
|
|
141
|
-
</button>
|
|
142
|
-
)
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Animations
|
|
146
|
-
|
|
147
|
-
Prefer CSS keyframes over JS animation libraries. Define keyframes **outside any layer**, use them inside `@layer component-variants`. Always add `prefers-reduced-motion`.
|
|
148
|
-
|
|
149
|
-
```css
|
|
150
|
-
@keyframes webchat-fade-in {
|
|
151
|
-
from {
|
|
152
|
-
opacity: 0;
|
|
153
|
-
transform: translateY(4px);
|
|
154
|
-
}
|
|
155
|
-
to {
|
|
156
|
-
opacity: 1;
|
|
157
|
-
transform: translateY(0);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@layer component-variants {
|
|
162
|
-
.messageEnter {
|
|
163
|
-
animation: webchat-fade-in var(--webchat-animation-duration, var(--lilara-transition-duration-fast)) var(--webchat-animation-easing, ease-out) both;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
@media (prefers-reduced-motion: reduce) {
|
|
168
|
-
.messageEnter {
|
|
169
|
-
animation: none;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
See the `webchat-animations` skill for token naming conventions and keyframe architecture.
|