@momo-kits/foundation 0.92.3-tracking.4 → 0.92.3-tracking.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.
@@ -158,41 +158,6 @@ const getAccessibilityID = (
158
158
  }
159
159
  };
160
160
 
161
- const cleanNameForTracking = (word = ''): string => {
162
- return word
163
- .normalize('NFD')
164
- .replace(/[\u0300-\u036f |\s]/g, '')
165
- .toLowerCase();
166
- };
167
-
168
- const formatComponentName = (word = '') => {
169
- const accentsMap = {
170
- a: 'á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ',
171
- A: 'Á|À|Ả|Ã|Ạ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ',
172
- e: 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ',
173
- E: 'É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ',
174
- i: 'í|ì|ỉ|ĩ|ị',
175
- I: 'Í|Ì|Ỉ|Ĩ|Ị',
176
- o: 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ',
177
- O: 'Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ',
178
- u: 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự',
179
- U: 'Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự',
180
- y: 'ý|ỳ|ỷ|ỹ|ỵ',
181
- Y: 'Ý|Ỳ|Ỷ|Ỹ|Ỵ',
182
- d: 'đ',
183
- D: 'Đ',
184
- };
185
-
186
- for (const [nonAccent, accentGroup] of Object.entries(accentsMap)) {
187
- const accents = new RegExp(accentGroup, 'g');
188
- word = word.replace(accents, nonAccent);
189
- }
190
-
191
- word = word.replace(/\s+/g, '_').toLowerCase();
192
-
193
- return word;
194
- };
195
-
196
161
  const formatNameLength = (name = '') => {
197
162
  let formattedName = name;
198
163
  if (formattedName.length > 100) {
@@ -205,8 +170,6 @@ export {
205
170
  getDialogOptions,
206
171
  getModalOptions,
207
172
  getOptions,
208
- formatComponentName,
209
173
  formatNameLength,
210
174
  getAccessibilityID,
211
- cleanNameForTracking,
212
175
  };
package/Button/index.tsx CHANGED
@@ -14,7 +14,6 @@ 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 {formatComponentName} from '../Application/utils';
18
17
 
19
18
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
20
19
 
@@ -306,7 +305,7 @@ const Button: FC<ButtonProps> = ({
306
305
  params,
307
306
  state: state,
308
307
  componentId: accessibilityLabel,
309
- componentValue: formatComponentName(title),
308
+ componentValue: title,
310
309
  action: 'click',
311
310
  }}>
312
311
  <TouchableOpacity
@@ -46,7 +46,7 @@ const CheckBox: FC<CheckBoxProps> = ({
46
46
  componentId: accessibilityLabel,
47
47
  action: 'click',
48
48
  componentLabel: formatNameLength(label || ''),
49
- componentValue: indeterminate ? 'indetermine' : value,
49
+ componentValue: indeterminate ? 'undetermined' : value,
50
50
  }}>
51
51
  <TouchableOpacity
52
52
  accessibilityLabel={accessibilityLabel}
@@ -9,7 +9,6 @@ import {ApplicationContext, ComponentContext} from '../Application';
9
9
  import {Colors} from '../Consts';
10
10
  import {Icon} from '../Icon';
11
11
  import styles from './styles';
12
- import {formatComponentName} from '../Application/utils';
13
12
 
14
13
  export interface IconButtonProps extends TouchableOpacityProps {
15
14
  /**
@@ -132,7 +131,7 @@ const IconButton: React.FC<IconButtonProps> = ({
132
131
  params,
133
132
  state: type === 'disabled' ? 'disabled' : 'enabled',
134
133
  componentId: accessibilityLabel,
135
- componentValue: formatComponentName(icon),
134
+ componentValue: icon,
136
135
  action: 'click',
137
136
  }}>
138
137
  <TouchableOpacity
package/Image/index.tsx CHANGED
@@ -16,6 +16,7 @@ const Image: React.FC<ImageProps> = ({
16
16
  source,
17
17
  loading = true,
18
18
  children,
19
+ params,
19
20
  accessibilityLabel,
20
21
  ...rest
21
22
  }) => {
@@ -30,7 +31,9 @@ const Image: React.FC<ImageProps> = ({
30
31
  );
31
32
 
32
33
  useEffect(() => {
33
- component?.addChild?.(id.testID || id.accessibilityLabel);
34
+ component?.addChildren?.(id.testID || id.accessibilityLabel, 'add');
35
+ return () =>
36
+ component?.addChildren(id.testID || id.accessibilityLabel, 'remove');
34
37
  }, []);
35
38
 
36
39
  /**
@@ -54,37 +57,45 @@ const Image: React.FC<ImageProps> = ({
54
57
  };
55
58
 
56
59
  return (
57
- <FastImage
58
- {...rest}
59
- {...id}
60
- source={source}
61
- style={[styles.container, style]}
62
- onProgress={() => {
63
- error.current = false;
64
- if (status !== 'loading' && loading) {
65
- setStatus('loading');
66
- }
67
- }}
68
- onLoadStart={() => {
69
- error.current = false;
70
- }}
71
- onLoad={() => {
72
- error.current = false;
73
- }}
74
- onLoadEnd={() => {
75
- let current: Status = 'success';
76
- if (error.current) {
77
- current = 'error';
78
- }
79
- if (status !== current) {
80
- setStatus(current);
81
- }
82
- }}
83
- onError={() => {
84
- error.current = true;
60
+ <ComponentContext.Provider
61
+ value={{
62
+ componentName: 'Image',
63
+ params,
64
+ state: loading ? 'loading' : 'loaded',
65
+ componentId: accessibilityLabel,
85
66
  }}>
86
- {renderContent()}
87
- </FastImage>
67
+ <FastImage
68
+ {...rest}
69
+ {...id}
70
+ source={source}
71
+ style={[styles.container, style]}
72
+ onProgress={() => {
73
+ error.current = false;
74
+ if (status !== 'loading' && loading) {
75
+ setStatus('loading');
76
+ }
77
+ }}
78
+ onLoadStart={() => {
79
+ error.current = false;
80
+ }}
81
+ onLoad={() => {
82
+ error.current = false;
83
+ }}
84
+ onLoadEnd={() => {
85
+ let current: Status = 'success';
86
+ if (error.current) {
87
+ current = 'error';
88
+ }
89
+ if (status !== current) {
90
+ setStatus(current);
91
+ }
92
+ }}
93
+ onError={() => {
94
+ error.current = true;
95
+ }}>
96
+ {renderContent()}
97
+ </FastImage>
98
+ </ComponentContext.Provider>
88
99
  );
89
100
  };
90
101
 
package/Image/types.ts CHANGED
@@ -3,4 +3,5 @@ import {FastImageProps} from 'react-native-fast-image';
3
3
  export interface ImageProps extends FastImageProps {
4
4
  loading?: boolean;
5
5
  accessibilityLabel?: string;
6
+ params?: any;
6
7
  }
package/Input/Input.tsx CHANGED
@@ -14,7 +14,6 @@ import {InputProps} from './index';
14
14
  import {Icon} from '../Icon';
15
15
  import {checkTyping} from './utils';
16
16
  import {Loader} from '../Loader';
17
- import {formatComponentName} from '../Application/utils';
18
17
 
19
18
  const Input = forwardRef(
20
19
  (
@@ -212,7 +211,7 @@ const Input = forwardRef(
212
211
  value={{
213
212
  componentName: 'Input',
214
213
  params,
215
- componentLabel: formatComponentName(floatingValue || ''),
214
+ componentLabel: floatingValue,
216
215
  state: inputState,
217
216
  componentId: accessibilityLabel,
218
217
  }}>
@@ -7,7 +7,6 @@ import {InputDropDownProps} from './index';
7
7
  import {Icon} from '../Icon';
8
8
  import {Loader} from '../Loader';
9
9
  import {Styles} from '../Consts';
10
- import {formatComponentName} from '../Application/utils';
11
10
 
12
11
  const InputDropDown = ({
13
12
  value,
@@ -109,10 +108,10 @@ const InputDropDown = ({
109
108
  return (
110
109
  <ComponentContext.Provider
111
110
  value={{
112
- componentName: 'InputOTP',
111
+ componentName: 'InputDropDown',
113
112
  params,
114
113
  state: 'enabled',
115
- componentLabel: formatComponentName(floatingValue || ''),
114
+ componentLabel: floatingValue,
116
115
  componentId: accessibilityLabel,
117
116
  }}>
118
117
  <TouchableOpacity
@@ -18,7 +18,6 @@ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
18
18
  import {InputMoneyProps} from './index';
19
19
  import {Icon} from '../Icon';
20
20
  import {formatMoneyToNumber, formatNumberToMoney} from './utils';
21
- import {formatComponentName} from '../Application/utils';
22
21
 
23
22
  const InputMoney = forwardRef(
24
23
  (
@@ -172,7 +171,7 @@ const InputMoney = forwardRef(
172
171
  value={{
173
172
  componentName: 'InputMoney',
174
173
  params,
175
- componentLabel: formatComponentName(floatingValue || ''),
174
+ componentLabel: floatingValue,
176
175
  state: inputState,
177
176
  componentId: accessibilityLabel,
178
177
  }}>
@@ -21,7 +21,6 @@ import styles from './styles';
21
21
  import {ErrorView, getBorderColor} from './common';
22
22
  import {ApplicationContext, ComponentContext} from '../Application';
23
23
  import {Spacing} from '../Consts';
24
- import {formatComponentName} from '../Application/utils';
25
24
 
26
25
  const OTPCaret: FC<CaretProps> = ({index, length}) => {
27
26
  const DURATION = 300;
@@ -229,7 +228,7 @@ const InputOTP = forwardRef(
229
228
  value={{
230
229
  componentName: 'InputOTP',
231
230
  params,
232
- componentLabel: formatComponentName(floatingValue || ''),
231
+ componentLabel: floatingValue,
233
232
  state: 'enabled',
234
233
  componentId: accessibilityLabel,
235
234
  }}>
@@ -51,10 +51,9 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
51
51
  */
52
52
  const buildCloseIcon = () => {
53
53
  return (
54
- <View
55
- {...getAccessibilityID?.('ic_popup_close')}
56
- style={styles.iconCloseContainer}>
54
+ <View style={styles.iconCloseContainer}>
57
55
  <TouchableOpacity
56
+ {...getAccessibilityID?.('ic_popup_close')}
58
57
  onPress={() => {
59
58
  closeAction.current = 'icon_close';
60
59
  navigator?.pop();
package/Radio/index.tsx CHANGED
@@ -43,12 +43,12 @@ const Radio: FC<RadioProps> = ({
43
43
  return (
44
44
  <ComponentContext.Provider
45
45
  value={{
46
- componentName: 'Button',
46
+ componentName: 'Radio',
47
47
  params,
48
48
  state: disabled ? 'disabled' : 'enabled',
49
49
  componentId: accessibilityLabel,
50
50
  componentLabel: formatNameLength(label || ''),
51
- componentValue: value,
51
+ componentValue: selected,
52
52
  action: 'click',
53
53
  }}>
54
54
  <TouchableOpacity
package/Switch/index.tsx CHANGED
@@ -24,7 +24,7 @@ const Switch: FC<SwitchProps> = ({
24
24
  return (
25
25
  <ComponentContext.Provider
26
26
  value={{
27
- componentName: 'Button',
27
+ componentName: 'Switch',
28
28
  params,
29
29
  state: disabled ? 'disabled' : 'enabled',
30
30
  componentId: accessibilityLabel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.3-tracking.4",
3
+ "version": "0.92.3-tracking.5",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {