@momo-kits/template 0.81.14 → 0.81.16
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/HeaderSliderBanner/index.tsx +1 -1
- package/TrustBanner/index.tsx +26 -36
- package/TrustBanner/types.ts +32 -5
- package/package.json +4 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, {FC} from 'react';
|
|
2
|
-
import {Animated, TouchableOpacity
|
|
2
|
+
import {Animated, TouchableOpacity} from 'react-native';
|
|
3
3
|
import Carousel from '@momo-kits/carousel';
|
|
4
4
|
import {Image, Pagination, Spacing} from '@momo-kits/foundation';
|
|
5
5
|
import {HeaderSliderBannerProps} from './types';
|
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
|
+
url_config,
|
|
47
|
+
content,
|
|
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,47 @@
|
|
|
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
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Optional. Styles to customize the appearance of the banner. Can be a single
|
|
14
|
+
* style object or an array of style objects.
|
|
15
|
+
*/
|
|
12
16
|
style?: ViewStyle | ViewStyle[];
|
|
13
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Optional. The name of the screen where the banner is displayed. This can be
|
|
20
|
+
* used to identify the context in which the banner appears.
|
|
21
|
+
*/
|
|
14
22
|
screenName?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Optional. The name of the service or feature the banner is associated with.
|
|
26
|
+
* This helps in providing contextual information within the banner content.
|
|
27
|
+
*/
|
|
15
28
|
serviceName?: string;
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Optional. A callback function can be openWeb or startFeatureCode,
|
|
32
|
+
* return params:
|
|
33
|
+
* service_name,
|
|
34
|
+
* screen_name,
|
|
35
|
+
* component_name,
|
|
36
|
+
* url_config,
|
|
37
|
+
* feature_code,
|
|
38
|
+
*/
|
|
39
|
+
onPress?: (params: TrustBannerCallbackParams) => void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Optional. instance of maxApi trackEvent function.
|
|
43
|
+
*/
|
|
44
|
+
trackEvent?: (eventName: string, params: TrustBannerCallbackParams) => void;
|
|
18
45
|
};
|
|
19
46
|
|
|
20
47
|
export type CustomAvatarProps = {
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/template",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.tsx",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@momo-kits/foundation": "
|
|
9
|
-
"@momo-kits/carousel": "
|
|
8
|
+
"@momo-kits/foundation": "*",
|
|
9
|
+
"@momo-kits/carousel": "*",
|
|
10
10
|
"prop-types": "^15.7.2",
|
|
11
11
|
"react": "16.9.0",
|
|
12
12
|
"react-native": ">=0.55"
|
|
13
13
|
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@momo-platform/versions": "4.1.11"
|
|
16
|
-
},
|
|
17
14
|
"license": "MoMo"
|
|
18
|
-
}
|
|
15
|
+
}
|