@momo-kits/foundation 0.88.1-beta.3 → 0.88.1-beta.5
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/Navigator.ts +4 -0
- package/Application/StackScreen.tsx +2 -3
- package/Application/types.ts +3 -8
- package/Button/index.tsx +6 -2
- package/CheckBox/index.tsx +2 -1
- package/IconButton/index.tsx +2 -1
- package/Input/Input.tsx +4 -2
- package/Input/InputMoney.tsx +4 -2
- package/Input/InputOTP.tsx +4 -2
- package/Input/InputSearch.tsx +5 -2
- package/Input/index.tsx +3 -0
- package/Radio/index.tsx +2 -1
- package/Switch/index.tsx +2 -1
- package/package.json +1 -1
package/Application/Navigator.ts
CHANGED
|
@@ -70,9 +70,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
70
70
|
return (
|
|
71
71
|
<ScreenContext.Provider
|
|
72
72
|
value={{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
feature_code: navigator?.trackingInfo?.code,
|
|
73
|
+
...navigator?.trackingInfo,
|
|
74
|
+
screenName: Component.name,
|
|
76
75
|
autoTracking: navigator?.maxApi?.autoTracking,
|
|
77
76
|
}}>
|
|
78
77
|
<Component heightHeader={heightHeader} {...params} />
|
package/Application/types.ts
CHANGED
|
@@ -82,9 +82,10 @@ export type LocalizationObject = {
|
|
|
82
82
|
|
|
83
83
|
export type TrackingInfo = {
|
|
84
84
|
[key: string]: any;
|
|
85
|
-
code: string;
|
|
86
85
|
appId: string;
|
|
87
|
-
|
|
86
|
+
code: string;
|
|
87
|
+
screenName: string;
|
|
88
|
+
buildNumber: string;
|
|
88
89
|
flowPartnerId?: string;
|
|
89
90
|
};
|
|
90
91
|
|
|
@@ -207,9 +208,3 @@ export type AnimatedHeader = {
|
|
|
207
208
|
type: 'default' | 'surface';
|
|
208
209
|
component?: (props?: any) => React.ReactElement;
|
|
209
210
|
};
|
|
210
|
-
|
|
211
|
-
export type ScreenInfo = {
|
|
212
|
-
app_id: string;
|
|
213
|
-
feature_code: string;
|
|
214
|
-
screen_name: string;
|
|
215
|
-
};
|
package/Button/index.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import {Colors, Spacing} from '../Consts';
|
|
|
14
14
|
import styles from './styles';
|
|
15
15
|
import {Icon} from '../Icon';
|
|
16
16
|
import {Loader} from '../Loader';
|
|
17
|
-
import {
|
|
17
|
+
import {TrackingInfo} from '../Application/types';
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
ScreenContext,
|
|
@@ -76,6 +76,8 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
76
76
|
onPress: () => void;
|
|
77
77
|
|
|
78
78
|
trackingParams?: any;
|
|
79
|
+
|
|
80
|
+
component_id?: string;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
const Button: FC<ButtonProps> = ({
|
|
@@ -89,6 +91,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
89
91
|
title = 'Button',
|
|
90
92
|
onPress,
|
|
91
93
|
trackingParams,
|
|
94
|
+
component_id,
|
|
92
95
|
...rest
|
|
93
96
|
}) => {
|
|
94
97
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -102,7 +105,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
102
105
|
};
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
const screenInfo = useContext<
|
|
108
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
106
109
|
const getSizeStyle = () => {
|
|
107
110
|
const styleSheet: {[key: string]: any} = styles;
|
|
108
111
|
return styleSheet[size ?? 'small'];
|
|
@@ -306,6 +309,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
306
309
|
componentName: 'Button',
|
|
307
310
|
params: trackingParams,
|
|
308
311
|
state: type === 'disabled' ? 'disabled' : 'enabled',
|
|
312
|
+
component_id,
|
|
309
313
|
}}>
|
|
310
314
|
<TouchableOpacity
|
|
311
315
|
{...rest}
|
package/CheckBox/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import styles from './styles';
|
|
|
5
5
|
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
+
import {TrackingInfo} from '../Application/types';
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
ScreenContext,
|
|
@@ -23,7 +24,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
23
24
|
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
24
25
|
let borderColor = theme.colors.text.default;
|
|
25
26
|
let backgroundColor = theme.colors.background.surface;
|
|
26
|
-
const screenInfo = useContext<
|
|
27
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
27
28
|
|
|
28
29
|
if (haveValue) {
|
|
29
30
|
borderColor = theme.colors.primary;
|
package/IconButton/index.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {ApplicationContext} from '../Application';
|
|
|
9
9
|
import {Colors} from '../Consts';
|
|
10
10
|
import {Icon} from '../Icon';
|
|
11
11
|
import styles from './styles';
|
|
12
|
+
import {TrackingInfo} from '../Application/types';
|
|
12
13
|
|
|
13
14
|
const {
|
|
14
15
|
ScreenContext,
|
|
@@ -40,7 +41,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
40
41
|
...rest
|
|
41
42
|
}) => {
|
|
42
43
|
const {theme} = useContext(ApplicationContext);
|
|
43
|
-
const screenInfo = useContext<
|
|
44
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* get size icon button
|
package/Input/Input.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import {InputProps} from './index';
|
|
|
13
13
|
import {Icon} from '../Icon';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
15
|
import {Loader} from '../Loader';
|
|
16
|
-
import {
|
|
16
|
+
import {TrackingInfo} from '../Application/types';
|
|
17
17
|
const {
|
|
18
18
|
ScreenContext,
|
|
19
19
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
@@ -43,6 +43,7 @@ const Input = forwardRef(
|
|
|
43
43
|
onPressIcon,
|
|
44
44
|
style,
|
|
45
45
|
trackingParams,
|
|
46
|
+
component_id,
|
|
46
47
|
...props
|
|
47
48
|
}: InputProps,
|
|
48
49
|
ref,
|
|
@@ -52,7 +53,7 @@ const Input = forwardRef(
|
|
|
52
53
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
53
54
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
54
55
|
const accessibilityLabel = `Input/${floatingValue ?? placeholder}`;
|
|
55
|
-
const screenInfo = useContext<
|
|
56
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
56
57
|
|
|
57
58
|
const onClearText = () => {
|
|
58
59
|
inputRef?.current?.clear();
|
|
@@ -172,6 +173,7 @@ const Input = forwardRef(
|
|
|
172
173
|
componentName: 'Input',
|
|
173
174
|
params: trackingParams,
|
|
174
175
|
state: disabled ? 'disabled' : 'enabled',
|
|
176
|
+
component_id,
|
|
175
177
|
}}>
|
|
176
178
|
<View
|
|
177
179
|
style={[style, styles.wrapper]}
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
|
12
12
|
import {InputMoneyProps} from './index';
|
|
13
13
|
import {Icon} from '../Icon';
|
|
14
14
|
import {formatMoneyToNumber, formatNumberToMoney} from './utils';
|
|
15
|
-
import {
|
|
15
|
+
import {TrackingInfo} from '../Application/types';
|
|
16
16
|
const {
|
|
17
17
|
ScreenContext,
|
|
18
18
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
@@ -36,6 +36,7 @@ const InputMoney = forwardRef(
|
|
|
36
36
|
style,
|
|
37
37
|
trackingParams,
|
|
38
38
|
defaultValue = '',
|
|
39
|
+
component_id,
|
|
39
40
|
...props
|
|
40
41
|
}: InputMoneyProps,
|
|
41
42
|
ref,
|
|
@@ -44,7 +45,7 @@ const InputMoney = forwardRef(
|
|
|
44
45
|
const [focused, setFocused] = useState(false);
|
|
45
46
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
46
47
|
const accessibilityLabel = `InputMoney/${floatingValue}`;
|
|
47
|
-
const screenInfo = useContext<
|
|
48
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
48
49
|
|
|
49
50
|
const validateText = (text: string) => {
|
|
50
51
|
const valueFormat = formatMoneyToNumber(text, 'đ');
|
|
@@ -154,6 +155,7 @@ const InputMoney = forwardRef(
|
|
|
154
155
|
componentName: 'InputMoney',
|
|
155
156
|
params: trackingParams,
|
|
156
157
|
state: 'enable',
|
|
158
|
+
component_id,
|
|
157
159
|
}}>
|
|
158
160
|
<View
|
|
159
161
|
style={[style, styles.wrapper]}
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import styles from './styles';
|
|
|
21
21
|
import {ErrorView, getBorderColor} from './common';
|
|
22
22
|
import {ApplicationContext} from '../Application';
|
|
23
23
|
import {Spacing} from '../Consts';
|
|
24
|
-
import {
|
|
24
|
+
import {TrackingInfo} from '../Application/types';
|
|
25
25
|
const {
|
|
26
26
|
ScreenContext,
|
|
27
27
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
@@ -84,6 +84,7 @@ const InputOTP = forwardRef(
|
|
|
84
84
|
dataType = 'number',
|
|
85
85
|
trackingParams,
|
|
86
86
|
style,
|
|
87
|
+
component_id,
|
|
87
88
|
...props
|
|
88
89
|
}: InputOTPProps,
|
|
89
90
|
ref,
|
|
@@ -94,7 +95,7 @@ const InputOTP = forwardRef(
|
|
|
94
95
|
const inputRef = useRef<TextInput>(null);
|
|
95
96
|
const {theme} = useContext(ApplicationContext);
|
|
96
97
|
const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
|
|
97
|
-
const screenInfo = useContext<
|
|
98
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
98
99
|
|
|
99
100
|
useImperativeHandle(ref, () => ({
|
|
100
101
|
onChangeText: (text: string) => {
|
|
@@ -235,6 +236,7 @@ const InputOTP = forwardRef(
|
|
|
235
236
|
componentName: 'InputOTP',
|
|
236
237
|
params: trackingParams,
|
|
237
238
|
state: 'enable',
|
|
239
|
+
component_id,
|
|
238
240
|
}}>
|
|
239
241
|
<TouchableOpacity
|
|
240
242
|
activeOpacity={1}
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import styles from './styles';
|
|
|
12
12
|
import {Icon} from '../Icon';
|
|
13
13
|
import {Text} from '../Text';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
|
-
import {
|
|
15
|
+
import {TrackingInfo} from '../Application/types';
|
|
16
16
|
const {
|
|
17
17
|
ScreenContext,
|
|
18
18
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
@@ -34,6 +34,8 @@ const InputSearch = forwardRef(
|
|
|
34
34
|
defaultValue,
|
|
35
35
|
onPressButtonText,
|
|
36
36
|
trackingParams,
|
|
37
|
+
component_id,
|
|
38
|
+
|
|
37
39
|
...props
|
|
38
40
|
}: InputSearchProps,
|
|
39
41
|
ref,
|
|
@@ -43,7 +45,7 @@ const InputSearch = forwardRef(
|
|
|
43
45
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
44
46
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
45
47
|
const accessibilityLabel = `InputMoney/${placeholder}`;
|
|
46
|
-
const screenInfo = useContext<
|
|
48
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
47
49
|
|
|
48
50
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
49
51
|
setFocused(true);
|
|
@@ -131,6 +133,7 @@ const InputSearch = forwardRef(
|
|
|
131
133
|
componentName: 'InputSearch',
|
|
132
134
|
params: trackingParams,
|
|
133
135
|
state: 'enabled',
|
|
136
|
+
component_id,
|
|
134
137
|
}}>
|
|
135
138
|
<View
|
|
136
139
|
style={[style, styles.searchInputContainer]}
|
package/Input/index.tsx
CHANGED
|
@@ -82,6 +82,7 @@ export interface InputProps extends TextInputProps {
|
|
|
82
82
|
onPressIcon?: () => void;
|
|
83
83
|
|
|
84
84
|
trackingParams?: any;
|
|
85
|
+
component_id?: string;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
type InputPropsWithoutSizeAndIcon = Omit<
|
|
@@ -130,6 +131,8 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
130
131
|
icon?: string;
|
|
131
132
|
|
|
132
133
|
trackingParams?: any;
|
|
134
|
+
|
|
135
|
+
component_id?: string;
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
package/Radio/index.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {Text} from '../Text';
|
|
|
6
6
|
import styles from './styles';
|
|
7
7
|
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
+
import {TrackingInfo} from '../Application/types';
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
12
|
ScreenContext,
|
|
@@ -41,7 +42,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
const screenInfo = useContext<
|
|
45
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
45
46
|
|
|
46
47
|
return (
|
|
47
48
|
<ScreenContext.Provider
|
package/Switch/index.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import {TouchableOpacity, View} from 'react-native';
|
|
|
3
3
|
import {SwitchProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {Colors} from '../Consts';
|
|
6
|
+
import {TrackingInfo} from '../Application/types';
|
|
6
7
|
|
|
7
8
|
const {
|
|
8
9
|
ScreenContext,
|
|
@@ -12,7 +13,7 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
12
13
|
const {value, onChange, disabled, style} = props;
|
|
13
14
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
14
15
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
15
|
-
const screenInfo = useContext<
|
|
16
|
+
const screenInfo = useContext<TrackingInfo>(ScreenContext);
|
|
16
17
|
|
|
17
18
|
let backgroundColor = value ? Colors.green_03 : Colors.black_07;
|
|
18
19
|
if (disabled) {
|