rn-erxes-sdk 0.1.22 → 0.1.24
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 +40 -2
- package/lib/commonjs/App.js +41 -21
- package/lib/commonjs/App.js.map +1 -1
- package/lib/commonjs/Widget.js +158 -31
- package/lib/commonjs/Widget.js.map +1 -1
- package/lib/commonjs/components/Avatar.js +24 -27
- package/lib/commonjs/components/Avatar.js.map +1 -1
- package/lib/commonjs/components/AvatarWithStatus.js +56 -0
- package/lib/commonjs/components/AvatarWithStatus.js.map +1 -0
- package/lib/commonjs/components/ConversationItem.js +161 -0
- package/lib/commonjs/components/ConversationItem.js.map +1 -0
- package/lib/commonjs/components/Icons.js +558 -0
- package/lib/commonjs/components/Icons.js.map +1 -0
- package/lib/commonjs/components/InputTools.js +329 -38
- package/lib/commonjs/components/InputTools.js.map +1 -1
- package/lib/commonjs/components/MessengerShell.js +64 -0
- package/lib/commonjs/components/MessengerShell.js.map +1 -0
- package/lib/commonjs/components/conversation/DateSeparator.js +47 -0
- package/lib/commonjs/components/conversation/DateSeparator.js.map +1 -0
- package/lib/commonjs/components/conversation/EmojiPicker.js +62 -0
- package/lib/commonjs/components/conversation/EmojiPicker.js.map +1 -0
- package/lib/commonjs/components/conversation/PersistentMenu.js +64 -0
- package/lib/commonjs/components/conversation/PersistentMenu.js.map +1 -0
- package/lib/commonjs/components/conversation/TypingStatus.js +122 -0
- package/lib/commonjs/components/conversation/TypingStatus.js.map +1 -0
- package/lib/commonjs/components/conversation/WelcomeMessage.js +85 -0
- package/lib/commonjs/components/conversation/WelcomeMessage.js.map +1 -0
- package/lib/commonjs/components/nav/Navigation.js +130 -0
- package/lib/commonjs/components/nav/Navigation.js.map +1 -0
- package/lib/commonjs/components/nav/constants.js +23 -0
- package/lib/commonjs/components/nav/constants.js.map +1 -0
- package/lib/commonjs/graphql/ApolloContainer.js +1 -2
- package/lib/commonjs/graphql/ApolloContainer.js.map +1 -1
- package/lib/commonjs/graphql/mutation.js +58 -23
- package/lib/commonjs/graphql/mutation.js.map +1 -1
- package/lib/commonjs/graphql/query.js +85 -55
- package/lib/commonjs/graphql/query.js.map +1 -1
- package/lib/commonjs/graphql/subscription.js +32 -28
- package/lib/commonjs/graphql/subscription.js.map +1 -1
- package/lib/commonjs/screen/conversation/Attachment.js +77 -12
- package/lib/commonjs/screen/conversation/Attachment.js.map +1 -1
- package/lib/commonjs/screen/conversation/ConversationDetail.js +307 -136
- package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -1
- package/lib/commonjs/screen/conversation/Message.js +145 -82
- package/lib/commonjs/screen/conversation/Message.js.map +1 -1
- package/lib/commonjs/screen/faq/Faq.js +373 -0
- package/lib/commonjs/screen/faq/Faq.js.map +1 -0
- package/lib/commonjs/screen/greetings/Social.js +19 -9
- package/lib/commonjs/screen/greetings/Social.js.map +1 -1
- package/lib/commonjs/screen/greetings/Supporters.js +49 -46
- package/lib/commonjs/screen/greetings/Supporters.js.map +1 -1
- package/lib/commonjs/screen/home/Home.js +246 -0
- package/lib/commonjs/screen/home/Home.js.map +1 -0
- package/lib/commonjs/screen/messages/Messages.js +312 -0
- package/lib/commonjs/screen/messages/Messages.js.map +1 -0
- package/lib/commonjs/theme.js +132 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/utils/messages.js +93 -0
- package/lib/commonjs/utils/messages.js.map +1 -0
- package/lib/commonjs/utils/onlineHours.js +127 -0
- package/lib/commonjs/utils/onlineHours.js.map +1 -0
- package/lib/commonjs/utils/upload.js +245 -0
- package/lib/commonjs/utils/upload.js.map +1 -0
- package/lib/module/App.js +41 -21
- package/lib/module/App.js.map +1 -1
- package/lib/module/Widget.js +161 -34
- package/lib/module/Widget.js.map +1 -1
- package/lib/module/components/Avatar.js +25 -28
- package/lib/module/components/Avatar.js.map +1 -1
- package/lib/module/components/AvatarWithStatus.js +47 -0
- package/lib/module/components/AvatarWithStatus.js.map +1 -0
- package/lib/module/components/ConversationItem.js +153 -0
- package/lib/module/components/ConversationItem.js.map +1 -0
- package/lib/module/components/Icons.js +537 -0
- package/lib/module/components/Icons.js.map +1 -0
- package/lib/module/components/InputTools.js +331 -39
- package/lib/module/components/InputTools.js.map +1 -1
- package/lib/module/components/MessengerShell.js +55 -0
- package/lib/module/components/MessengerShell.js.map +1 -0
- package/lib/module/components/conversation/DateSeparator.js +40 -0
- package/lib/module/components/conversation/DateSeparator.js.map +1 -0
- package/lib/module/components/conversation/EmojiPicker.js +55 -0
- package/lib/module/components/conversation/EmojiPicker.js.map +1 -0
- package/lib/module/components/conversation/PersistentMenu.js +57 -0
- package/lib/module/components/conversation/PersistentMenu.js.map +1 -0
- package/lib/module/components/conversation/TypingStatus.js +113 -0
- package/lib/module/components/conversation/TypingStatus.js.map +1 -0
- package/lib/module/components/conversation/WelcomeMessage.js +76 -0
- package/lib/module/components/conversation/WelcomeMessage.js.map +1 -0
- package/lib/module/components/nav/Navigation.js +121 -0
- package/lib/module/components/nav/Navigation.js.map +1 -0
- package/lib/module/components/nav/constants.js +16 -0
- package/lib/module/components/nav/constants.js.map +1 -0
- package/lib/module/graphql/ApolloContainer.js +1 -2
- package/lib/module/graphql/ApolloContainer.js.map +1 -1
- package/lib/module/graphql/mutation.js +57 -23
- package/lib/module/graphql/mutation.js.map +1 -1
- package/lib/module/graphql/query.js +83 -52
- package/lib/module/graphql/query.js.map +1 -1
- package/lib/module/graphql/subscription.js +31 -28
- package/lib/module/graphql/subscription.js.map +1 -1
- package/lib/module/screen/conversation/Attachment.js +79 -14
- package/lib/module/screen/conversation/Attachment.js.map +1 -1
- package/lib/module/screen/conversation/ConversationDetail.js +311 -139
- package/lib/module/screen/conversation/ConversationDetail.js.map +1 -1
- package/lib/module/screen/conversation/Message.js +145 -82
- package/lib/module/screen/conversation/Message.js.map +1 -1
- package/lib/module/screen/faq/Faq.js +363 -0
- package/lib/module/screen/faq/Faq.js.map +1 -0
- package/lib/module/screen/greetings/Social.js +19 -9
- package/lib/module/screen/greetings/Social.js.map +1 -1
- package/lib/module/screen/greetings/Supporters.js +50 -46
- package/lib/module/screen/greetings/Supporters.js.map +1 -1
- package/lib/module/screen/home/Home.js +236 -0
- package/lib/module/screen/home/Home.js.map +1 -0
- package/lib/module/screen/messages/Messages.js +303 -0
- package/lib/module/screen/messages/Messages.js.map +1 -0
- package/lib/module/theme.js +122 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/utils/messages.js +81 -0
- package/lib/module/utils/messages.js.map +1 -0
- package/lib/module/utils/onlineHours.js +118 -0
- package/lib/module/utils/onlineHours.js.map +1 -0
- package/lib/module/utils/upload.js +233 -0
- package/lib/module/utils/upload.js.map +1 -0
- package/lib/typescript/App.d.ts +2 -1
- package/lib/typescript/App.d.ts.map +1 -1
- package/lib/typescript/Widget.d.ts.map +1 -1
- package/lib/typescript/components/Avatar.d.ts +7 -1
- package/lib/typescript/components/Avatar.d.ts.map +1 -1
- package/lib/typescript/components/AvatarWithStatus.d.ts +11 -0
- package/lib/typescript/components/AvatarWithStatus.d.ts.map +1 -0
- package/lib/typescript/components/ConversationItem.d.ts +9 -0
- package/lib/typescript/components/ConversationItem.d.ts.map +1 -0
- package/lib/typescript/components/Icons.d.ts +33 -0
- package/lib/typescript/components/Icons.d.ts.map +1 -0
- package/lib/typescript/components/InputTools.d.ts.map +1 -1
- package/lib/typescript/components/MessengerShell.d.ts +4 -0
- package/lib/typescript/components/MessengerShell.d.ts.map +1 -0
- package/lib/typescript/components/conversation/DateSeparator.d.ts +6 -0
- package/lib/typescript/components/conversation/DateSeparator.d.ts.map +1 -0
- package/lib/typescript/components/conversation/EmojiPicker.d.ts +7 -0
- package/lib/typescript/components/conversation/EmojiPicker.d.ts.map +1 -0
- package/lib/typescript/components/conversation/PersistentMenu.d.ts +13 -0
- package/lib/typescript/components/conversation/PersistentMenu.d.ts.map +1 -0
- package/lib/typescript/components/conversation/TypingStatus.d.ts +4 -0
- package/lib/typescript/components/conversation/TypingStatus.d.ts.map +1 -0
- package/lib/typescript/components/conversation/WelcomeMessage.d.ts +6 -0
- package/lib/typescript/components/conversation/WelcomeMessage.d.ts.map +1 -0
- package/lib/typescript/components/nav/Navigation.d.ts +12 -0
- package/lib/typescript/components/nav/Navigation.d.ts.map +1 -0
- package/lib/typescript/components/nav/constants.d.ts +7 -0
- package/lib/typescript/components/nav/constants.d.ts.map +1 -0
- package/lib/typescript/graphql/ApolloContainer.d.ts.map +1 -1
- package/lib/typescript/graphql/mutation.d.ts +2 -1
- package/lib/typescript/graphql/mutation.d.ts.map +1 -1
- package/lib/typescript/graphql/query.d.ts +2 -3
- package/lib/typescript/graphql/query.d.ts.map +1 -1
- package/lib/typescript/graphql/subscription.d.ts +2 -1
- package/lib/typescript/graphql/subscription.d.ts.map +1 -1
- package/lib/typescript/screen/conversation/Attachment.d.ts.map +1 -1
- package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -1
- package/lib/typescript/screen/conversation/Message.d.ts.map +1 -1
- package/lib/typescript/screen/faq/Faq.d.ts +4 -0
- package/lib/typescript/screen/faq/Faq.d.ts.map +1 -0
- package/lib/typescript/screen/greetings/Social.d.ts +1 -1
- package/lib/typescript/screen/greetings/Social.d.ts.map +1 -1
- package/lib/typescript/screen/greetings/Supporters.d.ts.map +1 -1
- package/lib/typescript/screen/home/Home.d.ts +4 -0
- package/lib/typescript/screen/home/Home.d.ts.map +1 -0
- package/lib/typescript/screen/messages/Messages.d.ts +4 -0
- package/lib/typescript/screen/messages/Messages.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +93 -0
- package/lib/typescript/theme.d.ts.map +1 -0
- package/lib/typescript/utils/messages.d.ts +27 -0
- package/lib/typescript/utils/messages.d.ts.map +1 -0
- package/lib/typescript/utils/onlineHours.d.ts +19 -0
- package/lib/typescript/utils/onlineHours.d.ts.map +1 -0
- package/lib/typescript/utils/upload.d.ts +32 -0
- package/lib/typescript/utils/upload.d.ts.map +1 -0
- package/package.json +25 -21
- package/src/App.tsx +48 -24
- package/src/Widget.tsx +214 -40
- package/src/components/Avatar.tsx +30 -30
- package/src/components/AvatarWithStatus.tsx +63 -0
- package/src/components/ConversationItem.tsx +199 -0
- package/src/components/Icons.tsx +532 -0
- package/src/components/InputTools.tsx +387 -48
- package/src/components/MessengerShell.tsx +58 -0
- package/src/components/conversation/DateSeparator.tsx +36 -0
- package/src/components/conversation/EmojiPicker.tsx +111 -0
- package/src/components/conversation/PersistentMenu.tsx +74 -0
- package/src/components/conversation/TypingStatus.tsx +112 -0
- package/src/components/conversation/WelcomeMessage.tsx +70 -0
- package/src/components/nav/Navigation.tsx +137 -0
- package/src/components/nav/constants.ts +16 -0
- package/src/graphql/ApolloContainer.tsx +0 -1
- package/src/graphql/mutation.ts +58 -22
- package/src/graphql/query.ts +83 -55
- package/src/graphql/subscription.ts +31 -27
- package/src/screen/conversation/Attachment.tsx +123 -33
- package/src/screen/conversation/ConversationDetail.tsx +367 -134
- package/src/screen/conversation/Message.tsx +160 -98
- package/src/screen/faq/Faq.tsx +425 -0
- package/src/screen/greetings/Social.tsx +18 -4
- package/src/screen/greetings/Supporters.tsx +56 -41
- package/src/screen/home/Home.tsx +276 -0
- package/src/screen/messages/Messages.tsx +331 -0
- package/src/theme.ts +104 -0
- package/src/utils/messages.ts +105 -0
- package/src/utils/onlineHours.ts +167 -0
- package/src/utils/upload.ts +326 -0
- package/lib/commonjs/components/FAB.js +0 -51
- package/lib/commonjs/components/FAB.js.map +0 -1
- package/lib/commonjs/screen/conversation/Conversations.js +0 -158
- package/lib/commonjs/screen/conversation/Conversations.js.map +0 -1
- package/lib/commonjs/screen/greetings/Greetings.js +0 -96
- package/lib/commonjs/screen/greetings/Greetings.js.map +0 -1
- package/lib/module/components/FAB.js +0 -42
- package/lib/module/components/FAB.js.map +0 -1
- package/lib/module/screen/conversation/Conversations.js +0 -147
- package/lib/module/screen/conversation/Conversations.js.map +0 -1
- package/lib/module/screen/greetings/Greetings.js +0 -85
- package/lib/module/screen/greetings/Greetings.js.map +0 -1
- package/lib/typescript/components/FAB.d.ts +0 -16
- package/lib/typescript/components/FAB.d.ts.map +0 -1
- package/lib/typescript/screen/conversation/Conversations.d.ts +0 -4
- package/lib/typescript/screen/conversation/Conversations.d.ts.map +0 -1
- package/lib/typescript/screen/greetings/Greetings.d.ts +0 -4
- package/lib/typescript/screen/greetings/Greetings.d.ts.map +0 -1
- package/src/components/FAB.tsx +0 -69
- package/src/screen/conversation/Conversations.tsx +0 -148
- package/src/screen/greetings/Greetings.tsx +0 -98
|
@@ -6,74 +6,95 @@ import HTML from 'react-native-render-html';
|
|
|
6
6
|
import { strip_html } from '../../utils/utils';
|
|
7
7
|
import Attachment from './Attachment';
|
|
8
8
|
import Avatar from '../../components/Avatar';
|
|
9
|
+
import { messengerTheme } from '../../theme';
|
|
9
10
|
|
|
10
11
|
const { width } = Dimensions.get('window');
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const r = parseInt(hex.slice(1, 3), 16);
|
|
16
|
-
const g = parseInt(hex.slice(3, 5), 16);
|
|
17
|
-
const b = parseInt(hex.slice(5, 7), 16);
|
|
18
|
-
// https://stackoverflow.com/a/58270890/9999202
|
|
19
|
-
const hsp = Math.sqrt(0.299 * r ** 2 + 0.587 * g ** 2 + 0.114 * b ** 2);
|
|
20
|
-
return hsp < 170;
|
|
21
|
-
};
|
|
13
|
+
const INCOMING_MAX = width * 0.8;
|
|
14
|
+
const OUTGOING_MAX = width * 0.78;
|
|
15
|
+
const AVATAR_SIZE = 32;
|
|
22
16
|
|
|
23
17
|
const Message = (props: any) => {
|
|
24
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
item,
|
|
20
|
+
bgColor,
|
|
21
|
+
// Grouping props (default to a standalone message when not provided).
|
|
22
|
+
isFirstInGroup = true,
|
|
23
|
+
isLastInGroup = true,
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
const showName = isFirstInGroup;
|
|
27
|
+
const showAvatar = isLastInGroup;
|
|
28
|
+
const showTime = isLastInGroup;
|
|
25
29
|
|
|
26
|
-
const
|
|
30
|
+
const isOutgoing = Boolean(item?.customerId);
|
|
31
|
+
const name = item?.user?.details?.fullName || item?.user?.details?.firstName;
|
|
27
32
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const strippedContent = strip_html(item?.content || '', true);
|
|
34
|
+
const hasContent = !!strippedContent && strippedContent.trim().length > 0;
|
|
35
|
+
const hasAttachments = item?.attachments?.length > 0;
|
|
36
|
+
|
|
37
|
+
const rowSpacing = {
|
|
38
|
+
marginTop: isFirstInGroup ? messengerTheme.spacing.md : 2,
|
|
34
39
|
};
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
renderContent()
|
|
54
|
-
) : (
|
|
55
|
-
<Text
|
|
56
|
-
style={{
|
|
57
|
-
paddingVertical: 12,
|
|
58
|
-
color: isDarkColor(bgColor) ? '#fff' : '#000',
|
|
59
|
-
}}
|
|
60
|
-
>
|
|
61
|
-
{item?.content}
|
|
41
|
+
if (isOutgoing) {
|
|
42
|
+
return (
|
|
43
|
+
<View style={[styles.outgoingRow, rowSpacing]}>
|
|
44
|
+
<View style={styles.outgoingColumn}>
|
|
45
|
+
{hasContent ? (
|
|
46
|
+
<View style={[styles.outgoingBubble, { backgroundColor: bgColor }]}>
|
|
47
|
+
<Text style={styles.outgoingText}>{item?.content}</Text>
|
|
48
|
+
</View>
|
|
49
|
+
) : null}
|
|
50
|
+
{hasAttachments ? (
|
|
51
|
+
<View style={styles.attachmentWrap}>
|
|
52
|
+
<Attachment images={item?.attachments} />
|
|
53
|
+
</View>
|
|
54
|
+
) : null}
|
|
55
|
+
{showTime ? (
|
|
56
|
+
<Text style={[styles.timestamp, styles.timestampRight]}>
|
|
57
|
+
{dayjs(item?.createdAt).format('hh:mm A')}
|
|
62
58
|
</Text>
|
|
63
|
-
)}
|
|
64
|
-
{item?.attachments?.length > 0 ? (
|
|
65
|
-
<Attachment images={item?.attachments} />
|
|
66
59
|
) : null}
|
|
67
60
|
</View>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
</View>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<View style={[styles.incomingRow, rowSpacing]}>
|
|
67
|
+
{showAvatar ? (
|
|
68
|
+
<Avatar
|
|
69
|
+
user={item?.user}
|
|
70
|
+
bgColor={bgColor}
|
|
71
|
+
size={AVATAR_SIZE}
|
|
72
|
+
name={name}
|
|
73
|
+
/>
|
|
74
|
+
) : (
|
|
75
|
+
<View style={styles.avatarSpacer} />
|
|
76
|
+
)}
|
|
77
|
+
<View style={styles.incomingColumn}>
|
|
78
|
+
{showName && name ? (
|
|
79
|
+
<Text numberOfLines={1} style={styles.senderName}>
|
|
80
|
+
{name}
|
|
81
|
+
</Text>
|
|
82
|
+
) : null}
|
|
83
|
+
{hasContent ? (
|
|
84
|
+
<View style={styles.incomingBubble}>
|
|
85
|
+
<RenderHTML html={item?.content} />
|
|
86
|
+
</View>
|
|
87
|
+
) : null}
|
|
88
|
+
{hasAttachments ? (
|
|
89
|
+
<View style={styles.attachmentWrap}>
|
|
90
|
+
<Attachment images={item?.attachments} />
|
|
91
|
+
</View>
|
|
92
|
+
) : null}
|
|
93
|
+
{showTime ? (
|
|
94
|
+
<Text style={[styles.timestamp, styles.timestampLeft]}>
|
|
95
|
+
{dayjs(item?.createdAt).format('hh:mm A')}
|
|
96
|
+
</Text>
|
|
97
|
+
) : null}
|
|
77
98
|
</View>
|
|
78
99
|
</View>
|
|
79
100
|
);
|
|
@@ -81,41 +102,79 @@ const Message = (props: any) => {
|
|
|
81
102
|
|
|
82
103
|
export default Message;
|
|
83
104
|
|
|
84
|
-
const customStyles = {
|
|
85
|
-
left: StyleSheet.create({
|
|
86
|
-
container: {
|
|
87
|
-
justifyContent: 'flex-start',
|
|
88
|
-
marginLeft: 0,
|
|
89
|
-
marginRight: 0,
|
|
90
|
-
marginTop: 10,
|
|
91
|
-
flexDirection: 'row',
|
|
92
|
-
alignItems: 'center',
|
|
93
|
-
},
|
|
94
|
-
}),
|
|
95
|
-
right: StyleSheet.create({
|
|
96
|
-
container: {
|
|
97
|
-
justifyContent: 'flex-end',
|
|
98
|
-
marginLeft: 0,
|
|
99
|
-
marginRight: 0,
|
|
100
|
-
marginTop: 10,
|
|
101
|
-
flexDirection: 'row',
|
|
102
|
-
alignItems: 'center',
|
|
103
|
-
},
|
|
104
|
-
}),
|
|
105
|
-
} as any;
|
|
106
|
-
|
|
107
105
|
const styles = StyleSheet.create({
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
// Incoming (operator) — avatar + bubble on the left.
|
|
107
|
+
incomingRow: {
|
|
108
|
+
flexDirection: 'row',
|
|
109
|
+
alignItems: 'flex-end',
|
|
110
|
+
marginTop: messengerTheme.spacing.md,
|
|
111
|
+
maxWidth: INCOMING_MAX,
|
|
112
|
+
alignSelf: 'flex-start',
|
|
113
|
+
},
|
|
114
|
+
incomingColumn: {
|
|
115
|
+
marginLeft: messengerTheme.spacing.sm,
|
|
116
|
+
flexShrink: 1,
|
|
117
|
+
},
|
|
118
|
+
avatarSpacer: {
|
|
119
|
+
width: AVATAR_SIZE,
|
|
120
|
+
height: AVATAR_SIZE,
|
|
121
|
+
},
|
|
122
|
+
senderName: {
|
|
123
|
+
fontSize: 11,
|
|
124
|
+
color: messengerTheme.colors.mutedText,
|
|
125
|
+
fontWeight: '500',
|
|
126
|
+
marginBottom: 3,
|
|
127
|
+
marginLeft: 4,
|
|
128
|
+
},
|
|
129
|
+
incomingBubble: {
|
|
130
|
+
backgroundColor: messengerTheme.colors.incomingBubble,
|
|
131
|
+
paddingHorizontal: messengerTheme.spacing.md,
|
|
132
|
+
paddingVertical: 8,
|
|
133
|
+
borderRadius: messengerTheme.radius.bubble,
|
|
134
|
+
borderBottomLeftRadius: messengerTheme.radius.tail,
|
|
135
|
+
alignSelf: 'flex-start',
|
|
136
|
+
...messengerTheme.shadow.bubble,
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
// Outgoing (customer) — bubble pinned right.
|
|
140
|
+
outgoingRow: {
|
|
141
|
+
marginTop: messengerTheme.spacing.md,
|
|
142
|
+
maxWidth: OUTGOING_MAX,
|
|
143
|
+
alignSelf: 'flex-end',
|
|
144
|
+
},
|
|
145
|
+
outgoingColumn: {
|
|
146
|
+
alignItems: 'flex-end',
|
|
147
|
+
},
|
|
148
|
+
outgoingBubble: {
|
|
149
|
+
paddingHorizontal: messengerTheme.spacing.md,
|
|
150
|
+
paddingVertical: 8,
|
|
151
|
+
borderRadius: messengerTheme.radius.bubble,
|
|
152
|
+
borderBottomRightRadius: messengerTheme.radius.tail,
|
|
153
|
+
alignSelf: 'flex-end',
|
|
154
|
+
...messengerTheme.shadow.bubble,
|
|
155
|
+
},
|
|
156
|
+
outgoingText: {
|
|
157
|
+
color: messengerTheme.colors.outgoingText,
|
|
158
|
+
fontSize: 14,
|
|
159
|
+
lineHeight: 20,
|
|
160
|
+
fontWeight: '500',
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
attachmentWrap: {
|
|
164
|
+
marginTop: 4,
|
|
165
|
+
},
|
|
166
|
+
timestamp: {
|
|
167
|
+
color: messengerTheme.colors.subtleText,
|
|
168
|
+
fontSize: 10,
|
|
169
|
+
marginTop: 4,
|
|
170
|
+
},
|
|
171
|
+
timestampLeft: {
|
|
172
|
+
textAlign: 'left',
|
|
173
|
+
marginLeft: 4,
|
|
114
174
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
borderRadius: 90,
|
|
175
|
+
timestampRight: {
|
|
176
|
+
textAlign: 'right',
|
|
177
|
+
marginRight: 2,
|
|
119
178
|
},
|
|
120
179
|
});
|
|
121
180
|
|
|
@@ -130,23 +189,26 @@ const RenderHTML = React.memo(function RenderHTML({ html }: any) {
|
|
|
130
189
|
|
|
131
190
|
return (
|
|
132
191
|
<HTML
|
|
133
|
-
contentWidth={
|
|
134
|
-
source={{
|
|
135
|
-
|
|
192
|
+
contentWidth={INCOMING_MAX - AVATAR_SIZE - 24}
|
|
193
|
+
source={{ html }}
|
|
194
|
+
baseStyle={{
|
|
195
|
+
color: messengerTheme.colors.incomingText,
|
|
196
|
+
fontSize: 14,
|
|
197
|
+
lineHeight: 20,
|
|
136
198
|
}}
|
|
137
199
|
tagsStyles={{
|
|
138
|
-
p: { color:
|
|
200
|
+
p: { color: messengerTheme.colors.incomingText, margin: 0 },
|
|
139
201
|
a: { color: '#3B85F4' },
|
|
140
|
-
li: { color:
|
|
141
|
-
ol: { color:
|
|
202
|
+
li: { color: messengerTheme.colors.incomingText },
|
|
203
|
+
ol: { color: messengerTheme.colors.incomingText },
|
|
204
|
+
ul: { color: messengerTheme.colors.incomingText },
|
|
142
205
|
}}
|
|
143
206
|
ignoredDomTags={['meta', 'script', 'font', 'title']}
|
|
144
207
|
ignoredStyles={['borderStyle']}
|
|
145
208
|
renderersProps={renderersProps}
|
|
146
209
|
defaultTextProps={{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
210
|
+
selectable: true,
|
|
211
|
+
style: { color: messengerTheme.colors.incomingText },
|
|
150
212
|
}}
|
|
151
213
|
/>
|
|
152
214
|
);
|