@momo-kits/foundation 0.81.17-beta.5 → 0.81.18-beta-01
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 +1 -40
- package/Application/types.ts +0 -1
- package/Popup/PopupNotify.tsx +28 -9
- package/Popup/PopupPromotion.tsx +24 -5
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ const ModalScreen: React.FC<any> = props => {
|
|
|
43
43
|
|
|
44
44
|
const Modal: React.FC<ModalParams> = props => {
|
|
45
45
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
46
|
-
const {screen, barrierDismissible
|
|
46
|
+
const {screen, barrierDismissible} = props.route.params;
|
|
47
47
|
const Component = useRef(screen).current;
|
|
48
48
|
const navigation = new Navigation(props.navigation, theme);
|
|
49
49
|
const params = {
|
|
@@ -53,49 +53,10 @@ 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
|
-
|
|
76
|
-
/**
|
|
77
|
-
* tracking
|
|
78
|
-
*/
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
if (navigator?.trackingInfo) {
|
|
81
|
-
navigator?.maxApi?.trackEvent('service_component_displayed', {
|
|
82
|
-
...getTrackingInfo(),
|
|
83
|
-
trigger_id: '111012100000000000',
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}, []);
|
|
87
|
-
|
|
88
56
|
const onDismiss = () => {
|
|
89
57
|
if (barrierDismissible) {
|
|
90
58
|
return;
|
|
91
59
|
}
|
|
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
60
|
navigator?.pop();
|
|
100
61
|
};
|
|
101
62
|
|
package/Application/types.ts
CHANGED
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useContext, useState} from 'react';
|
|
1
|
+
import React, {useContext, useEffect, useRef, useState} from 'react';
|
|
2
2
|
import {ScrollView, StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {PopupNotifyProps} from './types';
|
|
4
4
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
@@ -20,6 +20,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
20
20
|
}) => {
|
|
21
21
|
const {theme, navigator, translate} = useContext(ApplicationContext);
|
|
22
22
|
const [scrollContent, setScrollContent] = useState(false);
|
|
23
|
+
const closeAction = useRef('touch_outside');
|
|
23
24
|
|
|
24
25
|
let descriptionStyle = {};
|
|
25
26
|
let Description: any = View;
|
|
@@ -28,6 +29,19 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
28
29
|
descriptionStyle = {height: 80};
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* tracking
|
|
34
|
+
*/
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
onTracking('service_component_displayed', undefined, '111012100000000000');
|
|
37
|
+
return () => {
|
|
38
|
+
onTracking(
|
|
39
|
+
'service_popup_dismissed',
|
|
40
|
+
closeAction.current,
|
|
41
|
+
'111154100000000001',
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
31
45
|
/**
|
|
32
46
|
* on action popup
|
|
33
47
|
* @param callback
|
|
@@ -37,7 +51,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
37
51
|
callback?.();
|
|
38
52
|
};
|
|
39
53
|
|
|
40
|
-
const onTracking = (
|
|
54
|
+
const onTracking = (
|
|
55
|
+
event: string,
|
|
56
|
+
actionType: string | undefined,
|
|
57
|
+
trigger_id: string,
|
|
58
|
+
) => {
|
|
41
59
|
if (navigator?.trackingInfo) {
|
|
42
60
|
const routes = navigator.ref.current?.getRootState()?.routes || [];
|
|
43
61
|
const routesLength = routes.length;
|
|
@@ -45,7 +63,8 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
45
63
|
if (routesLength > 1) {
|
|
46
64
|
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
47
65
|
}
|
|
48
|
-
|
|
66
|
+
|
|
67
|
+
navigator?.maxApi?.trackEvent(event, {
|
|
49
68
|
feature_code: navigator?.trackingInfo?.code,
|
|
50
69
|
app_id: navigator?.trackingInfo?.appId,
|
|
51
70
|
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
@@ -54,7 +73,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
54
73
|
component_type: 'popup',
|
|
55
74
|
component_name: 'PopupNotify',
|
|
56
75
|
error_code: error,
|
|
57
|
-
trigger_id
|
|
76
|
+
trigger_id,
|
|
58
77
|
action_type: actionType,
|
|
59
78
|
});
|
|
60
79
|
}
|
|
@@ -75,7 +94,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
75
94
|
type="text"
|
|
76
95
|
size="medium"
|
|
77
96
|
onPress={() => {
|
|
78
|
-
|
|
97
|
+
closeAction.current = 'button_action';
|
|
79
98
|
onAction(secondary?.onPress);
|
|
80
99
|
}}
|
|
81
100
|
/>
|
|
@@ -88,7 +107,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
88
107
|
title={primary.title}
|
|
89
108
|
size="medium"
|
|
90
109
|
onPress={() => {
|
|
91
|
-
|
|
110
|
+
closeAction.current = 'button_action';
|
|
92
111
|
onAction(primary.onPress);
|
|
93
112
|
}}
|
|
94
113
|
/>
|
|
@@ -103,7 +122,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
103
122
|
title={primary.title}
|
|
104
123
|
size="medium"
|
|
105
124
|
onPress={() => {
|
|
106
|
-
|
|
125
|
+
closeAction.current = 'button_action';
|
|
107
126
|
onAction(primary.onPress);
|
|
108
127
|
}}
|
|
109
128
|
/>
|
|
@@ -115,7 +134,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
115
134
|
type="text"
|
|
116
135
|
size="medium"
|
|
117
136
|
onPress={() => {
|
|
118
|
-
|
|
137
|
+
closeAction.current = 'button_action';
|
|
119
138
|
onAction(secondary?.onPress);
|
|
120
139
|
}}
|
|
121
140
|
/>
|
|
@@ -148,7 +167,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
148
167
|
<TouchableOpacity
|
|
149
168
|
style={styles.iconCloseContainer}
|
|
150
169
|
onPress={() => {
|
|
151
|
-
|
|
170
|
+
closeAction.current = 'icon_close';
|
|
152
171
|
onAction(onIconClose);
|
|
153
172
|
}}>
|
|
154
173
|
<View
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
1
|
+
import React, {useContext, useEffect, useRef} from 'react';
|
|
2
2
|
import {StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {PopupPromotionProps} from './types';
|
|
4
4
|
import {ApplicationContext} from '../Application';
|
|
@@ -11,8 +11,27 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
11
11
|
onIconClose,
|
|
12
12
|
}) => {
|
|
13
13
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
14
|
+
const closeAction = useRef('touch_outside');
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* tracking
|
|
18
|
+
*/
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
onTracking('service_component_displayed', undefined, '111012100000000000');
|
|
21
|
+
return () => {
|
|
22
|
+
onTracking(
|
|
23
|
+
'service_popup_dismissed',
|
|
24
|
+
closeAction.current,
|
|
25
|
+
'111154100000000001',
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
const onTracking = (
|
|
31
|
+
event: string,
|
|
32
|
+
actionType: string | undefined,
|
|
33
|
+
trigger_id: string,
|
|
34
|
+
) => {
|
|
16
35
|
if (navigator?.trackingInfo) {
|
|
17
36
|
const routes = navigator.ref.current?.getRootState()?.routes || [];
|
|
18
37
|
const routesLength = routes.length;
|
|
@@ -20,7 +39,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
20
39
|
if (routesLength > 1) {
|
|
21
40
|
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
22
41
|
}
|
|
23
|
-
navigator?.maxApi?.trackEvent(
|
|
42
|
+
navigator?.maxApi?.trackEvent(event, {
|
|
24
43
|
feature_code: navigator?.trackingInfo?.code,
|
|
25
44
|
app_id: navigator?.trackingInfo?.appId,
|
|
26
45
|
miniapp_version: navigator?.trackingInfo?.buildNumber,
|
|
@@ -28,7 +47,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
28
47
|
screen_name,
|
|
29
48
|
component_type: 'popup',
|
|
30
49
|
component_name: 'PopupPromotion',
|
|
31
|
-
trigger_id
|
|
50
|
+
trigger_id,
|
|
32
51
|
action_type: actionType,
|
|
33
52
|
});
|
|
34
53
|
}
|
|
@@ -42,7 +61,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
42
61
|
<View style={styles.iconCloseContainer}>
|
|
43
62
|
<TouchableOpacity
|
|
44
63
|
onPress={() => {
|
|
45
|
-
|
|
64
|
+
closeAction.current = 'icon_close';
|
|
46
65
|
navigator?.pop();
|
|
47
66
|
onIconClose?.();
|
|
48
67
|
}}
|