@momo-kits/template 0.81.43 → 0.81.45
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/TrustBanner/CustomAvatar.tsx +3 -1
- package/TrustBanner/index.tsx +36 -42
- package/TrustBanner/types.ts +1 -2
- package/package.json +4 -3
|
@@ -10,7 +10,9 @@ const CustomAvatar: FC<CustomAvatarProps> = ({image, text, style}) => {
|
|
|
10
10
|
const renderContent = () => {
|
|
11
11
|
if (text) {
|
|
12
12
|
return (
|
|
13
|
-
<Text
|
|
13
|
+
<Text
|
|
14
|
+
color={theme.colors.primary}
|
|
15
|
+
typography={'description_xs_regular'}>
|
|
14
16
|
{text}
|
|
15
17
|
</Text>
|
|
16
18
|
);
|
package/TrustBanner/index.tsx
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import React, {FC, useContext, useEffect, useState} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
2
|
+
import {NativeModules, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {TrustBannerCallbackParams, TrustBannerProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
|
|
6
6
|
import CustomAvatar from './CustomAvatar';
|
|
7
|
-
|
|
8
|
-
const dataJsonUrl =
|
|
9
|
-
'https://static.momocdn.net/app/json/component-kits/design_system.json';
|
|
10
|
-
|
|
11
|
-
const defaultIcons = [
|
|
12
|
-
'https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png',
|
|
13
|
-
'https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png',
|
|
14
|
-
'https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png',
|
|
15
|
-
'https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png',
|
|
16
|
-
];
|
|
7
|
+
import MaxApi from '@momo-platform/api';
|
|
17
8
|
|
|
18
9
|
const defaultData = {
|
|
19
10
|
content: {
|
|
@@ -22,31 +13,26 @@ const defaultData = {
|
|
|
22
13
|
},
|
|
23
14
|
pciImage: 'https://static.momocdn.net/app/img/kits/trustBanner/pci.png',
|
|
24
15
|
sslImage: 'https://static.momocdn.net/app/img/kits/trustBanner/ssl.png',
|
|
25
|
-
url_config: 'https://momo.vn/an-toan-bao-mat',
|
|
26
|
-
feature_code: 'login_and_security',
|
|
27
|
-
icons: defaultIcons,
|
|
28
16
|
momoImage:
|
|
29
17
|
'https://static.momocdn.net/app/img/kits/trustBanner/ic_momo_secu.png',
|
|
18
|
+
urlConfig: 'login_and_security',
|
|
19
|
+
icons: [
|
|
20
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png',
|
|
21
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png',
|
|
22
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png',
|
|
23
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png',
|
|
24
|
+
],
|
|
30
25
|
};
|
|
31
26
|
|
|
32
27
|
const TrustBanner: FC<TrustBannerProps> = ({
|
|
33
28
|
style,
|
|
34
29
|
screenName = '',
|
|
35
30
|
serviceName = '',
|
|
36
|
-
onPress,
|
|
37
31
|
trackEvent,
|
|
38
32
|
}) => {
|
|
39
33
|
const {theme, language} = useContext(ApplicationContext);
|
|
40
34
|
const [data, setData] = useState(defaultData);
|
|
41
|
-
const {
|
|
42
|
-
icons,
|
|
43
|
-
sslImage,
|
|
44
|
-
pciImage,
|
|
45
|
-
momoImage,
|
|
46
|
-
url_config,
|
|
47
|
-
content,
|
|
48
|
-
feature_code,
|
|
49
|
-
} = data;
|
|
35
|
+
const {icons, sslImage, pciImage, momoImage, urlConfig, content} = data;
|
|
50
36
|
const trackingParams: TrustBannerCallbackParams = {
|
|
51
37
|
screen_name: screenName,
|
|
52
38
|
service_name: serviceName,
|
|
@@ -58,21 +44,25 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
58
44
|
fetchJson();
|
|
59
45
|
}, []);
|
|
60
46
|
|
|
61
|
-
const fetchJson =
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
const fetchJson = () => {
|
|
48
|
+
try {
|
|
49
|
+
const config = JSON.parse(
|
|
50
|
+
NativeModules?.ConfigsModule?.getConfigSync?.('DESIGN_SYSTEM'),
|
|
51
|
+
);
|
|
52
|
+
const dataJSon = config?.trustBanner;
|
|
64
53
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
if (dataJSon && dataJSon?.trustBanner) {
|
|
55
|
+
setData({
|
|
56
|
+
icons: dataJSon.trustBanner.icons || defaultData.icons,
|
|
57
|
+
sslImage: dataJSon.trustBanner.sslImage || defaultData.sslImage,
|
|
58
|
+
pciImage: dataJSon.trustBanner.pciImage || defaultData.pciImage,
|
|
59
|
+
momoImage: dataJSon.trustBanner.momoImage || defaultData.momoImage,
|
|
60
|
+
content: dataJSon.trustBanner.content || defaultData.content,
|
|
61
|
+
urlConfig: dataJSon.trustBanner.urlConfig || defaultData.urlConfig,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.log(e);
|
|
76
66
|
}
|
|
77
67
|
};
|
|
78
68
|
|
|
@@ -117,14 +107,18 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
117
107
|
};
|
|
118
108
|
|
|
119
109
|
const _onPress = () => {
|
|
120
|
-
trackEvent?.('service_component_clicked', {...trackingParams,
|
|
121
|
-
|
|
110
|
+
trackEvent?.('service_component_clicked', {...trackingParams, urlConfig});
|
|
111
|
+
if (urlConfig.indexOf('https') > -1) {
|
|
112
|
+
MaxApi.openWeb(urlConfig, {}, () => {});
|
|
113
|
+
} else {
|
|
114
|
+
MaxApi.startFeatureCode(urlConfig, {}, () => {});
|
|
115
|
+
}
|
|
122
116
|
};
|
|
123
117
|
|
|
124
118
|
return (
|
|
125
119
|
<TouchableOpacity
|
|
126
120
|
onPress={_onPress}
|
|
127
|
-
activeOpacity={
|
|
121
|
+
activeOpacity={0.7}
|
|
128
122
|
style={[style, styles.container]}>
|
|
129
123
|
<Image
|
|
130
124
|
style={styles.momoImage}
|
|
@@ -137,7 +131,7 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
137
131
|
<Text
|
|
138
132
|
style={styles.message}
|
|
139
133
|
color={theme.colors.text.secondary}
|
|
140
|
-
typography={'
|
|
134
|
+
typography={'description_default_regular'}>
|
|
141
135
|
{content?.[language || 'vi'] || defaultData.content.vi}
|
|
142
136
|
</Text>
|
|
143
137
|
{renderFooter()}
|
package/TrustBanner/types.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/template",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.45",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.tsx",
|
|
6
6
|
"dependencies": {},
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"@momo-kits/carousel": "*",
|
|
10
10
|
"prop-types": "^15.7.2",
|
|
11
11
|
"react": "16.9.0",
|
|
12
|
-
"react-native": ">=0.55"
|
|
12
|
+
"react-native": ">=0.55",
|
|
13
|
+
"@momo-platform/api": "0.1.67-rc.3"
|
|
13
14
|
},
|
|
14
15
|
"license": "MoMo"
|
|
15
|
-
}
|
|
16
|
+
}
|