@momo-kits/foundation 0.92.1-tracking.20 → 0.92.1-tracking.22
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/BottomTab.tsx +2 -5
- package/Application/Components.tsx +6 -5
- package/Application/StackScreen.tsx +17 -13
- package/Application/utils.tsx +6 -3
- package/Button/index.tsx +5 -9
- package/CheckBox/index.tsx +2 -1
- package/Image/index.tsx +2 -3
- package/Input/Input.tsx +2 -1
- package/Input/InputDropDown.tsx +2 -1
- package/Input/InputMoney.tsx +2 -1
- package/Input/InputOTP.tsx +2 -1
- package/Input/InputSearch.tsx +3 -4
- package/Input/InputTextArea.tsx +2 -1
- package/Popup/PopupNotify.tsx +4 -11
- package/Popup/PopupPromotion.tsx +4 -5
- package/Radio/index.tsx +1 -0
- package/Switch/index.tsx +1 -0
- package/package.json +1 -1
|
@@ -58,11 +58,9 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
58
58
|
});
|
|
59
59
|
}, []);
|
|
60
60
|
|
|
61
|
-
const accessibilityID = getAccessibilityID?.("tbr_main_bottom")
|
|
62
|
-
|
|
63
61
|
return (
|
|
64
62
|
<Tab.Navigator
|
|
65
|
-
|
|
63
|
+
{...getAccessibilityID('tbr_main_bottom')}
|
|
66
64
|
initialRouteName={initialRouteName}
|
|
67
65
|
backBehavior={'firstRoute'}
|
|
68
66
|
tabBarOptions={{
|
|
@@ -75,10 +73,9 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
75
73
|
},
|
|
76
74
|
}}>
|
|
77
75
|
{tabs.map(item => {
|
|
78
|
-
const itemAccessibilityID = getAccessibilityID?.(`btn_tabbar_${item.name}`)
|
|
79
76
|
return (
|
|
80
77
|
<Tab.Screen
|
|
81
|
-
|
|
78
|
+
{...getAccessibilityID(`btn_tabbar_${item.name}`)}
|
|
82
79
|
key={item.name}
|
|
83
80
|
name={item.name}
|
|
84
81
|
component={TabScreen}
|
|
@@ -69,9 +69,10 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
69
69
|
}
|
|
70
70
|
}, [badgeType, badgeValue]);
|
|
71
71
|
|
|
72
|
-
const ID = getAccessibilityID?.(accessibilityID);
|
|
73
72
|
return (
|
|
74
|
-
<View
|
|
73
|
+
<View
|
|
74
|
+
{...getAccessibilityID(accessibilityID)}
|
|
75
|
+
style={{width: scaleSize(28)}}>
|
|
75
76
|
<TouchableOpacity
|
|
76
77
|
style={[styles.navigationButton, buttonStyle]}
|
|
77
78
|
onPress={onPress}>
|
|
@@ -136,7 +137,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
136
137
|
icon_name: 'back',
|
|
137
138
|
};
|
|
138
139
|
navigator?.maxApi?.showToastDebug?.({
|
|
139
|
-
appId: context.appId
|
|
140
|
+
appId: `auto - ${context.appId}`,
|
|
140
141
|
message: 'service_icon_clicked',
|
|
141
142
|
params,
|
|
142
143
|
});
|
|
@@ -411,13 +412,13 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
411
412
|
},
|
|
412
413
|
]}>
|
|
413
414
|
<TouchableOpacity
|
|
414
|
-
{...getAccessibilityID
|
|
415
|
+
{...getAccessibilityID('btn_navigation_more')}
|
|
415
416
|
onPress={onMore}>
|
|
416
417
|
<Icon color={tintColor} source="navigation_more_horiz" size={20} />
|
|
417
418
|
</TouchableOpacity>
|
|
418
419
|
<View style={[styles.divider, {backgroundColor: tintColor}]} />
|
|
419
420
|
<TouchableOpacity
|
|
420
|
-
{...getAccessibilityID
|
|
421
|
+
{...getAccessibilityID('btn_navigation_close')}
|
|
421
422
|
onPress={onClose}>
|
|
422
423
|
<Icon
|
|
423
424
|
color={tintColor}
|
|
@@ -20,7 +20,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
20
20
|
|
|
21
21
|
const context = useContext<any>(MiniAppContext);
|
|
22
22
|
|
|
23
|
-
const {screen: Component, options}
|
|
23
|
+
const {screen: Component, options} = props.route.params;
|
|
24
24
|
const navigation = new Navigation(props.navigation, theme);
|
|
25
25
|
const heightHeader = useHeaderHeight();
|
|
26
26
|
|
|
@@ -31,14 +31,18 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
31
31
|
|
|
32
32
|
delete params.screen;
|
|
33
33
|
|
|
34
|
+
const screenName = Component?.name || Component?.type?.name || '';
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* set options for screen
|
|
36
38
|
*/
|
|
37
39
|
useLayoutEffect(() => {
|
|
40
|
+
const host = (global as any).miniAppApi?.currentHost || {};
|
|
41
|
+
host.screenName = screenName;
|
|
38
42
|
InteractionManager.runAfterInteractions(() => {
|
|
39
43
|
navigator?.maxApi?.showToastDebug?.({
|
|
40
|
-
appId: context.appId
|
|
41
|
-
message: `${
|
|
44
|
+
appId: `auto - ${context.appId}`,
|
|
45
|
+
message: `${screenName} screen_interaction_time ${
|
|
42
46
|
Date.now() - startTime.current
|
|
43
47
|
}`,
|
|
44
48
|
});
|
|
@@ -53,17 +57,17 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
53
57
|
*/
|
|
54
58
|
useEffect(() => {
|
|
55
59
|
if (__DEV__) {
|
|
56
|
-
if (!
|
|
60
|
+
if (!screenName || screenName === 'screen') {
|
|
57
61
|
Alert.alert(
|
|
58
62
|
'Design system',
|
|
59
|
-
`Unvalidated screen name "${
|
|
63
|
+
`Unvalidated screen name "${screenName}" !`,
|
|
60
64
|
);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
const tracking = {
|
|
65
69
|
...context,
|
|
66
|
-
screen_name:
|
|
70
|
+
screen_name: screenName,
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
const routes = props.navigation.getState()?.routes || [];
|
|
@@ -80,8 +84,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
80
84
|
};
|
|
81
85
|
navigator?.maxApi?.trackEvent?.('service_frame_displayed', params);
|
|
82
86
|
navigator?.maxApi?.showToastDebug?.({
|
|
83
|
-
appId: context.appId
|
|
84
|
-
message: `${
|
|
87
|
+
appId: `auto - ${context.appId}`,
|
|
88
|
+
message: `${screenName} service_frame_displayed`,
|
|
85
89
|
params,
|
|
86
90
|
});
|
|
87
91
|
|
|
@@ -93,8 +97,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
93
97
|
};
|
|
94
98
|
navigator?.maxApi?.trackEvent?.('service_icon_clicked', params);
|
|
95
99
|
navigator?.maxApi?.showToastDebug?.({
|
|
96
|
-
appId: context.appId
|
|
97
|
-
message: `${
|
|
100
|
+
appId: `auto - ${context.appId}`,
|
|
101
|
+
message: `${screenName} service_icon_clicked`,
|
|
98
102
|
params,
|
|
99
103
|
});
|
|
100
104
|
});
|
|
@@ -105,7 +109,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
105
109
|
value={{
|
|
106
110
|
appId: context.appId,
|
|
107
111
|
code: context.code,
|
|
108
|
-
screenName
|
|
112
|
+
screenName,
|
|
109
113
|
autoTracking: (data: any) => {
|
|
110
114
|
navigator?.maxApi?.dispatchFunction?.('autoTracking', data);
|
|
111
115
|
},
|
|
@@ -116,8 +120,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
116
120
|
if (timeLoad.current === 0) {
|
|
117
121
|
timeLoad.current = endTime.current - startTime.current;
|
|
118
122
|
navigator?.maxApi?.showToastDebug?.({
|
|
119
|
-
appId: context.appId
|
|
120
|
-
message: `${
|
|
123
|
+
appId: `auto - ${context.appId}`,
|
|
124
|
+
message: `${screenName} screen_load_time ${timeLoad.current}`,
|
|
121
125
|
});
|
|
122
126
|
}
|
|
123
127
|
}, 2000);
|
package/Application/utils.tsx
CHANGED
|
@@ -142,15 +142,18 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
142
142
|
};
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
const getAccessibilityID = (
|
|
145
|
+
const getAccessibilityID = (
|
|
146
|
+
key = '',
|
|
147
|
+
override: string | undefined = undefined,
|
|
148
|
+
) => {
|
|
146
149
|
if (isIOS) {
|
|
147
150
|
return {
|
|
148
151
|
accessible: true,
|
|
149
|
-
testID: key,
|
|
152
|
+
testID: override || key,
|
|
150
153
|
};
|
|
151
154
|
} else {
|
|
152
155
|
return {
|
|
153
|
-
accessibilityLabel: key,
|
|
156
|
+
accessibilityLabel: override || key,
|
|
154
157
|
};
|
|
155
158
|
}
|
|
156
159
|
};
|
package/Button/index.tsx
CHANGED
|
@@ -79,8 +79,6 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
79
79
|
params?: any;
|
|
80
80
|
|
|
81
81
|
componentId?: string;
|
|
82
|
-
|
|
83
|
-
accessibilityID?: object;
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
const Button: FC<ButtonProps> = ({
|
|
@@ -96,7 +94,6 @@ const Button: FC<ButtonProps> = ({
|
|
|
96
94
|
params,
|
|
97
95
|
componentId,
|
|
98
96
|
accessibilityLabel,
|
|
99
|
-
accessibilityID,
|
|
100
97
|
...rest
|
|
101
98
|
}) => {
|
|
102
99
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -307,11 +304,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
307
304
|
};
|
|
308
305
|
|
|
309
306
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
310
|
-
|
|
311
|
-
? accessibilityID
|
|
312
|
-
: getAccessibilityID?.(
|
|
313
|
-
`${appId}/${code}/${screenInfo.screenName}/btn_${title}`,
|
|
314
|
-
);
|
|
307
|
+
|
|
315
308
|
return (
|
|
316
309
|
<ScreenContext.Provider
|
|
317
310
|
value={{
|
|
@@ -329,7 +322,10 @@ const Button: FC<ButtonProps> = ({
|
|
|
329
322
|
}}>
|
|
330
323
|
<TouchableOpacity
|
|
331
324
|
{...rest}
|
|
332
|
-
{...
|
|
325
|
+
{...getAccessibilityID(
|
|
326
|
+
`${appId}/${code}/${screenInfo.screenName}/btn_${title}`,
|
|
327
|
+
accessibilityLabel,
|
|
328
|
+
)}
|
|
333
329
|
activeOpacity={activeOpacity}
|
|
334
330
|
onPress={onPressButton}
|
|
335
331
|
style={buttonStyle}>
|
package/CheckBox/index.tsx
CHANGED
|
@@ -43,7 +43,8 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
43
43
|
backgroundColor = theme.colors.background.tonal;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
const accessibilityID = getAccessibilityID(
|
|
47
48
|
`${appId}/${screenInfo.screenName}/cbx_${label}_${value}`,
|
|
48
49
|
);
|
|
49
50
|
|
package/Image/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {Skeleton} from '../Skeleton';
|
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
import {Styles} from '../Consts';
|
|
9
9
|
import {ImageProps} from './types';
|
|
10
|
-
import {getAccessibilityID} from
|
|
10
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
11
11
|
|
|
12
12
|
type Status = 'success' | 'loading' | 'error';
|
|
13
13
|
|
|
@@ -42,11 +42,10 @@ const Image: React.FC<ImageProps> = ({
|
|
|
42
42
|
return children;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const accessibilityID = getAccessibilityID?.(`img|${source}`)
|
|
46
45
|
return (
|
|
47
46
|
<FastImage
|
|
48
47
|
{...rest}
|
|
49
|
-
{...
|
|
48
|
+
{...getAccessibilityID(`img|${source}`)}
|
|
50
49
|
source={source}
|
|
51
50
|
style={[styles.container, style]}
|
|
52
51
|
onProgress={() => {
|
package/Input/Input.tsx
CHANGED
|
@@ -122,7 +122,8 @@ const Input = forwardRef(
|
|
|
122
122
|
placeholderColor = disabledColor;
|
|
123
123
|
iconTintColor = disabledColor;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
|
|
126
|
+
const accessibilityID = getAccessibilityID(
|
|
126
127
|
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
127
128
|
disabled && '_disabled'
|
|
128
129
|
}`,
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -61,7 +61,8 @@ const InputDropDown = ({
|
|
|
61
61
|
placeholderColor = disabledColor;
|
|
62
62
|
iconTintColor = disabledColor;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
const accessibilityID = getAccessibilityID(
|
|
65
66
|
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
66
67
|
disabled && '_disabled'
|
|
67
68
|
}`,
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -105,7 +105,8 @@ const InputMoney = forwardRef(
|
|
|
105
105
|
placeholderColor = disabledColor;
|
|
106
106
|
iconTintColor = disabledColor;
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
|
|
109
|
+
const accessibilityID = getAccessibilityID(
|
|
109
110
|
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
110
111
|
disabled && '_disabled'
|
|
111
112
|
}`,
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -191,9 +191,10 @@ const InputOTP = forwardRef(
|
|
|
191
191
|
);
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
const accessibilityID = getAccessibilityID
|
|
194
|
+
const accessibilityID = getAccessibilityID(
|
|
195
195
|
`${appId}/${screenInfo.screenName}/input_${floatingValue}`,
|
|
196
196
|
);
|
|
197
|
+
|
|
197
198
|
const renderInputView = () => {
|
|
198
199
|
return (
|
|
199
200
|
<View
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -67,15 +67,14 @@ const InputSearch = forwardRef(
|
|
|
67
67
|
checkTyping(text, haveValue, setHaveValue);
|
|
68
68
|
onChangeText?.(text);
|
|
69
69
|
};
|
|
70
|
-
const accessibilityID = getAccessibilityID?.(
|
|
71
|
-
`${appId}/${screenInfo.screenName}/input_search`,
|
|
72
|
-
);
|
|
73
70
|
|
|
74
71
|
const renderInputView = () => {
|
|
75
72
|
return (
|
|
76
73
|
<TextInput
|
|
77
74
|
{...props}
|
|
78
|
-
{...
|
|
75
|
+
{...getAccessibilityID(
|
|
76
|
+
`${appId}/${screenInfo.screenName}/input_search`,
|
|
77
|
+
)}
|
|
79
78
|
textAlignVertical="center"
|
|
80
79
|
ref={inputRef}
|
|
81
80
|
style={[
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -95,7 +95,8 @@ const InputTextArea = forwardRef(
|
|
|
95
95
|
textColor = disabledColor;
|
|
96
96
|
placeholderColor = disabledColor;
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
|
|
99
|
+
const accessibilityID = getAccessibilityID(
|
|
99
100
|
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
100
101
|
disabled && '_disabled'
|
|
101
102
|
}`,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -113,13 +113,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
113
113
|
);
|
|
114
114
|
};
|
|
115
115
|
const renderColumn = () => {
|
|
116
|
-
const accessibilityPrimaryID = getAccessibilityID?.('btn_popup_allow');
|
|
117
|
-
const accessibilitySecondID = getAccessibilityID?.('btn_popup_cancel');
|
|
118
|
-
|
|
119
116
|
return (
|
|
120
117
|
<View style={Styles.columnCenter}>
|
|
121
118
|
<Button
|
|
122
|
-
|
|
119
|
+
accessibilityLabel={'btn_popup_allow'}
|
|
123
120
|
title={primary.title}
|
|
124
121
|
size="medium"
|
|
125
122
|
onPress={() => {
|
|
@@ -131,7 +128,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
131
128
|
<>
|
|
132
129
|
<View style={styles.buttonSpace} />
|
|
133
130
|
<Button
|
|
134
|
-
|
|
131
|
+
accessibilityLabel={'btn_popup_cancel'}
|
|
135
132
|
title={secondary?.title}
|
|
136
133
|
type="text"
|
|
137
134
|
size="medium"
|
|
@@ -165,11 +162,9 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
165
162
|
* build close action
|
|
166
163
|
*/
|
|
167
164
|
const buildCloseIcon = () => {
|
|
168
|
-
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close');
|
|
169
|
-
|
|
170
165
|
return (
|
|
171
166
|
<TouchableOpacity
|
|
172
|
-
{...
|
|
167
|
+
{...getAccessibilityID?.('ic_popup_close')}
|
|
173
168
|
style={styles.iconCloseContainer}
|
|
174
169
|
onPress={() => {
|
|
175
170
|
closeAction.current = 'icon_close';
|
|
@@ -193,11 +188,9 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
193
188
|
);
|
|
194
189
|
};
|
|
195
190
|
|
|
196
|
-
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_notify`);
|
|
197
|
-
|
|
198
191
|
return (
|
|
199
192
|
<View
|
|
200
|
-
{...
|
|
193
|
+
{...getAccessibilityID?.(`pu_${context.code}_notify`)}
|
|
201
194
|
style={[
|
|
202
195
|
styles.container,
|
|
203
196
|
{backgroundColor: theme.colors.background.surface},
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -53,10 +53,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
53
53
|
* build close action
|
|
54
54
|
*/
|
|
55
55
|
const buildCloseIcon = () => {
|
|
56
|
-
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close');
|
|
57
|
-
|
|
58
56
|
return (
|
|
59
|
-
<View
|
|
57
|
+
<View
|
|
58
|
+
{...getAccessibilityID?.('ic_popup_close')}
|
|
59
|
+
style={styles.iconCloseContainer}>
|
|
60
60
|
<TouchableOpacity
|
|
61
61
|
onPress={() => {
|
|
62
62
|
closeAction.current = 'icon_close';
|
|
@@ -82,10 +82,9 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
82
82
|
</View>
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
|
-
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_promotion`);
|
|
86
85
|
|
|
87
86
|
return (
|
|
88
|
-
<View {...
|
|
87
|
+
<View {...getAccessibilityID?.(`pu_${context.code}_promotion`)}>
|
|
89
88
|
<Image
|
|
90
89
|
source={{
|
|
91
90
|
uri: image,
|
package/Radio/index.tsx
CHANGED
package/Switch/index.tsx
CHANGED