@helpway/react 0.13.3 → 0.14.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/dist/index.d.ts +53 -9
- package/dist/index.js +1975 -1194
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/themed/styles.css +1251 -93
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _helpway_widget_core from '@helpway/widget-core';
|
|
3
|
-
import { HelpwayMethods, WidgetTheme, WidgetStore } from '@helpway/widget-core';
|
|
3
|
+
import { HelpwayMethods, WidgetPlacement, DockSuggestion, WidgetTheme, WidgetStore } from '@helpway/widget-core';
|
|
4
4
|
export { ConversationSummary, HelpwayAPI, RealtimeEvent, TimelineItem, WidgetEventName, WidgetEvents, WidgetPosition, WidgetState, WidgetStore, WidgetTheme, clearVisitorId, formatRelativeTime, formatTime, getInitials, getOrCreateVisitorId } from '@helpway/widget-core';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode } from 'react';
|
|
@@ -45,6 +45,28 @@ interface HelpwayWidgetProps {
|
|
|
45
45
|
* the widget from your own UI.
|
|
46
46
|
*/
|
|
47
47
|
hideLauncher?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Where the widget lives on the page. The conversation UI is identical
|
|
50
|
+
* across placements — only the shell moves.
|
|
51
|
+
*
|
|
52
|
+
* - `bubble` floating launcher bottom-right (default)
|
|
53
|
+
* - `docked` composer bar pinned to the foot of the page; the bar is
|
|
54
|
+
* the composer, so the panel above it renders without one
|
|
55
|
+
* @default "bubble"
|
|
56
|
+
*/
|
|
57
|
+
placement?: WidgetPlacement;
|
|
58
|
+
/**
|
|
59
|
+
* Force the widget's appearance instead of following the visitor's OS.
|
|
60
|
+
* Set this to match the page you are embedding in — a light page in a
|
|
61
|
+
* dark-OS browser otherwise gets a dark widget.
|
|
62
|
+
* @default "system"
|
|
63
|
+
*/
|
|
64
|
+
colorScheme?: "light" | "dark" | "system";
|
|
65
|
+
/**
|
|
66
|
+
* Ways in offered above the docked bar before the visitor types.
|
|
67
|
+
* Only used when `placement="docked"`.
|
|
68
|
+
*/
|
|
69
|
+
dockSuggestions?: readonly DockSuggestion[];
|
|
48
70
|
/**
|
|
49
71
|
* CSS selector for a custom trigger element (e.g. `"#support-btn"`).
|
|
50
72
|
* Clicking the matched element calls `Helpway.open()`. Combine with
|
|
@@ -81,7 +103,7 @@ type HelpwayPublicAPI = HelpwayMethods;
|
|
|
81
103
|
* `layout.tsx`, or `main.tsx`). Unmounting cleanly tears down the
|
|
82
104
|
* widget and its WebSocket connection — useful for route-scoped mounts.
|
|
83
105
|
*/
|
|
84
|
-
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
106
|
+
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, hideLauncher, placement, colorScheme, dockSuggestions, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
85
107
|
|
|
86
108
|
interface IdentifyData {
|
|
87
109
|
externalId: string;
|
|
@@ -194,13 +216,13 @@ interface PendingAttachment {
|
|
|
194
216
|
mimeType: string;
|
|
195
217
|
} | null;
|
|
196
218
|
}
|
|
197
|
-
|
|
198
|
-
* Composer state — text input + attachments + submit for a conversation.
|
|
199
|
-
*/
|
|
200
|
-
declare function useComposer(conversationId: string | null): {
|
|
219
|
+
declare function useComposer(boundConversationId: string | null): {
|
|
201
220
|
text: string;
|
|
202
221
|
setText: react.Dispatch<react.SetStateAction<string>>;
|
|
203
|
-
submit: (
|
|
222
|
+
submit: (override?: {
|
|
223
|
+
text?: string;
|
|
224
|
+
conversationId?: string;
|
|
225
|
+
}) => Promise<void>;
|
|
204
226
|
isSubmitting: boolean;
|
|
205
227
|
attachments: PendingAttachment[];
|
|
206
228
|
addFiles: (files: File[]) => Promise<void>;
|
|
@@ -276,23 +298,45 @@ declare function WidgetLogo({ className, forceAgent, }: {
|
|
|
276
298
|
* Unified support widget — Intercom-style with tab navigation.
|
|
277
299
|
* Two tabs: Home + Messages. Sub-views: conversation + new conversation.
|
|
278
300
|
*/
|
|
279
|
-
declare function DefaultWidget({ hideLauncher }?: {
|
|
301
|
+
declare function DefaultWidget({ hideLauncher, placement, colorScheme, dockSuggestions, }?: {
|
|
280
302
|
hideLauncher?: boolean;
|
|
303
|
+
placement?: WidgetPlacement;
|
|
304
|
+
/**
|
|
305
|
+
* Pin the appearance instead of following the visitor's OS. An embedded
|
|
306
|
+
* widget lives in someone else's page; matching that page beats matching
|
|
307
|
+
* the machine it is being read on.
|
|
308
|
+
*/
|
|
309
|
+
colorScheme?: "light" | "dark" | "system";
|
|
310
|
+
/**
|
|
311
|
+
* Ways in offered above the docked bar before the visitor types.
|
|
312
|
+
* A prop for now — this belongs on AgentConfig once the API returns
|
|
313
|
+
* per-workspace (and eventually per-page) suggestions.
|
|
314
|
+
*/
|
|
315
|
+
dockSuggestions?: readonly DockSuggestion[];
|
|
281
316
|
}): react_jsx_runtime.JSX.Element;
|
|
282
317
|
|
|
283
318
|
interface MessageBubbleProps {
|
|
284
319
|
text: string;
|
|
285
320
|
sender: "visitor" | "team" | "ai";
|
|
286
321
|
senderName?: string;
|
|
322
|
+
/** Name the conversation header is showing; a sender matching it stays unlabelled. */
|
|
323
|
+
headerName?: string;
|
|
287
324
|
parts?: TimelineItemPart[] | null;
|
|
288
325
|
timestamp?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Whether this message closes a run from the same sender — the point where
|
|
328
|
+
* the author's name belongs. Kept separate from `timestamp` so a clock label
|
|
329
|
+
* that would only repeat the one above it can be dropped without taking the
|
|
330
|
+
* signature with it.
|
|
331
|
+
*/
|
|
332
|
+
showAuthor?: boolean;
|
|
289
333
|
/** Variant payload for interactive messages (quick replies, …). */
|
|
290
334
|
metadata?: TimelineItemMetadata | null;
|
|
291
335
|
/** Called when the visitor taps a quick-reply option. */
|
|
292
336
|
onQuickReplyTap?: (optionId: string, stepId: string) => void;
|
|
293
337
|
}
|
|
294
338
|
/** Single message bubble — Intercom-style, renders text + image/file parts */
|
|
295
|
-
declare function MessageBubble({ text, sender, senderName, parts, timestamp, metadata, onQuickReplyTap, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
339
|
+
declare function MessageBubble({ text, sender, senderName, headerName, parts, timestamp, showAuthor, metadata, onQuickReplyTap, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
296
340
|
|
|
297
341
|
interface MessageListProps {
|
|
298
342
|
items: TimelineItem[];
|