@momo-kits/template 0.81.12 → 0.81.13
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/index.tsx +26 -36
- package/TrustBanner/types.ts +4 -4
- package/package.json +2 -2
package/TrustBanner/index.tsx
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import React, {FC, useContext, useEffect, useState} from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
TouchableOpacity,
|
|
5
|
-
UIManager,
|
|
6
|
-
View,
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
import {TrackingParams, TrustBannerProps} from './types';
|
|
2
|
+
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
+
import {TrustBannerCallbackParams, TrustBannerProps} from './types';
|
|
9
4
|
import styles from './styles';
|
|
10
5
|
import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
|
|
11
6
|
import CustomAvatar from './CustomAvatar';
|
|
12
7
|
|
|
13
|
-
const NativeTrustBanner =
|
|
14
|
-
requireNativeComponent<TrustBannerProps>('TrustBannerView');
|
|
15
|
-
|
|
16
8
|
const dataJsonUrl =
|
|
17
9
|
'https://static.momocdn.net/app/json/component-kits/design_system.json';
|
|
18
10
|
|
|
@@ -30,6 +22,8 @@ const defaultData = {
|
|
|
30
22
|
},
|
|
31
23
|
pciImage: 'https://static.momocdn.net/app/img/kits/trustBanner/pci.png',
|
|
32
24
|
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',
|
|
33
27
|
icons: defaultIcons,
|
|
34
28
|
momoImage:
|
|
35
29
|
'https://static.momocdn.net/app/img/kits/trustBanner/ic_momo_secu.png',
|
|
@@ -37,20 +31,28 @@ const defaultData = {
|
|
|
37
31
|
|
|
38
32
|
const TrustBanner: FC<TrustBannerProps> = ({
|
|
39
33
|
style,
|
|
40
|
-
trackEvent,
|
|
41
34
|
screenName = '',
|
|
42
35
|
serviceName = '',
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
onPress,
|
|
37
|
+
trackEvent,
|
|
45
38
|
}) => {
|
|
46
39
|
const {theme, language} = useContext(ApplicationContext);
|
|
47
40
|
const [data, setData] = useState(defaultData);
|
|
48
|
-
const {
|
|
49
|
-
|
|
41
|
+
const {
|
|
42
|
+
icons,
|
|
43
|
+
sslImage,
|
|
44
|
+
pciImage,
|
|
45
|
+
momoImage,
|
|
46
|
+
content,
|
|
47
|
+
url_config,
|
|
48
|
+
feature_code,
|
|
49
|
+
} = data;
|
|
50
|
+
const trackingParams: TrustBannerCallbackParams = {
|
|
50
51
|
screen_name: screenName,
|
|
51
52
|
service_name: serviceName,
|
|
52
53
|
component_name: 'logo_trust',
|
|
53
54
|
};
|
|
55
|
+
|
|
54
56
|
useEffect(() => {
|
|
55
57
|
trackEvent?.('service_component_displayed', trackingParams);
|
|
56
58
|
fetchJson();
|
|
@@ -67,6 +69,9 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
67
69
|
pciImage: dataJSon.trustBanner.pciImage || defaultData.pciImage,
|
|
68
70
|
momoImage: dataJSon.trustBanner.momoImage || defaultData.momoImage,
|
|
69
71
|
content: dataJSon.trustBanner.content || defaultData.content,
|
|
72
|
+
url_config: dataJSon.trustBanner.url_config || defaultData.url_config,
|
|
73
|
+
feature_code:
|
|
74
|
+
dataJSon.trustBanner.feature_code || defaultData.feature_code,
|
|
70
75
|
});
|
|
71
76
|
}
|
|
72
77
|
};
|
|
@@ -111,30 +116,15 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
111
116
|
);
|
|
112
117
|
};
|
|
113
118
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
trackEvent?.('service_component_clicked', trackingParams);
|
|
119
|
-
openWeb?.(openUrl);
|
|
120
|
-
}}
|
|
121
|
-
activeOpacity={0.7}
|
|
122
|
-
style={style}>
|
|
123
|
-
<NativeTrustBanner
|
|
124
|
-
content={defaultData.content.vi}
|
|
125
|
-
style={{height: 88}}
|
|
126
|
-
/>
|
|
127
|
-
</TouchableOpacity>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
119
|
+
const _onPress = () => {
|
|
120
|
+
trackEvent?.('service_component_clicked', trackingParams);
|
|
121
|
+
onPress?.({...trackingParams, url_config, feature_code});
|
|
122
|
+
};
|
|
130
123
|
|
|
131
124
|
return (
|
|
132
125
|
<TouchableOpacity
|
|
133
|
-
onPress={
|
|
134
|
-
|
|
135
|
-
openWeb?.(openUrl);
|
|
136
|
-
}}
|
|
137
|
-
activeOpacity={0.7}
|
|
126
|
+
onPress={_onPress}
|
|
127
|
+
activeOpacity={onPress ? 0.7 : 1}
|
|
138
128
|
style={[style, styles.container]}>
|
|
139
129
|
<Image
|
|
140
130
|
style={styles.momoImage}
|
package/TrustBanner/types.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type TrustBannerCallbackParams = {
|
|
4
4
|
service_name: string;
|
|
5
5
|
screen_name: string;
|
|
6
6
|
component_name: string;
|
|
7
7
|
url_config?: string;
|
|
8
|
+
feature_code?: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export type TrustBannerProps = {
|
|
11
|
-
trackEvent?: (eventName: string, trackingParams: TrackingParams) => void;
|
|
12
12
|
style?: ViewStyle | ViewStyle[];
|
|
13
|
-
openWeb?: (params: string) => void;
|
|
14
13
|
screenName?: string;
|
|
15
14
|
serviceName?: string;
|
|
16
|
-
openUrl?: string;
|
|
17
15
|
content?: string;
|
|
16
|
+
onPress?: (params: TrustBannerCallbackParams) => void;
|
|
17
|
+
trackEvent?: (eventName: string, params: TrustBannerCallbackParams) => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export type CustomAvatarProps = {
|
package/package.json
CHANGED