@helpway/react 0.9.0 → 0.11.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 +125 -1
- package/dist/index.js +860 -458
- package/dist/index.js.map +1 -1
- package/package.json +1 -3
- package/src/themed/styles.css +246 -3
package/dist/index.d.ts
CHANGED
|
@@ -246,6 +246,26 @@ declare function useUnread(): {
|
|
|
246
246
|
*/
|
|
247
247
|
declare function useRealtime(handler: (event: RealtimeEvent) => void): void;
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* WidgetLogo — chat-header avatar. Renders WHO is talking to the
|
|
251
|
+
* visitor right now. Resolution chain:
|
|
252
|
+
* 1. Active conversation's assigned support user (assigneeName +
|
|
253
|
+
* assigneeImage from the widget API). When a human takes over a
|
|
254
|
+
* conversation the visitor sees that human, not the AI agent.
|
|
255
|
+
* 2. Agent uploaded image (agentConfig.avatarUrl)
|
|
256
|
+
* 3. Agent icon preset (avatarPreset + brandColor)
|
|
257
|
+
* 4. Website logo (website.logoUrl)
|
|
258
|
+
* 5. Helpway brand mark (octagonal) as the true last-resort fallback
|
|
259
|
+
*
|
|
260
|
+
* The `forceAgent` escape hatch skips the assignee lookup — used by
|
|
261
|
+
* surfaces that mean "the agent" specifically (welcome card, conversation
|
|
262
|
+
* list rows where we want the persistent brand, etc.) rather than "the
|
|
263
|
+
* person currently helping you".
|
|
264
|
+
*/
|
|
265
|
+
declare function WidgetLogo({ className, forceAgent, }: {
|
|
266
|
+
className?: string;
|
|
267
|
+
forceAgent?: boolean;
|
|
268
|
+
}): react_jsx_runtime.JSX.Element;
|
|
249
269
|
/**
|
|
250
270
|
* Unified support widget — Intercom-style with tab navigation.
|
|
251
271
|
* Two tabs: Home + Messages. Sub-views: conversation + new conversation.
|
|
@@ -304,6 +324,110 @@ interface ComposerProps {
|
|
|
304
324
|
/** Widget composer — auto-resize, Enter-to-send, paste/drop attachments */
|
|
305
325
|
declare function Composer({ text, onTextChange, onSubmit, onTyping, isSubmitting, placeholder, compact, attachments, onAddFiles, onRemoveAttachment, disabled, }: ComposerProps): react_jsx_runtime.JSX.Element;
|
|
306
326
|
|
|
327
|
+
/** Where the preview is anchored — controls only the outer positioning. */
|
|
328
|
+
type MessagePreviewPlacement = "launcher" | "anchored";
|
|
329
|
+
interface MessagePreviewProps {
|
|
330
|
+
/** Called when the visitor taps the preview (or a quick reply). The
|
|
331
|
+
* active conversation is already switched to the one that pinged —
|
|
332
|
+
* the consumer just has to reveal the chat surface. */
|
|
333
|
+
onOpen: () => void;
|
|
334
|
+
/**
|
|
335
|
+
* The avatar node shown in the header. Injected by the consumer so
|
|
336
|
+
* this component stays decoupled from avatar resolution — the default
|
|
337
|
+
* widget passes `<WidgetLogo />`; a custom surface can pass its own.
|
|
338
|
+
*/
|
|
339
|
+
avatar: ReactNode;
|
|
340
|
+
/**
|
|
341
|
+
* Outer positioning mode. `"launcher"` (default) keeps the original
|
|
342
|
+
* absolute placement above the floating bubble — DefaultWidget relies
|
|
343
|
+
* on this, so the default is unchanged. `"anchored"` drops the
|
|
344
|
+
* absolute/bottom/right rules (via `hw-preview--anchored`) so a
|
|
345
|
+
* consumer can pin it to their own trigger (e.g. a sidebar item).
|
|
346
|
+
*/
|
|
347
|
+
placement?: MessagePreviewPlacement;
|
|
348
|
+
/**
|
|
349
|
+
* Auto-dismiss delay in ms. Default `8000` (the launcher behaviour).
|
|
350
|
+
* Pass `null` (or `0`) to keep the preview until the visitor acts on
|
|
351
|
+
* it — useful for an anchored surface where it isn't competing with
|
|
352
|
+
* page content for attention. Quick-reply previews never auto-dismiss
|
|
353
|
+
* regardless, since the visitor needs time to choose.
|
|
354
|
+
*/
|
|
355
|
+
autoDismissMs?: number | null;
|
|
356
|
+
/**
|
|
357
|
+
* Optional caption rendered as a separated footer beneath the message
|
|
358
|
+
* (e.g. a source label like "via Helpway"). Omitted for the launcher
|
|
359
|
+
* so its visual stays byte-identical to the original.
|
|
360
|
+
*/
|
|
361
|
+
footer?: ReactNode;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* `<MessagePreview>` — the proactive incoming-message bubble shown while
|
|
365
|
+
* the chat surface is closed. Reads `incomingPreview` from the widget
|
|
366
|
+
* store, auto-dismisses after 8s (unless quick replies are present), and
|
|
367
|
+
* on tap switches to the pinging conversation before calling `onOpen`.
|
|
368
|
+
*
|
|
369
|
+
* Extracted from the default widget so `hideLauncher` integrations can
|
|
370
|
+
* surface the *exact same* preview next to their own UI instead of the
|
|
371
|
+
* floating launcher. Visual/markup is byte-identical to the launcher
|
|
372
|
+
* version — only the outer positioning is parameterised via `placement`.
|
|
373
|
+
*
|
|
374
|
+
* Must be rendered inside `<SupportProvider>`.
|
|
375
|
+
*/
|
|
376
|
+
declare function MessagePreview({ onOpen, avatar, placement, autoDismissMs, footer, }: MessagePreviewProps): react_jsx_runtime.JSX.Element | null;
|
|
377
|
+
|
|
378
|
+
/** Placement of the announcement stack — mirrors `MessagePreviewPlacement`. */
|
|
379
|
+
type AnnouncementPreviewsPlacement = "launcher" | "anchored";
|
|
380
|
+
/** Shape of a single announcement entry as it lives in the widget store. */
|
|
381
|
+
interface AnnouncementPreviewEntry {
|
|
382
|
+
title: string;
|
|
383
|
+
body: string | null;
|
|
384
|
+
slug: string;
|
|
385
|
+
tabId: string;
|
|
386
|
+
badge: string | null;
|
|
387
|
+
}
|
|
388
|
+
interface AnnouncementPreviewsProps {
|
|
389
|
+
/** Called when the visitor taps an announcement card. Receives the
|
|
390
|
+
* entry's slug + the parent tab id. The consumer decides what to
|
|
391
|
+
* do — at minimum `setOpen(true)`, optionally deep-link into the
|
|
392
|
+
* matching content tab + detail. */
|
|
393
|
+
onOpen: (slug: string, tabId: string) => void;
|
|
394
|
+
/** The avatar node shown in each card's header. Injected so the
|
|
395
|
+
* component is decoupled from avatar resolution; pass
|
|
396
|
+
* `<WidgetLogo />` for the SDK default. */
|
|
397
|
+
avatar: ReactNode;
|
|
398
|
+
/**
|
|
399
|
+
* Outer positioning mode. `"launcher"` (default) keeps the stack
|
|
400
|
+
* pinned above the floating bubble; `"anchored"` drops that and
|
|
401
|
+
* lets the consumer's positioned wrapper place the stack — and
|
|
402
|
+
* each card stretches to the wrapper width instead of the launcher
|
|
403
|
+
* 300px (via the same `.hw-preview--anchored` modifier the
|
|
404
|
+
* message preview uses).
|
|
405
|
+
*/
|
|
406
|
+
placement?: AnnouncementPreviewsPlacement;
|
|
407
|
+
/**
|
|
408
|
+
* Optional caption rendered as a separated footer beneath each
|
|
409
|
+
* card (e.g. a "via X" provenance line). Omitted on the launcher
|
|
410
|
+
* so its visual stays byte-identical to the original.
|
|
411
|
+
*/
|
|
412
|
+
footer?: ReactNode;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* `<AnnouncementPreviews>` — proactive "new content" cards shown when
|
|
416
|
+
* the widget panel is closed and the visitor hasn't seen the latest
|
|
417
|
+
* entries from a "Promote new content" tab yet. Stacks multiple
|
|
418
|
+
* entries vertically.
|
|
419
|
+
*
|
|
420
|
+
* Extracted from the default widget so `hideLauncher` integrations can
|
|
421
|
+
* surface the *exact same* cards next to their own UI instead of the
|
|
422
|
+
* floating launcher. Visual/markup is byte-identical to the launcher
|
|
423
|
+
* version — only the outer positioning is parameterised via
|
|
424
|
+
* `placement`. Announcements never auto-dismiss (visitors need time to
|
|
425
|
+
* read); they're cleared by tapping the card or the ✕.
|
|
426
|
+
*
|
|
427
|
+
* Must be rendered inside `<SupportProvider>`.
|
|
428
|
+
*/
|
|
429
|
+
declare function AnnouncementPreviews({ onOpen, avatar, placement, footer, }: AnnouncementPreviewsProps): react_jsx_runtime.JSX.Element | null;
|
|
430
|
+
|
|
307
431
|
/**
|
|
308
432
|
* Lightweight Markdown → HTML renderer.
|
|
309
433
|
* Zero dependencies. Handles common patterns:
|
|
@@ -332,4 +456,4 @@ declare function MarkdownContent({ bodyHtml, bodyMarkdown, className, }: {
|
|
|
332
456
|
className?: string;
|
|
333
457
|
}): react_jsx_runtime.JSX.Element | null;
|
|
334
458
|
|
|
335
|
-
export { Composer, DefaultWidget, type HelpwayPublicAPI, HelpwayWidget, type HelpwayWidgetProps, type IdentifyData, MarkdownContent, MessageBubble, MessageList, SupportProvider, linkifyText, renderMarkdown, useComposer, useConversations, useIdentify, usePresence, useRealtime, useTimeline, useUnread, useWidget, useWidgetStore };
|
|
459
|
+
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 };
|