@dashx/react 0.5.0 → 0.5.1

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.
@@ -0,0 +1,254 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+ declare const button: import("tailwind-variants").TVReturnType<{
3
+ size: {
4
+ extrasmall: string;
5
+ small: string;
6
+ medium: string;
7
+ large: string;
8
+ extralarge: string;
9
+ };
10
+ variant: {
11
+ fill: string;
12
+ outline: string;
13
+ simple: string;
14
+ ghost: string;
15
+ };
16
+ mode: {
17
+ distinct: string;
18
+ subtle: string;
19
+ negative: string;
20
+ };
21
+ roundness: {};
22
+ elevation: {};
23
+ shape: {
24
+ square: string;
25
+ rect: string;
26
+ };
27
+ inset: {
28
+ left: string;
29
+ right: string;
30
+ both: string;
31
+ };
32
+ }, undefined, "ease-fluid inline-flex items-center justify-center gap-2 outline-none transition-[box-shadow,background-color,color] duration-300 select-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-offset-2 data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:shadow-none", import("tailwind-variants/dist/config.js").TVConfig<{
33
+ size: {
34
+ extrasmall: string;
35
+ small: string;
36
+ medium: string;
37
+ large: string;
38
+ extralarge: string;
39
+ };
40
+ variant: {
41
+ fill: string;
42
+ outline: string;
43
+ simple: string;
44
+ ghost: string;
45
+ };
46
+ mode: {
47
+ distinct: string;
48
+ subtle: string;
49
+ negative: string;
50
+ };
51
+ roundness: {};
52
+ elevation: {};
53
+ shape: {
54
+ square: string;
55
+ rect: string;
56
+ };
57
+ inset: {
58
+ left: string;
59
+ right: string;
60
+ both: string;
61
+ };
62
+ }, {
63
+ size: {
64
+ extrasmall: string;
65
+ small: string;
66
+ medium: string;
67
+ large: string;
68
+ extralarge: string;
69
+ };
70
+ roundness: {
71
+ none: string;
72
+ small: string;
73
+ medium: string;
74
+ large: string;
75
+ full: string;
76
+ };
77
+ elevation: {
78
+ none: string;
79
+ small: string;
80
+ medium: string;
81
+ large: string;
82
+ };
83
+ }>, {
84
+ size: {
85
+ extrasmall: string;
86
+ small: string;
87
+ medium: string;
88
+ large: string;
89
+ extralarge: string;
90
+ };
91
+ roundness: {
92
+ none: string;
93
+ small: string;
94
+ medium: string;
95
+ large: string;
96
+ full: string;
97
+ };
98
+ elevation: {
99
+ none: string;
100
+ small: string;
101
+ medium: string;
102
+ large: string;
103
+ };
104
+ }, undefined, import("tailwind-variants").TVReturnType<{
105
+ size: {
106
+ extrasmall: string;
107
+ small: string;
108
+ medium: string;
109
+ large: string;
110
+ extralarge: string;
111
+ };
112
+ roundness: {
113
+ none: string;
114
+ small: string;
115
+ medium: string;
116
+ large: string;
117
+ full: string;
118
+ };
119
+ elevation: {
120
+ none: string;
121
+ small: string;
122
+ medium: string;
123
+ large: string;
124
+ };
125
+ }, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
126
+ size: {
127
+ extrasmall: string;
128
+ small: string;
129
+ medium: string;
130
+ large: string;
131
+ extralarge: string;
132
+ };
133
+ roundness: {
134
+ none: string;
135
+ small: string;
136
+ medium: string;
137
+ large: string;
138
+ full: string;
139
+ };
140
+ elevation: {
141
+ none: string;
142
+ small: string;
143
+ medium: string;
144
+ large: string;
145
+ };
146
+ }, {
147
+ size: {
148
+ extrasmall: string;
149
+ small: string;
150
+ medium: string;
151
+ large: string;
152
+ extralarge: string;
153
+ };
154
+ roundness: {
155
+ none: string;
156
+ small: string;
157
+ medium: string;
158
+ large: string;
159
+ full: string;
160
+ };
161
+ elevation: {
162
+ none: string;
163
+ small: string;
164
+ medium: string;
165
+ large: string;
166
+ };
167
+ }>, {
168
+ size: {
169
+ extrasmall: string;
170
+ small: string;
171
+ medium: string;
172
+ large: string;
173
+ extralarge: string;
174
+ };
175
+ roundness: {
176
+ none: string;
177
+ small: string;
178
+ medium: string;
179
+ large: string;
180
+ full: string;
181
+ };
182
+ elevation: {
183
+ none: string;
184
+ small: string;
185
+ medium: string;
186
+ large: string;
187
+ };
188
+ }, undefined, import("tailwind-variants").TVReturnType<{
189
+ size: {
190
+ extrasmall: string;
191
+ small: string;
192
+ medium: string;
193
+ large: string;
194
+ extralarge: string;
195
+ };
196
+ roundness: {
197
+ none: string;
198
+ small: string;
199
+ medium: string;
200
+ large: string;
201
+ full: string;
202
+ };
203
+ elevation: {
204
+ none: string;
205
+ small: string;
206
+ medium: string;
207
+ large: string;
208
+ };
209
+ }, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
210
+ size: {
211
+ extrasmall: string;
212
+ small: string;
213
+ medium: string;
214
+ large: string;
215
+ extralarge: string;
216
+ };
217
+ roundness: {
218
+ none: string;
219
+ small: string;
220
+ medium: string;
221
+ large: string;
222
+ full: string;
223
+ };
224
+ elevation: {
225
+ none: string;
226
+ small: string;
227
+ medium: string;
228
+ large: string;
229
+ };
230
+ }, {
231
+ size: {
232
+ extrasmall: string;
233
+ small: string;
234
+ medium: string;
235
+ large: string;
236
+ extralarge: string;
237
+ };
238
+ roundness: {
239
+ none: string;
240
+ small: string;
241
+ medium: string;
242
+ large: string;
243
+ full: string;
244
+ };
245
+ elevation: {
246
+ none: string;
247
+ small: string;
248
+ medium: string;
249
+ large: string;
250
+ };
251
+ }>, unknown, unknown, undefined>>>;
252
+ type ButtonVariantProps = VariantProps<typeof button>;
253
+ export type { ButtonVariantProps };
254
+ export { button };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashx/react",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "license": "UNLICENSED",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/cjs/index.js",
@@ -75,7 +75,7 @@
75
75
  "clean": "rm -rf .turbo node_modules dist tokens layout *.css"
76
76
  },
77
77
  "dependencies": {
78
- "@dashx/browser": "^0.13.1",
78
+ "@dashx/browser": "^0.14.0",
79
79
  "@radix-ui/colors": "^3.0.0",
80
80
  "@radix-ui/primitive": "^1.1.3",
81
81
  "@radix-ui/react-accessible-icon": "^1.1.8",
package/CHANGELOG.md DELETED
@@ -1,93 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `@dashx/react` are documented in this file. Format loosely follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versions follow [SemVer](https://semver.org/).
4
-
5
- ## [Unreleased]
6
-
7
- ### Added
8
-
9
- - **`DashXProvider` accepts `autocapture`.** `<DashXProvider autocapture ...>` (or `autocapture={{ pageleave: false }}`) turns on `@dashx/browser`'s page view / page leave capture for the provider's client. It is started and stopped in an effect, so StrictMode's double render does not leave a second set of listeners behind. Route changes are picked up from the History API, so no router integration is needed.
10
-
11
- - **`DashXProvider` accepts the privacy options** `maskPersonalDataProperties`, `customPersonalDataProperties` and `beforeSend`, and passes them to the client. Changing either masking option recreates the client. `beforeSend` is read on every event, so an inline function or a changed array takes effect without recreating it.
12
-
13
- Requires `@dashx/browser` 0.13.1 or later (`startAutocapture` and the privacy options). 0.13.0 was published from a stale build without them.
14
-
15
- - **README** documents `DashXProvider`, autocapture and the privacy props.
16
-
17
- ## [0.4.1] — 2026-08-05
18
-
19
- ### Changed
20
-
21
- - **`useInAppChatNotifications`'s `onActivate` now receives the message that raised the notification.**
22
-
23
- ```diff
24
- - onActivate?: () => void
25
- + onActivate?: (message: InAppChatMessageData) => void
26
- ```
27
-
28
- Notifications are tagged per conversation, so a surface watching more than one thread could raise several at once — but the old zero-argument callback gave the handler no way to tell them apart, and it closed over whichever message arrived last. Clicking an older notification opened the wrong conversation.
29
-
30
- **Backward compatible.** A `() => void` handler is still assignable and still behaves as before; take the parameter only if you need to route by `message.conversationId`. `InAppChatMessageData` is imported from `@dashx/browser`, same as the existing `renderBody` option on this hook.
31
-
32
- ## [0.4.0] — 2026-07-29
33
-
34
- ### Changed
35
-
36
- - **BREAKING — In-App Chat no longer creates conversations; the caller supplies one.** `useInAppChat` and both widgets participate in an EXISTING conversation:
37
-
38
- ```diff
39
- - useInAppChat({ identityId, idempotencyKey, initialMessage? })
40
- + useInAppChat({ identityId, conversationId })
41
- ```
42
-
43
- `idempotencyKey` and `initialMessage` are gone, along with the create-on-mount behaviour. `<InAppChat>` and `<InAppChatButton>` take a required `conversationId` prop in place of `idempotencyKey`/`initialMessage`.
44
-
45
- **Why.** Creating a chat is now server-only in DashX: identity-token callers are rejected outright, and the operation requires an `accountUid` naming the visitor — a claim no browser should be able to make. The conversation's `data`/`issueProperties` are metadata the agent console trusts, so they must be derived server-side. `@dashx/browser@0.10.0` therefore removes `startInAppChatConversation`, which is what this hook used.
46
-
47
- **Migration.** Create the conversation in your backend (for JVM services, `dashx-java` ≥ 1.5.0 exposes `DashX.startInAppChatConversation(input)`), return the id to your client, and pass it in:
48
-
49
- ```tsx
50
- const { conversationId } = useMyBackendChatSession(); // your endpoint
51
- <InAppChatButton identityId="<chat-identity-id>" conversationId={conversationId} />
52
- ```
53
-
54
- `conversationId` accepts `null` while you're still fetching it — the hook stays idle (no subscription, no history fetch) rather than guessing, so you can render the widget unconditionally.
55
- - **`conversationId` is no longer returned from the hook.** The caller now owns it, so echoing it back was noise. Everything else in the response is unchanged: `messages`, `isLoading`, `isConnected`, `error`, `sendMessage`.
56
- - `sendMessage(text)` returns `false` when there is no `conversationId` yet (or the hook is disabled) — same contract as before, so callers that keep the composer populated on `false` need no change.
57
- - **`@dashx/browser` dependency raised to `^0.10.0`** (a regular `dependencies` entry, as before), which is the release that removes the creation method.
58
-
59
- ### Unchanged
60
-
61
- - History fetch, realtime subscribe, optimistic send + reconciliation, reconnect refetch, and the notification hook all behave exactly as before. `<InAppChatButton>` still activates lazily on first open, so a launcher the visitor never opens does no chat work.
62
-
63
- ## [0.3.0] — 2026-06-18
64
-
65
- ### Added
66
-
67
- - **In-App Chat hook + widgets.** A two-way in-app chat surface for visitors:
68
- - `useInAppChat({ identityId, idempotencyKey, initialMessage? })` — manages the conversation lifecycle (start → subscribe → fetch history), exposes `messages`, `sendMessage(text)`, and loading/error state, and reconciles optimistic sends against the realtime echoes (deduping by message id and external uid). Refetches history on reconnect so a reply that landed during an outage isn't missed.
69
- - `<InAppChat>` — the chat surface (header / message list / composer).
70
- - `<InAppChatButton>` — a floating launcher that opens `<InAppChat>` in a popover. Props: `identityId`, `idempotencyKey`, `position` (`'bottom-right'` | `'bottom-left'` | `'top-right'` | `'top-left'`, default `'bottom-right'`), and `theme` (accent color, mode, roundness, …). The chat mounts lazily on open, so no conversation is created until the visitor opens the launcher.
71
-
72
- In-App Chat requires a visitor identity token configured on `DashXProvider` (see below); render the chat only once that token is available.
73
-
74
- Example — `<InAppChatButton>` with a `theme` override (all `ThemeProps` fields are optional and otherwise inherit from a surrounding `<Theme>` / `DashXProvider`):
75
-
76
- ```tsx
77
- <InAppChatButton
78
- identityId="<dashx-chat-identity-id>"
79
- idempotencyKey="main"
80
- position="bottom-right"
81
- theme={{
82
- accentBaseColor: '#6d28d9',
83
- mode: 'dark',
84
- roundness: 'large',
85
- }}
86
- />
87
- ```
88
- - **`DashXProvider` identity props.** New optional `identityUid?` and `identityToken?`. When set, the identity is applied on both transports — the Apollo `X-Identity-Token` header and the WebSocket handshake — which is the visitor auth In-App Chat needs. Pass `null` to clear on logout; omit (`undefined`) to leave unchanged. Pair `identityUid` with `identityToken` to address the same identity on both transports.
89
-
90
- ### Changed
91
-
92
- - **Bumped `@dashx/browser` to `^0.8.0`** — for the In-App Chat client methods, the `subscribeToChannel` helper, and the `setIdentity` "undefined = leave unchanged" semantics this provider relies on.
93
- - **Identity is now applied synchronously at client creation**, and the provider reconnects its own WebSocket when `identityToken` changes (so tracked chat channels re-subscribe under the new identity). Existing consumers that pass neither `identityUid` nor `identityToken` are unaffected — no extra `setIdentity` call, no reconnect, and the client is not recreated.