rn-erxes-sdk 0.1.9 → 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 (155) hide show
  1. package/lib/commonjs/App.js +75 -6
  2. package/lib/commonjs/App.js.map +1 -1
  3. package/lib/commonjs/Widget.js +96 -88
  4. package/lib/commonjs/Widget.js.map +1 -1
  5. package/lib/commonjs/assets/images/Facebook.png +0 -0
  6. package/lib/commonjs/assets/images/Twitter.png +0 -0
  7. package/lib/commonjs/assets/images/Youtube.png +0 -0
  8. package/lib/commonjs/components/FAB.js +60 -0
  9. package/lib/commonjs/components/FAB.js.map +1 -0
  10. package/lib/commonjs/components/InputTools.js +79 -0
  11. package/lib/commonjs/components/InputTools.js.map +1 -0
  12. package/lib/commonjs/{apolloClient.js → graphql/apolloClient.js} +8 -1
  13. package/lib/commonjs/graphql/apolloClient.js.map +1 -0
  14. package/lib/commonjs/graphql/mutation.js +82 -1
  15. package/lib/commonjs/graphql/mutation.js.map +1 -1
  16. package/lib/commonjs/graphql/query.js +68 -1
  17. package/lib/commonjs/graphql/query.js.map +1 -1
  18. package/lib/commonjs/graphql/subscription.js +91 -0
  19. package/lib/commonjs/graphql/subscription.js.map +1 -0
  20. package/lib/commonjs/icons/MaterialCommunityIcons.js +2 -2
  21. package/lib/commonjs/icons/MaterialCommunityIcons.js.map +1 -1
  22. package/lib/commonjs/screen/conversation/Attachment.js +128 -0
  23. package/lib/commonjs/screen/conversation/Attachment.js.map +1 -0
  24. package/lib/commonjs/screen/conversation/ConversationDetail.js +290 -0
  25. package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -0
  26. package/lib/commonjs/screen/conversation/Conversations.js +161 -0
  27. package/lib/commonjs/screen/conversation/Conversations.js.map +1 -0
  28. package/lib/commonjs/screen/conversation/Message.js +151 -0
  29. package/lib/commonjs/screen/conversation/Message.js.map +1 -0
  30. package/lib/commonjs/{Greetings.js → screen/greetings/Greetings.js} +35 -7
  31. package/lib/commonjs/screen/greetings/Greetings.js.map +1 -0
  32. package/lib/commonjs/{Social.js → screen/greetings/Social.js} +1 -1
  33. package/lib/commonjs/screen/greetings/Social.js.map +1 -0
  34. package/lib/commonjs/{Supporters.js → screen/greetings/Supporters.js} +2 -2
  35. package/lib/commonjs/screen/greetings/Supporters.js.map +1 -0
  36. package/lib/commonjs/utils/common.js +24 -0
  37. package/lib/commonjs/utils/common.js.map +1 -0
  38. package/lib/commonjs/utils/utils.js +42 -0
  39. package/lib/commonjs/utils/utils.js.map +1 -0
  40. package/lib/module/App.js +73 -6
  41. package/lib/module/App.js.map +1 -1
  42. package/lib/module/Widget.js +99 -87
  43. package/lib/module/Widget.js.map +1 -1
  44. package/lib/module/assets/images/Facebook.png +0 -0
  45. package/lib/module/assets/images/Twitter.png +0 -0
  46. package/lib/module/assets/images/Youtube.png +0 -0
  47. package/lib/module/components/FAB.js +51 -0
  48. package/lib/module/components/FAB.js.map +1 -0
  49. package/lib/module/components/InputTools.js +68 -0
  50. package/lib/module/components/InputTools.js.map +1 -0
  51. package/lib/module/{apolloClient.js → graphql/apolloClient.js} +8 -1
  52. package/lib/module/graphql/apolloClient.js.map +1 -0
  53. package/lib/module/graphql/mutation.js +80 -1
  54. package/lib/module/graphql/mutation.js.map +1 -1
  55. package/lib/module/graphql/query.js +67 -1
  56. package/lib/module/graphql/query.js.map +1 -1
  57. package/lib/module/graphql/subscription.js +81 -0
  58. package/lib/module/graphql/subscription.js.map +1 -0
  59. package/lib/module/icons/MaterialCommunityIcons.js +2 -2
  60. package/lib/module/icons/MaterialCommunityIcons.js.map +1 -1
  61. package/lib/module/screen/conversation/Attachment.js +119 -0
  62. package/lib/module/screen/conversation/Attachment.js.map +1 -0
  63. package/lib/module/screen/conversation/ConversationDetail.js +279 -0
  64. package/lib/module/screen/conversation/ConversationDetail.js.map +1 -0
  65. package/lib/module/screen/conversation/Conversations.js +152 -0
  66. package/lib/module/screen/conversation/Conversations.js.map +1 -0
  67. package/lib/module/screen/conversation/Message.js +142 -0
  68. package/lib/module/screen/conversation/Message.js.map +1 -0
  69. package/lib/module/{Greetings.js → screen/greetings/Greetings.js} +36 -8
  70. package/lib/module/screen/greetings/Greetings.js.map +1 -0
  71. package/lib/module/{Social.js → screen/greetings/Social.js} +1 -1
  72. package/lib/module/screen/greetings/Social.js.map +1 -0
  73. package/lib/module/{Supporters.js → screen/greetings/Supporters.js} +2 -2
  74. package/lib/module/screen/greetings/Supporters.js.map +1 -0
  75. package/lib/module/utils/common.js +15 -0
  76. package/lib/module/utils/common.js.map +1 -0
  77. package/lib/module/utils/utils.js +32 -0
  78. package/lib/module/utils/utils.js.map +1 -0
  79. package/lib/typescript/App.d.ts +3 -0
  80. package/lib/typescript/App.d.ts.map +1 -1
  81. package/lib/typescript/Widget.d.ts +1 -1
  82. package/lib/typescript/Widget.d.ts.map +1 -1
  83. package/lib/typescript/components/FAB.d.ts +18 -0
  84. package/lib/typescript/components/FAB.d.ts.map +1 -0
  85. package/lib/typescript/components/InputTools.d.ts +4 -0
  86. package/lib/typescript/components/InputTools.d.ts.map +1 -0
  87. package/lib/typescript/graphql/apolloClient.d.ts.map +1 -0
  88. package/lib/typescript/graphql/mutation.d.ts +3 -1
  89. package/lib/typescript/graphql/mutation.d.ts.map +1 -1
  90. package/lib/typescript/graphql/query.d.ts +2 -1
  91. package/lib/typescript/graphql/query.d.ts.map +1 -1
  92. package/lib/typescript/graphql/subscription.d.ts +7 -0
  93. package/lib/typescript/graphql/subscription.d.ts.map +1 -0
  94. package/lib/typescript/icons/MaterialCommunityIcons.d.ts.map +1 -1
  95. package/lib/typescript/screen/conversation/Attachment.d.ts +4 -0
  96. package/lib/typescript/screen/conversation/Attachment.d.ts.map +1 -0
  97. package/lib/typescript/screen/conversation/ConversationDetail.d.ts +4 -0
  98. package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -0
  99. package/lib/typescript/screen/conversation/Conversations.d.ts +4 -0
  100. package/lib/typescript/screen/conversation/Conversations.d.ts.map +1 -0
  101. package/lib/typescript/screen/conversation/Message.d.ts +4 -0
  102. package/lib/typescript/screen/conversation/Message.d.ts.map +1 -0
  103. package/lib/typescript/screen/greetings/Greetings.d.ts.map +1 -0
  104. package/lib/typescript/screen/greetings/Social.d.ts.map +1 -0
  105. package/lib/typescript/screen/greetings/Supporters.d.ts.map +1 -0
  106. package/lib/typescript/utils/common.d.ts +4 -0
  107. package/lib/typescript/utils/common.d.ts.map +1 -0
  108. package/lib/typescript/utils/utils.d.ts +4 -0
  109. package/lib/typescript/utils/utils.d.ts.map +1 -0
  110. package/package.json +10 -1
  111. package/src/App.tsx +79 -4
  112. package/src/Widget.tsx +98 -92
  113. package/src/assets/images/Facebook.png +0 -0
  114. package/src/assets/images/Twitter.png +0 -0
  115. package/src/assets/images/Youtube.png +0 -0
  116. package/src/components/FAB.tsx +80 -0
  117. package/src/components/InputTools.tsx +74 -0
  118. package/src/{apolloClient.ts → graphql/apolloClient.ts} +8 -1
  119. package/src/graphql/mutation.ts +82 -1
  120. package/src/graphql/query.ts +68 -0
  121. package/src/graphql/subscription.ts +91 -0
  122. package/src/icons/MaterialCommunityIcons.tsx +2 -6
  123. package/src/screen/conversation/Attachment.tsx +136 -0
  124. package/src/screen/conversation/ConversationDetail.tsx +293 -0
  125. package/src/screen/conversation/Conversations.tsx +146 -0
  126. package/src/screen/conversation/Message.tsx +152 -0
  127. package/src/screen/greetings/Greetings.tsx +76 -0
  128. package/src/{Social.tsx → screen/greetings/Social.tsx} +1 -1
  129. package/src/{Supporters.tsx → screen/greetings/Supporters.tsx} +2 -2
  130. package/src/utils/common.ts +17 -0
  131. package/src/utils/utils.tsx +35 -0
  132. package/lib/commonjs/Greetings.js.map +0 -1
  133. package/lib/commonjs/Social.js.map +0 -1
  134. package/lib/commonjs/Support.js +0 -93
  135. package/lib/commonjs/Support.js.map +0 -1
  136. package/lib/commonjs/Supporters.js.map +0 -1
  137. package/lib/commonjs/apolloClient.js.map +0 -1
  138. package/lib/module/Greetings.js.map +0 -1
  139. package/lib/module/Social.js.map +0 -1
  140. package/lib/module/Support.js +0 -84
  141. package/lib/module/Support.js.map +0 -1
  142. package/lib/module/Supporters.js.map +0 -1
  143. package/lib/module/apolloClient.js.map +0 -1
  144. package/lib/typescript/Greetings.d.ts.map +0 -1
  145. package/lib/typescript/Social.d.ts.map +0 -1
  146. package/lib/typescript/Support.d.ts +0 -4
  147. package/lib/typescript/Support.d.ts.map +0 -1
  148. package/lib/typescript/Supporters.d.ts.map +0 -1
  149. package/lib/typescript/apolloClient.d.ts.map +0 -1
  150. package/src/Greetings.tsx +0 -37
  151. package/src/Support.tsx +0 -74
  152. /package/lib/typescript/{apolloClient.d.ts → graphql/apolloClient.d.ts} +0 -0
  153. /package/lib/typescript/{Greetings.d.ts → screen/greetings/Greetings.d.ts} +0 -0
  154. /package/lib/typescript/{Social.d.ts → screen/greetings/Social.d.ts} +0 -0
  155. /package/lib/typescript/{Supporters.d.ts → screen/greetings/Supporters.d.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ declare const ConversationDetail: (props: any) => React.JSX.Element;
3
+ export default ConversationDetail;
4
+ //# sourceMappingURL=ConversationDetail.d.ts.map
@@ -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,4 @@
1
+ import React from 'react';
2
+ declare const Conversations: (props: any) => React.JSX.Element | null;
3
+ export default Conversations;
4
+ //# sourceMappingURL=Conversations.d.ts.map
@@ -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;AAS1B,QAAA,MAAM,aAAa,UAAW,GAAG,6BA2GhC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ declare const Message: (props: any) => React.JSX.Element;
3
+ export default Message;
4
+ //# sourceMappingURL=Message.d.ts.map
@@ -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,4 @@
1
+ export declare const initStorage: (storageObject: string) => void;
2
+ export declare const getLocalStorageItem: (key: string) => any;
3
+ export declare const setLocalStorageItem: (key: string, value: string) => void;
4
+ //# sourceMappingURL=common.d.ts.map
@@ -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,4 @@
1
+ export declare function getAttachmentUrl(value: string): string;
2
+ export declare const strip_html: (string: any, withoutCut?: boolean) => any;
3
+ export declare const getVisitorId: () => Promise<string>;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -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.9",
3
+ "version": "0.1.10",
4
4
  "description": "react-native erxes sdk",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -158,10 +158,19 @@
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",
163
+ "@react-navigation/native": "^6.1.6",
164
+ "@react-navigation/stack": "^6.3.16",
161
165
  "dayjs": "^1.11.8",
162
166
  "graphql": "^16.6.0",
163
167
  "graphql-ws": "^5.13.1",
164
168
  "react-apollo": "^3.1.5",
169
+ "react-native-gesture-handler": "^2.12.0",
170
+ "react-native-render-html": "^6.3.4",
171
+ "react-native-safe-area-context": "^4.5.3",
172
+ "react-native-screens": "^3.21.1",
173
+ "react-native-uuid": "^2.0.1",
165
174
  "react-native-vector-icons": "^9.1.0"
166
175
  }
167
176
  }
package/src/App.tsx CHANGED
@@ -1,16 +1,91 @@
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 { createStackNavigator } from '@react-navigation/stack';
6
+ import { NavigationContainer } from '@react-navigation/native';
7
+ import ConversationDetail from './screen/conversation/ConversationDetail';
8
+ import AsyncStorage from '@react-native-async-storage/async-storage';
9
+ import { getVisitorId } from './utils/utils';
5
10
 
6
11
  export type PropTypes = {
7
12
  brandCode: string;
13
+ email?: string;
14
+ hasBack?: boolean;
15
+ onBack?: () => void;
8
16
  };
9
17
 
10
- const ErxesSDK: React.FC<PropTypes> = ({ brandCode }) => {
18
+ const ErxesSDK: React.FC<PropTypes> = ({
19
+ brandCode,
20
+ email,
21
+ hasBack = false,
22
+ onBack = () => {},
23
+ }) => {
24
+ const RootStack = createStackNavigator();
25
+
26
+ const [connection, setConnection] = React.useState<any>({
27
+ cachedCustomerId: null,
28
+ visitorId: null,
29
+ });
30
+
31
+ const props = { brandCode, email, hasBack, onBack, connection };
32
+
33
+ useEffect(() => {
34
+ let visitorId;
35
+ let tempCustomerId = '';
36
+ AsyncStorage.getItem('clockId')
37
+ .then((value) => {
38
+ if (value !== null) {
39
+ tempCustomerId = value;
40
+ }
41
+ })
42
+ .catch((e) => {
43
+ console.log('checkIntro', e.message);
44
+ });
45
+ if (!tempCustomerId) {
46
+ // declare the data fetching function
47
+ const fetchData = async () => {
48
+ visitorId = await getVisitorId();
49
+ };
50
+
51
+ // call the function
52
+ fetchData()
53
+ // make sure to catch any error
54
+ .catch(console.error);
55
+ }
56
+ setConnection({
57
+ cachedCustomerId: tempCustomerId,
58
+ visitorId,
59
+ });
60
+ }, []);
61
+
11
62
  return (
12
63
  <ApolloProvider client={ClientProvider()}>
13
- <Widget brandCode={brandCode} />
64
+ <NavigationContainer>
65
+ <RootStack.Navigator>
66
+ <RootStack.Screen
67
+ name="Widget"
68
+ options={{
69
+ headerShown: false,
70
+ gestureEnabled: false,
71
+ }}
72
+ >
73
+ {(rest: any) => <Widget {...rest} {...props} />}
74
+ </RootStack.Screen>
75
+ <RootStack.Screen
76
+ name="ConversationDetail"
77
+ component={ConversationDetail}
78
+ options={{
79
+ headerShown: false,
80
+ cardStyleInterpolator: ({ current }) => ({
81
+ cardStyle: {
82
+ opacity: current.progress,
83
+ },
84
+ }),
85
+ }}
86
+ />
87
+ </RootStack.Navigator>
88
+ </NavigationContainer>
14
89
  </ApolloProvider>
15
90
  );
16
91
  };
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