@helpway/react 0.4.1 → 0.5.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/README.md +7 -0
- package/dist/index.d.ts +29 -7
- package/dist/index.js +135 -103
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/themed/styles.css +5 -72
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Official React SDK for [Helpway](https://helpway.ai) — AI-powered customer support widget with full programmatic control.
|
|
4
4
|
|
|
5
|
+
> **📚 Full documentation:** https://helpway.ai/docs
|
|
6
|
+
> · [Quick start](https://helpway.ai/docs/quick-start)
|
|
7
|
+
> · [React SDK](https://helpway.ai/docs/react-sdk)
|
|
8
|
+
> · [Customization & theming](https://helpway.ai/docs/customization)
|
|
9
|
+
> · [Widget API](https://helpway.ai/docs/widget-api)
|
|
10
|
+
> · [Integration notes (CSP, SSR, multi-tenant)](https://helpway.ai/docs/integration-notes)
|
|
11
|
+
|
|
5
12
|
## Install
|
|
6
13
|
|
|
7
14
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _helpway_widget_core from '@helpway/widget-core';
|
|
3
|
-
import {
|
|
4
|
-
export { ConversationSummary, HelpwayAPI, RealtimeEvent, TimelineItem, WidgetEventName, WidgetEvents, WidgetState, WidgetStore, clearVisitorId, formatRelativeTime, formatTime, getInitials, getOrCreateVisitorId } from '@helpway/widget-core';
|
|
3
|
+
import { HelpwayMethods, WidgetTheme, WidgetStore } from '@helpway/widget-core';
|
|
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';
|
|
7
7
|
import * as _helpway_types from '@helpway/types';
|
|
@@ -52,6 +52,16 @@ interface HelpwayWidgetProps {
|
|
|
52
52
|
onClose?: () => void;
|
|
53
53
|
/** Fires when the unread count changes */
|
|
54
54
|
onUnreadChange?: (count: number) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Developer-side theme override. Most consumers should configure
|
|
57
|
+
* appearance from the dashboard so changes apply without a redeploy
|
|
58
|
+
* — see https://helpway.ai/docs/customization. Use this prop only
|
|
59
|
+
* for runtime-resolved theming (multi-tenant brand colors, dark/
|
|
60
|
+
* light sync with the host app, etc). Values map to CSS custom
|
|
61
|
+
* properties on the widget host. See the `WidgetTheme` type for
|
|
62
|
+
* the full set of supported keys.
|
|
63
|
+
*/
|
|
64
|
+
theme?: WidgetTheme;
|
|
55
65
|
/**
|
|
56
66
|
* @deprecated Legacy prop from the v0.1 script-loader era. If set,
|
|
57
67
|
* the `/widget.js` suffix is stripped to derive `apiUrl`. New code
|
|
@@ -60,13 +70,13 @@ interface HelpwayWidgetProps {
|
|
|
60
70
|
src?: string;
|
|
61
71
|
}
|
|
62
72
|
|
|
63
|
-
type HelpwayPublicAPI =
|
|
73
|
+
type HelpwayPublicAPI = HelpwayMethods;
|
|
64
74
|
/**
|
|
65
75
|
* Render this once at the root of your app (e.g. in `_app.tsx`,
|
|
66
76
|
* `layout.tsx`, or `main.tsx`). Unmounting cleanly tears down the
|
|
67
77
|
* widget and its WebSocket connection — useful for route-scoped mounts.
|
|
68
78
|
*/
|
|
69
|
-
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
79
|
+
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, onReady, hideLauncher, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
70
80
|
|
|
71
81
|
interface IdentifyData {
|
|
72
82
|
externalId: string;
|
|
@@ -84,11 +94,22 @@ interface SupportProviderProps {
|
|
|
84
94
|
apiUrl?: string;
|
|
85
95
|
locale?: string;
|
|
86
96
|
initialConversationId?: string;
|
|
87
|
-
onReady?: (api:
|
|
97
|
+
onReady?: (api: HelpwayMethods) => void;
|
|
88
98
|
customLauncherSelector?: string;
|
|
89
99
|
onOpen?: () => void;
|
|
90
100
|
onClose?: () => void;
|
|
91
101
|
onUnreadChange?: (count: number) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Developer-side theme override. Most consumers should configure
|
|
104
|
+
* appearance in the Helpway dashboard (see
|
|
105
|
+
* https://helpway.ai/docs/customization) so changes apply without
|
|
106
|
+
* a redeploy. Use this prop only when you need the widget to inherit
|
|
107
|
+
* a host-app theme that the dashboard can't see (e.g. a tenant-
|
|
108
|
+
* specific brand color resolved at runtime). Values here are written
|
|
109
|
+
* as CSS custom properties on the widget host and override the
|
|
110
|
+
* dashboard config for this mount only.
|
|
111
|
+
*/
|
|
112
|
+
theme?: WidgetTheme;
|
|
92
113
|
children: ReactNode;
|
|
93
114
|
}
|
|
94
115
|
/**
|
|
@@ -98,7 +119,7 @@ interface SupportProviderProps {
|
|
|
98
119
|
* Visitor identity is managed via server-side cookies (hw_visitor).
|
|
99
120
|
* No localStorage or client-side ID management needed.
|
|
100
121
|
*/
|
|
101
|
-
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
|
|
122
|
+
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, onReady, customLauncherSelector, onOpen, onClose, onUnreadChange, theme, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
|
|
102
123
|
|
|
103
124
|
/**
|
|
104
125
|
* Core widget state — connection status, visitor identity, website info.
|
|
@@ -238,9 +259,10 @@ interface MessageBubbleProps {
|
|
|
238
259
|
sender: "visitor" | "team" | "ai";
|
|
239
260
|
senderName?: string;
|
|
240
261
|
parts?: TimelineItemPart[] | null;
|
|
262
|
+
timestamp?: string;
|
|
241
263
|
}
|
|
242
264
|
/** Single message bubble — Intercom-style, renders text + image/file parts */
|
|
243
|
-
declare function MessageBubble({ text, sender, senderName, parts }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
265
|
+
declare function MessageBubble({ text, sender, senderName, parts, timestamp }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
244
266
|
|
|
245
267
|
interface MessageListProps {
|
|
246
268
|
items: TimelineItem[];
|