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.
Files changed (124) hide show
  1. package/README.md +17 -17
  2. package/lib/commonjs/App.js +60 -17
  3. package/lib/commonjs/App.js.map +1 -1
  4. package/lib/commonjs/Widget.js +36 -29
  5. package/lib/commonjs/Widget.js.map +1 -1
  6. package/lib/commonjs/assets/images/index.js +2 -1
  7. package/lib/commonjs/assets/images/index.js.map +1 -1
  8. package/lib/commonjs/assets/images/logo.png +0 -0
  9. package/lib/commonjs/components/Avatar.js +60 -0
  10. package/lib/commonjs/components/Avatar.js.map +1 -0
  11. package/lib/commonjs/components/InputTools.js +4 -1
  12. package/lib/commonjs/components/InputTools.js.map +1 -1
  13. package/lib/commonjs/context/Context.js +11 -0
  14. package/lib/commonjs/context/Context.js.map +1 -0
  15. package/lib/commonjs/graphql/apolloClient.js +2 -0
  16. package/lib/commonjs/graphql/apolloClient.js.map +1 -1
  17. package/lib/commonjs/graphql/mutation.js +150 -1
  18. package/lib/commonjs/graphql/mutation.js.map +1 -1
  19. package/lib/commonjs/graphql/query.js +0 -9
  20. package/lib/commonjs/graphql/query.js.map +1 -1
  21. package/lib/commonjs/icons/icons.js +96 -0
  22. package/lib/commonjs/icons/icons.js.map +1 -0
  23. package/lib/commonjs/screen/conversation/ConversationDetail.js +106 -69
  24. package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -1
  25. package/lib/commonjs/screen/conversation/Conversations.js +22 -41
  26. package/lib/commonjs/screen/conversation/Conversations.js.map +1 -1
  27. package/lib/commonjs/screen/conversation/Message.js +5 -17
  28. package/lib/commonjs/screen/conversation/Message.js.map +1 -1
  29. package/lib/commonjs/screen/greetings/Greetings.js +27 -10
  30. package/lib/commonjs/screen/greetings/Greetings.js.map +1 -1
  31. package/lib/commonjs/screen/greetings/Social.js +1 -1
  32. package/lib/commonjs/screen/greetings/Social.js.map +1 -1
  33. package/lib/commonjs/types.js +2 -0
  34. package/lib/commonjs/types.js.map +1 -0
  35. package/lib/commonjs/utils/utils.js +11 -1
  36. package/lib/commonjs/utils/utils.js.map +1 -1
  37. package/lib/module/App.js +60 -17
  38. package/lib/module/App.js.map +1 -1
  39. package/lib/module/Widget.js +36 -29
  40. package/lib/module/Widget.js.map +1 -1
  41. package/lib/module/assets/images/index.js +2 -1
  42. package/lib/module/assets/images/index.js.map +1 -1
  43. package/lib/module/assets/images/logo.png +0 -0
  44. package/lib/module/components/Avatar.js +52 -0
  45. package/lib/module/components/Avatar.js.map +1 -0
  46. package/lib/module/components/InputTools.js +5 -2
  47. package/lib/module/components/InputTools.js.map +1 -1
  48. package/lib/module/context/Context.js +4 -0
  49. package/lib/module/context/Context.js.map +1 -0
  50. package/lib/module/graphql/apolloClient.js +2 -0
  51. package/lib/module/graphql/apolloClient.js.map +1 -1
  52. package/lib/module/graphql/mutation.js +148 -1
  53. package/lib/module/graphql/mutation.js.map +1 -1
  54. package/lib/module/graphql/query.js +0 -9
  55. package/lib/module/graphql/query.js.map +1 -1
  56. package/lib/module/icons/icons.js +85 -0
  57. package/lib/module/icons/icons.js.map +1 -0
  58. package/lib/module/screen/conversation/ConversationDetail.js +109 -72
  59. package/lib/module/screen/conversation/ConversationDetail.js.map +1 -1
  60. package/lib/module/screen/conversation/Conversations.js +21 -42
  61. package/lib/module/screen/conversation/Conversations.js.map +1 -1
  62. package/lib/module/screen/conversation/Message.js +7 -19
  63. package/lib/module/screen/conversation/Message.js.map +1 -1
  64. package/lib/module/screen/greetings/Greetings.js +25 -10
  65. package/lib/module/screen/greetings/Greetings.js.map +1 -1
  66. package/lib/module/screen/greetings/Social.js +1 -1
  67. package/lib/module/screen/greetings/Social.js.map +1 -1
  68. package/lib/module/types.js +2 -0
  69. package/lib/module/types.js.map +1 -0
  70. package/lib/module/utils/utils.js +9 -0
  71. package/lib/module/utils/utils.js.map +1 -1
  72. package/lib/typescript/App.d.ts +1 -3
  73. package/lib/typescript/App.d.ts.map +1 -1
  74. package/lib/typescript/Widget.d.ts.map +1 -1
  75. package/lib/typescript/assets/images/index.d.ts +1 -0
  76. package/lib/typescript/assets/images/index.d.ts.map +1 -1
  77. package/lib/typescript/components/Avatar.d.ts +4 -0
  78. package/lib/typescript/components/Avatar.d.ts.map +1 -0
  79. package/lib/typescript/components/InputTools.d.ts.map +1 -1
  80. package/lib/typescript/context/Context.d.ts +4 -0
  81. package/lib/typescript/context/Context.d.ts.map +1 -0
  82. package/lib/typescript/graphql/apolloClient.d.ts.map +1 -1
  83. package/lib/typescript/graphql/mutation.d.ts +3 -1
  84. package/lib/typescript/graphql/mutation.d.ts.map +1 -1
  85. package/lib/typescript/graphql/query.d.ts.map +1 -1
  86. package/lib/typescript/icons/icons.d.ts +28 -0
  87. package/lib/typescript/icons/icons.d.ts.map +1 -0
  88. package/lib/typescript/screen/conversation/ConversationDetail.d.ts +1 -1
  89. package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -1
  90. package/lib/typescript/screen/conversation/Conversations.d.ts +1 -1
  91. package/lib/typescript/screen/conversation/Conversations.d.ts.map +1 -1
  92. package/lib/typescript/screen/conversation/Message.d.ts.map +1 -1
  93. package/lib/typescript/screen/greetings/Greetings.d.ts +1 -1
  94. package/lib/typescript/screen/greetings/Greetings.d.ts.map +1 -1
  95. package/lib/typescript/types.d.ts +12 -0
  96. package/lib/typescript/types.d.ts.map +1 -0
  97. package/lib/typescript/utils/utils.d.ts +1 -0
  98. package/lib/typescript/utils/utils.d.ts.map +1 -1
  99. package/package.json +2 -1
  100. package/src/App.tsx +63 -20
  101. package/src/Widget.tsx +52 -33
  102. package/src/assets/images/index.ts +1 -0
  103. package/src/assets/images/logo.png +0 -0
  104. package/src/components/Avatar.tsx +56 -0
  105. package/src/components/InputTools.tsx +3 -8
  106. package/src/context/Context.ts +5 -0
  107. package/src/graphql/apolloClient.ts +1 -0
  108. package/src/graphql/mutation.ts +158 -1
  109. package/src/graphql/query.ts +0 -9
  110. package/src/icons/icons.tsx +106 -0
  111. package/src/screen/conversation/ConversationDetail.tsx +142 -100
  112. package/src/screen/conversation/Conversations.tsx +14 -36
  113. package/src/screen/conversation/Message.tsx +6 -23
  114. package/src/screen/greetings/Greetings.tsx +30 -10
  115. package/src/screen/greetings/Social.tsx +1 -1
  116. package/src/types.ts +11 -0
  117. package/src/utils/utils.tsx +9 -0
  118. package/lib/commonjs/FAQ.js +0 -177
  119. package/lib/commonjs/FAQ.js.map +0 -1
  120. package/lib/module/FAQ.js +0 -167
  121. package/lib/module/FAQ.js.map +0 -1
  122. package/lib/typescript/FAQ.d.ts +0 -4
  123. package/lib/typescript/FAQ.d.ts.map +0 -1
  124. 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
- });