@channlize/react 0.1.0-alpha.2 → 0.1.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/CHANGELOG.md +13 -0
- package/dist/index.d.mts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +487 -403
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +478 -395
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -16
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @channlize/react
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a2f2080: `useChatSession` no longer closes its EventSource when the server ends a
|
|
8
|
+
stream. The browser reconnects on its own and resumes from the last message,
|
|
9
|
+
so agent replies keep arriving in long chats instead of stopping after the
|
|
10
|
+
first stream ends.
|
|
11
|
+
- 7f6cb9c: `useChatSession` with `autoConnect` no longer closes its chat stream right after opening it. The auto-connect effect's cleanup ran on every `session`/`isConnecting` change, so the widget stayed disconnected and never received agent replies; the stream now closes only on unmount.
|
|
12
|
+
- Updated dependencies [9ddf630]
|
|
13
|
+
- @channlize/core@0.1.0
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ChannlizeConfig, ChannlizeClient, CreateContactResponse, ChannlizeError, ContactFormData, ChatMessage, ChatSession } from '@channlize/core';
|
|
4
|
-
export { AuthenticationError, ChannlizeConfig, ChannlizeError, ChatMessage, ChatSession, ContactFormData, CreateChatSessionResponse, CreateContactResponse, FileAttachment, RateLimitError, SendMessageResponse, ValidationError } from '@channlize/core';
|
|
3
|
+
import { ChannlizeConfig, ChannlizeClient, CreateContactResponse, ChannlizeError, ContactFormData, ChatMessage, ChatSession, TrackEventOptions } from '@channlize/core';
|
|
4
|
+
export { AuthenticationError, ChannlizeConfig, ChannlizeError, ChatMessage, ChatSession, ContactFormData, CreateChatSessionResponse, CreateContactResponse, EventSeverity, FileAttachment, RateLimitError, SendMessageResponse, TrackEventOptions, ValidationError } from '@channlize/core';
|
|
5
5
|
|
|
6
6
|
interface ChannlizeContextValue {
|
|
7
7
|
client: ChannlizeClient;
|
|
@@ -14,7 +14,7 @@ interface ChannlizeProviderProps {
|
|
|
14
14
|
/**
|
|
15
15
|
* Provider component that makes Channlize client available to all child components
|
|
16
16
|
*/
|
|
17
|
-
declare function ChannlizeProvider({ config, children }: ChannlizeProviderProps):
|
|
17
|
+
declare function ChannlizeProvider({ config, children, }: ChannlizeProviderProps): react.JSX.Element;
|
|
18
18
|
/**
|
|
19
19
|
* Hook to access the Channlize client and configuration
|
|
20
20
|
*/
|
|
@@ -60,6 +60,16 @@ interface UseChatSessionReturn {
|
|
|
60
60
|
*/
|
|
61
61
|
declare function useChatSession(options?: UseChatSessionOptions): UseChatSessionReturn;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Returns a stable `track` function bound to the provider client for event tracking (browser / widget key).
|
|
65
|
+
*/
|
|
66
|
+
declare function useChannlizeAnalytics(): {
|
|
67
|
+
track: (name: string, options?: TrackEventOptions) => Promise<{
|
|
68
|
+
success: boolean;
|
|
69
|
+
id: string;
|
|
70
|
+
}>;
|
|
71
|
+
};
|
|
72
|
+
|
|
63
73
|
interface FormProps {
|
|
64
74
|
/** Custom fields to include in the form */
|
|
65
75
|
customFields?: Array<{
|
|
@@ -96,7 +106,7 @@ interface FormProps {
|
|
|
96
106
|
* ContactForm component - Alias for Form component
|
|
97
107
|
* Provides a form for collecting contact information and messages
|
|
98
108
|
*/
|
|
99
|
-
declare function ContactForm(props: FormProps):
|
|
109
|
+
declare function ContactForm(props: FormProps): react.JSX.Element;
|
|
100
110
|
|
|
101
111
|
interface SupportChatProps extends UseChatSessionOptions {
|
|
102
112
|
/** Custom CSS classes */
|
|
@@ -130,7 +140,7 @@ interface SupportChatProps extends UseChatSessionOptions {
|
|
|
130
140
|
* SupportChat component - Real-time chat interface
|
|
131
141
|
* Provides a complete chat UI with message history and real-time updates
|
|
132
142
|
*/
|
|
133
|
-
declare function SupportChat({ autoConnect, metadata, onMessage, onError, sessionId, persistSession, storageKey, className, styles, placeholder, title, sendButtonText, showTimestamps, allowAttachments, }: SupportChatProps):
|
|
143
|
+
declare function SupportChat({ autoConnect, metadata, onMessage, onError, sessionId, persistSession, storageKey, className, styles, placeholder, title, sendButtonText, showTimestamps, allowAttachments, }: SupportChatProps): react.JSX.Element;
|
|
134
144
|
|
|
135
145
|
interface ChannlizeChatProps {
|
|
136
146
|
/** Channlize configuration */
|
|
@@ -198,6 +208,6 @@ interface ChannlizeChatProps {
|
|
|
198
208
|
* />
|
|
199
209
|
* ```
|
|
200
210
|
*/
|
|
201
|
-
declare function ChannlizeChat({ config, position, offset, buttonElement, buttonIcon, buttonSize, buttonColors, chatProps, defaultOpen, showBadge, unreadCount, zIndex, showOnMobile, onOpen, onClose, enableAnimations, buttonClassName, chatClassName, }: ChannlizeChatProps):
|
|
211
|
+
declare function ChannlizeChat({ config, position, offset, buttonElement, buttonIcon, buttonSize, buttonColors, chatProps, defaultOpen, showBadge, unreadCount, zIndex, showOnMobile, onOpen, onClose, enableAnimations, buttonClassName, chatClassName, }: ChannlizeChatProps): react.JSX.Element | null;
|
|
202
212
|
|
|
203
|
-
export { ChannlizeChat, ChannlizeProvider, ContactForm, SupportChat, useChannlize, useChatSession, useContactForm };
|
|
213
|
+
export { ChannlizeChat, ChannlizeProvider, ContactForm, SupportChat, useChannlize, useChannlizeAnalytics, useChatSession, useContactForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ChannlizeConfig, ChannlizeClient, CreateContactResponse, ChannlizeError, ContactFormData, ChatMessage, ChatSession } from '@channlize/core';
|
|
4
|
-
export { AuthenticationError, ChannlizeConfig, ChannlizeError, ChatMessage, ChatSession, ContactFormData, CreateChatSessionResponse, CreateContactResponse, FileAttachment, RateLimitError, SendMessageResponse, ValidationError } from '@channlize/core';
|
|
3
|
+
import { ChannlizeConfig, ChannlizeClient, CreateContactResponse, ChannlizeError, ContactFormData, ChatMessage, ChatSession, TrackEventOptions } from '@channlize/core';
|
|
4
|
+
export { AuthenticationError, ChannlizeConfig, ChannlizeError, ChatMessage, ChatSession, ContactFormData, CreateChatSessionResponse, CreateContactResponse, EventSeverity, FileAttachment, RateLimitError, SendMessageResponse, TrackEventOptions, ValidationError } from '@channlize/core';
|
|
5
5
|
|
|
6
6
|
interface ChannlizeContextValue {
|
|
7
7
|
client: ChannlizeClient;
|
|
@@ -14,7 +14,7 @@ interface ChannlizeProviderProps {
|
|
|
14
14
|
/**
|
|
15
15
|
* Provider component that makes Channlize client available to all child components
|
|
16
16
|
*/
|
|
17
|
-
declare function ChannlizeProvider({ config, children }: ChannlizeProviderProps):
|
|
17
|
+
declare function ChannlizeProvider({ config, children, }: ChannlizeProviderProps): react.JSX.Element;
|
|
18
18
|
/**
|
|
19
19
|
* Hook to access the Channlize client and configuration
|
|
20
20
|
*/
|
|
@@ -60,6 +60,16 @@ interface UseChatSessionReturn {
|
|
|
60
60
|
*/
|
|
61
61
|
declare function useChatSession(options?: UseChatSessionOptions): UseChatSessionReturn;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Returns a stable `track` function bound to the provider client for event tracking (browser / widget key).
|
|
65
|
+
*/
|
|
66
|
+
declare function useChannlizeAnalytics(): {
|
|
67
|
+
track: (name: string, options?: TrackEventOptions) => Promise<{
|
|
68
|
+
success: boolean;
|
|
69
|
+
id: string;
|
|
70
|
+
}>;
|
|
71
|
+
};
|
|
72
|
+
|
|
63
73
|
interface FormProps {
|
|
64
74
|
/** Custom fields to include in the form */
|
|
65
75
|
customFields?: Array<{
|
|
@@ -96,7 +106,7 @@ interface FormProps {
|
|
|
96
106
|
* ContactForm component - Alias for Form component
|
|
97
107
|
* Provides a form for collecting contact information and messages
|
|
98
108
|
*/
|
|
99
|
-
declare function ContactForm(props: FormProps):
|
|
109
|
+
declare function ContactForm(props: FormProps): react.JSX.Element;
|
|
100
110
|
|
|
101
111
|
interface SupportChatProps extends UseChatSessionOptions {
|
|
102
112
|
/** Custom CSS classes */
|
|
@@ -130,7 +140,7 @@ interface SupportChatProps extends UseChatSessionOptions {
|
|
|
130
140
|
* SupportChat component - Real-time chat interface
|
|
131
141
|
* Provides a complete chat UI with message history and real-time updates
|
|
132
142
|
*/
|
|
133
|
-
declare function SupportChat({ autoConnect, metadata, onMessage, onError, sessionId, persistSession, storageKey, className, styles, placeholder, title, sendButtonText, showTimestamps, allowAttachments, }: SupportChatProps):
|
|
143
|
+
declare function SupportChat({ autoConnect, metadata, onMessage, onError, sessionId, persistSession, storageKey, className, styles, placeholder, title, sendButtonText, showTimestamps, allowAttachments, }: SupportChatProps): react.JSX.Element;
|
|
134
144
|
|
|
135
145
|
interface ChannlizeChatProps {
|
|
136
146
|
/** Channlize configuration */
|
|
@@ -198,6 +208,6 @@ interface ChannlizeChatProps {
|
|
|
198
208
|
* />
|
|
199
209
|
* ```
|
|
200
210
|
*/
|
|
201
|
-
declare function ChannlizeChat({ config, position, offset, buttonElement, buttonIcon, buttonSize, buttonColors, chatProps, defaultOpen, showBadge, unreadCount, zIndex, showOnMobile, onOpen, onClose, enableAnimations, buttonClassName, chatClassName, }: ChannlizeChatProps):
|
|
211
|
+
declare function ChannlizeChat({ config, position, offset, buttonElement, buttonIcon, buttonSize, buttonColors, chatProps, defaultOpen, showBadge, unreadCount, zIndex, showOnMobile, onOpen, onClose, enableAnimations, buttonClassName, chatClassName, }: ChannlizeChatProps): react.JSX.Element | null;
|
|
202
212
|
|
|
203
|
-
export { ChannlizeChat, ChannlizeProvider, ContactForm, SupportChat, useChannlize, useChatSession, useContactForm };
|
|
213
|
+
export { ChannlizeChat, ChannlizeProvider, ContactForm, SupportChat, useChannlize, useChannlizeAnalytics, useChatSession, useContactForm };
|