@momo-kits/foundation 0.81.16 → 0.81.17-beta.2
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/Application/ModalScreen.tsx +28 -29
- package/Application/StackScreen.tsx +4 -5
- package/Assets/language.json +3 -1
- package/Icon/index.tsx +0 -1
- package/Icon/types.ts +2 -2
- package/Popup/PopupNotify.tsx +42 -6
- package/Popup/PopupPromotion.tsx +35 -8
- package/Popup/types.ts +3 -3
- package/package.json +1 -1
|
@@ -53,43 +53,35 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
53
53
|
|
|
54
54
|
delete params.screen;
|
|
55
55
|
|
|
56
|
+
const getTrackingInfo = () => {
|
|
57
|
+
const routes = props.navigation.getState()?.routes || [];
|
|
58
|
+
const routesLength = routes.length;
|
|
59
|
+
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
60
|
+
if (routesLength > 1) {
|
|
61
|
+
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
62
|
+
}
|
|
63
|
+
const error_code = screen?.({params: {}})?.props?.error;
|
|
64
|
+
return {
|
|
65
|
+
feature_code: navigator?.trackingInfo?.code,
|
|
66
|
+
app_id: navigator?.trackingInfo?.appId,
|
|
67
|
+
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
68
|
+
flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
|
|
69
|
+
screen_name,
|
|
70
|
+
component_type: 'popup',
|
|
71
|
+
component_name: modalName,
|
|
72
|
+
error_code,
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
56
76
|
/**
|
|
57
77
|
* tracking
|
|
58
78
|
*/
|
|
59
79
|
useEffect(() => {
|
|
60
80
|
if (navigator?.trackingInfo) {
|
|
61
|
-
const navigationRoutes = props.navigation.getState()?.routes || [];
|
|
62
|
-
const routesLength = navigationRoutes.length;
|
|
63
|
-
let screen_name = navigationRoutes?.[0]?.params?.screen?.name;
|
|
64
|
-
if (routesLength > 1) {
|
|
65
|
-
screen_name = navigationRoutes[routesLength - 2]?.params?.screen?.name;
|
|
66
|
-
}
|
|
67
|
-
const error_code = screen?.({params: {}})?.props?.information;
|
|
68
81
|
navigator?.maxApi?.trackEvent('service_component_displayed', {
|
|
69
|
-
|
|
70
|
-
app_id: navigator.trackingInfo.appId,
|
|
71
|
-
miniapp_version: navigator.trackingInfo.buildNumber,
|
|
72
|
-
flow_partner_id: navigator.trackingInfo.flowPartnerId,
|
|
73
|
-
screen_name,
|
|
82
|
+
...getTrackingInfo(),
|
|
74
83
|
trigger_id: '111012100000000000',
|
|
75
|
-
component_type: 'popup',
|
|
76
|
-
component_name: modalName,
|
|
77
|
-
error_code,
|
|
78
84
|
});
|
|
79
|
-
|
|
80
|
-
return () => {
|
|
81
|
-
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
82
|
-
feature_code: navigator?.trackingInfo?.code,
|
|
83
|
-
app_id: navigator?.trackingInfo?.appId,
|
|
84
|
-
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
85
|
-
screen_name,
|
|
86
|
-
trigger_id: '111154100000000001',
|
|
87
|
-
component_type: 'popup',
|
|
88
|
-
component_name: modalName,
|
|
89
|
-
error_code,
|
|
90
|
-
icon_name: 'close',
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
85
|
}
|
|
94
86
|
}, []);
|
|
95
87
|
|
|
@@ -97,6 +89,13 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
97
89
|
if (barrierDismissible) {
|
|
98
90
|
return;
|
|
99
91
|
}
|
|
92
|
+
if (navigator?.trackingInfo) {
|
|
93
|
+
navigator?.maxApi?.trackEvent('service_popup_dismissed', {
|
|
94
|
+
...getTrackingInfo(),
|
|
95
|
+
action_type: 'touch_outside',
|
|
96
|
+
trigger_id: '111154100000000001',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
100
99
|
navigator?.pop();
|
|
101
100
|
};
|
|
102
101
|
|
|
@@ -32,12 +32,11 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
32
32
|
*/
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
if (navigator?.trackingInfo) {
|
|
35
|
-
const
|
|
36
|
-
const routesLength =
|
|
37
|
-
let pre_screen_name =
|
|
35
|
+
const routes = props.navigation.getState()?.routes || [];
|
|
36
|
+
const routesLength = routes.length;
|
|
37
|
+
let pre_screen_name = '';
|
|
38
38
|
if (routesLength > 1) {
|
|
39
|
-
pre_screen_name =
|
|
40
|
-
navigationRoutes[routesLength - 2]?.params?.screen?.name;
|
|
39
|
+
pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
41
40
|
}
|
|
42
41
|
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
43
42
|
feature_code: navigator.trackingInfo.code,
|
package/Assets/language.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"vi": {
|
|
3
|
+
"errorCode": "Mã lỗi: ",
|
|
3
4
|
"seeMore": "Xem thêm",
|
|
4
5
|
"cancel": "Huỷ",
|
|
5
6
|
"done": "Xong",
|
|
@@ -195,6 +196,7 @@
|
|
|
195
196
|
"information": "Information",
|
|
196
197
|
"tutorial": "Instruction",
|
|
197
198
|
"question": "FAQ",
|
|
198
|
-
"support": "Support center"
|
|
199
|
+
"support": "Support center",
|
|
200
|
+
"errorCode": "Error code: "
|
|
199
201
|
}
|
|
200
202
|
}
|
package/Icon/index.tsx
CHANGED
package/Icon/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ImageStyle} from 'react-native-fast-image';
|
|
2
2
|
|
|
3
3
|
export type IconProps = {
|
|
4
4
|
/**
|
|
@@ -23,5 +23,5 @@ export type IconProps = {
|
|
|
23
23
|
* Optional. Used to apply custom styling to the Icon component.
|
|
24
24
|
* Accepts an object of style properties.
|
|
25
25
|
*/
|
|
26
|
-
style?:
|
|
26
|
+
style?: ImageStyle;
|
|
27
27
|
};
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -12,13 +12,13 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
12
12
|
image,
|
|
13
13
|
title = 'Title',
|
|
14
14
|
description = 'Description',
|
|
15
|
-
|
|
15
|
+
error,
|
|
16
16
|
secondary,
|
|
17
17
|
primary,
|
|
18
18
|
buttonDirection = 'row',
|
|
19
19
|
onIconClose,
|
|
20
20
|
}) => {
|
|
21
|
-
const {theme, navigator} = useContext(ApplicationContext);
|
|
21
|
+
const {theme, navigator, translate} = useContext(ApplicationContext);
|
|
22
22
|
const [scrollContent, setScrollContent] = useState(false);
|
|
23
23
|
|
|
24
24
|
let descriptionStyle = {};
|
|
@@ -37,6 +37,29 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
37
37
|
callback?.();
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
const onTracking = (actionType: string) => {
|
|
41
|
+
if (navigator?.trackingInfo) {
|
|
42
|
+
const routes = navigator.ref.current?.getRootState()?.routes || [];
|
|
43
|
+
const routesLength = routes.length;
|
|
44
|
+
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
45
|
+
if (routesLength > 1) {
|
|
46
|
+
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
47
|
+
}
|
|
48
|
+
navigator?.maxApi?.trackEvent('service_popup_dismissed', {
|
|
49
|
+
feature_code: navigator?.trackingInfo?.code,
|
|
50
|
+
app_id: navigator?.trackingInfo?.appId,
|
|
51
|
+
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
52
|
+
flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
|
|
53
|
+
screen_name,
|
|
54
|
+
component_type: 'popup',
|
|
55
|
+
component_name: 'PopupNotify',
|
|
56
|
+
error_code: error,
|
|
57
|
+
trigger_id: '111154100000000001',
|
|
58
|
+
action_type: actionType,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
40
63
|
/**
|
|
41
64
|
* build main action of popup
|
|
42
65
|
*/
|
|
@@ -52,6 +75,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
52
75
|
type="text"
|
|
53
76
|
size="medium"
|
|
54
77
|
onPress={() => {
|
|
78
|
+
onTracking('button_action');
|
|
55
79
|
onAction(secondary?.onPress);
|
|
56
80
|
}}
|
|
57
81
|
/>
|
|
@@ -64,6 +88,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
64
88
|
title={primary.title}
|
|
65
89
|
size="medium"
|
|
66
90
|
onPress={() => {
|
|
91
|
+
onTracking('button_action');
|
|
67
92
|
onAction(primary.onPress);
|
|
68
93
|
}}
|
|
69
94
|
/>
|
|
@@ -78,6 +103,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
78
103
|
title={primary.title}
|
|
79
104
|
size="medium"
|
|
80
105
|
onPress={() => {
|
|
106
|
+
onTracking('button_action');
|
|
81
107
|
onAction(primary.onPress);
|
|
82
108
|
}}
|
|
83
109
|
/>
|
|
@@ -89,6 +115,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
89
115
|
type="text"
|
|
90
116
|
size="medium"
|
|
91
117
|
onPress={() => {
|
|
118
|
+
onTracking('button_action');
|
|
92
119
|
onAction(secondary?.onPress);
|
|
93
120
|
}}
|
|
94
121
|
/>
|
|
@@ -120,7 +147,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
120
147
|
return (
|
|
121
148
|
<TouchableOpacity
|
|
122
149
|
style={styles.iconCloseContainer}
|
|
123
|
-
onPress={() =>
|
|
150
|
+
onPress={() => {
|
|
151
|
+
onTracking('icon_close');
|
|
152
|
+
onAction(onIconClose);
|
|
153
|
+
}}>
|
|
124
154
|
<View
|
|
125
155
|
style={[
|
|
126
156
|
styles.iconClose,
|
|
@@ -146,7 +176,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
146
176
|
styles.container,
|
|
147
177
|
{backgroundColor: theme.colors.background.surface},
|
|
148
178
|
]}>
|
|
149
|
-
{!!image &&
|
|
179
|
+
{!!image && (
|
|
180
|
+
<View style={styles.image}>
|
|
181
|
+
<Image source={{uri: image}} />
|
|
182
|
+
</View>
|
|
183
|
+
)}
|
|
150
184
|
<View style={styles.content}>
|
|
151
185
|
<Text typography={'title_xs'} numberOfLines={1}>
|
|
152
186
|
{title}
|
|
@@ -164,13 +198,14 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
164
198
|
{description}
|
|
165
199
|
</Text>
|
|
166
200
|
</Description>
|
|
167
|
-
{!!
|
|
201
|
+
{!!error && (
|
|
168
202
|
<View style={styles.information}>
|
|
169
203
|
<Text
|
|
170
204
|
typography={'description_xs'}
|
|
171
205
|
color={theme.colors.text.hint}
|
|
172
206
|
numberOfLines={1}>
|
|
173
|
-
{
|
|
207
|
+
{translate?.('errorCode')}
|
|
208
|
+
{error}
|
|
174
209
|
</Text>
|
|
175
210
|
</View>
|
|
176
211
|
)}
|
|
@@ -190,6 +225,7 @@ const styles = StyleSheet.create({
|
|
|
190
225
|
borderTopLeftRadius: Radius.L,
|
|
191
226
|
borderTopRightRadius: Radius.L,
|
|
192
227
|
aspectRatio: 1.7777,
|
|
228
|
+
overflow: 'hidden',
|
|
193
229
|
},
|
|
194
230
|
content: {padding: Spacing.XL},
|
|
195
231
|
description: {
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -6,9 +6,34 @@ import {Image} from '../Image';
|
|
|
6
6
|
import {Radius, Spacing} from '../Consts';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
|
|
9
|
-
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
9
|
+
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
10
|
+
image,
|
|
11
|
+
onIconClose,
|
|
12
|
+
}) => {
|
|
10
13
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
11
14
|
|
|
15
|
+
const onTracking = (actionType: string) => {
|
|
16
|
+
if (navigator?.trackingInfo) {
|
|
17
|
+
const routes = navigator.ref.current?.getRootState()?.routes || [];
|
|
18
|
+
const routesLength = routes.length;
|
|
19
|
+
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
20
|
+
if (routesLength > 1) {
|
|
21
|
+
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
22
|
+
}
|
|
23
|
+
navigator?.maxApi?.trackEvent('service_popup_dismissed', {
|
|
24
|
+
feature_code: navigator?.trackingInfo?.code,
|
|
25
|
+
app_id: navigator?.trackingInfo?.appId,
|
|
26
|
+
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
27
|
+
flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
|
|
28
|
+
screen_name,
|
|
29
|
+
component_type: 'popup',
|
|
30
|
+
component_name: 'PopupPromotion',
|
|
31
|
+
trigger_id: '111154100000000001',
|
|
32
|
+
action_type: actionType,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
12
37
|
/**
|
|
13
38
|
* build close action
|
|
14
39
|
*/
|
|
@@ -17,8 +42,9 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
17
42
|
<View style={styles.iconCloseContainer}>
|
|
18
43
|
<TouchableOpacity
|
|
19
44
|
onPress={() => {
|
|
45
|
+
onTracking('icon_close');
|
|
20
46
|
navigator?.pop();
|
|
21
|
-
|
|
47
|
+
onIconClose?.();
|
|
22
48
|
}}
|
|
23
49
|
style={styles.iconButton}>
|
|
24
50
|
<View
|
|
@@ -42,12 +68,13 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
42
68
|
|
|
43
69
|
return (
|
|
44
70
|
<View accessibilityLabel={'PopupPromotion'}>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
<View style={styles.container}>
|
|
72
|
+
<Image
|
|
73
|
+
source={{
|
|
74
|
+
uri: image,
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
51
78
|
{buildCloseIcon()}
|
|
52
79
|
</View>
|
|
53
80
|
);
|
package/Popup/types.ts
CHANGED
|
@@ -18,9 +18,9 @@ export type PopupNotifyProps = {
|
|
|
18
18
|
description: string | React.ReactNode;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* `
|
|
21
|
+
* `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
error?: string;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* `secondary`: Optional. Represents the secondary action that can be performed from the PopupNotify component.
|
|
@@ -55,7 +55,7 @@ export type PopupPromotionProps = {
|
|
|
55
55
|
/**
|
|
56
56
|
* `onClose`: Optional. A callback function that is called when the PopupPromotion component is closed.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
onIconClose?: () => void;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
type PopupAction = {
|