@helpway/react 0.1.0 → 0.2.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 +44 -34
- package/dist/index.js +269 -248
- package/dist/index.js.map +1 -1
- package/package.json +15 -20
- package/src/themed/styles.css +26 -2
package/dist/index.d.ts
CHANGED
|
@@ -7,40 +7,6 @@ import react__default, { ReactNode } from 'react';
|
|
|
7
7
|
import * as _helpway_types from '@helpway/types';
|
|
8
8
|
import { TimelineItem, RealtimeEvent, TimelineItemPart } from '@helpway/types';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* `<HelpwayWidget />` — one-line drop-in React component that loads
|
|
12
|
-
* the Helpway widget script and tears it down on unmount.
|
|
13
|
-
*
|
|
14
|
-
* This is the lowest-friction integration path for React / Next.js /
|
|
15
|
-
* Vite apps that don't need to render custom chat UI themselves. Under
|
|
16
|
-
* the hood it just injects `https://api.helpway.ai/widget.js` with the
|
|
17
|
-
* provided public key, exactly like the plain `<script>` snippet — but
|
|
18
|
-
* wrapped in a React lifecycle so it participates in StrictMode double
|
|
19
|
-
* mounts, SSR boundaries, and component cleanup without footguns.
|
|
20
|
-
*
|
|
21
|
-
* Power-user alternative: import `{ SupportProvider, useWidget, … }`
|
|
22
|
-
* from this same package for full programmatic control.
|
|
23
|
-
*/
|
|
24
|
-
interface HelpwayWidgetProps {
|
|
25
|
-
/**
|
|
26
|
-
* Public API key from the Helpway dashboard. Required.
|
|
27
|
-
* Format: `pk_live_…` or `pk_test_…`.
|
|
28
|
-
*/
|
|
29
|
-
apiKey: string;
|
|
30
|
-
/**
|
|
31
|
-
* Override the default widget loader URL. Almost no one needs this —
|
|
32
|
-
* exposed for staging / self-hosted setups.
|
|
33
|
-
* @default "https://api.helpway.ai/widget.js"
|
|
34
|
-
*/
|
|
35
|
-
src?: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Render this once at the root of your app (e.g. in `_app.tsx`,
|
|
39
|
-
* `layout.tsx`, or `main.tsx`). Unmounting removes the script and
|
|
40
|
-
* collapses the widget iframe — useful for route-scoped mounts.
|
|
41
|
-
*/
|
|
42
|
-
declare function HelpwayWidget({ apiKey, src, }: HelpwayWidgetProps): null;
|
|
43
|
-
|
|
44
10
|
interface IdentifyData {
|
|
45
11
|
externalId: string;
|
|
46
12
|
email?: string;
|
|
@@ -77,6 +43,50 @@ interface SupportProviderProps {
|
|
|
77
43
|
*/
|
|
78
44
|
declare function SupportProvider({ apiKey, apiUrl, locale, initialConversationId, onReady, children, }: SupportProviderProps): react_jsx_runtime.JSX.Element;
|
|
79
45
|
|
|
46
|
+
interface HelpwayWidgetProps {
|
|
47
|
+
/**
|
|
48
|
+
* Public API key from the Helpway dashboard. Required.
|
|
49
|
+
* Format: `pk_live_…` or `pk_test_…`.
|
|
50
|
+
*/
|
|
51
|
+
apiKey: string;
|
|
52
|
+
/**
|
|
53
|
+
* Override the default API URL. Almost no one needs this —
|
|
54
|
+
* exposed for staging / self-hosted setups.
|
|
55
|
+
* @default "https://api.helpway.ai"
|
|
56
|
+
*/
|
|
57
|
+
apiUrl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Widget locale (e.g. "tr", "en", "de"). Falls back to server-side
|
|
60
|
+
* detection (Accept-Language + CF-IPCountry) then widget-core default.
|
|
61
|
+
*/
|
|
62
|
+
locale?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Deep link: auto-open this conversation after bootstrap.
|
|
65
|
+
* Usually sourced from `?hw_conv=` URL param for email CTAs.
|
|
66
|
+
*/
|
|
67
|
+
initialConversationId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Called once after the widget has bootstrapped and exposes
|
|
70
|
+
* programmatic APIs (identify, openConversation).
|
|
71
|
+
*/
|
|
72
|
+
onReady?: (api: {
|
|
73
|
+
identify: (data: IdentifyData) => Promise<void>;
|
|
74
|
+
openConversation: (id: string) => void;
|
|
75
|
+
}) => void;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Legacy prop from the v0.1 script-loader era. If set,
|
|
78
|
+
* the `/widget.js` suffix is stripped to derive `apiUrl`. New code
|
|
79
|
+
* should use `apiUrl` instead.
|
|
80
|
+
*/
|
|
81
|
+
src?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Render this once at the root of your app (e.g. in `_app.tsx`,
|
|
85
|
+
* `layout.tsx`, or `main.tsx`). Unmounting cleanly tears down the
|
|
86
|
+
* widget and its WebSocket connection — useful for route-scoped mounts.
|
|
87
|
+
*/
|
|
88
|
+
declare function HelpwayWidget({ apiKey, apiUrl, locale, initialConversationId, onReady, src, }: HelpwayWidgetProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
|
|
80
90
|
/**
|
|
81
91
|
* Core widget state — connection status, visitor identity, website info.
|
|
82
92
|
*
|