@helpway/react 0.12.1 → 0.13.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.
- package/dist/index.d.ts +19 -12
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import react__default, { ReactNode } from 'react';
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import * as _helpway_widget_core from '@helpway/widget-core';
|
|
4
3
|
import { HelpwayMethods, WidgetTheme, WidgetStore } from '@helpway/widget-core';
|
|
5
4
|
export { ConversationSummary, HelpwayAPI, RealtimeEvent, TimelineItem, WidgetEventName, WidgetEvents, WidgetPosition, WidgetState, WidgetStore, WidgetTheme, clearVisitorId, formatRelativeTime, formatTime, getInitials, getOrCreateVisitorId } from '@helpway/widget-core';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
import react__default, { ReactNode } from 'react';
|
|
6
7
|
import * as _helpway_types from '@helpway/types';
|
|
7
8
|
import { TimelineItem, RealtimeEvent, TimelineItemPart, TimelineItemMetadata } from '@helpway/types';
|
|
8
9
|
|
|
@@ -28,6 +29,11 @@ interface HelpwayWidgetProps {
|
|
|
28
29
|
* Usually sourced from `?hw_conv=` URL param for email CTAs.
|
|
29
30
|
*/
|
|
30
31
|
initialConversationId?: string;
|
|
32
|
+
/**
|
|
33
|
+
* HMAC-signed token for cross-device visitor identity restoration.
|
|
34
|
+
* Sourced from `#hw_token=` URL fragment in email deep-links.
|
|
35
|
+
*/
|
|
36
|
+
deepLinkToken?: string;
|
|
31
37
|
/**
|
|
32
38
|
* Called once after the widget has bootstrapped and exposes
|
|
33
39
|
* the full programmatic API object (also available as `window.Helpway`).
|
|
@@ -75,7 +81,7 @@ type HelpwayPublicAPI = HelpwayMethods;
|
|
|
75
81
|
* `layout.tsx`, or `main.tsx`). Unmounting cleanly tears down the
|
|
76
82
|
* widget and its WebSocket connection — useful for route-scoped mounts.
|
|
77
83
|
*/
|
|
78
|
-
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps):
|
|
84
|
+
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
79
85
|
|
|
80
86
|
interface IdentifyData {
|
|
81
87
|
externalId: string;
|
|
@@ -93,6 +99,7 @@ interface SupportProviderProps {
|
|
|
93
99
|
apiUrl?: string;
|
|
94
100
|
locale?: string;
|
|
95
101
|
initialConversationId?: string;
|
|
102
|
+
deepLinkToken?: string;
|
|
96
103
|
onReady?: (api: HelpwayMethods) => void;
|
|
97
104
|
customLauncherSelector?: string;
|
|
98
105
|
onOpen?: () => void;
|
|
@@ -118,7 +125,7 @@ interface SupportProviderProps {
|
|
|
118
125
|
* Visitor identity is managed via server-side cookies (hw_visitor).
|
|
119
126
|
* No localStorage or client-side ID management needed.
|
|
120
127
|
*/
|
|
121
|
-
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps):
|
|
128
|
+
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
|
|
122
129
|
|
|
123
130
|
/**
|
|
124
131
|
* Core widget state — connection status, visitor identity, website info.
|
|
@@ -264,14 +271,14 @@ declare function useRealtime(handler: (event: RealtimeEvent) => void): void;
|
|
|
264
271
|
declare function WidgetLogo({ className, forceAgent, }: {
|
|
265
272
|
className?: string;
|
|
266
273
|
forceAgent?: boolean;
|
|
267
|
-
}):
|
|
274
|
+
}): react_jsx_runtime.JSX.Element;
|
|
268
275
|
/**
|
|
269
276
|
* Unified support widget — Intercom-style with tab navigation.
|
|
270
277
|
* Two tabs: Home + Messages. Sub-views: conversation + new conversation.
|
|
271
278
|
*/
|
|
272
279
|
declare function DefaultWidget({ hideLauncher }?: {
|
|
273
280
|
hideLauncher?: boolean;
|
|
274
|
-
}):
|
|
281
|
+
}): react_jsx_runtime.JSX.Element;
|
|
275
282
|
|
|
276
283
|
interface MessageBubbleProps {
|
|
277
284
|
text: string;
|
|
@@ -285,7 +292,7 @@ interface MessageBubbleProps {
|
|
|
285
292
|
onQuickReplyTap?: (optionId: string, stepId: string) => void;
|
|
286
293
|
}
|
|
287
294
|
/** Single message bubble — Intercom-style, renders text + image/file parts */
|
|
288
|
-
declare function MessageBubble({ text, sender, senderName, parts, timestamp, metadata, onQuickReplyTap, }: MessageBubbleProps):
|
|
295
|
+
declare function MessageBubble({ text, sender, senderName, parts, timestamp, metadata, onQuickReplyTap, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
289
296
|
|
|
290
297
|
interface MessageListProps {
|
|
291
298
|
items: TimelineItem[];
|
|
@@ -300,7 +307,7 @@ interface MessageListProps {
|
|
|
300
307
|
renderAfterMessages?: react__default.ReactNode;
|
|
301
308
|
}
|
|
302
309
|
/** Timeline with date separators, typing indicator, infinite scroll, and AI processing state */
|
|
303
|
-
declare function MessageList({ items, visitorName, isTyping, isAiProcessing, streamingText, hasMore, isLoadingMore, onLoadMore, renderAfterMessages, }: MessageListProps):
|
|
310
|
+
declare function MessageList({ items, visitorName, isTyping, isAiProcessing, streamingText, hasMore, isLoadingMore, onLoadMore, renderAfterMessages, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
304
311
|
|
|
305
312
|
interface ComposerProps {
|
|
306
313
|
text: string;
|
|
@@ -321,7 +328,7 @@ interface ComposerProps {
|
|
|
321
328
|
disabled?: boolean;
|
|
322
329
|
}
|
|
323
330
|
/** Widget composer — auto-resize, Enter-to-send, paste/drop attachments */
|
|
324
|
-
declare function Composer({ text, onTextChange, onSubmit, onTyping, isSubmitting, placeholder, compact, attachments, onAddFiles, onRemoveAttachment, disabled, }: ComposerProps):
|
|
331
|
+
declare function Composer({ text, onTextChange, onSubmit, onTyping, isSubmitting, placeholder, compact, attachments, onAddFiles, onRemoveAttachment, disabled, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
325
332
|
|
|
326
333
|
/** Where the preview is anchored — controls only the outer positioning. */
|
|
327
334
|
type MessagePreviewPlacement = "launcher" | "anchored";
|
|
@@ -372,7 +379,7 @@ interface MessagePreviewProps {
|
|
|
372
379
|
*
|
|
373
380
|
* Must be rendered inside `<SupportProvider>`.
|
|
374
381
|
*/
|
|
375
|
-
declare function MessagePreview({ onOpen, avatar, placement, autoDismissMs, footer, }: MessagePreviewProps):
|
|
382
|
+
declare function MessagePreview({ onOpen, avatar, placement, autoDismissMs, footer, }: MessagePreviewProps): react_jsx_runtime.JSX.Element | null;
|
|
376
383
|
|
|
377
384
|
/** Placement of the announcement stack — mirrors `MessagePreviewPlacement`. */
|
|
378
385
|
type AnnouncementPreviewsPlacement = "launcher" | "anchored";
|
|
@@ -425,7 +432,7 @@ interface AnnouncementPreviewsProps {
|
|
|
425
432
|
*
|
|
426
433
|
* Must be rendered inside `<SupportProvider>`.
|
|
427
434
|
*/
|
|
428
|
-
declare function AnnouncementPreviews({ onOpen, avatar, placement, footer, }: AnnouncementPreviewsProps):
|
|
435
|
+
declare function AnnouncementPreviews({ onOpen, avatar, placement, footer, }: AnnouncementPreviewsProps): react_jsx_runtime.JSX.Element | null;
|
|
429
436
|
|
|
430
437
|
/**
|
|
431
438
|
* Lightweight Markdown → HTML renderer.
|
|
@@ -453,6 +460,6 @@ declare function MarkdownContent({ bodyHtml, bodyMarkdown, className, }: {
|
|
|
453
460
|
bodyHtml?: string | null;
|
|
454
461
|
bodyMarkdown?: string | null;
|
|
455
462
|
className?: string;
|
|
456
|
-
}):
|
|
463
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
457
464
|
|
|
458
465
|
export { type AnnouncementPreviewEntry, AnnouncementPreviews, type AnnouncementPreviewsPlacement, type AnnouncementPreviewsProps, Composer, DefaultWidget, type HelpwayPublicAPI, HelpwayWidget, type HelpwayWidgetProps, type IdentifyData, MarkdownContent, MessageBubble, MessageList, MessagePreview, type MessagePreviewPlacement, type MessagePreviewProps, SupportProvider, WidgetLogo, linkifyText, renderMarkdown, useComposer, useConversations, useIdentify, usePresence, useRealtime, useTimeline, useUnread, useWidget, useWidgetStore };
|
package/dist/index.js
CHANGED
|
@@ -1030,6 +1030,7 @@ function SupportProvider({
|
|
|
1030
1030
|
apiUrl,
|
|
1031
1031
|
locale,
|
|
1032
1032
|
initialConversationId,
|
|
1033
|
+
deepLinkToken,
|
|
1033
1034
|
onReady,
|
|
1034
1035
|
customLauncherSelector,
|
|
1035
1036
|
onOpen,
|
|
@@ -1159,8 +1160,29 @@ function SupportProvider({
|
|
|
1159
1160
|
});
|
|
1160
1161
|
}
|
|
1161
1162
|
if (initialConversationId && !cancelled) {
|
|
1162
|
-
|
|
1163
|
-
|
|
1163
|
+
if (deepLinkToken) {
|
|
1164
|
+
try {
|
|
1165
|
+
const redeemed = await client.widget.redeemDeepLink.mutate({ token: deepLinkToken });
|
|
1166
|
+
if (!cancelled && redeemed?.visitorId && redeemed.visitorId !== data.visitor?.id) {
|
|
1167
|
+
syncVisitorId(apiKey, redeemed.visitorId);
|
|
1168
|
+
const freshData = await client.widget.bootstrap.query();
|
|
1169
|
+
if (!cancelled) {
|
|
1170
|
+
store.getState().setReady(freshData.visitor, freshData.website, freshData.agentConfig);
|
|
1171
|
+
const freshConvs = await client.widget.listConversations.query();
|
|
1172
|
+
if (!cancelled) {
|
|
1173
|
+
store.getState().setConversations(
|
|
1174
|
+
freshConvs.conversations.map(mapConversation)
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
} catch {
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
if (!cancelled) {
|
|
1183
|
+
store.getState().setActiveConversation(initialConversationId);
|
|
1184
|
+
store.getState().setOpen(true);
|
|
1185
|
+
}
|
|
1164
1186
|
}
|
|
1165
1187
|
emitter.emit("ready");
|
|
1166
1188
|
onReady?.(initRef.current.api);
|
|
@@ -5506,6 +5528,7 @@ function HelpwayWidget({
|
|
|
5506
5528
|
apiUrl,
|
|
5507
5529
|
locale,
|
|
5508
5530
|
initialConversationId,
|
|
5531
|
+
deepLinkToken,
|
|
5509
5532
|
onReady,
|
|
5510
5533
|
hideLauncher,
|
|
5511
5534
|
customLauncherSelector,
|
|
@@ -5524,6 +5547,7 @@ function HelpwayWidget({
|
|
|
5524
5547
|
apiUrl: resolvedApiUrl,
|
|
5525
5548
|
locale,
|
|
5526
5549
|
initialConversationId,
|
|
5550
|
+
deepLinkToken,
|
|
5527
5551
|
onReady,
|
|
5528
5552
|
customLauncherSelector,
|
|
5529
5553
|
onOpen,
|