rn-erxes-sdk 0.1.8 → 0.1.10

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.
Files changed (161) hide show
  1. package/lib/commonjs/App.js +75 -6
  2. package/lib/commonjs/App.js.map +1 -1
  3. package/lib/commonjs/FAQ.js +12 -2
  4. package/lib/commonjs/FAQ.js.map +1 -1
  5. package/lib/commonjs/Widget.js +96 -88
  6. package/lib/commonjs/Widget.js.map +1 -1
  7. package/lib/commonjs/assets/images/Facebook.png +0 -0
  8. package/lib/commonjs/assets/images/Twitter.png +0 -0
  9. package/lib/commonjs/assets/images/Youtube.png +0 -0
  10. package/lib/commonjs/components/FAB.js +60 -0
  11. package/lib/commonjs/components/FAB.js.map +1 -0
  12. package/lib/commonjs/components/InputTools.js +79 -0
  13. package/lib/commonjs/components/InputTools.js.map +1 -0
  14. package/lib/commonjs/{apolloClient.js → graphql/apolloClient.js} +8 -1
  15. package/lib/commonjs/graphql/apolloClient.js.map +1 -0
  16. package/lib/commonjs/graphql/mutation.js +82 -1
  17. package/lib/commonjs/graphql/mutation.js.map +1 -1
  18. package/lib/commonjs/graphql/query.js +68 -1
  19. package/lib/commonjs/graphql/query.js.map +1 -1
  20. package/lib/commonjs/graphql/subscription.js +91 -0
  21. package/lib/commonjs/graphql/subscription.js.map +1 -0
  22. package/lib/commonjs/icons/MaterialCommunityIcons.js +2 -2
  23. package/lib/commonjs/icons/MaterialCommunityIcons.js.map +1 -1
  24. package/lib/commonjs/screen/conversation/Attachment.js +128 -0
  25. package/lib/commonjs/screen/conversation/Attachment.js.map +1 -0
  26. package/lib/commonjs/screen/conversation/ConversationDetail.js +290 -0
  27. package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -0
  28. package/lib/commonjs/screen/conversation/Conversations.js +161 -0
  29. package/lib/commonjs/screen/conversation/Conversations.js.map +1 -0
  30. package/lib/commonjs/screen/conversation/Message.js +151 -0
  31. package/lib/commonjs/screen/conversation/Message.js.map +1 -0
  32. package/lib/commonjs/{Greetings.js → screen/greetings/Greetings.js} +35 -7
  33. package/lib/commonjs/screen/greetings/Greetings.js.map +1 -0
  34. package/lib/commonjs/{Social.js → screen/greetings/Social.js} +1 -1
  35. package/lib/commonjs/screen/greetings/Social.js.map +1 -0
  36. package/lib/commonjs/{Supporters.js → screen/greetings/Supporters.js} +2 -2
  37. package/lib/commonjs/screen/greetings/Supporters.js.map +1 -0
  38. package/lib/commonjs/utils/common.js +24 -0
  39. package/lib/commonjs/utils/common.js.map +1 -0
  40. package/lib/commonjs/utils/utils.js +42 -0
  41. package/lib/commonjs/utils/utils.js.map +1 -0
  42. package/lib/module/App.js +73 -6
  43. package/lib/module/App.js.map +1 -1
  44. package/lib/module/FAQ.js +11 -2
  45. package/lib/module/FAQ.js.map +1 -1
  46. package/lib/module/Widget.js +99 -87
  47. package/lib/module/Widget.js.map +1 -1
  48. package/lib/module/assets/images/Facebook.png +0 -0
  49. package/lib/module/assets/images/Twitter.png +0 -0
  50. package/lib/module/assets/images/Youtube.png +0 -0
  51. package/lib/module/components/FAB.js +51 -0
  52. package/lib/module/components/FAB.js.map +1 -0
  53. package/lib/module/components/InputTools.js +68 -0
  54. package/lib/module/components/InputTools.js.map +1 -0
  55. package/lib/module/{apolloClient.js → graphql/apolloClient.js} +8 -1
  56. package/lib/module/graphql/apolloClient.js.map +1 -0
  57. package/lib/module/graphql/mutation.js +80 -1
  58. package/lib/module/graphql/mutation.js.map +1 -1
  59. package/lib/module/graphql/query.js +67 -1
  60. package/lib/module/graphql/query.js.map +1 -1
  61. package/lib/module/graphql/subscription.js +81 -0
  62. package/lib/module/graphql/subscription.js.map +1 -0
  63. package/lib/module/icons/MaterialCommunityIcons.js +2 -2
  64. package/lib/module/icons/MaterialCommunityIcons.js.map +1 -1
  65. package/lib/module/screen/conversation/Attachment.js +119 -0
  66. package/lib/module/screen/conversation/Attachment.js.map +1 -0
  67. package/lib/module/screen/conversation/ConversationDetail.js +279 -0
  68. package/lib/module/screen/conversation/ConversationDetail.js.map +1 -0
  69. package/lib/module/screen/conversation/Conversations.js +152 -0
  70. package/lib/module/screen/conversation/Conversations.js.map +1 -0
  71. package/lib/module/screen/conversation/Message.js +142 -0
  72. package/lib/module/screen/conversation/Message.js.map +1 -0
  73. package/lib/module/{Greetings.js → screen/greetings/Greetings.js} +36 -8
  74. package/lib/module/screen/greetings/Greetings.js.map +1 -0
  75. package/lib/module/{Social.js → screen/greetings/Social.js} +1 -1
  76. package/lib/module/screen/greetings/Social.js.map +1 -0
  77. package/lib/module/{Supporters.js → screen/greetings/Supporters.js} +2 -2
  78. package/lib/module/screen/greetings/Supporters.js.map +1 -0
  79. package/lib/module/utils/common.js +15 -0
  80. package/lib/module/utils/common.js.map +1 -0
  81. package/lib/module/utils/utils.js +32 -0
  82. package/lib/module/utils/utils.js.map +1 -0
  83. package/lib/typescript/App.d.ts +3 -0
  84. package/lib/typescript/App.d.ts.map +1 -1
  85. package/lib/typescript/FAQ.d.ts.map +1 -1
  86. package/lib/typescript/Widget.d.ts +1 -1
  87. package/lib/typescript/Widget.d.ts.map +1 -1
  88. package/lib/typescript/components/FAB.d.ts +18 -0
  89. package/lib/typescript/components/FAB.d.ts.map +1 -0
  90. package/lib/typescript/components/InputTools.d.ts +4 -0
  91. package/lib/typescript/components/InputTools.d.ts.map +1 -0
  92. package/lib/typescript/graphql/apolloClient.d.ts.map +1 -0
  93. package/lib/typescript/graphql/mutation.d.ts +3 -1
  94. package/lib/typescript/graphql/mutation.d.ts.map +1 -1
  95. package/lib/typescript/graphql/query.d.ts +2 -1
  96. package/lib/typescript/graphql/query.d.ts.map +1 -1
  97. package/lib/typescript/graphql/subscription.d.ts +7 -0
  98. package/lib/typescript/graphql/subscription.d.ts.map +1 -0
  99. package/lib/typescript/icons/MaterialCommunityIcons.d.ts.map +1 -1
  100. package/lib/typescript/screen/conversation/Attachment.d.ts +4 -0
  101. package/lib/typescript/screen/conversation/Attachment.d.ts.map +1 -0
  102. package/lib/typescript/screen/conversation/ConversationDetail.d.ts +4 -0
  103. package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -0
  104. package/lib/typescript/screen/conversation/Conversations.d.ts +4 -0
  105. package/lib/typescript/screen/conversation/Conversations.d.ts.map +1 -0
  106. package/lib/typescript/screen/conversation/Message.d.ts +4 -0
  107. package/lib/typescript/screen/conversation/Message.d.ts.map +1 -0
  108. package/lib/typescript/screen/greetings/Greetings.d.ts.map +1 -0
  109. package/lib/typescript/screen/greetings/Social.d.ts.map +1 -0
  110. package/lib/typescript/screen/greetings/Supporters.d.ts.map +1 -0
  111. package/lib/typescript/utils/common.d.ts +4 -0
  112. package/lib/typescript/utils/common.d.ts.map +1 -0
  113. package/lib/typescript/utils/utils.d.ts +4 -0
  114. package/lib/typescript/utils/utils.d.ts.map +1 -0
  115. package/package.json +10 -1
  116. package/src/App.tsx +79 -4
  117. package/src/FAQ.tsx +14 -1
  118. package/src/Widget.tsx +98 -92
  119. package/src/assets/images/Facebook.png +0 -0
  120. package/src/assets/images/Twitter.png +0 -0
  121. package/src/assets/images/Youtube.png +0 -0
  122. package/src/components/FAB.tsx +80 -0
  123. package/src/components/InputTools.tsx +74 -0
  124. package/src/{apolloClient.ts → graphql/apolloClient.ts} +8 -1
  125. package/src/graphql/mutation.ts +82 -1
  126. package/src/graphql/query.ts +68 -0
  127. package/src/graphql/subscription.ts +91 -0
  128. package/src/icons/MaterialCommunityIcons.tsx +2 -6
  129. package/src/screen/conversation/Attachment.tsx +136 -0
  130. package/src/screen/conversation/ConversationDetail.tsx +293 -0
  131. package/src/screen/conversation/Conversations.tsx +146 -0
  132. package/src/screen/conversation/Message.tsx +152 -0
  133. package/src/screen/greetings/Greetings.tsx +76 -0
  134. package/src/{Social.tsx → screen/greetings/Social.tsx} +1 -1
  135. package/src/{Supporters.tsx → screen/greetings/Supporters.tsx} +2 -2
  136. package/src/utils/common.ts +17 -0
  137. package/src/utils/utils.tsx +35 -0
  138. package/lib/commonjs/Greetings.js.map +0 -1
  139. package/lib/commonjs/Social.js.map +0 -1
  140. package/lib/commonjs/Support.js +0 -93
  141. package/lib/commonjs/Support.js.map +0 -1
  142. package/lib/commonjs/Supporters.js.map +0 -1
  143. package/lib/commonjs/apolloClient.js.map +0 -1
  144. package/lib/module/Greetings.js.map +0 -1
  145. package/lib/module/Social.js.map +0 -1
  146. package/lib/module/Support.js +0 -84
  147. package/lib/module/Support.js.map +0 -1
  148. package/lib/module/Supporters.js.map +0 -1
  149. package/lib/module/apolloClient.js.map +0 -1
  150. package/lib/typescript/Greetings.d.ts.map +0 -1
  151. package/lib/typescript/Social.d.ts.map +0 -1
  152. package/lib/typescript/Support.d.ts +0 -4
  153. package/lib/typescript/Support.d.ts.map +0 -1
  154. package/lib/typescript/Supporters.d.ts.map +0 -1
  155. package/lib/typescript/apolloClient.d.ts.map +0 -1
  156. package/src/Greetings.tsx +0 -37
  157. package/src/Support.tsx +0 -74
  158. /package/lib/typescript/{apolloClient.d.ts → graphql/apolloClient.d.ts} +0 -0
  159. /package/lib/typescript/{Greetings.d.ts → screen/greetings/Greetings.d.ts} +0 -0
  160. /package/lib/typescript/{Social.d.ts → screen/greetings/Social.d.ts} +0 -0
  161. /package/lib/typescript/{Supporters.d.ts → screen/greetings/Supporters.d.ts} +0 -0
package/src/Widget.tsx CHANGED
@@ -1,30 +1,29 @@
1
- /* eslint-disable react-native/no-inline-styles */
2
- import { View, StyleSheet, TouchableOpacity, Text } from 'react-native';
1
+ import { View, StyleSheet } from 'react-native';
3
2
  import React from 'react';
4
3
  import { useMutation } from '@apollo/client';
5
4
  import { connect } from './graphql/mutation';
6
- import Greetings from './Greetings';
7
- import Support from './Support';
8
- import FAQ from './FAQ';
5
+ import Greetings from './screen/greetings/Greetings';
6
+ import Conversations from './screen/conversation/Conversations';
9
7
 
10
8
  const Widget = (props: any) => {
11
- const { brandCode } = props;
9
+ const { brandCode, email, hasBack, onBack, connection } = props;
12
10
  const [response, setResponse] = React.useState<any>(null);
13
- const [index, setIndex] = React.useState<number>(0);
11
+
14
12
  const [connectMutation] = useMutation(connect);
15
13
 
16
14
  React.useEffect(() => {
17
15
  connectMutation({
18
16
  variables: {
19
17
  brandCode,
20
- cachedCustomerId: null,
21
- visitorId: '20675ab50c23e7c8c615a8f4ab9107e2',
22
- isUser: false,
18
+ email,
19
+ cachedCustomerId: connection?.cachedCustomerId,
20
+ visitorId: connection?.visitorId,
21
+ // if client passed email automatically then consider this as user
22
+ isUser: Boolean(email),
23
23
  },
24
24
  })
25
25
  .then((res: any) => {
26
26
  setResponse(res);
27
- console.log(res);
28
27
  })
29
28
  .catch((err) => {
30
29
  console.log(err);
@@ -34,9 +33,11 @@ const Widget = (props: any) => {
34
33
 
35
34
  const bgColor = response?.data?.widgetsMessengerConnect?.uiOptions?.color;
36
35
  const integrationId = response?.data?.widgetsMessengerConnect?.integrationId;
37
- const knowledgeBaseTopicId =
38
- response?.data?.widgetsMessengerConnect?.messengerData
39
- ?.knowledgeBaseTopicId;
36
+ const brand = response?.data?.widgetsMessengerConnect?.brand;
37
+
38
+ if (!integrationId) {
39
+ return null;
40
+ }
40
41
 
41
42
  return (
42
43
  <View style={styles.container}>
@@ -44,92 +45,97 @@ const Widget = (props: any) => {
44
45
  greetings={response?.data?.widgetsMessengerConnect?.messengerData}
45
46
  bgColor={bgColor}
46
47
  integrationId={integrationId}
48
+ hasBack={hasBack}
49
+ onBack={onBack}
50
+ />
51
+ {/* <TabBar index={index} setIndex={setIndex} bgColor={bgColor} /> */}
52
+ {/* {index === 0 ? ( */}
53
+ <Conversations
54
+ customerId={connection?.cachedCustomerId}
55
+ visitorId={connection?.visitorId}
56
+ integrationId={integrationId}
57
+ bgColor={bgColor}
58
+ brand={brand}
47
59
  />
48
- <TabBar index={index} setIndex={setIndex} bgColor={bgColor} />
49
- {index === 0 ? (
50
- <Support
51
- customerId={'7o6DA3tFhM5EXRWZX'}
52
- integrationId={integrationId}
53
- />
54
- ) : (
60
+ {/* ) : (
55
61
  <FAQ knowledgeBaseTopicId={knowledgeBaseTopicId} />
56
- )}
62
+ )} */}
57
63
  </View>
58
64
  );
59
65
  };
60
66
 
61
67
  export default Widget;
62
68
 
63
- const TabBar = (props: any) => {
64
- const { index, setIndex, bgColor } = props;
65
- return (
66
- <View
67
- style={{
68
- backgroundColor: '#fff',
69
- flexDirection: 'row',
70
- padding: 3,
71
- marginBottom: 3,
72
- borderColor: '#E5E5E5',
73
- borderWidth: 0.3,
74
- }}
75
- >
76
- <TouchableOpacity onPress={() => setIndex(0)} style={{ flex: 1 }}>
77
- <View
78
- style={{
79
- backgroundColor: index === 0 ? bgColor : 'transparent',
80
- borderRadius: 5,
81
- shadowColor: bgColor,
82
- shadowOffset: {
83
- width: 0,
84
- height: index === 0 ? 2 : 0,
85
- },
86
- shadowOpacity: 0.5,
87
- shadowRadius: index === 0 ? 3.84 : 0,
88
- elevation: index === 0 ? 5 : 0,
89
- }}
90
- >
91
- <Text
92
- style={{
93
- textAlign: 'center',
94
- color: index === 0 ? 'white' : 'black',
95
- paddingVertical: 10,
96
- fontWeight: '600',
97
- }}
98
- >
99
- Support
100
- </Text>
101
- </View>
102
- </TouchableOpacity>
103
- <TouchableOpacity
104
- onPress={() => setIndex(1)}
105
- style={{
106
- flex: 1,
107
- backgroundColor: index === 1 ? bgColor : 'transparent',
108
- borderRadius: 5,
109
- shadowColor: bgColor,
110
- shadowOffset: {
111
- width: 0,
112
- height: index === 1 ? 2 : 0,
113
- },
114
- shadowOpacity: 0.5,
115
- shadowRadius: index === 1 ? 3.84 : 0,
116
- elevation: index === 1 ? 5 : 0,
117
- }}
118
- >
119
- <Text
120
- style={{
121
- paddingVertical: 10,
122
- color: index === 1 ? 'white' : 'black',
123
- textAlign: 'center',
124
- fontWeight: '600',
125
- }}
126
- >
127
- FAQ
128
- </Text>
129
- </TouchableOpacity>
130
- </View>
131
- );
132
- };
69
+ // const TabBar = (props: any) => {
70
+ // const { index, setIndex, bgColor } = props;
71
+ // return (
72
+ // <View
73
+ // style={{
74
+ // backgroundColor: '#fff',
75
+ // flexDirection: 'row',
76
+ // padding: 3,
77
+ // marginBottom: 3,
78
+ // borderColor: '#E5E5E5',
79
+ // borderWidth: 0.3,
80
+ // }}
81
+ // >
82
+ // <TouchableOpacity onPress={() => setIndex(0)} style={{ flex: 1 }}>
83
+ // <View
84
+ // style={{
85
+ // backgroundColor: index === 0 ? bgColor : 'transparent',
86
+ // borderRadius: 5,
87
+ // shadowColor: bgColor,
88
+ // shadowOffset: {
89
+ // width: 0,
90
+ // height: index === 0 ? 2 : 0,
91
+ // },
92
+ // shadowOpacity: 0.5,
93
+ // shadowRadius: index === 0 ? 3.84 : 0,
94
+ // elevation: index === 0 ? 5 : 0,
95
+ // }}
96
+ // >
97
+ // <Text
98
+ // style={{
99
+ // textAlign: 'center',
100
+ // color: index === 0 ? 'white' : 'black',
101
+ // paddingVertical: 10,
102
+ // fontWeight: '600',
103
+ // }}
104
+ // >
105
+ // Support
106
+ // </Text>
107
+ // </View>
108
+ // </TouchableOpacity>
109
+ // <TouchableOpacity
110
+ // onPress={() => setIndex(1)}
111
+ // style={{
112
+ // flex: 1,
113
+ // backgroundColor: index === 1 ? bgColor : 'transparent',
114
+ // borderRadius: 5,
115
+ // shadowColor: bgColor,
116
+ // shadowOffset: {
117
+ // width: 0,
118
+ // height: index === 1 ? 2 : 0,
119
+ // },
120
+ // shadowOpacity: 0.5,
121
+ // shadowRadius: index === 1 ? 3.84 : 0,
122
+ // elevation: index === 1 ? 5 : 0,
123
+ // }}
124
+ // >
125
+ // <Text
126
+ // style={{
127
+ // paddingVertical: 10,
128
+ // color: index === 1 ? 'white' : 'black',
129
+ // textAlign: 'center',
130
+ // fontWeight: '600',
131
+ // }}
132
+ // >
133
+ // FAQ
134
+ // </Text>
135
+ // </TouchableOpacity>
136
+ // </View>
137
+ // );
138
+ // };
133
139
 
134
140
  const styles = StyleSheet.create({
135
141
  container: {
Binary file
Binary file
Binary file
@@ -0,0 +1,80 @@
1
+ /* eslint-disable react-native/no-inline-styles */
2
+ import React from 'react';
3
+ import {
4
+ StyleProp,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ ViewStyle,
8
+ } from 'react-native';
9
+ import MaterialCommunityIcons from '../icons/MaterialCommunityIcons';
10
+
11
+ type Props = {
12
+ icon?: string;
13
+ onPress: () => void;
14
+ top?: number;
15
+ left?: number;
16
+ right?: number;
17
+ bottom?: number;
18
+ backgroundColor?: string;
19
+ iconColor?: string;
20
+ iconSize?: number;
21
+ style?: StyleProp<ViewStyle>;
22
+ iconSource?: string;
23
+ };
24
+
25
+ const FAB = (props: Props) => {
26
+ const {
27
+ icon = 'plus',
28
+ onPress,
29
+ backgroundColor = '#2F1F69',
30
+ iconColor = '#fff',
31
+ iconSize = 20,
32
+ style,
33
+ bottom = 20,
34
+ } = props;
35
+ return (
36
+ <TouchableOpacity
37
+ onPress={onPress}
38
+ style={[
39
+ styles.default,
40
+ {
41
+ backgroundColor: backgroundColor ? backgroundColor : '#2F1F69',
42
+ bottom: bottom,
43
+ },
44
+ style,
45
+ ]}
46
+ >
47
+ <MaterialCommunityIcons
48
+ allowFontScaling={false}
49
+ name={icon}
50
+ size={iconSize}
51
+ color={iconColor}
52
+ direction="ltr"
53
+ />
54
+ </TouchableOpacity>
55
+ );
56
+ };
57
+
58
+ const styles = StyleSheet.create({
59
+ default: {
60
+ position: 'absolute',
61
+ right: 20,
62
+ bottom: 20,
63
+ height: 60,
64
+ width: 60,
65
+ borderRadius: 50,
66
+ justifyContent: 'center',
67
+ alignItems: 'center',
68
+ elevation: 3,
69
+ zIndex: 3,
70
+ shadowColor: '#2F1F69',
71
+ shadowOffset: {
72
+ width: 0,
73
+ height: 0,
74
+ },
75
+ shadowOpacity: 0.5,
76
+ shadowRadius: 3,
77
+ },
78
+ });
79
+
80
+ export default FAB;
@@ -0,0 +1,74 @@
1
+ /* eslint-disable react-native/no-inline-styles */
2
+ import React, { useState } from 'react';
3
+ import { StyleSheet, TextInput, TouchableOpacity, View } from 'react-native';
4
+ import MaterialCommunityIcons from '../icons/MaterialCommunityIcons';
5
+
6
+ const InputTools: React.FC<any> = (props: any) => {
7
+ const { onSend, bgColor } = props;
8
+
9
+ const [input, onInput] = useState<string>('');
10
+
11
+ return (
12
+ <View
13
+ style={{
14
+ paddingVertical: 5,
15
+ alignItems: 'flex-end',
16
+ flexDirection: 'row',
17
+ marginBottom: 20,
18
+ marginHorizontal: 20,
19
+ }}
20
+ >
21
+ <TextInput
22
+ placeholder={'Write a reply'}
23
+ selectionColor={'#686868'}
24
+ underlineColorAndroid={'transparent'}
25
+ style={[styles.textInputStyle]}
26
+ placeholderTextColor={'#686868'}
27
+ value={input}
28
+ onChangeText={(text) => {
29
+ onInput(text);
30
+ }}
31
+ multiline={true}
32
+ numberOfLines={5}
33
+ // returnKeyType="send"
34
+ />
35
+ <TouchableOpacity
36
+ style={[styles.sendStyle, { backgroundColor: bgColor }]}
37
+ onPress={() => {
38
+ onSend && onSend(input);
39
+ onInput('');
40
+ }}
41
+ >
42
+ <MaterialCommunityIcons
43
+ allowFontScaling={false}
44
+ name={'send'}
45
+ size={20}
46
+ color={'white'}
47
+ direction="ltr"
48
+ />
49
+ </TouchableOpacity>
50
+ </View>
51
+ );
52
+ };
53
+
54
+ const styles = StyleSheet.create({
55
+ sendStyle: {
56
+ width: 40,
57
+ height: 40,
58
+ marginLeft: 10,
59
+ borderRadius: 90,
60
+ justifyContent: 'center',
61
+ alignItems: 'center',
62
+ },
63
+ textInputStyle: {
64
+ flex: 1,
65
+ paddingHorizontal: 15,
66
+ backgroundColor: 'white',
67
+ borderRadius: 20,
68
+ maxHeight: 100,
69
+ minHeight: 40,
70
+ paddingTop: 12,
71
+ },
72
+ });
73
+
74
+ export default InputTools;
@@ -50,7 +50,14 @@ const splitLink = split(
50
50
  const ClientProvider = () =>
51
51
  new ApolloClient({
52
52
  link: splitLink,
53
- cache: new InMemoryCache(),
53
+ cache: new InMemoryCache({
54
+ typePolicies: {
55
+ UserDetailsType: {
56
+ merge: true,
57
+ },
58
+ },
59
+ addTypename: true,
60
+ }),
54
61
  defaultOptions: { watchQuery: { fetchPolicy: 'network-only' } },
55
62
  });
56
63
 
@@ -39,4 +39,85 @@ const connect = gql`
39
39
  }
40
40
  `;
41
41
 
42
- export { connect };
42
+ const widgetsInsertMessage = gql`
43
+ mutation widgetsInsertMessage(
44
+ $integrationId: String!
45
+ $customerId: String
46
+ $visitorId: String
47
+ $message: String
48
+ $contentType: String
49
+ $conversationId: String
50
+ $attachments: [AttachmentInput]
51
+ $skillId: String
52
+ ) {
53
+ widgetsInsertMessage(
54
+ integrationId: $integrationId
55
+ customerId: $customerId
56
+ visitorId: $visitorId
57
+ contentType: $contentType
58
+ message: $message
59
+ conversationId: $conversationId
60
+ attachments: $attachments
61
+ skillId: $skillId
62
+ ) {
63
+ _id
64
+ conversationId
65
+ customerId
66
+ user {
67
+ _id
68
+ details {
69
+ avatar
70
+ fullName
71
+ __typename
72
+ }
73
+ __typename
74
+ }
75
+ content
76
+ createdAt
77
+ internal
78
+ fromBot
79
+ contentType
80
+ videoCallData {
81
+ url
82
+ status
83
+ __typename
84
+ }
85
+ engageData {
86
+ content
87
+ kind
88
+ sentAs
89
+ messageId
90
+ brandId
91
+ __typename
92
+ }
93
+ botData
94
+ messengerAppData
95
+ attachments {
96
+ url
97
+ name
98
+ size
99
+ type
100
+ __typename
101
+ }
102
+ __typename
103
+ }
104
+ }
105
+ `;
106
+
107
+ const widgetsSaveCustomerGetNotified = gql`
108
+ mutation widgetsSaveCustomerGetNotified(
109
+ $customerId: String
110
+ $visitorId: String
111
+ $type: String!
112
+ $value: String!
113
+ ) {
114
+ widgetsSaveCustomerGetNotified(
115
+ customerId: $customerId
116
+ visitorId: $visitorId
117
+ type: $type
118
+ value: $value
119
+ )
120
+ }
121
+ `;
122
+
123
+ export { connect, widgetsInsertMessage, widgetsSaveCustomerGetNotified };
@@ -100,9 +100,77 @@ const knowledgeBaseCategoryDetail = gql`
100
100
  }
101
101
  `;
102
102
 
103
+ const widgetsConversationDetail = gql`
104
+ query widgetsConversationDetail($_id: String, $integrationId: String!) {
105
+ widgetsConversationDetail(_id: $_id, integrationId: $integrationId) {
106
+ _id
107
+ messages {
108
+ _id
109
+ conversationId
110
+ customerId
111
+ user {
112
+ _id
113
+ details {
114
+ avatar
115
+ fullName
116
+ __typename
117
+ }
118
+ __typename
119
+ }
120
+ content
121
+ createdAt
122
+ internal
123
+ fromBot
124
+ contentType
125
+ videoCallData {
126
+ url
127
+ status
128
+ __typename
129
+ }
130
+ engageData {
131
+ content
132
+ kind
133
+ sentAs
134
+ messageId
135
+ brandId
136
+ __typename
137
+ }
138
+ botData
139
+ messengerAppData
140
+ attachments {
141
+ url
142
+ name
143
+ size
144
+ type
145
+ __typename
146
+ }
147
+ __typename
148
+ }
149
+ operatorStatus
150
+ isOnline
151
+ participatedUsers {
152
+ _id
153
+ details {
154
+ avatar
155
+ fullName
156
+ shortName
157
+ description
158
+ position
159
+ location
160
+ __typename
161
+ }
162
+ links
163
+ __typename
164
+ }
165
+ __typename
166
+ }
167
+ }
168
+ `;
169
+
103
170
  export {
104
171
  widgetsMessengerSupporters,
105
172
  widgetsConversations,
173
+ widgetsConversationDetail,
106
174
  knowledgeBaseTopicDetail,
107
175
  knowledgeBaseCategoryDetail,
108
176
  };
@@ -0,0 +1,91 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ const conversationMessageInserted = gql`
4
+ subscription conversationMessageInserted($_id: String!) {
5
+ conversationMessageInserted(_id: $_id) {
6
+ _id
7
+ attachments {
8
+ url
9
+ name
10
+ type
11
+ size
12
+ }
13
+ botData
14
+ content
15
+ contentType
16
+ conversationId
17
+ createdAt
18
+ customer {
19
+ avatar
20
+ firstName
21
+ lastName
22
+ primaryEmail
23
+ primaryPhone
24
+ _id
25
+ state
26
+ }
27
+ customerId
28
+ internal
29
+ fromBot
30
+ user {
31
+ _id
32
+ username
33
+ details {
34
+ avatar
35
+ fullName
36
+ position
37
+ }
38
+ }
39
+ userId
40
+ videoCallData {
41
+ url
42
+ name
43
+ status
44
+ recordingLinks
45
+ }
46
+ mentionedUserIds
47
+ }
48
+ }
49
+ `;
50
+
51
+ const conversationClientMessageInserted = gql`
52
+ subscription conversationClientMessageInserted(
53
+ $subdomain: String!
54
+ $userId: String!
55
+ ) {
56
+ conversationClientMessageInserted(subdomain: $subdomain, userId: $userId) {
57
+ _id
58
+ content
59
+ }
60
+ }
61
+ `;
62
+
63
+ const conversationChanged = gql`
64
+ subscription conversationChanged($_id: String!) {
65
+ conversationChanged(_id: $_id) {
66
+ conversationId
67
+ type
68
+ }
69
+ }
70
+ `;
71
+ const conversationExternalIntegrationMessageInserted = gql`
72
+ subscription conversationExternalIntegrationMessageInserted {
73
+ conversationExternalIntegrationMessageInserted
74
+ }
75
+ `;
76
+
77
+ const adminMessageInserted = gql`
78
+ subscription conversationAdminMessageInserted($customerId: String) {
79
+ conversationAdminMessageInserted(customerId: $customerId) {
80
+ unreadCount
81
+ }
82
+ }
83
+ `;
84
+
85
+ export {
86
+ conversationMessageInserted,
87
+ conversationClientMessageInserted,
88
+ conversationChanged,
89
+ conversationExternalIntegrationMessageInserted,
90
+ adminMessageInserted,
91
+ };
@@ -21,12 +21,8 @@ try {
21
21
  // Fallback component for icons
22
22
  MaterialCommunityIcons = ({ color, size, ...rest }: any) => {
23
23
  if (!isErrorLogged) {
24
- if (
25
- !/(Cannot find module|Module not found|Cannot resolve module)/.test(
26
- (e as any).message
27
- )
28
- ) {
29
- console.error(e);
24
+ if (!/(Cannot find module|Module not found|Cannot resolve module)/) {
25
+ console.error('Error');
30
26
  }
31
27
 
32
28
  console.warn(