@sendbird/ai-agent-messenger-react-native 0.0.1-beta.6 → 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/README.md +2 -2
- package/dist/icons/icon-delight.png +0 -0
- package/dist/icons/icon-delight@2x.png +0 -0
- package/dist/icons/icon-delight@3x.png +0 -0
- package/dist/icons/icon-thumbnail-none.png +0 -0
- package/dist/icons/icon-thumbnail-none@2x.png +0 -0
- package/dist/icons/icon-thumbnail-none@3x.png +0 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +128 -34
- package/dist/index.js +2829 -2473
- package/package.json +13 -8
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { PropsWithChildren } from 'react';
|
|
|
28
28
|
import { ReactNode } from 'react';
|
|
29
29
|
import { RefAttributes } from 'react';
|
|
30
30
|
import { RefObject } from 'react';
|
|
31
|
+
import type * as RNPermissions from 'react-native-permissions';
|
|
31
32
|
import { SendbirdChatParams } from '@sendbird/chat';
|
|
32
33
|
import { SendbirdChatWith } from '@sendbird/chat';
|
|
33
34
|
import { SendbirdError } from '@sendbird/chat';
|
|
@@ -35,6 +36,7 @@ import { SessionHandler } from '@sendbird/chat';
|
|
|
35
36
|
import { User } from '@sendbird/chat';
|
|
36
37
|
import { UserMessage } from '@sendbird/chat/message';
|
|
37
38
|
import { UserMessageCreateParams } from '@sendbird/chat/message';
|
|
39
|
+
import { ViewProps } from 'react-native';
|
|
38
40
|
import { ViewStyle } from 'react-native';
|
|
39
41
|
|
|
40
42
|
declare interface ActionbookInfo {
|
|
@@ -106,6 +108,7 @@ declare interface AIAgentContextValue {
|
|
|
106
108
|
dispatcher: Dispatcher;
|
|
107
109
|
|
|
108
110
|
cache: AIAgentCache;
|
|
111
|
+
networkStateAdapter?: NetworkStateAdapter;
|
|
109
112
|
|
|
110
113
|
queryParams?: AIAgentQueryParams;
|
|
111
114
|
config?: AIAgentConfig;
|
|
@@ -133,6 +136,11 @@ declare interface AIAgentConversationContextValue {
|
|
|
133
136
|
};
|
|
134
137
|
|
|
135
138
|
state: {
|
|
139
|
+
streamAnimation: {
|
|
140
|
+
isAnimating: boolean;
|
|
141
|
+
start: (id: string | number) => void;
|
|
142
|
+
stop: (id: string | number) => void;
|
|
143
|
+
};
|
|
136
144
|
input: InputState;
|
|
137
145
|
};
|
|
138
146
|
}
|
|
@@ -317,6 +325,7 @@ declare interface AIAgentStringSet {
|
|
|
317
325
|
input_placeholder_disabled: string;
|
|
318
326
|
input_placeholder_wait_ai_agent_response: string;
|
|
319
327
|
input_placeholder_active_form: string;
|
|
328
|
+
input_placeholder_reconnecting: string;
|
|
320
329
|
|
|
321
330
|
unknown_message_type: string;
|
|
322
331
|
powered_by: string;
|
|
@@ -332,6 +341,7 @@ declare interface AIAgentStringSet {
|
|
|
332
341
|
conversation_list: {
|
|
333
342
|
header_title: string;
|
|
334
343
|
ended: string;
|
|
344
|
+
footer_title: string;
|
|
335
345
|
};
|
|
336
346
|
|
|
337
347
|
date_format: {
|
|
@@ -515,9 +525,10 @@ declare interface ConversationContextProps extends PropsWithChildren {
|
|
|
515
525
|
onClearChannelUrl?: () => void;
|
|
516
526
|
onNavigateToConversationList?: () => void;
|
|
517
527
|
onClose?: () => void;
|
|
528
|
+
shouldMarkAsRead?: boolean;
|
|
518
529
|
}
|
|
519
530
|
|
|
520
|
-
export declare const ConversationContextProvider: (
|
|
531
|
+
export declare const ConversationContextProvider: (props: ConversationContextProps) => JSX.Element;
|
|
521
532
|
|
|
522
533
|
declare interface ConversationContextValue extends AIAgentConversationContextValue {
|
|
523
534
|
scrollSource: ConversationScrollContextValue;
|
|
@@ -538,9 +549,13 @@ export declare const ConversationHeaderLayout: {
|
|
|
538
549
|
defaults: {
|
|
539
550
|
template: ComponentType<ConversationHeaderTemplateProps>;
|
|
540
551
|
components: {
|
|
541
|
-
|
|
552
|
+
StartArea: () => ReactNode;
|
|
553
|
+
TitleArea: () => ReactNode;
|
|
554
|
+
EndArea: () => ReactNode;
|
|
555
|
+
MenuButton: () => ReactNode;
|
|
542
556
|
Title: () => ReactNode;
|
|
543
|
-
|
|
557
|
+
HandoffButton: () => ReactNode;
|
|
558
|
+
CloseButton: () => ReactNode;
|
|
544
559
|
};
|
|
545
560
|
};
|
|
546
561
|
Template: ({ template, children }: {
|
|
@@ -548,23 +563,43 @@ export declare const ConversationHeaderLayout: {
|
|
|
548
563
|
children?: ReactNode;
|
|
549
564
|
}) => JSX.Element;
|
|
550
565
|
Context: Context<LayoutContextValue< {
|
|
551
|
-
|
|
566
|
+
StartArea: () => ReactNode;
|
|
567
|
+
TitleArea: () => ReactNode;
|
|
568
|
+
EndArea: () => ReactNode;
|
|
569
|
+
MenuButton: () => ReactNode;
|
|
552
570
|
Title: () => ReactNode;
|
|
553
|
-
|
|
571
|
+
HandoffButton: () => ReactNode;
|
|
572
|
+
CloseButton: () => ReactNode;
|
|
554
573
|
}, ConversationHeaderTemplateProps>>;
|
|
555
574
|
useContext: () => LayoutContextValue< {
|
|
556
|
-
|
|
575
|
+
StartArea: () => ReactNode;
|
|
576
|
+
TitleArea: () => ReactNode;
|
|
577
|
+
EndArea: () => ReactNode;
|
|
578
|
+
MenuButton: () => ReactNode;
|
|
557
579
|
Title: () => ReactNode;
|
|
558
|
-
|
|
580
|
+
HandoffButton: () => ReactNode;
|
|
581
|
+
CloseButton: () => ReactNode;
|
|
559
582
|
}, ConversationHeaderTemplateProps>;
|
|
560
583
|
} & {
|
|
561
|
-
|
|
584
|
+
StartArea: (props: {
|
|
585
|
+
component: () => ReactNode;
|
|
586
|
+
}) => null;
|
|
587
|
+
TitleArea: (props: {
|
|
588
|
+
component: () => ReactNode;
|
|
589
|
+
}) => null;
|
|
590
|
+
EndArea: (props: {
|
|
591
|
+
component: () => ReactNode;
|
|
592
|
+
}) => null;
|
|
593
|
+
MenuButton: (props: {
|
|
562
594
|
component: () => ReactNode;
|
|
563
595
|
}) => null;
|
|
564
596
|
Title: (props: {
|
|
565
597
|
component: () => ReactNode;
|
|
566
598
|
}) => null;
|
|
567
|
-
|
|
599
|
+
HandoffButton: (props: {
|
|
600
|
+
component: () => ReactNode;
|
|
601
|
+
}) => null;
|
|
602
|
+
CloseButton: (props: {
|
|
568
603
|
component: () => ReactNode;
|
|
569
604
|
}) => null;
|
|
570
605
|
};
|
|
@@ -650,9 +685,11 @@ export declare const ConversationListHeaderLayout: {
|
|
|
650
685
|
defaults: {
|
|
651
686
|
template: ComponentType<ConversationListHeaderTemplateProps>;
|
|
652
687
|
components: {
|
|
653
|
-
|
|
688
|
+
StartArea: () => ReactNode;
|
|
689
|
+
TitleArea: () => ReactNode;
|
|
690
|
+
EndArea: () => ReactNode;
|
|
654
691
|
Title: () => ReactNode;
|
|
655
|
-
|
|
692
|
+
CloseButton: () => ReactNode;
|
|
656
693
|
};
|
|
657
694
|
};
|
|
658
695
|
Template: ({ template, children }: {
|
|
@@ -660,23 +697,33 @@ export declare const ConversationListHeaderLayout: {
|
|
|
660
697
|
children?: ReactNode;
|
|
661
698
|
}) => JSX.Element;
|
|
662
699
|
Context: Context<LayoutContextValue< {
|
|
663
|
-
|
|
700
|
+
StartArea: () => ReactNode;
|
|
701
|
+
TitleArea: () => ReactNode;
|
|
702
|
+
EndArea: () => ReactNode;
|
|
664
703
|
Title: () => ReactNode;
|
|
665
|
-
|
|
704
|
+
CloseButton: () => ReactNode;
|
|
666
705
|
}, ConversationListHeaderTemplateProps>>;
|
|
667
706
|
useContext: () => LayoutContextValue< {
|
|
668
|
-
|
|
707
|
+
StartArea: () => ReactNode;
|
|
708
|
+
TitleArea: () => ReactNode;
|
|
709
|
+
EndArea: () => ReactNode;
|
|
669
710
|
Title: () => ReactNode;
|
|
670
|
-
|
|
711
|
+
CloseButton: () => ReactNode;
|
|
671
712
|
}, ConversationListHeaderTemplateProps>;
|
|
672
713
|
} & {
|
|
673
|
-
|
|
714
|
+
StartArea: (props: {
|
|
715
|
+
component: () => ReactNode;
|
|
716
|
+
}) => null;
|
|
717
|
+
TitleArea: (props: {
|
|
718
|
+
component: () => ReactNode;
|
|
719
|
+
}) => null;
|
|
720
|
+
EndArea: (props: {
|
|
674
721
|
component: () => ReactNode;
|
|
675
722
|
}) => null;
|
|
676
723
|
Title: (props: {
|
|
677
724
|
component: () => ReactNode;
|
|
678
725
|
}) => null;
|
|
679
|
-
|
|
726
|
+
CloseButton: (props: {
|
|
680
727
|
component: () => ReactNode;
|
|
681
728
|
}) => null;
|
|
682
729
|
};
|
|
@@ -725,7 +772,7 @@ declare interface ConversationScrollContextValue {
|
|
|
725
772
|
ref: RefObject<FlatList | null>;
|
|
726
773
|
state: {
|
|
727
774
|
distanceFromBottom: number;
|
|
728
|
-
|
|
775
|
+
shouldShowScrollButton: boolean;
|
|
729
776
|
bottomSpace?: number;
|
|
730
777
|
};
|
|
731
778
|
props: {
|
|
@@ -787,6 +834,15 @@ declare interface Dispatcher {
|
|
|
787
834
|
): void;
|
|
788
835
|
}
|
|
789
836
|
|
|
837
|
+
/** Adapter interface for document picker */
|
|
838
|
+
declare interface DocumentPickerAdapter {
|
|
839
|
+
/**
|
|
840
|
+
* Select files from file picker
|
|
841
|
+
* @returns Array of MediaFiles, or null if cancelled
|
|
842
|
+
*/
|
|
843
|
+
selectFile: (options?: FilePickerOptions) => Promise<MediaFile[] | null>;
|
|
844
|
+
}
|
|
845
|
+
|
|
790
846
|
declare type ExpoDocumentPickerModule = typeof ExpoDocumentPicker;
|
|
791
847
|
|
|
792
848
|
declare type ExpoImagePickerModule = typeof ExpoImagePicker;
|
|
@@ -874,8 +930,10 @@ declare interface FilePickerOptions {
|
|
|
874
930
|
mimeTypes?: string[];
|
|
875
931
|
}
|
|
876
932
|
|
|
877
|
-
export declare const FixedMessenger: (({ entryPoint, edgeToEdgeEnabled, windowMode, fullscreenInsets, children, }: FixedMessengerProps) => JSX.Element) & {
|
|
933
|
+
export declare const FixedMessenger: (({ entryPoint, edgeToEdgeEnabled, windowMode, fullscreenInsets, initialChannelUrl, windowContainerProps, children, }: FixedMessengerProps) => JSX.Element) & {
|
|
878
934
|
Style: (props: FixedMessengerStyleProps) => null;
|
|
935
|
+
ConversationChildren: ({ children }: PropsWithChildren) => null;
|
|
936
|
+
ConversationListChildren: ({ children }: PropsWithChildren) => null;
|
|
879
937
|
};
|
|
880
938
|
|
|
881
939
|
declare type FixedMessengerMargin = {
|
|
@@ -892,6 +950,10 @@ declare interface FixedMessengerProps {
|
|
|
892
950
|
* @description Initial entry point of the messenger. (Defaults to 'Conversation')
|
|
893
951
|
* */
|
|
894
952
|
entryPoint?: 'Conversation' | 'ConversationList';
|
|
953
|
+
/**
|
|
954
|
+
* @description The URL of the channel to open initially when the messenger is first loaded.
|
|
955
|
+
* */
|
|
956
|
+
initialChannelUrl?: string;
|
|
895
957
|
/**
|
|
896
958
|
* @description Window mode of the messenger. (Defaults to 'floating')
|
|
897
959
|
* */
|
|
@@ -910,6 +972,10 @@ declare interface FixedMessengerProps {
|
|
|
910
972
|
* @description On Android, when edge-to-edge is enabled, bottom inset will be considered when the soft keyboard is opened to avoid overlapping. (Defaults to true)
|
|
911
973
|
* */
|
|
912
974
|
edgeToEdgeEnabled?: boolean;
|
|
975
|
+
/**
|
|
976
|
+
* @description Props to pass to the window container.
|
|
977
|
+
* */
|
|
978
|
+
windowContainerProps?: ViewProps;
|
|
913
979
|
children?: ReactNode;
|
|
914
980
|
}
|
|
915
981
|
|
|
@@ -999,10 +1065,26 @@ declare const icons: {
|
|
|
999
1065
|
bad: any;
|
|
1000
1066
|
'good-filled': any;
|
|
1001
1067
|
'bad-filled': any;
|
|
1068
|
+
delight: any;
|
|
1069
|
+
'thumbnail-none': any;
|
|
1002
1070
|
};
|
|
1003
1071
|
|
|
1004
1072
|
declare type IconType = keyof typeof icons;
|
|
1005
1073
|
|
|
1074
|
+
/** Adapter interface for image picker (camera and gallery) */
|
|
1075
|
+
declare interface ImagePickerAdapter {
|
|
1076
|
+
/**
|
|
1077
|
+
* Launch camera to capture a photo
|
|
1078
|
+
* @returns Array with single MediaFile, or null if cancelled
|
|
1079
|
+
*/
|
|
1080
|
+
captureCamera: (options?: CameraOptions) => Promise<MediaFile[] | null>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Select photos from gallery
|
|
1083
|
+
* @returns Array of MediaFiles, or null if cancelled
|
|
1084
|
+
*/
|
|
1085
|
+
selectFromGallery: (options?: GalleryOptions) => Promise<MediaFile[] | null>;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1006
1088
|
declare type IncomingBaseMessageProps<T> = T &
|
|
1007
1089
|
BaseMessageProps<{
|
|
1008
1090
|
sender: {
|
|
@@ -1031,6 +1113,8 @@ BaseMessageProps<{
|
|
|
1031
1113
|
onFeedbackUpdate?: (params: { rating: 'good' | 'bad'; comment?: string } | null) => void;
|
|
1032
1114
|
onSubmitForm?: (params: { key: string; data: Record<string, FormFieldValue> }) => Promise<void>;
|
|
1033
1115
|
onCancelForm?: (params: { key: string }) => Promise<void>;
|
|
1116
|
+
onStreamAnimationStart?: () => void;
|
|
1117
|
+
onStreamAnimationComplete?: () => void;
|
|
1034
1118
|
|
|
1035
1119
|
// fallbacks
|
|
1036
1120
|
messageTemplateErrorFallback?: ReactNode;
|
|
@@ -1232,6 +1316,7 @@ declare type InputState = {
|
|
|
1232
1316
|
| 'ai_responding'
|
|
1233
1317
|
| 'conversation_closed'
|
|
1234
1318
|
| 'suggested_replies'
|
|
1319
|
+
| 'reconnecting'
|
|
1235
1320
|
| (string & {});
|
|
1236
1321
|
};
|
|
1237
1322
|
|
|
@@ -1430,27 +1515,27 @@ declare type MultiSelectField = {
|
|
|
1430
1515
|
/** Configuration for NativeAdapter */
|
|
1431
1516
|
declare interface NativeAdapterConfig {
|
|
1432
1517
|
mmkv: MMKVModule;
|
|
1433
|
-
imagePicker: ExpoImagePickerModule | CommunityImagePickerModule;
|
|
1434
|
-
documentPicker: ExpoDocumentPickerModule | CommunityDocumentPickerModule;
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
/** Methods available from useNativeAdapterContext() */
|
|
1438
|
-
declare interface NativeAdapterContextValue {
|
|
1439
1518
|
/**
|
|
1440
|
-
*
|
|
1441
|
-
*
|
|
1519
|
+
* Optional: Image picker module for camera and gallery functionality.
|
|
1520
|
+
* Can be omitted if attachment features are not used.
|
|
1521
|
+
* Supports expo-image-picker or react-native-image-picker.
|
|
1442
1522
|
*/
|
|
1443
|
-
|
|
1523
|
+
imagePicker?: ExpoImagePickerModule | CommunityImagePickerModule;
|
|
1444
1524
|
/**
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1525
|
+
* Optional: Document picker module for file selection.
|
|
1526
|
+
* Can be omitted if attachment features are not used.
|
|
1527
|
+
* Supports expo-document-picker or @react-native-documents/picker.
|
|
1447
1528
|
*/
|
|
1448
|
-
|
|
1529
|
+
documentPicker?: ExpoDocumentPickerModule | CommunityDocumentPickerModule;
|
|
1449
1530
|
/**
|
|
1450
|
-
*
|
|
1451
|
-
*
|
|
1531
|
+
* Optional: react-native-permissions module.
|
|
1532
|
+
* Only required when using react-native-image-picker (Community version).
|
|
1452
1533
|
*/
|
|
1453
|
-
|
|
1534
|
+
permissions?: RNPermissionsModule;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
/** Methods available from useNativeAdapterContext() */
|
|
1538
|
+
declare interface NativeAdapterContextValue extends ImagePickerAdapter, DocumentPickerAdapter {
|
|
1454
1539
|
/**
|
|
1455
1540
|
* Key-value storage interface
|
|
1456
1541
|
*/
|
|
@@ -1468,6 +1553,13 @@ declare interface NativeAdapterProviderProps {
|
|
|
1468
1553
|
children: ReactNode | ((context: NativeAdapterContextValue) => ReactNode);
|
|
1469
1554
|
}
|
|
1470
1555
|
|
|
1556
|
+
declare interface NetworkStateAdapter {
|
|
1557
|
+
/** Returns true if network is currently online */
|
|
1558
|
+
isOnline: () => boolean;
|
|
1559
|
+
/** Subscribe to network state changes. Returns unsubscribe function. */
|
|
1560
|
+
subscribe: (callback: (isOnline: boolean) => void) => () => void;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1471
1563
|
declare type NumberField = {
|
|
1472
1564
|
key: string;
|
|
1473
1565
|
type: 'number';
|
|
@@ -1629,6 +1721,8 @@ declare type PositionHorizontal = 'start' | 'end';
|
|
|
1629
1721
|
|
|
1630
1722
|
declare type PositionVertical = 'top' | 'bottom';
|
|
1631
1723
|
|
|
1724
|
+
declare type RNPermissionsModule = typeof RNPermissions;
|
|
1725
|
+
|
|
1632
1726
|
declare type SingleSelectField = {
|
|
1633
1727
|
key: string;
|
|
1634
1728
|
type: 'single-select';
|