@momo-kits/template 0.165.1-beta.1 → 0.165.1-expo.1
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 +23 -25
- package/package.json +2 -3
package/TrustBanner/index.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { FC, useContext, useEffect } from 'react';
|
|
1
|
+
import React, { FC, useContext, useEffect, useMemo } from 'react';
|
|
3
2
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
4
3
|
import { TrustBannerCallbackParams, TrustBannerProps } from './types';
|
|
5
4
|
import styles from './styles';
|
|
@@ -11,8 +10,6 @@ import {
|
|
|
11
10
|
Styles,
|
|
12
11
|
Text,
|
|
13
12
|
} from '@momo-kits/foundation';
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
import MaxApi from '@momo-platform/api';
|
|
16
13
|
|
|
17
14
|
const defaultData = {
|
|
18
15
|
content: {
|
|
@@ -43,10 +40,10 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
43
40
|
style,
|
|
44
41
|
screenName = '',
|
|
45
42
|
serviceName = '',
|
|
46
|
-
trackEvent,
|
|
47
43
|
}) => {
|
|
48
44
|
const context = useContext<any>(MiniAppContext);
|
|
49
45
|
const {
|
|
46
|
+
navigator,
|
|
50
47
|
theme,
|
|
51
48
|
translate = (data: { vi: string; en: string }) => {
|
|
52
49
|
return data.vi;
|
|
@@ -66,34 +63,35 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
66
63
|
const translationSubContent = translate(subContent) || subContent.vi;
|
|
67
64
|
const translationContent = translate(content);
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const trackingParams: TrustBannerCallbackParams = {
|
|
78
|
-
screen_name: screenName,
|
|
79
|
-
service_name: serviceName,
|
|
80
|
-
component_name: 'logo_trust',
|
|
81
|
-
};
|
|
66
|
+
const trackingParams: TrustBannerCallbackParams = useMemo(
|
|
67
|
+
() => ({
|
|
68
|
+
screen_name: screenName,
|
|
69
|
+
service_name: serviceName,
|
|
70
|
+
component_name: 'logo_trust',
|
|
71
|
+
}),
|
|
72
|
+
[screenName, serviceName],
|
|
73
|
+
);
|
|
82
74
|
|
|
83
75
|
useEffect(() => {
|
|
84
|
-
trackEvent?.(
|
|
85
|
-
|
|
76
|
+
navigator?.maxApi.trackEvent?.(
|
|
77
|
+
'service_component_displayed',
|
|
78
|
+
trackingParams,
|
|
79
|
+
);
|
|
80
|
+
}, [navigator?.maxApi, trackingParams]);
|
|
86
81
|
|
|
87
82
|
const _onPress = () => {
|
|
88
|
-
trackEvent?.('service_component_clicked', {
|
|
83
|
+
navigator?.maxApi.trackEvent?.('service_component_clicked', {
|
|
84
|
+
...trackingParams,
|
|
85
|
+
urlConfig,
|
|
86
|
+
});
|
|
89
87
|
if (urlConfig.indexOf('https') > -1) {
|
|
90
88
|
const openWebData = {
|
|
91
89
|
url: urlConfig,
|
|
92
90
|
title: translate(titleWeb) || subContent.vi,
|
|
93
91
|
};
|
|
94
|
-
|
|
92
|
+
navigator?.maxApi.openWeb(openWebData);
|
|
95
93
|
} else {
|
|
96
|
-
|
|
94
|
+
navigator?.maxApi.startFeatureCode(urlConfig, {}, () => {});
|
|
97
95
|
}
|
|
98
96
|
};
|
|
99
97
|
|
|
@@ -102,7 +100,7 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
102
100
|
<View style={stylesInside.footerContainer}>
|
|
103
101
|
<View style={Styles.row}>
|
|
104
102
|
<Text typography={'action_xs_bold'} color={'#eb2f96'}>
|
|
105
|
-
{
|
|
103
|
+
{translationSubContent}
|
|
106
104
|
</Text>
|
|
107
105
|
<Icon
|
|
108
106
|
source={'arrow_chevron_right_small'}
|
|
@@ -146,7 +144,7 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
146
144
|
typography={'description_default_regular'}
|
|
147
145
|
numberOfLines={2}
|
|
148
146
|
>
|
|
149
|
-
{
|
|
147
|
+
{translationContent}
|
|
150
148
|
</Text>
|
|
151
149
|
{renderFooter()}
|
|
152
150
|
</View>
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/template",
|
|
3
|
-
"version": "0.165.1-
|
|
3
|
+
"version": "0.165.1-expo.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.tsx",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@momo-kits/foundation": "latest",
|
|
8
8
|
"@momo-kits/carousel": "*",
|
|
9
9
|
"react": "*",
|
|
10
|
-
"react-native": "*"
|
|
11
|
-
"@momo-platform/api": "0.1.67-rc.3"
|
|
10
|
+
"react-native": "*"
|
|
12
11
|
},
|
|
13
12
|
"license": "MoMo",
|
|
14
13
|
"publishConfig": {
|