@customerhero/react 0.0.2 → 1.0.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.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CustomerHeroChatConfig, IdentifyPayload } from '@customerhero/js';
3
- export { IdentifyPayload } from '@customerhero/js';
2
+ import { CustomerHeroChatConfig, IdentifyPayload, ActionConfirmationBlock, TranslateFn, ChatState, MessageRating } from '@customerhero/js';
3
+ export { ActionConfirmationBlock, IdentifyPayload } from '@customerhero/js';
4
4
 
5
5
  interface ChatWidgetProps extends CustomerHeroChatConfig {
6
6
  /** Pass customer identity data to link conversations to customer records. */
@@ -8,4 +8,37 @@ interface ChatWidgetProps extends CustomerHeroChatConfig {
8
8
  }
9
9
  declare function ChatWidget({ identity, ...config }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
10
10
 
11
- export { ChatWidget, type ChatWidgetProps };
11
+ interface ActionConfirmationCardProps {
12
+ block: ActionConfirmationBlock;
13
+ primaryColor: string;
14
+ t: TranslateFn;
15
+ onApprove: (pendingId: string) => Promise<void>;
16
+ onCancel: (pendingId: string) => Promise<void>;
17
+ }
18
+ declare function ActionConfirmationCard({ block, primaryColor, t, onApprove, onCancel, }: ActionConfirmationCardProps): react_jsx_runtime.JSX.Element;
19
+
20
+ interface UseChatReturn extends ChatState {
21
+ t: TranslateFn;
22
+ sendMessage: (message: string, options?: {
23
+ attachmentTokens?: string[];
24
+ }) => Promise<void>;
25
+ rateMessage: (messageId: string, rating: MessageRating) => Promise<void>;
26
+ approveAction: (pendingId: string) => Promise<void>;
27
+ cancelAction: (pendingId: string) => Promise<void>;
28
+ uploadAttachment: (blob: Blob, options?: {
29
+ filename?: string;
30
+ }) => Promise<{
31
+ attachmentToken: string;
32
+ previewUrl: string;
33
+ expiresAt: string;
34
+ }>;
35
+ setLocale: (tag: string) => void;
36
+ toggle: () => void;
37
+ open: () => void;
38
+ close: () => void;
39
+ reset: () => void;
40
+ identify: (payload: IdentifyPayload) => void;
41
+ }
42
+ declare function useChat(): UseChatReturn;
43
+
44
+ export { ActionConfirmationCard, type ActionConfirmationCardProps, ChatWidget, type ChatWidgetProps, type UseChatReturn, useChat };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CustomerHeroChatConfig, IdentifyPayload } from '@customerhero/js';
3
- export { IdentifyPayload } from '@customerhero/js';
2
+ import { CustomerHeroChatConfig, IdentifyPayload, ActionConfirmationBlock, TranslateFn, ChatState, MessageRating } from '@customerhero/js';
3
+ export { ActionConfirmationBlock, IdentifyPayload } from '@customerhero/js';
4
4
 
5
5
  interface ChatWidgetProps extends CustomerHeroChatConfig {
6
6
  /** Pass customer identity data to link conversations to customer records. */
@@ -8,4 +8,37 @@ interface ChatWidgetProps extends CustomerHeroChatConfig {
8
8
  }
9
9
  declare function ChatWidget({ identity, ...config }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
10
10
 
11
- export { ChatWidget, type ChatWidgetProps };
11
+ interface ActionConfirmationCardProps {
12
+ block: ActionConfirmationBlock;
13
+ primaryColor: string;
14
+ t: TranslateFn;
15
+ onApprove: (pendingId: string) => Promise<void>;
16
+ onCancel: (pendingId: string) => Promise<void>;
17
+ }
18
+ declare function ActionConfirmationCard({ block, primaryColor, t, onApprove, onCancel, }: ActionConfirmationCardProps): react_jsx_runtime.JSX.Element;
19
+
20
+ interface UseChatReturn extends ChatState {
21
+ t: TranslateFn;
22
+ sendMessage: (message: string, options?: {
23
+ attachmentTokens?: string[];
24
+ }) => Promise<void>;
25
+ rateMessage: (messageId: string, rating: MessageRating) => Promise<void>;
26
+ approveAction: (pendingId: string) => Promise<void>;
27
+ cancelAction: (pendingId: string) => Promise<void>;
28
+ uploadAttachment: (blob: Blob, options?: {
29
+ filename?: string;
30
+ }) => Promise<{
31
+ attachmentToken: string;
32
+ previewUrl: string;
33
+ expiresAt: string;
34
+ }>;
35
+ setLocale: (tag: string) => void;
36
+ toggle: () => void;
37
+ open: () => void;
38
+ close: () => void;
39
+ reset: () => void;
40
+ identify: (payload: IdentifyPayload) => void;
41
+ }
42
+ declare function useChat(): UseChatReturn;
43
+
44
+ export { ActionConfirmationCard, type ActionConfirmationCardProps, ChatWidget, type ChatWidgetProps, type UseChatReturn, useChat };