@momo-kits/foundation 0.81.17 → 0.81.18-beta.1

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.
@@ -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, modalName} = props.route.params;
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,46 +53,6 @@ const Modal: React.FC<ModalParams> = props => {
53
53
 
54
54
  delete params.screen;
55
55
 
56
- /**
57
- * tracking
58
- */
59
- useEffect(() => {
60
- if (navigator?.trackingInfo) {
61
- const navigationRoutes = props.navigation.getState()?.routes || [];
62
- const routesLength = navigationRoutes.length;
63
- let screen_name = navigationRoutes?.[0]?.params?.screen?.name;
64
- if (routesLength > 1) {
65
- screen_name = navigationRoutes[routesLength - 2]?.params?.screen?.name;
66
- }
67
- const error_code = screen?.({params: {}})?.props?.information;
68
- navigator?.maxApi?.trackEvent('service_component_displayed', {
69
- feature_code: navigator.trackingInfo.code,
70
- app_id: navigator.trackingInfo.appId,
71
- miniapp_version: navigator.trackingInfo.buildNumber,
72
- flow_partner_id: navigator.trackingInfo.flowPartnerId,
73
- screen_name,
74
- trigger_id: '111012100000000000',
75
- component_type: 'popup',
76
- component_name: modalName,
77
- error_code,
78
- });
79
-
80
- return () => {
81
- navigator?.maxApi?.trackEvent('service_icon_clicked', {
82
- feature_code: navigator?.trackingInfo?.code,
83
- app_id: navigator?.trackingInfo?.appId,
84
- miniapp_version: navigator?.trackingInfo?.buildNumber,
85
- screen_name,
86
- trigger_id: '111154100000000001',
87
- component_type: 'popup',
88
- component_name: modalName,
89
- error_code,
90
- icon_name: 'close',
91
- });
92
- };
93
- }
94
- }, []);
95
-
96
56
  const onDismiss = () => {
97
57
  if (barrierDismissible) {
98
58
  return;
@@ -32,12 +32,11 @@ const StackScreen: React.FC<ScreenParams> = props => {
32
32
  */
33
33
  useEffect(() => {
34
34
  if (navigator?.trackingInfo) {
35
- const navigationRoutes = props.navigation.getState()?.routes || [];
36
- const routesLength = navigationRoutes.length;
37
- let pre_screen_name = navigationRoutes?.[0]?.params?.screen?.name;
35
+ const routes = props.navigation.getState()?.routes || [];
36
+ const routesLength = routes.length;
37
+ let pre_screen_name = '';
38
38
  if (routesLength > 1) {
39
- pre_screen_name =
40
- navigationRoutes[routesLength - 2]?.params?.screen?.name;
39
+ pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
41
40
  }
42
41
  navigator?.maxApi?.trackEvent('service_frame_displayed', {
43
42
  feature_code: navigator.trackingInfo.code,
@@ -110,7 +110,6 @@ export type ScreenParams = {
110
110
 
111
111
  export interface ModalParams extends ScreenParams {
112
112
  [key: string]: any;
113
- modalName?: string;
114
113
  onDismiss?: () => void;
115
114
  barrierDismissible?: boolean;
116
115
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "vi": {
3
+ "errorCode": "Mã lỗi: ",
3
4
  "seeMore": "Xem thêm",
4
5
  "cancel": "Huỷ",
5
6
  "done": "Xong",
@@ -195,6 +196,7 @@
195
196
  "information": "Information",
196
197
  "tutorial": "Instruction",
197
198
  "question": "FAQ",
198
- "support": "Support center"
199
+ "support": "Support center",
200
+ "errorCode": "Error code: "
199
201
  }
200
202
  }
package/Icon/index.tsx CHANGED
@@ -20,7 +20,6 @@ const Icon: React.FC<IconProps> = ({source, size, color, style = {}}) => {
20
20
 
21
21
  return (
22
22
  <Image
23
- accessibilityLabel={`Icon/${getIconSource()?.uri}`}
24
23
  loading={false}
25
24
  source={getIconSource()}
26
25
  style={[style, {width: size, height: size}]}
package/Icon/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {ViewStyle} from 'react-native';
1
+ import {ImageStyle} from 'react-native-fast-image';
2
2
 
3
3
  export type IconProps = {
4
4
  /**
@@ -23,5 +23,5 @@ export type IconProps = {
23
23
  * Optional. Used to apply custom styling to the Icon component.
24
24
  * Accepts an object of style properties.
25
25
  */
26
- style?: ViewStyle;
26
+ style?: ImageStyle;
27
27
  };
@@ -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';
@@ -12,14 +12,15 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
12
12
  image,
13
13
  title = 'Title',
14
14
  description = 'Description',
15
- information,
15
+ error,
16
16
  secondary,
17
17
  primary,
18
18
  buttonDirection = 'row',
19
19
  onIconClose,
20
20
  }) => {
21
- const {theme, navigator} = useContext(ApplicationContext);
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,6 +51,34 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
37
51
  callback?.();
38
52
  };
39
53
 
54
+ const onTracking = (
55
+ event: string,
56
+ actionType: string | undefined,
57
+ trigger_id: string,
58
+ ) => {
59
+ if (navigator?.trackingInfo) {
60
+ const routes = navigator.ref.current?.getRootState()?.routes || [];
61
+ const routesLength = routes.length;
62
+ let screen_name = routes?.[0]?.params?.screen?.name;
63
+ if (routesLength > 1) {
64
+ screen_name = routes[routesLength - 2]?.params?.screen?.name;
65
+ }
66
+
67
+ navigator?.maxApi?.trackEvent(event, {
68
+ feature_code: navigator?.trackingInfo?.code,
69
+ app_id: navigator?.trackingInfo?.appId,
70
+ miniapp_version: navigator?.trackingInfo?.buildNumber,
71
+ flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
72
+ screen_name,
73
+ component_type: 'popup',
74
+ component_name: 'PopupNotify',
75
+ error_code: error,
76
+ trigger_id,
77
+ action_type: actionType,
78
+ });
79
+ }
80
+ };
81
+
40
82
  /**
41
83
  * build main action of popup
42
84
  */
@@ -52,6 +94,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
52
94
  type="text"
53
95
  size="medium"
54
96
  onPress={() => {
97
+ closeAction.current = 'button_action';
55
98
  onAction(secondary?.onPress);
56
99
  }}
57
100
  />
@@ -64,6 +107,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
64
107
  title={primary.title}
65
108
  size="medium"
66
109
  onPress={() => {
110
+ closeAction.current = 'button_action';
67
111
  onAction(primary.onPress);
68
112
  }}
69
113
  />
@@ -78,6 +122,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
78
122
  title={primary.title}
79
123
  size="medium"
80
124
  onPress={() => {
125
+ closeAction.current = 'button_action';
81
126
  onAction(primary.onPress);
82
127
  }}
83
128
  />
@@ -89,6 +134,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
89
134
  type="text"
90
135
  size="medium"
91
136
  onPress={() => {
137
+ closeAction.current = 'button_action';
92
138
  onAction(secondary?.onPress);
93
139
  }}
94
140
  />
@@ -120,7 +166,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
120
166
  return (
121
167
  <TouchableOpacity
122
168
  style={styles.iconCloseContainer}
123
- onPress={() => onAction(onIconClose)}>
169
+ onPress={() => {
170
+ closeAction.current = 'icon_close';
171
+ onAction(onIconClose);
172
+ }}>
124
173
  <View
125
174
  style={[
126
175
  styles.iconClose,
@@ -146,7 +195,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
146
195
  styles.container,
147
196
  {backgroundColor: theme.colors.background.surface},
148
197
  ]}>
149
- {!!image && <Image source={{uri: image}} style={styles.image} />}
198
+ {!!image && (
199
+ <View style={styles.image}>
200
+ <Image source={{uri: image}} />
201
+ </View>
202
+ )}
150
203
  <View style={styles.content}>
151
204
  <Text typography={'title_xs'} numberOfLines={1}>
152
205
  {title}
@@ -164,13 +217,14 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
164
217
  {description}
165
218
  </Text>
166
219
  </Description>
167
- {!!information && (
220
+ {!!error && (
168
221
  <View style={styles.information}>
169
222
  <Text
170
223
  typography={'description_xs'}
171
224
  color={theme.colors.text.hint}
172
225
  numberOfLines={1}>
173
- {information}
226
+ {translate?.('errorCode')}
227
+ {error}
174
228
  </Text>
175
229
  </View>
176
230
  )}
@@ -190,6 +244,7 @@ const styles = StyleSheet.create({
190
244
  borderTopLeftRadius: Radius.L,
191
245
  borderTopRightRadius: Radius.L,
192
246
  aspectRatio: 1.7777,
247
+ overflow: 'hidden',
193
248
  },
194
249
  content: {padding: Spacing.XL},
195
250
  description: {
@@ -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';
@@ -6,8 +6,52 @@ 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> = ({image, onClose}) => {
9
+ const PopupPromotion: React.FC<PopupPromotionProps> = ({
10
+ image,
11
+ onIconClose,
12
+ }) => {
10
13
  const {theme, navigator} = useContext(ApplicationContext);
14
+ const closeAction = useRef('touch_outside');
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
+ ) => {
35
+ if (navigator?.trackingInfo) {
36
+ const routes = navigator.ref.current?.getRootState()?.routes || [];
37
+ const routesLength = routes.length;
38
+ let screen_name = routes?.[0]?.params?.screen?.name;
39
+ if (routesLength > 1) {
40
+ screen_name = routes[routesLength - 2]?.params?.screen?.name;
41
+ }
42
+ navigator?.maxApi?.trackEvent(event, {
43
+ feature_code: navigator?.trackingInfo?.code,
44
+ app_id: navigator?.trackingInfo?.appId,
45
+ miniapp_version: navigator?.trackingInfo?.buildNumber,
46
+ flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
47
+ screen_name,
48
+ component_type: 'popup',
49
+ component_name: 'PopupPromotion',
50
+ trigger_id,
51
+ action_type: actionType,
52
+ });
53
+ }
54
+ };
11
55
 
12
56
  /**
13
57
  * build close action
@@ -17,8 +61,9 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
17
61
  <View style={styles.iconCloseContainer}>
18
62
  <TouchableOpacity
19
63
  onPress={() => {
64
+ closeAction.current = 'icon_close';
20
65
  navigator?.pop();
21
- onClose?.();
66
+ onIconClose?.();
22
67
  }}
23
68
  style={styles.iconButton}>
24
69
  <View
@@ -42,12 +87,13 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
42
87
 
43
88
  return (
44
89
  <View accessibilityLabel={'PopupPromotion'}>
45
- <Image
46
- style={styles.container}
47
- source={{
48
- uri: image,
49
- }}
50
- />
90
+ <View style={styles.container}>
91
+ <Image
92
+ source={{
93
+ uri: image,
94
+ }}
95
+ />
96
+ </View>
51
97
  {buildCloseIcon()}
52
98
  </View>
53
99
  );
package/Popup/types.ts CHANGED
@@ -18,9 +18,9 @@ export type PopupNotifyProps = {
18
18
  description: string | React.ReactNode;
19
19
 
20
20
  /**
21
- * `information`: Optional. Represents additional information text to be displayed in the PopupNotify component.
21
+ * `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
22
22
  */
23
- information?: string;
23
+ error?: string;
24
24
 
25
25
  /**
26
26
  * `secondary`: Optional. Represents the secondary action that can be performed from the PopupNotify component.
@@ -55,7 +55,7 @@ export type PopupPromotionProps = {
55
55
  /**
56
56
  * `onClose`: Optional. A callback function that is called when the PopupPromotion component is closed.
57
57
  */
58
- onClose?: () => void;
58
+ onIconClose?: () => void;
59
59
  };
60
60
 
61
61
  type PopupAction = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.17",
3
+ "version": "0.81.18-beta.1",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -10,17 +10,17 @@
10
10
  "@momo-kits/foundation"
11
11
  ],
12
12
  "dependencies": {
13
- "@gorhom/bottom-sheet": "https://gitlab.com/momo-platform/bottom-sheet.git",
13
+ "@gorhom/bottom-sheet": "git+https://gitlab.com/momo-platform/bottom-sheet.git#main",
14
14
  "react-native-safe-area-context": "3.1.4",
15
15
  "react-native-linear-gradient": "2.8.3",
16
16
  "react-native-gesture-handler": "1.10.3",
17
17
  "react-native-fast-image": "8.1.5",
18
- "@react-navigation/bottom-tabs": "https://gitlab.com/momo-platform/react-navigation-bottom-tabs.git#main",
18
+ "@react-navigation/bottom-tabs": "git+https://gitlab.com/momo-platform/react-navigation-bottom-tabs.git#main",
19
19
  "@react-navigation/core": "5.16.1",
20
20
  "@react-navigation/native": "5.9.8",
21
21
  "@react-navigation/routers": "5.7.4",
22
22
  "lottie-react-native": "3.3.2",
23
- "@react-navigation/stack": "https://gitlab.com/momo-platform/react-navigation-stack.git"
23
+ "@react-navigation/stack": "git+https://gitlab.com/momo-platform/react-navigation-stack.git#main"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react-native": "*"