rn-erxes-sdk 0.1.9 → 0.1.11
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/lib/commonjs/App.js +48 -6
- package/lib/commonjs/App.js.map +1 -1
- package/lib/commonjs/Widget.js +96 -88
- package/lib/commonjs/Widget.js.map +1 -1
- package/lib/commonjs/assets/images/Facebook.png +0 -0
- package/lib/commonjs/assets/images/Twitter.png +0 -0
- package/lib/commonjs/assets/images/Youtube.png +0 -0
- package/lib/commonjs/components/FAB.js +60 -0
- package/lib/commonjs/components/FAB.js.map +1 -0
- package/lib/commonjs/components/InputTools.js +79 -0
- package/lib/commonjs/components/InputTools.js.map +1 -0
- package/lib/commonjs/{apolloClient.js → graphql/apolloClient.js} +8 -1
- package/lib/commonjs/graphql/apolloClient.js.map +1 -0
- package/lib/commonjs/graphql/mutation.js +82 -1
- package/lib/commonjs/graphql/mutation.js.map +1 -1
- package/lib/commonjs/graphql/query.js +68 -1
- package/lib/commonjs/graphql/query.js.map +1 -1
- package/lib/commonjs/graphql/subscription.js +91 -0
- package/lib/commonjs/graphql/subscription.js.map +1 -0
- package/lib/commonjs/icons/MaterialCommunityIcons.js +2 -2
- package/lib/commonjs/icons/MaterialCommunityIcons.js.map +1 -1
- package/lib/commonjs/screen/conversation/Attachment.js +128 -0
- package/lib/commonjs/screen/conversation/Attachment.js.map +1 -0
- package/lib/commonjs/screen/conversation/ConversationDetail.js +290 -0
- package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -0
- package/lib/commonjs/screen/conversation/Conversations.js +164 -0
- package/lib/commonjs/screen/conversation/Conversations.js.map +1 -0
- package/lib/commonjs/screen/conversation/Message.js +151 -0
- package/lib/commonjs/screen/conversation/Message.js.map +1 -0
- package/lib/commonjs/{Greetings.js → screen/greetings/Greetings.js} +35 -7
- package/lib/commonjs/screen/greetings/Greetings.js.map +1 -0
- package/lib/commonjs/{Social.js → screen/greetings/Social.js} +1 -1
- package/lib/commonjs/screen/greetings/Social.js.map +1 -0
- package/lib/commonjs/{Supporters.js → screen/greetings/Supporters.js} +2 -2
- package/lib/commonjs/screen/greetings/Supporters.js.map +1 -0
- package/lib/commonjs/utils/common.js +24 -0
- package/lib/commonjs/utils/common.js.map +1 -0
- package/lib/commonjs/utils/utils.js +42 -0
- package/lib/commonjs/utils/utils.js.map +1 -0
- package/lib/module/App.js +46 -6
- package/lib/module/App.js.map +1 -1
- package/lib/module/Widget.js +99 -87
- package/lib/module/Widget.js.map +1 -1
- package/lib/module/assets/images/Facebook.png +0 -0
- package/lib/module/assets/images/Twitter.png +0 -0
- package/lib/module/assets/images/Youtube.png +0 -0
- package/lib/module/components/FAB.js +51 -0
- package/lib/module/components/FAB.js.map +1 -0
- package/lib/module/components/InputTools.js +68 -0
- package/lib/module/components/InputTools.js.map +1 -0
- package/lib/module/{apolloClient.js → graphql/apolloClient.js} +8 -1
- package/lib/module/graphql/apolloClient.js.map +1 -0
- package/lib/module/graphql/mutation.js +80 -1
- package/lib/module/graphql/mutation.js.map +1 -1
- package/lib/module/graphql/query.js +67 -1
- package/lib/module/graphql/query.js.map +1 -1
- package/lib/module/graphql/subscription.js +81 -0
- package/lib/module/graphql/subscription.js.map +1 -0
- package/lib/module/icons/MaterialCommunityIcons.js +2 -2
- package/lib/module/icons/MaterialCommunityIcons.js.map +1 -1
- package/lib/module/screen/conversation/Attachment.js +119 -0
- package/lib/module/screen/conversation/Attachment.js.map +1 -0
- package/lib/module/screen/conversation/ConversationDetail.js +279 -0
- package/lib/module/screen/conversation/ConversationDetail.js.map +1 -0
- package/lib/module/screen/conversation/Conversations.js +156 -0
- package/lib/module/screen/conversation/Conversations.js.map +1 -0
- package/lib/module/screen/conversation/Message.js +142 -0
- package/lib/module/screen/conversation/Message.js.map +1 -0
- package/lib/module/{Greetings.js → screen/greetings/Greetings.js} +36 -8
- package/lib/module/screen/greetings/Greetings.js.map +1 -0
- package/lib/module/{Social.js → screen/greetings/Social.js} +1 -1
- package/lib/module/screen/greetings/Social.js.map +1 -0
- package/lib/module/{Supporters.js → screen/greetings/Supporters.js} +2 -2
- package/lib/module/screen/greetings/Supporters.js.map +1 -0
- package/lib/module/utils/common.js +15 -0
- package/lib/module/utils/common.js.map +1 -0
- package/lib/module/utils/utils.js +32 -0
- package/lib/module/utils/utils.js.map +1 -0
- package/lib/typescript/App.d.ts +3 -0
- package/lib/typescript/App.d.ts.map +1 -1
- package/lib/typescript/Widget.d.ts +1 -1
- package/lib/typescript/Widget.d.ts.map +1 -1
- package/lib/typescript/components/FAB.d.ts +18 -0
- package/lib/typescript/components/FAB.d.ts.map +1 -0
- package/lib/typescript/components/InputTools.d.ts +4 -0
- package/lib/typescript/components/InputTools.d.ts.map +1 -0
- package/lib/typescript/graphql/apolloClient.d.ts.map +1 -0
- package/lib/typescript/graphql/mutation.d.ts +3 -1
- package/lib/typescript/graphql/mutation.d.ts.map +1 -1
- package/lib/typescript/graphql/query.d.ts +2 -1
- package/lib/typescript/graphql/query.d.ts.map +1 -1
- package/lib/typescript/graphql/subscription.d.ts +7 -0
- package/lib/typescript/graphql/subscription.d.ts.map +1 -0
- package/lib/typescript/icons/MaterialCommunityIcons.d.ts.map +1 -1
- package/lib/typescript/screen/conversation/Attachment.d.ts +4 -0
- package/lib/typescript/screen/conversation/Attachment.d.ts.map +1 -0
- package/lib/typescript/screen/conversation/ConversationDetail.d.ts +4 -0
- package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -0
- package/lib/typescript/screen/conversation/Conversations.d.ts +4 -0
- package/lib/typescript/screen/conversation/Conversations.d.ts.map +1 -0
- package/lib/typescript/screen/conversation/Message.d.ts +4 -0
- package/lib/typescript/screen/conversation/Message.d.ts.map +1 -0
- package/lib/typescript/screen/greetings/Greetings.d.ts.map +1 -0
- package/lib/typescript/screen/greetings/Social.d.ts.map +1 -0
- package/lib/typescript/screen/greetings/Supporters.d.ts.map +1 -0
- package/lib/typescript/utils/common.d.ts +4 -0
- package/lib/typescript/utils/common.d.ts.map +1 -0
- package/lib/typescript/utils/utils.d.ts +4 -0
- package/lib/typescript/utils/utils.d.ts.map +1 -0
- package/package.json +8 -1
- package/src/App.tsx +50 -4
- package/src/Widget.tsx +98 -92
- package/src/assets/images/Facebook.png +0 -0
- package/src/assets/images/Twitter.png +0 -0
- package/src/assets/images/Youtube.png +0 -0
- package/src/components/FAB.tsx +80 -0
- package/src/components/InputTools.tsx +74 -0
- package/src/{apolloClient.ts → graphql/apolloClient.ts} +8 -1
- package/src/graphql/mutation.ts +82 -1
- package/src/graphql/query.ts +68 -0
- package/src/graphql/subscription.ts +91 -0
- package/src/icons/MaterialCommunityIcons.tsx +2 -6
- package/src/screen/conversation/Attachment.tsx +136 -0
- package/src/screen/conversation/ConversationDetail.tsx +293 -0
- package/src/screen/conversation/Conversations.tsx +149 -0
- package/src/screen/conversation/Message.tsx +152 -0
- package/src/screen/greetings/Greetings.tsx +76 -0
- package/src/{Social.tsx → screen/greetings/Social.tsx} +1 -1
- package/src/{Supporters.tsx → screen/greetings/Supporters.tsx} +2 -2
- package/src/utils/common.ts +17 -0
- package/src/utils/utils.tsx +35 -0
- package/lib/commonjs/Greetings.js.map +0 -1
- package/lib/commonjs/Social.js.map +0 -1
- package/lib/commonjs/Support.js +0 -93
- package/lib/commonjs/Support.js.map +0 -1
- package/lib/commonjs/Supporters.js.map +0 -1
- package/lib/commonjs/apolloClient.js.map +0 -1
- package/lib/module/Greetings.js.map +0 -1
- package/lib/module/Social.js.map +0 -1
- package/lib/module/Support.js +0 -84
- package/lib/module/Support.js.map +0 -1
- package/lib/module/Supporters.js.map +0 -1
- package/lib/module/apolloClient.js.map +0 -1
- package/lib/typescript/Greetings.d.ts.map +0 -1
- package/lib/typescript/Social.d.ts.map +0 -1
- package/lib/typescript/Support.d.ts +0 -4
- package/lib/typescript/Support.d.ts.map +0 -1
- package/lib/typescript/Supporters.d.ts.map +0 -1
- package/lib/typescript/apolloClient.d.ts.map +0 -1
- package/src/Greetings.tsx +0 -37
- package/src/Support.tsx +0 -74
- /package/lib/typescript/{apolloClient.d.ts → graphql/apolloClient.d.ts} +0 -0
- /package/lib/typescript/{Greetings.d.ts → screen/greetings/Greetings.d.ts} +0 -0
- /package/lib/typescript/{Social.d.ts → screen/greetings/Social.d.ts} +0 -0
- /package/lib/typescript/{Supporters.d.ts → screen/greetings/Supporters.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationDetail.d.ts","sourceRoot":"","sources":["../../../../src/screen/conversation/ConversationDetail.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAYzC,QAAA,MAAM,kBAAkB,UAAW,GAAG,sBAyIrC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Conversations.d.ts","sourceRoot":"","sources":["../../../../src/screen/conversation/Conversations.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,QAAA,MAAM,aAAa,UAAW,GAAG,6BA+GhC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/screen/conversation/Message.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,QAAA,MAAM,OAAO,UAAW,GAAG,sBA6D1B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Greetings.d.ts","sourceRoot":"","sources":["../../../../src/screen/greetings/Greetings.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,SAAS,UAAW,GAAG,sBA0C5B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Social.d.ts","sourceRoot":"","sources":["../../../../src/screen/greetings/Social.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,QAAA,MAAM,MAAM,UAAW,GAAG,sBAyBzB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Supporters.d.ts","sourceRoot":"","sources":["../../../../src/screen/greetings/Supporters.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,UAAU,UAAW,GAAG,6BAsC7B,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,kBAAmB,MAAM,SAEhD,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,GAEjD,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,SAAS,MAAM,SAE7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.tsx"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAK7C;AAED,eAAO,MAAM,UAAU,WAAY,GAAG,eAAe,OAAO,QAa3D,CAAC;AAEF,eAAO,MAAM,YAAY,uBAQxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rn-erxes-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "react-native erxes sdk",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -158,10 +158,17 @@
|
|
|
158
158
|
},
|
|
159
159
|
"dependencies": {
|
|
160
160
|
"@apollo/client": "^3.7.15",
|
|
161
|
+
"@fingerprintjs/fingerprintjs": "^3.4.1",
|
|
162
|
+
"@react-native-async-storage/async-storage": "^1.18.2",
|
|
161
163
|
"dayjs": "^1.11.8",
|
|
162
164
|
"graphql": "^16.6.0",
|
|
163
165
|
"graphql-ws": "^5.13.1",
|
|
164
166
|
"react-apollo": "^3.1.5",
|
|
167
|
+
"react-native-gesture-handler": "^2.12.0",
|
|
168
|
+
"react-native-render-html": "^6.3.4",
|
|
169
|
+
"react-native-safe-area-context": "^4.5.3",
|
|
170
|
+
"react-native-screens": "^3.21.1",
|
|
171
|
+
"react-native-uuid": "^2.0.1",
|
|
165
172
|
"react-native-vector-icons": "^9.1.0"
|
|
166
173
|
}
|
|
167
174
|
}
|
package/src/App.tsx
CHANGED
|
@@ -1,16 +1,62 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { ApolloProvider } from '@apollo/client';
|
|
3
|
-
import ClientProvider from './apolloClient';
|
|
3
|
+
import ClientProvider from './graphql/apolloClient';
|
|
4
4
|
import Widget from './Widget';
|
|
5
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
6
|
+
import { getVisitorId } from './utils/utils';
|
|
5
7
|
|
|
6
8
|
export type PropTypes = {
|
|
7
9
|
brandCode: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
hasBack?: boolean;
|
|
12
|
+
onBack?: () => void;
|
|
8
13
|
};
|
|
9
14
|
|
|
10
|
-
const ErxesSDK: React.FC<PropTypes> = ({
|
|
15
|
+
const ErxesSDK: React.FC<PropTypes> = ({
|
|
16
|
+
brandCode,
|
|
17
|
+
email,
|
|
18
|
+
hasBack = false,
|
|
19
|
+
onBack = () => {},
|
|
20
|
+
}) => {
|
|
21
|
+
const [connection, setConnection] = React.useState<any>({
|
|
22
|
+
cachedCustomerId: null,
|
|
23
|
+
visitorId: null,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const props = { brandCode, email, hasBack, onBack, connection };
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
let visitorId;
|
|
30
|
+
let tempCustomerId = '';
|
|
31
|
+
AsyncStorage.getItem('clockId')
|
|
32
|
+
.then((value) => {
|
|
33
|
+
if (value !== null) {
|
|
34
|
+
tempCustomerId = value;
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.catch((e) => {
|
|
38
|
+
console.log('checkIntro', e.message);
|
|
39
|
+
});
|
|
40
|
+
if (!tempCustomerId) {
|
|
41
|
+
// declare the data fetching function
|
|
42
|
+
const fetchData = async () => {
|
|
43
|
+
visitorId = await getVisitorId();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// call the function
|
|
47
|
+
fetchData()
|
|
48
|
+
// make sure to catch any error
|
|
49
|
+
.catch(console.error);
|
|
50
|
+
}
|
|
51
|
+
setConnection({
|
|
52
|
+
cachedCustomerId: tempCustomerId,
|
|
53
|
+
visitorId,
|
|
54
|
+
});
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
11
57
|
return (
|
|
12
58
|
<ApolloProvider client={ClientProvider()}>
|
|
13
|
-
<Widget
|
|
59
|
+
<Widget {...props} />
|
|
14
60
|
</ApolloProvider>
|
|
15
61
|
);
|
|
16
62
|
};
|
package/src/Widget.tsx
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
-
|
|
11
|
+
|
|
14
12
|
const [connectMutation] = useMutation(connect);
|
|
15
13
|
|
|
16
14
|
React.useEffect(() => {
|
|
17
15
|
connectMutation({
|
|
18
16
|
variables: {
|
|
19
17
|
brandCode,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
|
package/src/graphql/mutation.ts
CHANGED
|
@@ -39,4 +39,85 @@ const connect = gql`
|
|
|
39
39
|
}
|
|
40
40
|
`;
|
|
41
41
|
|
|
42
|
-
|
|
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 };
|