@helpway/react 0.16.0 → 0.17.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 CHANGED
@@ -67,6 +67,12 @@ interface HelpwayWidgetProps {
67
67
  * Only used when `placement="docked"`.
68
68
  */
69
69
  dockSuggestions?: readonly DockSuggestion[];
70
+ /**
71
+ * Render your own agent avatar (e.g. an animated mascot) wherever the
72
+ * widget shows the AI agent. Wins over the dashboard avatar image; an
73
+ * assigned human's photo still wins over it.
74
+ */
75
+ agentAvatar?: ReactNode;
70
76
  /**
71
77
  * CSS selector for a custom trigger element (e.g. `"#support-btn"`).
72
78
  * Clicking the matched element calls `Helpway.open()`. Combine with
@@ -103,7 +109,7 @@ type HelpwayPublicAPI = HelpwayMethods;
103
109
  * `layout.tsx`, or `main.tsx`). Unmounting cleanly tears down the
104
110
  * widget and its WebSocket connection — useful for route-scoped mounts.
105
111
  */
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;
112
+ declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, hideLauncher, placement, colorScheme, dockSuggestions, agentAvatar, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
107
113
 
108
114
  interface IdentifyData {
109
115
  externalId: string;
@@ -126,6 +132,14 @@ declare function useIdentify(): (data: IdentifyData) => Promise<void>;
126
132
  interface SupportProviderProps {
127
133
  apiKey: string;
128
134
  apiUrl?: string;
135
+ /**
136
+ * "mobile" when this is running inside @helpway/react-native's WebView.
137
+ * Travels to the server as a header on every call, because the server
138
+ * cannot work it out: the User-Agent in there is the phone's browser, so
139
+ * an app user and a website visitor on the same phone arrive identical.
140
+ * Defaults to web, which is what an embedding site is.
141
+ */
142
+ surface?: "web" | "mobile";
129
143
  locale?: string;
130
144
  initialConversationId?: string;
131
145
  deepLinkToken?: string;
@@ -154,7 +168,7 @@ interface SupportProviderProps {
154
168
  * Visitor identity is managed via server-side cookies (hw_visitor).
155
169
  * No localStorage or client-side ID management needed.
156
170
  */
157
- declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, deepLinkToken, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
171
+ declare function SupportProvider({ apiKey, apiUrl, surface, locale, initialConversationId, deepLinkToken, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
158
172
 
159
173
  /**
160
174
  * Core widget state — connection status, visitor identity, website info.
@@ -319,16 +333,18 @@ declare function useAwaitingReply(): number;
319
333
  */
320
334
  declare function useRealtime(handler: (event: RealtimeEvent) => void): void;
321
335
 
336
+ declare const AgentAvatarProvider: react.Provider<ReactNode>;
322
337
  /**
323
338
  * WidgetLogo — chat-header avatar. Renders WHO is talking to the
324
339
  * visitor right now. Resolution chain:
325
340
  * 1. Active conversation's assigned support user (assigneeName +
326
341
  * assigneeImage from the widget API). When a human takes over a
327
342
  * conversation the visitor sees that human, not the AI agent.
328
- * 2. Agent uploaded image (agentConfig.avatarUrl)
329
- * 3. Agent icon preset (avatarPreset + brandColor)
330
- * 4. Website logo (website.logoUrl)
331
- * 5. Helpway brand mark (octagonal) as the true last-resort fallback
343
+ * 2. Host-rendered avatar (`agentAvatar` prop, via AgentAvatarContext)
344
+ * 3. Agent uploaded image (agentConfig.avatarUrl)
345
+ * 4. Agent icon preset (avatarPreset + brandColor)
346
+ * 5. Website logo (website.logoUrl)
347
+ * 6. Helpway brand mark (octagonal) as the true last-resort fallback
332
348
  *
333
349
  * The `forceAgent` escape hatch skips the assignee lookup — used by
334
350
  * surfaces that mean "the agent" specifically (welcome card, conversation
@@ -578,4 +594,4 @@ declare function MarkdownContent({ bodyHtml, bodyMarkdown, className, }: {
578
594
  className?: string;
579
595
  }): react_jsx_runtime.JSX.Element | null;
580
596
 
581
- 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, useAwaitingReply, useComposer, useConversations, useIdentify, usePresence, useRealtime, useTimeline, useUnread, useWidget, useWidgetStore };
597
+ export { AgentAvatarProvider, 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, useAwaitingReply, useComposer, useConversations, useIdentify, usePresence, useRealtime, useTimeline, useUnread, useWidget, useWidgetStore };