@sendbird/ai-agent-messenger-react-native 0.0.1-beta.6 → 1.0.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/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 +133 -35
- package/dist/index.js +2867 -2489
- 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;
|
|
@@ -327,11 +336,16 @@ declare interface AIAgentStringSet {
|
|
|
327
336
|
failed_message_remove: string;
|
|
328
337
|
|
|
329
338
|
file_upload_no_supported_files: string;
|
|
339
|
+
|
|
340
|
+
// Accessibility
|
|
341
|
+
a11y_message_list: string;
|
|
342
|
+
a11y_scroll_to_bottom: string;
|
|
330
343
|
};
|
|
331
344
|
|
|
332
345
|
conversation_list: {
|
|
333
346
|
header_title: string;
|
|
334
347
|
ended: string;
|
|
348
|
+
footer_title: string;
|
|
335
349
|
};
|
|
336
350
|
|
|
337
351
|
date_format: {
|
|
@@ -515,9 +529,10 @@ declare interface ConversationContextProps extends PropsWithChildren {
|
|
|
515
529
|
onClearChannelUrl?: () => void;
|
|
516
530
|
onNavigateToConversationList?: () => void;
|
|
517
531
|
onClose?: () => void;
|
|
532
|
+
shouldMarkAsRead?: boolean;
|
|
518
533
|
}
|
|
519
534
|
|
|
520
|
-
export declare const ConversationContextProvider: (
|
|
535
|
+
export declare const ConversationContextProvider: (props: ConversationContextProps) => JSX.Element;
|
|
521
536
|
|
|
522
537
|
declare interface ConversationContextValue extends AIAgentConversationContextValue {
|
|
523
538
|
scrollSource: ConversationScrollContextValue;
|
|
@@ -538,9 +553,13 @@ export declare const ConversationHeaderLayout: {
|
|
|
538
553
|
defaults: {
|
|
539
554
|
template: ComponentType<ConversationHeaderTemplateProps>;
|
|
540
555
|
components: {
|
|
541
|
-
|
|
556
|
+
StartArea: () => ReactNode;
|
|
557
|
+
TitleArea: () => ReactNode;
|
|
558
|
+
EndArea: () => ReactNode;
|
|
559
|
+
MenuButton: () => ReactNode;
|
|
542
560
|
Title: () => ReactNode;
|
|
543
|
-
|
|
561
|
+
HandoffButton: () => ReactNode;
|
|
562
|
+
CloseButton: () => ReactNode;
|
|
544
563
|
};
|
|
545
564
|
};
|
|
546
565
|
Template: ({ template, children }: {
|
|
@@ -548,23 +567,43 @@ export declare const ConversationHeaderLayout: {
|
|
|
548
567
|
children?: ReactNode;
|
|
549
568
|
}) => JSX.Element;
|
|
550
569
|
Context: Context<LayoutContextValue< {
|
|
551
|
-
|
|
570
|
+
StartArea: () => ReactNode;
|
|
571
|
+
TitleArea: () => ReactNode;
|
|
572
|
+
EndArea: () => ReactNode;
|
|
573
|
+
MenuButton: () => ReactNode;
|
|
552
574
|
Title: () => ReactNode;
|
|
553
|
-
|
|
575
|
+
HandoffButton: () => ReactNode;
|
|
576
|
+
CloseButton: () => ReactNode;
|
|
554
577
|
}, ConversationHeaderTemplateProps>>;
|
|
555
578
|
useContext: () => LayoutContextValue< {
|
|
556
|
-
|
|
579
|
+
StartArea: () => ReactNode;
|
|
580
|
+
TitleArea: () => ReactNode;
|
|
581
|
+
EndArea: () => ReactNode;
|
|
582
|
+
MenuButton: () => ReactNode;
|
|
557
583
|
Title: () => ReactNode;
|
|
558
|
-
|
|
584
|
+
HandoffButton: () => ReactNode;
|
|
585
|
+
CloseButton: () => ReactNode;
|
|
559
586
|
}, ConversationHeaderTemplateProps>;
|
|
560
587
|
} & {
|
|
561
|
-
|
|
588
|
+
StartArea: (props: {
|
|
589
|
+
component: () => ReactNode;
|
|
590
|
+
}) => null;
|
|
591
|
+
TitleArea: (props: {
|
|
592
|
+
component: () => ReactNode;
|
|
593
|
+
}) => null;
|
|
594
|
+
EndArea: (props: {
|
|
595
|
+
component: () => ReactNode;
|
|
596
|
+
}) => null;
|
|
597
|
+
MenuButton: (props: {
|
|
562
598
|
component: () => ReactNode;
|
|
563
599
|
}) => null;
|
|
564
600
|
Title: (props: {
|
|
565
601
|
component: () => ReactNode;
|
|
566
602
|
}) => null;
|
|
567
|
-
|
|
603
|
+
HandoffButton: (props: {
|
|
604
|
+
component: () => ReactNode;
|
|
605
|
+
}) => null;
|
|
606
|
+
CloseButton: (props: {
|
|
568
607
|
component: () => ReactNode;
|
|
569
608
|
}) => null;
|
|
570
609
|
};
|
|
@@ -650,9 +689,11 @@ export declare const ConversationListHeaderLayout: {
|
|
|
650
689
|
defaults: {
|
|
651
690
|
template: ComponentType<ConversationListHeaderTemplateProps>;
|
|
652
691
|
components: {
|
|
653
|
-
|
|
692
|
+
StartArea: () => ReactNode;
|
|
693
|
+
TitleArea: () => ReactNode;
|
|
694
|
+
EndArea: () => ReactNode;
|
|
654
695
|
Title: () => ReactNode;
|
|
655
|
-
|
|
696
|
+
CloseButton: () => ReactNode;
|
|
656
697
|
};
|
|
657
698
|
};
|
|
658
699
|
Template: ({ template, children }: {
|
|
@@ -660,23 +701,33 @@ export declare const ConversationListHeaderLayout: {
|
|
|
660
701
|
children?: ReactNode;
|
|
661
702
|
}) => JSX.Element;
|
|
662
703
|
Context: Context<LayoutContextValue< {
|
|
663
|
-
|
|
704
|
+
StartArea: () => ReactNode;
|
|
705
|
+
TitleArea: () => ReactNode;
|
|
706
|
+
EndArea: () => ReactNode;
|
|
664
707
|
Title: () => ReactNode;
|
|
665
|
-
|
|
708
|
+
CloseButton: () => ReactNode;
|
|
666
709
|
}, ConversationListHeaderTemplateProps>>;
|
|
667
710
|
useContext: () => LayoutContextValue< {
|
|
668
|
-
|
|
711
|
+
StartArea: () => ReactNode;
|
|
712
|
+
TitleArea: () => ReactNode;
|
|
713
|
+
EndArea: () => ReactNode;
|
|
669
714
|
Title: () => ReactNode;
|
|
670
|
-
|
|
715
|
+
CloseButton: () => ReactNode;
|
|
671
716
|
}, ConversationListHeaderTemplateProps>;
|
|
672
717
|
} & {
|
|
673
|
-
|
|
718
|
+
StartArea: (props: {
|
|
719
|
+
component: () => ReactNode;
|
|
720
|
+
}) => null;
|
|
721
|
+
TitleArea: (props: {
|
|
722
|
+
component: () => ReactNode;
|
|
723
|
+
}) => null;
|
|
724
|
+
EndArea: (props: {
|
|
674
725
|
component: () => ReactNode;
|
|
675
726
|
}) => null;
|
|
676
727
|
Title: (props: {
|
|
677
728
|
component: () => ReactNode;
|
|
678
729
|
}) => null;
|
|
679
|
-
|
|
730
|
+
CloseButton: (props: {
|
|
680
731
|
component: () => ReactNode;
|
|
681
732
|
}) => null;
|
|
682
733
|
};
|
|
@@ -725,7 +776,7 @@ declare interface ConversationScrollContextValue {
|
|
|
725
776
|
ref: RefObject<FlatList | null>;
|
|
726
777
|
state: {
|
|
727
778
|
distanceFromBottom: number;
|
|
728
|
-
|
|
779
|
+
shouldShowScrollButton: boolean;
|
|
729
780
|
bottomSpace?: number;
|
|
730
781
|
};
|
|
731
782
|
props: {
|
|
@@ -787,6 +838,15 @@ declare interface Dispatcher {
|
|
|
787
838
|
): void;
|
|
788
839
|
}
|
|
789
840
|
|
|
841
|
+
/** Adapter interface for document picker */
|
|
842
|
+
declare interface DocumentPickerAdapter {
|
|
843
|
+
/**
|
|
844
|
+
* Select files from file picker
|
|
845
|
+
* @returns Array of MediaFiles, or null if cancelled
|
|
846
|
+
*/
|
|
847
|
+
selectFile: (options?: FilePickerOptions) => Promise<MediaFile[] | null>;
|
|
848
|
+
}
|
|
849
|
+
|
|
790
850
|
declare type ExpoDocumentPickerModule = typeof ExpoDocumentPicker;
|
|
791
851
|
|
|
792
852
|
declare type ExpoImagePickerModule = typeof ExpoImagePicker;
|
|
@@ -874,8 +934,10 @@ declare interface FilePickerOptions {
|
|
|
874
934
|
mimeTypes?: string[];
|
|
875
935
|
}
|
|
876
936
|
|
|
877
|
-
export declare const FixedMessenger: (({ entryPoint, edgeToEdgeEnabled, windowMode, fullscreenInsets, children, }: FixedMessengerProps) => JSX.Element) & {
|
|
937
|
+
export declare const FixedMessenger: (({ entryPoint, edgeToEdgeEnabled, windowMode, fullscreenInsets, initialChannelUrl, windowContainerProps, children, }: FixedMessengerProps) => JSX.Element) & {
|
|
878
938
|
Style: (props: FixedMessengerStyleProps) => null;
|
|
939
|
+
ConversationChildren: ({ children }: PropsWithChildren) => null;
|
|
940
|
+
ConversationListChildren: ({ children }: PropsWithChildren) => null;
|
|
879
941
|
};
|
|
880
942
|
|
|
881
943
|
declare type FixedMessengerMargin = {
|
|
@@ -892,6 +954,10 @@ declare interface FixedMessengerProps {
|
|
|
892
954
|
* @description Initial entry point of the messenger. (Defaults to 'Conversation')
|
|
893
955
|
* */
|
|
894
956
|
entryPoint?: 'Conversation' | 'ConversationList';
|
|
957
|
+
/**
|
|
958
|
+
* @description The URL of the channel to open initially when the messenger is first loaded.
|
|
959
|
+
* */
|
|
960
|
+
initialChannelUrl?: string;
|
|
895
961
|
/**
|
|
896
962
|
* @description Window mode of the messenger. (Defaults to 'floating')
|
|
897
963
|
* */
|
|
@@ -910,6 +976,10 @@ declare interface FixedMessengerProps {
|
|
|
910
976
|
* @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
977
|
* */
|
|
912
978
|
edgeToEdgeEnabled?: boolean;
|
|
979
|
+
/**
|
|
980
|
+
* @description Props to pass to the window container.
|
|
981
|
+
* */
|
|
982
|
+
windowContainerProps?: ViewProps;
|
|
913
983
|
children?: ReactNode;
|
|
914
984
|
}
|
|
915
985
|
|
|
@@ -999,10 +1069,26 @@ declare const icons: {
|
|
|
999
1069
|
bad: any;
|
|
1000
1070
|
'good-filled': any;
|
|
1001
1071
|
'bad-filled': any;
|
|
1072
|
+
delight: any;
|
|
1073
|
+
'thumbnail-none': any;
|
|
1002
1074
|
};
|
|
1003
1075
|
|
|
1004
1076
|
declare type IconType = keyof typeof icons;
|
|
1005
1077
|
|
|
1078
|
+
/** Adapter interface for image picker (camera and gallery) */
|
|
1079
|
+
declare interface ImagePickerAdapter {
|
|
1080
|
+
/**
|
|
1081
|
+
* Launch camera to capture a photo
|
|
1082
|
+
* @returns Array with single MediaFile, or null if cancelled
|
|
1083
|
+
*/
|
|
1084
|
+
captureCamera: (options?: CameraOptions) => Promise<MediaFile[] | null>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Select photos from gallery
|
|
1087
|
+
* @returns Array of MediaFiles, or null if cancelled
|
|
1088
|
+
*/
|
|
1089
|
+
selectFromGallery: (options?: GalleryOptions) => Promise<MediaFile[] | null>;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1006
1092
|
declare type IncomingBaseMessageProps<T> = T &
|
|
1007
1093
|
BaseMessageProps<{
|
|
1008
1094
|
sender: {
|
|
@@ -1031,6 +1117,8 @@ BaseMessageProps<{
|
|
|
1031
1117
|
onFeedbackUpdate?: (params: { rating: 'good' | 'bad'; comment?: string } | null) => void;
|
|
1032
1118
|
onSubmitForm?: (params: { key: string; data: Record<string, FormFieldValue> }) => Promise<void>;
|
|
1033
1119
|
onCancelForm?: (params: { key: string }) => Promise<void>;
|
|
1120
|
+
onStreamAnimationStart?: () => void;
|
|
1121
|
+
onStreamAnimationComplete?: () => void;
|
|
1034
1122
|
|
|
1035
1123
|
// fallbacks
|
|
1036
1124
|
messageTemplateErrorFallback?: ReactNode;
|
|
@@ -1232,6 +1320,7 @@ declare type InputState = {
|
|
|
1232
1320
|
| 'ai_responding'
|
|
1233
1321
|
| 'conversation_closed'
|
|
1234
1322
|
| 'suggested_replies'
|
|
1323
|
+
| 'reconnecting'
|
|
1235
1324
|
| (string & {});
|
|
1236
1325
|
};
|
|
1237
1326
|
|
|
@@ -1430,27 +1519,27 @@ declare type MultiSelectField = {
|
|
|
1430
1519
|
/** Configuration for NativeAdapter */
|
|
1431
1520
|
declare interface NativeAdapterConfig {
|
|
1432
1521
|
mmkv: MMKVModule;
|
|
1433
|
-
imagePicker: ExpoImagePickerModule | CommunityImagePickerModule;
|
|
1434
|
-
documentPicker: ExpoDocumentPickerModule | CommunityDocumentPickerModule;
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
/** Methods available from useNativeAdapterContext() */
|
|
1438
|
-
declare interface NativeAdapterContextValue {
|
|
1439
1522
|
/**
|
|
1440
|
-
*
|
|
1441
|
-
*
|
|
1523
|
+
* Optional: Image picker module for camera and gallery functionality.
|
|
1524
|
+
* Can be omitted if attachment features are not used.
|
|
1525
|
+
* Supports expo-image-picker or react-native-image-picker.
|
|
1442
1526
|
*/
|
|
1443
|
-
|
|
1527
|
+
imagePicker?: ExpoImagePickerModule | CommunityImagePickerModule;
|
|
1444
1528
|
/**
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1529
|
+
* Optional: Document picker module for file selection.
|
|
1530
|
+
* Can be omitted if attachment features are not used.
|
|
1531
|
+
* Supports expo-document-picker or @react-native-documents/picker.
|
|
1447
1532
|
*/
|
|
1448
|
-
|
|
1533
|
+
documentPicker?: ExpoDocumentPickerModule | CommunityDocumentPickerModule;
|
|
1449
1534
|
/**
|
|
1450
|
-
*
|
|
1451
|
-
*
|
|
1535
|
+
* Optional: react-native-permissions module.
|
|
1536
|
+
* Only required when using react-native-image-picker (Community version).
|
|
1452
1537
|
*/
|
|
1453
|
-
|
|
1538
|
+
permissions?: RNPermissionsModule;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** Methods available from useNativeAdapterContext() */
|
|
1542
|
+
declare interface NativeAdapterContextValue extends ImagePickerAdapter, DocumentPickerAdapter {
|
|
1454
1543
|
/**
|
|
1455
1544
|
* Key-value storage interface
|
|
1456
1545
|
*/
|
|
@@ -1468,6 +1557,13 @@ declare interface NativeAdapterProviderProps {
|
|
|
1468
1557
|
children: ReactNode | ((context: NativeAdapterContextValue) => ReactNode);
|
|
1469
1558
|
}
|
|
1470
1559
|
|
|
1560
|
+
declare interface NetworkStateAdapter {
|
|
1561
|
+
/** Returns true if network is currently online */
|
|
1562
|
+
isOnline: () => boolean;
|
|
1563
|
+
/** Subscribe to network state changes. Returns unsubscribe function. */
|
|
1564
|
+
subscribe: (callback: (isOnline: boolean) => void) => () => void;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1471
1567
|
declare type NumberField = {
|
|
1472
1568
|
key: string;
|
|
1473
1569
|
type: 'number';
|
|
@@ -1629,6 +1725,8 @@ declare type PositionHorizontal = 'start' | 'end';
|
|
|
1629
1725
|
|
|
1630
1726
|
declare type PositionVertical = 'top' | 'bottom';
|
|
1631
1727
|
|
|
1728
|
+
declare type RNPermissionsModule = typeof RNPermissions;
|
|
1729
|
+
|
|
1632
1730
|
declare type SingleSelectField = {
|
|
1633
1731
|
key: string;
|
|
1634
1732
|
type: 'single-select';
|
|
@@ -1709,7 +1807,7 @@ declare type SystemMessageUnion =
|
|
|
1709
1807
|
csatReason?: string;
|
|
1710
1808
|
csatExpireAt?: number;
|
|
1711
1809
|
isResolvedWhenDeterminedByUser?: boolean;
|
|
1712
|
-
onSubmitCSAT: (params: CSATSubmitParams) => void
|
|
1810
|
+
onSubmitCSAT: (params: CSATSubmitParams) => Promise<void>;
|
|
1713
1811
|
}>;
|
|
1714
1812
|
|
|
1715
1813
|
declare type TextField = {
|