rn-erxes-sdk 0.1.4 → 0.1.6
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 +39 -20
- package/lib/commonjs/App.js +9 -44
- package/lib/commonjs/App.js.map +1 -1
- package/lib/commonjs/FAQ.js +175 -0
- package/lib/commonjs/FAQ.js.map +1 -0
- package/lib/commonjs/Greetings.js +57 -0
- package/lib/commonjs/Greetings.js.map +1 -0
- package/lib/commonjs/Social.js +46 -0
- package/lib/commonjs/Social.js.map +1 -0
- package/lib/commonjs/Support.js +93 -0
- package/lib/commonjs/Support.js.map +1 -0
- package/lib/commonjs/Supporters.js +73 -0
- package/lib/commonjs/Supporters.js.map +1 -0
- package/lib/commonjs/Widget.js +132 -0
- package/lib/commonjs/Widget.js.map +1 -0
- package/lib/commonjs/apolloClient.js +55 -0
- package/lib/commonjs/apolloClient.js.map +1 -0
- 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/assets/images/avatar.png +0 -0
- package/lib/commonjs/assets/images/index.js +15 -0
- package/lib/commonjs/assets/images/index.js.map +1 -0
- package/lib/commonjs/graphql/graphql.js +108 -0
- package/lib/commonjs/graphql/graphql.js.map +1 -0
- package/lib/commonjs/graphql/mutation.js +47 -0
- package/lib/commonjs/graphql/mutation.js.map +1 -0
- package/lib/commonjs/icons/MaterialCommunityIcons.js +81 -0
- package/lib/commonjs/icons/MaterialCommunityIcons.js.map +1 -0
- package/lib/module/App.js +9 -44
- package/lib/module/App.js.map +1 -1
- package/lib/module/FAQ.js +165 -0
- package/lib/module/FAQ.js.map +1 -0
- package/lib/module/Greetings.js +48 -0
- package/lib/module/Greetings.js.map +1 -0
- package/lib/module/Social.js +37 -0
- package/lib/module/Social.js.map +1 -0
- package/lib/module/Support.js +84 -0
- package/lib/module/Support.js.map +1 -0
- package/lib/module/Supporters.js +64 -0
- package/lib/module/Supporters.js.map +1 -0
- package/lib/module/Widget.js +123 -0
- package/lib/module/Widget.js.map +1 -0
- package/lib/module/apolloClient.js +46 -0
- package/lib/module/apolloClient.js.map +1 -0
- 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/assets/images/avatar.png +0 -0
- package/lib/module/assets/images/index.js +8 -0
- package/lib/module/assets/images/index.js.map +1 -0
- package/lib/module/graphql/graphql.js +99 -0
- package/lib/module/graphql/graphql.js.map +1 -0
- package/lib/module/graphql/mutation.js +41 -0
- package/lib/module/graphql/mutation.js.map +1 -0
- package/lib/module/icons/MaterialCommunityIcons.js +71 -0
- package/lib/module/icons/MaterialCommunityIcons.js.map +1 -0
- package/lib/typescript/App.d.ts +1 -1
- package/lib/typescript/App.d.ts.map +1 -1
- package/lib/typescript/FAQ.d.ts +4 -0
- package/lib/typescript/FAQ.d.ts.map +1 -0
- package/lib/typescript/Greetings.d.ts +4 -0
- package/lib/typescript/Greetings.d.ts.map +1 -0
- package/lib/typescript/Social.d.ts +4 -0
- package/lib/typescript/Social.d.ts.map +1 -0
- package/lib/typescript/Support.d.ts +4 -0
- package/lib/typescript/Support.d.ts.map +1 -0
- package/lib/typescript/Supporters.d.ts +4 -0
- package/lib/typescript/Supporters.d.ts.map +1 -0
- package/lib/typescript/Widget.d.ts +4 -0
- package/lib/typescript/Widget.d.ts.map +1 -0
- package/lib/typescript/apolloClient.d.ts +6 -0
- package/lib/typescript/apolloClient.d.ts.map +1 -0
- package/lib/typescript/assets/images/index.d.ts +8 -0
- package/lib/typescript/assets/images/index.d.ts.map +1 -0
- package/lib/typescript/graphql/graphql.d.ts +6 -0
- package/lib/typescript/graphql/graphql.d.ts.map +1 -0
- package/lib/typescript/graphql/mutation.d.ts +3 -0
- package/lib/typescript/graphql/mutation.d.ts.map +1 -0
- package/lib/typescript/icons/MaterialCommunityIcons.d.ts +22 -0
- package/lib/typescript/icons/MaterialCommunityIcons.d.ts.map +1 -0
- package/package.json +9 -5
- package/src/App.tsx +8 -42
- package/src/FAQ.tsx +166 -0
- package/src/Greetings.tsx +37 -0
- package/src/Social.tsx +46 -0
- package/src/Support.tsx +74 -0
- package/src/Supporters.tsx +63 -0
- package/src/Widget.tsx +138 -0
- package/src/apolloClient.ts +57 -0
- 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/assets/images/avatar.png +0 -0
- package/src/assets/images/index.ts +8 -0
- package/src/graphql/graphql.ts +108 -0
- package/src/graphql/mutation.ts +42 -0
- package/src/icons/MaterialCommunityIcons.tsx +95 -0
- package/lib/commonjs/index.html +0 -114
- package/lib/module/index.html +0 -114
- package/src/index.html +0 -114
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["images","facebook","require","youtube","twitter","avatar"],"sourceRoot":"../../../../src","sources":["assets/images/index.ts"],"mappings":"AAAA,MAAMA,MAAM,GAAG;EACbC,QAAQ,EAAEC,OAAO,CAAC,gBAAgB,CAAC;EACnCC,OAAO,EAAED,OAAO,CAAC,eAAe,CAAC;EACjCE,OAAO,EAAEF,OAAO,CAAC,eAAe,CAAC;EACjCG,MAAM,EAAEH,OAAO,CAAC,cAAc;AAChC,CAAC;AAED,eAAeF,MAAM"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
const widgetsMessengerSupporters = gql`
|
|
3
|
+
query widgetsMessengerSupporters($integrationId: String!) {
|
|
4
|
+
widgetsMessengerSupporters(integrationId: $integrationId) {
|
|
5
|
+
supporters {
|
|
6
|
+
_id
|
|
7
|
+
isActive
|
|
8
|
+
details {
|
|
9
|
+
avatar
|
|
10
|
+
fullName
|
|
11
|
+
shortName
|
|
12
|
+
location
|
|
13
|
+
__typename
|
|
14
|
+
}
|
|
15
|
+
isOnline
|
|
16
|
+
__typename
|
|
17
|
+
}
|
|
18
|
+
isOnline
|
|
19
|
+
__typename
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const widgetsConversations = gql`
|
|
24
|
+
query widgetsConversations(
|
|
25
|
+
$integrationId: String!
|
|
26
|
+
$customerId: String
|
|
27
|
+
$visitorId: String
|
|
28
|
+
) {
|
|
29
|
+
widgetsConversations(
|
|
30
|
+
integrationId: $integrationId
|
|
31
|
+
customerId: $customerId
|
|
32
|
+
visitorId: $visitorId
|
|
33
|
+
) {
|
|
34
|
+
_id
|
|
35
|
+
content
|
|
36
|
+
createdAt
|
|
37
|
+
participatedUsers {
|
|
38
|
+
details {
|
|
39
|
+
avatar
|
|
40
|
+
fullName
|
|
41
|
+
__typename
|
|
42
|
+
}
|
|
43
|
+
__typename
|
|
44
|
+
}
|
|
45
|
+
__typename
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
const knowledgeBaseTopicDetail = gql`
|
|
50
|
+
query knowledgeBaseTopicDetail($_id: String!) {
|
|
51
|
+
knowledgeBaseTopicDetail(_id: $_id) {
|
|
52
|
+
title
|
|
53
|
+
description
|
|
54
|
+
categories {
|
|
55
|
+
_id
|
|
56
|
+
title
|
|
57
|
+
description
|
|
58
|
+
numOfArticles
|
|
59
|
+
parentCategoryId
|
|
60
|
+
icon
|
|
61
|
+
__typename
|
|
62
|
+
}
|
|
63
|
+
parentCategories {
|
|
64
|
+
_id
|
|
65
|
+
title
|
|
66
|
+
description
|
|
67
|
+
numOfArticles
|
|
68
|
+
parentCategoryId
|
|
69
|
+
icon
|
|
70
|
+
__typename
|
|
71
|
+
}
|
|
72
|
+
__typename
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
const knowledgeBaseCategoryDetail = gql`
|
|
77
|
+
query knowledgeBaseCategoryDetail($_id: String!) {
|
|
78
|
+
knowledgeBaseCategoryDetail(_id: $_id) {
|
|
79
|
+
_id
|
|
80
|
+
title
|
|
81
|
+
description
|
|
82
|
+
numOfArticles
|
|
83
|
+
parentCategoryId
|
|
84
|
+
icon
|
|
85
|
+
parentCategoryId
|
|
86
|
+
articles {
|
|
87
|
+
_id
|
|
88
|
+
title
|
|
89
|
+
summary
|
|
90
|
+
content
|
|
91
|
+
createdDate
|
|
92
|
+
__typename
|
|
93
|
+
}
|
|
94
|
+
__typename
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
export { widgetsMessengerSupporters, widgetsConversations, knowledgeBaseTopicDetail, knowledgeBaseCategoryDetail };
|
|
99
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["gql","widgetsMessengerSupporters","widgetsConversations","knowledgeBaseTopicDetail","knowledgeBaseCategoryDetail"],"sourceRoot":"../../../src","sources":["graphql/graphql.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,0BAA0B,GAAGD,GAAI;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAME,oBAAoB,GAAGF,GAAI;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMG,wBAAwB,GAAGH,GAAI;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMI,2BAA2B,GAAGJ,GAAI;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,SACEC,0BAA0B,EAC1BC,oBAAoB,EACpBC,wBAAwB,EACxBC,2BAA2B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
const connect = gql`
|
|
3
|
+
mutation connect(
|
|
4
|
+
$brandCode: String!
|
|
5
|
+
$email: String
|
|
6
|
+
$phone: String
|
|
7
|
+
$code: String
|
|
8
|
+
$isUser: Boolean
|
|
9
|
+
$data: JSON
|
|
10
|
+
$companyData: JSON
|
|
11
|
+
$cachedCustomerId: String
|
|
12
|
+
$visitorId: String
|
|
13
|
+
) {
|
|
14
|
+
widgetsMessengerConnect(
|
|
15
|
+
brandCode: $brandCode
|
|
16
|
+
email: $email
|
|
17
|
+
phone: $phone
|
|
18
|
+
code: $code
|
|
19
|
+
isUser: $isUser
|
|
20
|
+
data: $data
|
|
21
|
+
companyData: $companyData
|
|
22
|
+
cachedCustomerId: $cachedCustomerId
|
|
23
|
+
visitorId: $visitorId
|
|
24
|
+
) {
|
|
25
|
+
integrationId
|
|
26
|
+
messengerData
|
|
27
|
+
languageCode
|
|
28
|
+
uiOptions
|
|
29
|
+
customerId
|
|
30
|
+
visitorId
|
|
31
|
+
brand {
|
|
32
|
+
name
|
|
33
|
+
description
|
|
34
|
+
__typename
|
|
35
|
+
}
|
|
36
|
+
__typename
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
export { connect };
|
|
41
|
+
//# sourceMappingURL=mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["gql","connect"],"sourceRoot":"../../../src","sources":["graphql/mutation.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,OAAO,GAAGD,GAAI;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,SAASC,OAAO"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { StyleSheet, Text, Platform } from 'react-native';
|
|
4
|
+
let MaterialCommunityIcons;
|
|
5
|
+
try {
|
|
6
|
+
// Optionally require vector-icons
|
|
7
|
+
MaterialCommunityIcons = require('react-native-vector-icons/MaterialCommunityIcons').default;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
let isErrorLogged = false;
|
|
10
|
+
|
|
11
|
+
// Fallback component for icons
|
|
12
|
+
MaterialCommunityIcons = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
color,
|
|
15
|
+
size,
|
|
16
|
+
...rest
|
|
17
|
+
} = _ref;
|
|
18
|
+
if (!isErrorLogged) {
|
|
19
|
+
if (!/(Cannot find module|Module not found|Cannot resolve module)/.test(e.message)) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
}
|
|
22
|
+
console.warn(`To remove this warning, try installing 'react-native-vector-icons'`);
|
|
23
|
+
isErrorLogged = true;
|
|
24
|
+
}
|
|
25
|
+
return /*#__PURE__*/React.createElement(Text, _extends({}, rest, {
|
|
26
|
+
style: [styles.icon, {
|
|
27
|
+
color,
|
|
28
|
+
fontSize: size
|
|
29
|
+
}],
|
|
30
|
+
pointerEvents: "none",
|
|
31
|
+
selectable: false
|
|
32
|
+
}), "\u25A1");
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export const accessibilityProps = Platform.OS === 'web' ? {
|
|
36
|
+
role: 'img',
|
|
37
|
+
focusable: false
|
|
38
|
+
} : {
|
|
39
|
+
accessibilityElementsHidden: true,
|
|
40
|
+
importantForAccessibility: 'no-hide-descendants'
|
|
41
|
+
};
|
|
42
|
+
const defaultIcon = _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
name,
|
|
45
|
+
color,
|
|
46
|
+
size,
|
|
47
|
+
direction,
|
|
48
|
+
allowFontScaling
|
|
49
|
+
} = _ref2;
|
|
50
|
+
return /*#__PURE__*/React.createElement(MaterialCommunityIcons, _extends({
|
|
51
|
+
allowFontScaling: allowFontScaling,
|
|
52
|
+
name: name,
|
|
53
|
+
color: color,
|
|
54
|
+
size: size,
|
|
55
|
+
style: [{
|
|
56
|
+
transform: [{
|
|
57
|
+
scaleX: direction === 'rtl' ? -1 : 1
|
|
58
|
+
}],
|
|
59
|
+
lineHeight: size
|
|
60
|
+
}, styles.icon],
|
|
61
|
+
pointerEvents: "none",
|
|
62
|
+
selectable: false
|
|
63
|
+
}, accessibilityProps));
|
|
64
|
+
};
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
icon: {
|
|
67
|
+
backgroundColor: 'transparent'
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export default defaultIcon;
|
|
71
|
+
//# sourceMappingURL=MaterialCommunityIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","Text","Platform","MaterialCommunityIcons","require","default","e","isErrorLogged","_ref","color","size","rest","test","message","console","error","warn","createElement","_extends","style","styles","icon","fontSize","pointerEvents","selectable","accessibilityProps","OS","role","focusable","accessibilityElementsHidden","importantForAccessibility","defaultIcon","_ref2","name","direction","allowFontScaling","transform","scaleX","lineHeight","create","backgroundColor"],"sourceRoot":"../../../src","sources":["icons/MaterialCommunityIcons.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,cAAc;AAUzD,IAAIC,sBAA2B;AAE/B,IAAI;EACF;EACAA,sBAAsB,GACpBC,OAAO,CAAC,kDAAkD,CAAC,CAACC,OAAO;AACvE,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV,IAAIC,aAAa,GAAG,KAAK;;EAEzB;EACAJ,sBAAsB,GAAGK,IAAA,IAAmC;IAAA,IAAlC;MAAEC,KAAK;MAAEC,IAAI;MAAE,GAAGC;IAAU,CAAC,GAAAH,IAAA;IACrD,IAAI,CAACD,aAAa,EAAE;MAClB,IACE,CAAC,6DAA6D,CAACK,IAAI,CAChEN,CAAC,CAASO,OACb,CAAC,EACD;QACAC,OAAO,CAACC,KAAK,CAACT,CAAC,CAAC;MAClB;MAEAQ,OAAO,CAACE,IAAI,CACT,oEACH,CAAC;MAEDT,aAAa,GAAG,IAAI;IACtB;IAEA,oBACER,KAAA,CAAAkB,aAAA,CAAChB,IAAI,EAAAiB,QAAA,KACCP,IAAI;MACRQ,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,EAAE;QAAEZ,KAAK;QAAEa,QAAQ,EAAEZ;MAAK,CAAC,CAAE;MAChDa,aAAa,EAAC,MAAM;MACpBC,UAAU,EAAE;IAAM,IACnB,QAEK,CAAC;EAEX,CAAC;AACH;AAEA,OAAO,MAAMC,kBAAkB,GAC7BvB,QAAQ,CAACwB,EAAE,KAAK,KAAK,GACjB;EACEC,IAAI,EAAE,KAAK;EACXC,SAAS,EAAE;AACb,CAAC,GACD;EACEC,2BAA2B,EAAE,IAAI;EACjCC,yBAAyB,EACvB;AACJ,CAAC;AAEP,MAAMC,WAAW,GAAGC,KAAA;EAAA,IAAC;IACnBC,IAAI;IACJxB,KAAK;IACLC,IAAI;IACJwB,SAAS;IACTC;EACS,CAAC,GAAAH,KAAA;EAAA,oBACVjC,KAAA,CAAAkB,aAAA,CAACd,sBAAsB,EAAAe,QAAA;IACrBiB,gBAAgB,EAAEA,gBAAiB;IACnCF,IAAI,EAAEA,IAAK;IACXxB,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXS,KAAK,EAAE,CACL;MACEiB,SAAS,EAAE,CAAC;QAAEC,MAAM,EAAEH,SAAS,KAAK,KAAK,GAAG,CAAC,CAAC,GAAG;MAAE,CAAC,CAAC;MACrDI,UAAU,EAAE5B;IACd,CAAC,EACDU,MAAM,CAACC,IAAI,CACX;IACFE,aAAa,EAAC,MAAM;IACpBC,UAAU,EAAE;EAAM,GACdC,kBAAkB,CACvB,CAAC;AAAA,CACH;AAED,MAAML,MAAM,GAAGpB,UAAU,CAACuC,MAAM,CAAC;EAC/BlB,IAAI,EAAE;IACJmB,eAAe,EAAE;EACnB;AACF,CAAC,CAAC;AAEF,eAAeT,WAAW"}
|
package/lib/typescript/App.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAMjC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FAQ.d.ts","sourceRoot":"","sources":["../../src/FAQ.tsx"],"names":[],"mappings":"AASA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAOxC,QAAA,MAAM,GAAG,UAAW,GAAG,6BA4ItB,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Greetings.d.ts","sourceRoot":"","sources":["../../src/Greetings.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,SAAS,UAAW,GAAG,sBAmB5B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Social.d.ts","sourceRoot":"","sources":["../../src/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":"Support.d.ts","sourceRoot":"","sources":["../../src/Support.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,QAAA,MAAM,OAAO,UAAW,GAAG,6BAiD1B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Supporters.d.ts","sourceRoot":"","sources":["../../src/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":"Widget.d.ts","sourceRoot":"","sources":["../../src/Widget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,QAAA,MAAM,MAAM,UAAW,GAAG,sBAiDzB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApolloClient } from '@apollo/client/core';
|
|
2
|
+
export declare const apiUrl: string;
|
|
3
|
+
export declare const wsLink: any;
|
|
4
|
+
declare const ClientProvider: () => ApolloClient<import("@apollo/client/core").NormalizedCacheObject>;
|
|
5
|
+
export default ClientProvider;
|
|
6
|
+
//# sourceMappingURL=apolloClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apolloClient.d.ts","sourceRoot":"","sources":["../../src/apolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAQ7B,eAAO,MAAM,MAAM,QAAuB,CAAC;AAG3C,eAAO,MAAM,MAAM,EAAE,GAQpB,CAAC;AAwBF,QAAA,MAAM,cAAc,yEAKhB,CAAC;AAEL,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/assets/images/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;CAKX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const widgetsMessengerSupporters: DocumentNode;
|
|
2
|
+
declare const widgetsConversations: DocumentNode;
|
|
3
|
+
declare const knowledgeBaseTopicDetail: DocumentNode;
|
|
4
|
+
declare const knowledgeBaseCategoryDetail: DocumentNode;
|
|
5
|
+
export { widgetsMessengerSupporters, widgetsConversations, knowledgeBaseTopicDetail, knowledgeBaseCategoryDetail, };
|
|
6
|
+
//# sourceMappingURL=graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/graphql/graphql.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,0BAA0B,cAoB/B,CAAC;AAEF,QAAA,MAAM,oBAAoB,cAyBzB,CAAC;AAEF,QAAA,MAAM,wBAAwB,cA0B7B,CAAC;AAEF,QAAA,MAAM,2BAA2B,cAqBhC,CAAC;AAEF,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../src/graphql/mutation.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,cAqCZ,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type IconProps = {
|
|
3
|
+
name: string;
|
|
4
|
+
color: string;
|
|
5
|
+
size: number;
|
|
6
|
+
direction: 'rtl' | 'ltr';
|
|
7
|
+
allowFontScaling?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const accessibilityProps: {
|
|
10
|
+
role: string;
|
|
11
|
+
focusable: boolean;
|
|
12
|
+
accessibilityElementsHidden?: undefined;
|
|
13
|
+
importantForAccessibility?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
accessibilityElementsHidden: boolean;
|
|
16
|
+
importantForAccessibility: "no-hide-descendants";
|
|
17
|
+
role?: undefined;
|
|
18
|
+
focusable?: undefined;
|
|
19
|
+
};
|
|
20
|
+
declare const defaultIcon: ({ name, color, size, direction, allowFontScaling, }: IconProps) => React.JSX.Element;
|
|
21
|
+
export default defaultIcon;
|
|
22
|
+
//# sourceMappingURL=MaterialCommunityIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialCommunityIcons.d.ts","sourceRoot":"","sources":["../../../src/icons/MaterialCommunityIcons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AA0CF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAUxB,CAAC;AAER,QAAA,MAAM,WAAW,wDAMd,SAAS,sBAiBX,CAAC;AAQF,eAAe,WAAW,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.6",
|
|
4
4
|
"description": "react-native erxes sdk",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"ios",
|
|
41
41
|
"android"
|
|
42
42
|
],
|
|
43
|
-
"repository": "https://github.com/
|
|
43
|
+
"repository": "https://github.com/erxes/rn-erxes-sdk",
|
|
44
44
|
"author": "Munkh-orgil <monkhorgilbayarbaatar@gmail.com> (https://github.com/Munkhorgilb)",
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"bugs": {
|
|
47
|
-
"url": "https://github.com/
|
|
47
|
+
"url": "https://github.com/erxes/rn-erxes-sdk/issues"
|
|
48
48
|
},
|
|
49
|
-
"homepage": "https://github.com/
|
|
49
|
+
"homepage": "https://github.com/erxes/rn-erxes-sdk#readme",
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"registry": "https://registry.npmjs.org/"
|
|
52
52
|
},
|
|
@@ -157,6 +157,10 @@
|
|
|
157
157
|
]
|
|
158
158
|
},
|
|
159
159
|
"dependencies": {
|
|
160
|
-
"
|
|
160
|
+
"@apollo/client": "^3.7.15",
|
|
161
|
+
"dayjs": "^1.11.8",
|
|
162
|
+
"graphql-ws": "^5.13.1",
|
|
163
|
+
"react-apollo": "^3.1.5",
|
|
164
|
+
"react-native-vector-icons": "^9.1.0"
|
|
161
165
|
}
|
|
162
166
|
}
|
package/src/App.tsx
CHANGED
|
@@ -1,51 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { ApolloProvider } from '@apollo/client';
|
|
3
|
+
import ClientProvider from './apolloClient';
|
|
4
|
+
import Widget from './Widget';
|
|
4
5
|
|
|
5
6
|
export type PropTypes = {
|
|
6
|
-
|
|
7
|
+
brandCode: string;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
const ErxesSDK: React.FC<PropTypes> = ({
|
|
10
|
-
const onMessage = (data: any) => {
|
|
11
|
-
const { notificationCount } = JSON.parse(data.nativeEvent.data);
|
|
12
|
-
|
|
13
|
-
console.log('****************** ', notificationCount);
|
|
14
|
-
};
|
|
15
|
-
|
|
10
|
+
const ErxesSDK: React.FC<PropTypes> = ({ brandCode }) => {
|
|
16
11
|
return (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Platform.OS === 'ios'
|
|
21
|
-
? require('./index.html')
|
|
22
|
-
: { uri: 'file:///android_asset/index.html' }
|
|
23
|
-
}
|
|
24
|
-
originWhitelist={['*']}
|
|
25
|
-
sharedCookiesEnabled={true}
|
|
26
|
-
cacheEnabled={true}
|
|
27
|
-
allowFileAccess={true}
|
|
28
|
-
domStorageEnabled={true}
|
|
29
|
-
thirdPartyCookiesEnabled={true}
|
|
30
|
-
// allowingReadAccessToURL
|
|
31
|
-
// style={{ width: 200 }}
|
|
32
|
-
onLoadEnd={(syntheticEvent) => {
|
|
33
|
-
// update component to be aware of loading status
|
|
34
|
-
const { nativeEvent } = syntheticEvent;
|
|
35
|
-
console.log(nativeEvent.loading);
|
|
36
|
-
}}
|
|
37
|
-
javaScriptEnabled={true}
|
|
38
|
-
onError={(er) => {
|
|
39
|
-
console.log(er);
|
|
40
|
-
}}
|
|
41
|
-
startInLoadingState={true}
|
|
42
|
-
// renderLoading={() => <Loader />}
|
|
43
|
-
injectedJavaScript={script}
|
|
44
|
-
// injectedJavaScriptBeforeContentLoaded={runFirst}
|
|
45
|
-
|
|
46
|
-
// onNavigationStateChange={this.handleWebViewNavigationStateChange}
|
|
47
|
-
onMessage={onMessage}
|
|
48
|
-
/>
|
|
12
|
+
<ApolloProvider client={ClientProvider()}>
|
|
13
|
+
<Widget brandCode={brandCode} />
|
|
14
|
+
</ApolloProvider>
|
|
49
15
|
);
|
|
50
16
|
};
|
|
51
17
|
|
package/src/FAQ.tsx
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
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/graphql';
|
|
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={{ backgroundColor: '#f7f6f9', padding: 5 }}
|
|
116
|
+
onPress={() => {
|
|
117
|
+
setSelectedParent('');
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<Text style={{ marginLeft: 5 }}>Back to FAQ</Text>
|
|
121
|
+
</TouchableOpacity>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const seperator = () => {
|
|
126
|
+
return (
|
|
127
|
+
<View style={{ height: 1, backgroundColor: '#000', marginTop: 10 }} />
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<View style={{ flex: 1 }}>
|
|
133
|
+
{selectedCategory ? (
|
|
134
|
+
renderCategoryDetail()
|
|
135
|
+
) : selectedParent ? (
|
|
136
|
+
<FlatList
|
|
137
|
+
data={data?.knowledgeBaseTopicDetail?.categories?.filter(
|
|
138
|
+
(e: any) => e?.parentCategoryId === selectedParent?._id
|
|
139
|
+
)}
|
|
140
|
+
renderItem={renderItem}
|
|
141
|
+
keyExtractor={(item) => item.id}
|
|
142
|
+
contentContainerStyle={{ gap: 10, paddingBottom: 60 }}
|
|
143
|
+
ItemSeparatorComponent={seperator}
|
|
144
|
+
ListHeaderComponent={header}
|
|
145
|
+
/>
|
|
146
|
+
) : (
|
|
147
|
+
<FlatList
|
|
148
|
+
data={data?.knowledgeBaseTopicDetail?.parentCategories}
|
|
149
|
+
renderItem={renderItem}
|
|
150
|
+
keyExtractor={(item) => item.id}
|
|
151
|
+
contentContainerStyle={{ gap: 10 }}
|
|
152
|
+
ItemSeparatorComponent={seperator}
|
|
153
|
+
/>
|
|
154
|
+
)}
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export default FAQ;
|
|
160
|
+
|
|
161
|
+
const styles = StyleSheet.create({
|
|
162
|
+
container: {
|
|
163
|
+
marginTop: 10,
|
|
164
|
+
marginHorizontal: 10,
|
|
165
|
+
},
|
|
166
|
+
});
|