@momo-kits/foundation 0.81.17-beta.1 → 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 +11 -11
- package/Application/StackScreen.tsx +4 -4
- package/Popup/PopupNotify.tsx +31 -1
- package/Popup/PopupPromotion.tsx +27 -1
- package/package.json +1 -1
|
@@ -54,11 +54,11 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
54
54
|
delete params.screen;
|
|
55
55
|
|
|
56
56
|
const getTrackingInfo = () => {
|
|
57
|
-
const
|
|
58
|
-
const routesLength =
|
|
59
|
-
let screen_name =
|
|
57
|
+
const routes = props.navigation.getState()?.routes || [];
|
|
58
|
+
const routesLength = routes.length;
|
|
59
|
+
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
60
60
|
if (routesLength > 1) {
|
|
61
|
-
screen_name =
|
|
61
|
+
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
62
62
|
}
|
|
63
63
|
const error_code = screen?.({params: {}})?.props?.error;
|
|
64
64
|
return {
|
|
@@ -82,13 +82,6 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
82
82
|
...getTrackingInfo(),
|
|
83
83
|
trigger_id: '111012100000000000',
|
|
84
84
|
});
|
|
85
|
-
return () => {
|
|
86
|
-
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
87
|
-
...getTrackingInfo(),
|
|
88
|
-
trigger_id: '111154100000000001',
|
|
89
|
-
icon_name: 'close',
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
85
|
}
|
|
93
86
|
}, []);
|
|
94
87
|
|
|
@@ -96,6 +89,13 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
96
89
|
if (barrierDismissible) {
|
|
97
90
|
return;
|
|
98
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
|
+
}
|
|
99
99
|
navigator?.pop();
|
|
100
100
|
};
|
|
101
101
|
|
|
@@ -32,11 +32,11 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
32
32
|
*/
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
if (navigator?.trackingInfo) {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
35
|
+
const routes = props.navigation.getState()?.routes || [];
|
|
36
|
+
const routesLength = routes.length;
|
|
37
37
|
let pre_screen_name = '';
|
|
38
|
-
if (
|
|
39
|
-
pre_screen_name =
|
|
38
|
+
if (routesLength > 1) {
|
|
39
|
+
pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
40
40
|
}
|
|
41
41
|
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
42
42
|
feature_code: navigator.trackingInfo.code,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -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,
|
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,6 +42,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onIconClose}) =>
|
|
|
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
|
}}
|