@helpway/react 0.12.1 → 0.13.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 +14 -12
- package/dist/index.js +24 -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
|
|
|
@@ -75,7 +76,7 @@ type HelpwayPublicAPI = HelpwayMethods;
|
|
|
75
76
|
* `layout.tsx`, or `main.tsx`). Unmounting cleanly tears down the
|
|
76
77
|
* widget and its WebSocket connection — useful for route-scoped mounts.
|
|
77
78
|
*/
|
|
78
|
-
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps):
|
|
79
|
+
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
79
80
|
|
|
80
81
|
interface IdentifyData {
|
|
81
82
|
externalId: string;
|
|
@@ -93,6 +94,7 @@ interface SupportProviderProps {
|
|
|
93
94
|
apiUrl?: string;
|
|
94
95
|
locale?: string;
|
|
95
96
|
initialConversationId?: string;
|
|
97
|
+
deepLinkToken?: string;
|
|
96
98
|
onReady?: (api: HelpwayMethods) => void;
|
|
97
99
|
customLauncherSelector?: string;
|
|
98
100
|
onOpen?: () => void;
|
|
@@ -118,7 +120,7 @@ interface SupportProviderProps {
|
|
|
118
120
|
* Visitor identity is managed via server-side cookies (hw_visitor).
|
|
119
121
|
* No localStorage or client-side ID management needed.
|
|
120
122
|
*/
|
|
121
|
-
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps):
|
|
123
|
+
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
|
|
122
124
|
|
|
123
125
|
/**
|
|
124
126
|
* Core widget state — connection status, visitor identity, website info.
|
|
@@ -264,14 +266,14 @@ declare function useRealtime(handler: (event: RealtimeEvent) => void): void;
|
|
|
264
266
|
declare function WidgetLogo({ className, forceAgent, }: {
|
|
265
267
|
className?: string;
|
|
266
268
|
forceAgent?: boolean;
|
|
267
|
-
}):
|
|
269
|
+
}): react_jsx_runtime.JSX.Element;
|
|
268
270
|
/**
|
|
269
271
|
* Unified support widget — Intercom-style with tab navigation.
|
|
270
272
|
* Two tabs: Home + Messages. Sub-views: conversation + new conversation.
|
|
271
273
|
*/
|
|
272
274
|
declare function DefaultWidget({ hideLauncher }?: {
|
|
273
275
|
hideLauncher?: boolean;
|
|
274
|
-
}):
|
|
276
|
+
}): react_jsx_runtime.JSX.Element;
|
|
275
277
|
|
|
276
278
|
interface MessageBubbleProps {
|
|
277
279
|
text: string;
|
|
@@ -285,7 +287,7 @@ interface MessageBubbleProps {
|
|
|
285
287
|
onQuickReplyTap?: (optionId: string, stepId: string) => void;
|
|
286
288
|
}
|
|
287
289
|
/** Single message bubble — Intercom-style, renders text + image/file parts */
|
|
288
|
-
declare function MessageBubble({ text, sender, senderName, parts, timestamp, metadata, onQuickReplyTap, }: MessageBubbleProps):
|
|
290
|
+
declare function MessageBubble({ text, sender, senderName, parts, timestamp, metadata, onQuickReplyTap, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
289
291
|
|
|
290
292
|
interface MessageListProps {
|
|
291
293
|
items: TimelineItem[];
|
|
@@ -300,7 +302,7 @@ interface MessageListProps {
|
|
|
300
302
|
renderAfterMessages?: react__default.ReactNode;
|
|
301
303
|
}
|
|
302
304
|
/** 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):
|
|
305
|
+
declare function MessageList({ items, visitorName, isTyping, isAiProcessing, streamingText, hasMore, isLoadingMore, onLoadMore, renderAfterMessages, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
304
306
|
|
|
305
307
|
interface ComposerProps {
|
|
306
308
|
text: string;
|
|
@@ -321,7 +323,7 @@ interface ComposerProps {
|
|
|
321
323
|
disabled?: boolean;
|
|
322
324
|
}
|
|
323
325
|
/** 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):
|
|
326
|
+
declare function Composer({ text, onTextChange, onSubmit, onTyping, isSubmitting, placeholder, compact, attachments, onAddFiles, onRemoveAttachment, disabled, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
325
327
|
|
|
326
328
|
/** Where the preview is anchored — controls only the outer positioning. */
|
|
327
329
|
type MessagePreviewPlacement = "launcher" | "anchored";
|
|
@@ -372,7 +374,7 @@ interface MessagePreviewProps {
|
|
|
372
374
|
*
|
|
373
375
|
* Must be rendered inside `<SupportProvider>`.
|
|
374
376
|
*/
|
|
375
|
-
declare function MessagePreview({ onOpen, avatar, placement, autoDismissMs, footer, }: MessagePreviewProps):
|
|
377
|
+
declare function MessagePreview({ onOpen, avatar, placement, autoDismissMs, footer, }: MessagePreviewProps): react_jsx_runtime.JSX.Element | null;
|
|
376
378
|
|
|
377
379
|
/** Placement of the announcement stack — mirrors `MessagePreviewPlacement`. */
|
|
378
380
|
type AnnouncementPreviewsPlacement = "launcher" | "anchored";
|
|
@@ -425,7 +427,7 @@ interface AnnouncementPreviewsProps {
|
|
|
425
427
|
*
|
|
426
428
|
* Must be rendered inside `<SupportProvider>`.
|
|
427
429
|
*/
|
|
428
|
-
declare function AnnouncementPreviews({ onOpen, avatar, placement, footer, }: AnnouncementPreviewsProps):
|
|
430
|
+
declare function AnnouncementPreviews({ onOpen, avatar, placement, footer, }: AnnouncementPreviewsProps): react_jsx_runtime.JSX.Element | null;
|
|
429
431
|
|
|
430
432
|
/**
|
|
431
433
|
* Lightweight Markdown → HTML renderer.
|
|
@@ -453,6 +455,6 @@ declare function MarkdownContent({ bodyHtml, bodyMarkdown, className, }: {
|
|
|
453
455
|
bodyHtml?: string | null;
|
|
454
456
|
bodyMarkdown?: string | null;
|
|
455
457
|
className?: string;
|
|
456
|
-
}):
|
|
458
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
457
459
|
|
|
458
460
|
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);
|