rn-erxes-sdk 0.1.13 → 0.1.15
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 +17 -17
- package/lib/commonjs/App.js +60 -17
- package/lib/commonjs/App.js.map +1 -1
- package/lib/commonjs/Widget.js +36 -29
- package/lib/commonjs/Widget.js.map +1 -1
- package/lib/commonjs/assets/images/index.js +2 -1
- package/lib/commonjs/assets/images/index.js.map +1 -1
- package/lib/commonjs/assets/images/logo.png +0 -0
- package/lib/commonjs/components/Avatar.js +60 -0
- package/lib/commonjs/components/Avatar.js.map +1 -0
- package/lib/commonjs/components/InputTools.js +4 -1
- package/lib/commonjs/components/InputTools.js.map +1 -1
- package/lib/commonjs/context/Context.js +11 -0
- package/lib/commonjs/context/Context.js.map +1 -0
- package/lib/commonjs/graphql/apolloClient.js +2 -0
- package/lib/commonjs/graphql/apolloClient.js.map +1 -1
- package/lib/commonjs/graphql/mutation.js +150 -1
- package/lib/commonjs/graphql/mutation.js.map +1 -1
- package/lib/commonjs/graphql/query.js +0 -9
- package/lib/commonjs/graphql/query.js.map +1 -1
- package/lib/commonjs/icons/icons.js +96 -0
- package/lib/commonjs/icons/icons.js.map +1 -0
- package/lib/commonjs/screen/conversation/ConversationDetail.js +106 -69
- package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -1
- package/lib/commonjs/screen/conversation/Conversations.js +22 -41
- package/lib/commonjs/screen/conversation/Conversations.js.map +1 -1
- package/lib/commonjs/screen/conversation/Message.js +5 -17
- package/lib/commonjs/screen/conversation/Message.js.map +1 -1
- package/lib/commonjs/screen/greetings/Greetings.js +27 -10
- package/lib/commonjs/screen/greetings/Greetings.js.map +1 -1
- package/lib/commonjs/screen/greetings/Social.js +1 -1
- package/lib/commonjs/screen/greetings/Social.js.map +1 -1
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/utils.js +11 -1
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/module/App.js +60 -17
- package/lib/module/App.js.map +1 -1
- package/lib/module/Widget.js +36 -29
- package/lib/module/Widget.js.map +1 -1
- package/lib/module/assets/images/index.js +2 -1
- package/lib/module/assets/images/index.js.map +1 -1
- package/lib/module/assets/images/logo.png +0 -0
- package/lib/module/components/Avatar.js +52 -0
- package/lib/module/components/Avatar.js.map +1 -0
- package/lib/module/components/InputTools.js +5 -2
- package/lib/module/components/InputTools.js.map +1 -1
- package/lib/module/context/Context.js +4 -0
- package/lib/module/context/Context.js.map +1 -0
- package/lib/module/graphql/apolloClient.js +2 -0
- package/lib/module/graphql/apolloClient.js.map +1 -1
- package/lib/module/graphql/mutation.js +148 -1
- package/lib/module/graphql/mutation.js.map +1 -1
- package/lib/module/graphql/query.js +0 -9
- package/lib/module/graphql/query.js.map +1 -1
- package/lib/module/icons/icons.js +85 -0
- package/lib/module/icons/icons.js.map +1 -0
- package/lib/module/screen/conversation/ConversationDetail.js +109 -72
- package/lib/module/screen/conversation/ConversationDetail.js.map +1 -1
- package/lib/module/screen/conversation/Conversations.js +21 -42
- package/lib/module/screen/conversation/Conversations.js.map +1 -1
- package/lib/module/screen/conversation/Message.js +7 -19
- package/lib/module/screen/conversation/Message.js.map +1 -1
- package/lib/module/screen/greetings/Greetings.js +25 -10
- package/lib/module/screen/greetings/Greetings.js.map +1 -1
- package/lib/module/screen/greetings/Social.js +1 -1
- package/lib/module/screen/greetings/Social.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/utils.js +9 -0
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/App.d.ts +1 -3
- package/lib/typescript/App.d.ts.map +1 -1
- package/lib/typescript/Widget.d.ts.map +1 -1
- package/lib/typescript/assets/images/index.d.ts +1 -0
- package/lib/typescript/assets/images/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar.d.ts +4 -0
- package/lib/typescript/components/Avatar.d.ts.map +1 -0
- package/lib/typescript/components/InputTools.d.ts.map +1 -1
- package/lib/typescript/context/Context.d.ts +4 -0
- package/lib/typescript/context/Context.d.ts.map +1 -0
- package/lib/typescript/graphql/apolloClient.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/icons/icons.d.ts +28 -0
- package/lib/typescript/icons/icons.d.ts.map +1 -0
- package/lib/typescript/screen/conversation/ConversationDetail.d.ts +1 -1
- package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -1
- package/lib/typescript/screen/conversation/Conversations.d.ts +1 -1
- package/lib/typescript/screen/conversation/Conversations.d.ts.map +1 -1
- package/lib/typescript/screen/conversation/Message.d.ts.map +1 -1
- package/lib/typescript/screen/greetings/Greetings.d.ts +1 -1
- package/lib/typescript/screen/greetings/Greetings.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +12 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/utils.d.ts +1 -0
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/App.tsx +63 -20
- package/src/Widget.tsx +52 -33
- package/src/assets/images/index.ts +1 -0
- package/src/assets/images/logo.png +0 -0
- package/src/components/Avatar.tsx +56 -0
- package/src/components/InputTools.tsx +3 -8
- package/src/context/Context.ts +5 -0
- package/src/graphql/apolloClient.ts +1 -0
- package/src/graphql/mutation.ts +158 -1
- package/src/graphql/query.ts +0 -9
- package/src/icons/icons.tsx +106 -0
- package/src/screen/conversation/ConversationDetail.tsx +142 -100
- package/src/screen/conversation/Conversations.tsx +14 -36
- package/src/screen/conversation/Message.tsx +6 -23
- package/src/screen/greetings/Greetings.tsx +30 -10
- package/src/screen/greetings/Social.tsx +1 -1
- package/src/types.ts +11 -0
- package/src/utils/utils.tsx +9 -0
- package/lib/commonjs/FAQ.js +0 -177
- package/lib/commonjs/FAQ.js.map +0 -1
- package/lib/module/FAQ.js +0 -167
- package/lib/module/FAQ.js.map +0 -1
- package/lib/typescript/FAQ.d.ts +0 -4
- package/lib/typescript/FAQ.d.ts.map +0 -1
- package/src/FAQ.tsx +0 -171
package/src/FAQ.tsx
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-native/no-inline-styles */
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
FlatList,
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
ActivityIndicator,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import React, { useState } from 'react';
|
|
11
|
-
import { useQuery } from '@apollo/client';
|
|
12
|
-
import {
|
|
13
|
-
knowledgeBaseCategoryDetail,
|
|
14
|
-
knowledgeBaseTopicDetail,
|
|
15
|
-
} from './graphql/query';
|
|
16
|
-
|
|
17
|
-
const FAQ = (props: any) => {
|
|
18
|
-
const { knowledgeBaseTopicId } = props;
|
|
19
|
-
|
|
20
|
-
const [selectedParent, setSelectedParent] = useState<any>('');
|
|
21
|
-
const [selectedCategory, setSelectedCategory] = useState<any>('');
|
|
22
|
-
|
|
23
|
-
const { data, loading } = useQuery(knowledgeBaseTopicDetail, {
|
|
24
|
-
variables: {
|
|
25
|
-
_id: knowledgeBaseTopicId,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const { data: dataCategory, loading: loadingCategory } = useQuery(
|
|
30
|
-
knowledgeBaseCategoryDetail,
|
|
31
|
-
{
|
|
32
|
-
variables: {
|
|
33
|
-
_id: selectedCategory?._id,
|
|
34
|
-
},
|
|
35
|
-
skip: !selectedCategory,
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
if (loading) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const renderItem = ({ item, index }: any) => {
|
|
44
|
-
const isParent = item?.parentCategoryId === null;
|
|
45
|
-
const childrenCount = isParent
|
|
46
|
-
? data?.knowledgeBaseTopicDetail?.categories?.filter(
|
|
47
|
-
(e: any) => e?.parentCategoryId === item?._id
|
|
48
|
-
)?.length
|
|
49
|
-
: item?.numOfArticles;
|
|
50
|
-
return (
|
|
51
|
-
<TouchableOpacity
|
|
52
|
-
key={index}
|
|
53
|
-
onPress={() => {
|
|
54
|
-
if (item?.parentCategoryId === null) {
|
|
55
|
-
return setSelectedParent(item);
|
|
56
|
-
}
|
|
57
|
-
return setSelectedCategory(item);
|
|
58
|
-
}}
|
|
59
|
-
style={styles.container}
|
|
60
|
-
>
|
|
61
|
-
<Text>
|
|
62
|
-
{item?.title} ({childrenCount})
|
|
63
|
-
</Text>
|
|
64
|
-
<Text style={{ color: '#393C40', marginTop: 5 }}>
|
|
65
|
-
{item?.description}
|
|
66
|
-
</Text>
|
|
67
|
-
</TouchableOpacity>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const renderArticles = ({ item, index }: any) => {
|
|
72
|
-
return (
|
|
73
|
-
<TouchableOpacity key={index} style={styles.container}>
|
|
74
|
-
<Text>{item?.title}</Text>
|
|
75
|
-
<Text style={{ marginTop: 5, color: '#393C40' }}>{item?.summary}</Text>
|
|
76
|
-
</TouchableOpacity>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const renderCategoryDetail = () => {
|
|
81
|
-
if (loadingCategory) {
|
|
82
|
-
return (
|
|
83
|
-
<View style={{ marginTop: 20, alignItems: 'center' }}>
|
|
84
|
-
<ActivityIndicator />
|
|
85
|
-
</View>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
return (
|
|
89
|
-
<FlatList
|
|
90
|
-
data={dataCategory?.knowledgeBaseCategoryDetail?.articles}
|
|
91
|
-
renderItem={renderArticles}
|
|
92
|
-
keyExtractor={(item) => item.id}
|
|
93
|
-
contentContainerStyle={{ gap: 10, paddingBottom: 60 }}
|
|
94
|
-
ItemSeparatorComponent={seperator}
|
|
95
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
96
|
-
ListHeaderComponent={() => {
|
|
97
|
-
return (
|
|
98
|
-
<TouchableOpacity
|
|
99
|
-
style={{ backgroundColor: '#f7f6f9', padding: 5 }}
|
|
100
|
-
onPress={() => {
|
|
101
|
-
setSelectedCategory('');
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<Text style={{ marginLeft: 5 }}>Back to Categories</Text>
|
|
105
|
-
</TouchableOpacity>
|
|
106
|
-
);
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const header = () => {
|
|
113
|
-
return (
|
|
114
|
-
<TouchableOpacity
|
|
115
|
-
style={{
|
|
116
|
-
backgroundColor: '#f7f6f9',
|
|
117
|
-
padding: 5,
|
|
118
|
-
flexDirection: 'row',
|
|
119
|
-
alignItems: 'center',
|
|
120
|
-
}}
|
|
121
|
-
onPress={() => {
|
|
122
|
-
setSelectedParent('');
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
<Text style={{ marginLeft: 5 }}>Back to FAQ</Text>
|
|
126
|
-
</TouchableOpacity>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const seperator = () => {
|
|
131
|
-
return (
|
|
132
|
-
<View style={{ height: 1, backgroundColor: '#000', marginTop: 10 }} />
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<View style={{ flex: 1 }}>
|
|
138
|
-
{selectedCategory ? (
|
|
139
|
-
renderCategoryDetail()
|
|
140
|
-
) : selectedParent ? (
|
|
141
|
-
<FlatList
|
|
142
|
-
data={data?.knowledgeBaseTopicDetail?.categories?.filter(
|
|
143
|
-
(e: any) => e?.parentCategoryId === selectedParent?._id
|
|
144
|
-
)}
|
|
145
|
-
renderItem={renderItem}
|
|
146
|
-
keyExtractor={(item) => item.id}
|
|
147
|
-
contentContainerStyle={{ gap: 10, paddingBottom: 60 }}
|
|
148
|
-
ItemSeparatorComponent={seperator}
|
|
149
|
-
ListHeaderComponent={header}
|
|
150
|
-
/>
|
|
151
|
-
) : (
|
|
152
|
-
<FlatList
|
|
153
|
-
data={data?.knowledgeBaseTopicDetail?.parentCategories}
|
|
154
|
-
renderItem={renderItem}
|
|
155
|
-
keyExtractor={(item) => item.id}
|
|
156
|
-
contentContainerStyle={{ gap: 10 }}
|
|
157
|
-
ItemSeparatorComponent={seperator}
|
|
158
|
-
/>
|
|
159
|
-
)}
|
|
160
|
-
</View>
|
|
161
|
-
);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export default FAQ;
|
|
165
|
-
|
|
166
|
-
const styles = StyleSheet.create({
|
|
167
|
-
container: {
|
|
168
|
-
marginTop: 10,
|
|
169
|
-
marginHorizontal: 10,
|
|
170
|
-
},
|
|
171
|
-
});
|