@momo-kits/foundation 0.121.0-test.1 → 0.121.0-test.3

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.
@@ -172,16 +172,9 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
172
172
  onReady={() => {
173
173
  isReady.current = true;
174
174
  routes.current = navigationRef.current?.getRootState?.()?.routes;
175
- maxApi?.getDataObserver('CURRENT_SCREEN', (data: any) => {
176
- onScreenNavigated(
177
- data?.screenName,
178
- screen?.name,
179
- 'push',
180
- 'Screen'
181
- );
182
- maxApi?.setObserver('CURRENT_SCREEN', {
183
- screenName: screen?.name,
184
- });
175
+ maxApi?.getDataObserver('CURRENT_SCREEN', (screenName: any) => {
176
+ onScreenNavigated(screenName, screen?.name, 'push', 'Screen');
177
+ maxApi?.setObserver('CURRENT_SCREEN', screen?.name);
185
178
  });
186
179
  }}
187
180
  onStateChange={state => {
@@ -221,7 +214,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
221
214
 
222
215
  routes.current = state?.routes;
223
216
  maxApi?.of?.({screenName});
224
- maxApi?.setObserver('CURRENT_SCREEN', {screenName});
217
+ maxApi?.setObserver('CURRENT_SCREEN', screenName);
225
218
  }}
226
219
  independent={true}>
227
220
  <Stack.Navigator initialRouteName="Stack" headerMode="screen">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.121.0-test.1",
3
+ "version": "0.121.0-test.3",
4
4
  "minimumDeployTarget": 32,
5
5
  "deploymentTarget": 120,
6
6
  "description": "React Native Component Kits",
@@ -1,192 +0,0 @@
1
- import React, {useContext} from 'react';
2
- import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
- import {ApplicationContext, MiniAppContext} from '../index';
4
- import {Colors, Radius, Spacing, Styles} from '../../Consts';
5
- import {Text} from '../../Text';
6
- import {Icon} from '../../Icon';
7
-
8
- const ServiceItem: React.FC<any> = ({service}) => {
9
- const {theme, translate} = useContext(ApplicationContext);
10
- const {title, description, icon, onPress} = service;
11
- const serviceTitle = translate?.(title);
12
- const serviceDescription = translate?.(description);
13
-
14
- return (
15
- <TouchableOpacity onPress={onPress} style={Styles.row}>
16
- <View style={styles.iconWrapper}>
17
- <Icon color={theme.colors.text.hint} source={icon} size={28} />
18
- </View>
19
- <View>
20
- <View style={Styles.row}>
21
- <Text typography={'action_xs_bold'}>{serviceTitle}</Text>
22
- <Icon source={'arrow_chevron_right_small'} size={16} />
23
- </View>
24
- <Text
25
- typography={'description_xs_regular'}
26
- color={theme.colors.text.hint}>
27
- {serviceDescription}
28
- </Text>
29
- </View>
30
- </TouchableOpacity>
31
- );
32
- };
33
-
34
- const BottomSheetHelpCenter: React.FC<any> = ({onRequestClose}) => {
35
- const {theme, navigator} = useContext(ApplicationContext);
36
- const context = useContext<any>(MiniAppContext);
37
-
38
- const onPressFaq = () => {
39
- const routes = navigator?.ref.current?.getRootState()?.routes || [];
40
- const routesLength = routes.length;
41
- let screenName = routes?.[0]?.params?.screen?.name;
42
- if (routesLength > 1) {
43
- screenName = routes[routesLength - 2]?.params?.screen?.name;
44
- }
45
-
46
- context?.autoTracking?.({
47
- ...context,
48
- componentName: 'TouchableOpacity',
49
- componentId: 'bottomsheet_faq_item',
50
- screenName: screenName,
51
- });
52
-
53
- onRequestClose?.(() => {
54
- navigator?.maxApi?.startFeatureCode?.(
55
- 'helpcenter_problemlevel1',
56
- context?.toolkitConfig?.faq
57
- );
58
- });
59
- };
60
-
61
- const onPressChatbot = () => {
62
- const routes = navigator?.ref.current?.getRootState()?.routes || [];
63
- const routesLength = routes.length;
64
- let screenName = routes?.[0]?.params?.screen?.name;
65
- if (routesLength > 1) {
66
- screenName = routes[routesLength - 2]?.params?.screen?.name;
67
- }
68
-
69
- context?.autoTracking?.({
70
- ...context,
71
- componentName: 'TouchableOpacity',
72
- componentId: 'bottomsheet_chatbot_item',
73
- screenName: screenName,
74
- });
75
-
76
- onRequestClose?.(() => {
77
- navigator?.maxApi?.getDataObserver('CURRENT_SCREEN', (data: any) => {
78
- let screenName = data?.screenName;
79
- navigator?.maxApi?.startFeatureCode?.('chatbot', {
80
- botId: 'botGptCs',
81
- forwardParams: {
82
- forService: 'navigation',
83
- mini_app_id: context?.appId,
84
- feature_code: context?.code,
85
- screen_name: screenName,
86
- },
87
- });
88
- });
89
- });
90
- };
91
-
92
- const onPressFeedback = () => {
93
- const routes = navigator?.ref.current?.getRootState()?.routes || [];
94
- const routesLength = routes.length;
95
- let screenName = routes?.[0]?.params?.screen?.name;
96
- if (routesLength > 1) {
97
- screenName = routes[routesLength - 2]?.params?.screen?.name;
98
- }
99
-
100
- context?.autoTracking?.({
101
- ...context,
102
- componentName: 'TouchableOpacity',
103
- componentId: 'bottomsheet_feedback_item',
104
- screenName: screenName,
105
- });
106
-
107
- onRequestClose?.(() => {
108
- navigator?.maxApi?.startFeatureCode?.('feedback', {
109
- forService: 'navigation',
110
- loggedStatus: true,
111
- application: {
112
- appId: context?.appId,
113
- appCode: context?.code,
114
- appName: context?.name?.['en'],
115
- buildNumber: context?.buildNumber,
116
- },
117
- newUi: true,
118
- stepFeedback: 1,
119
- });
120
- });
121
- };
122
-
123
- const services = [
124
- {
125
- title: {vi: 'Câu hỏi thường gặp', en: 'Câu hỏi thường gặp'},
126
- description: {
127
- vi: 'Giải đáp các thắc mắc mọi người thường gặp',
128
- en: 'Giải đáp các thắc mắc mọi người thường gặp',
129
- },
130
- icon: 'notifications_circle_question',
131
- onPress: onPressFaq,
132
- },
133
- {
134
- title: {vi: 'Hỗ trợ trực tuyến', en: 'Hỗ trợ trực tuyến'},
135
- description: {
136
- vi: 'Trả lời mọi câu hỏi của bạn 24/7',
137
- en: 'Trả lời mọi câu hỏi của bạn 24/7',
138
- },
139
- icon: 'ic_support',
140
- onPress: onPressChatbot,
141
- },
142
- {
143
- title: {vi: 'Chia sẻ góp ý', en: 'Chia sẻ góp ý'},
144
- description: {
145
- vi: 'Đề xuất cải thiện hoặc báo lỗi sản phẩm/dịch vụ',
146
- en: 'Đề xuất cải thiện hoặc báo lỗi sản phẩm/dịch vụ',
147
- },
148
- icon: 'file_mail',
149
- onPress: onPressFeedback,
150
- },
151
- ];
152
-
153
- return (
154
- <View
155
- style={[
156
- styles.container,
157
- {
158
- backgroundColor: theme.colors.background.surface,
159
- },
160
- ]}>
161
- {services.map((item, index) => {
162
- return (
163
- <>
164
- <ServiceItem service={item} />
165
- {index !== services.length - 1 && <View style={styles.divider} />}
166
- </>
167
- );
168
- })}
169
- </View>
170
- );
171
- };
172
-
173
- const styles = StyleSheet.create({
174
- container: {height: 300, width: '100%', padding: Spacing.M},
175
- divider: {
176
- marginVertical: Spacing.M,
177
- backgroundColor: Colors.black_02,
178
- height: 1,
179
- width: '100%',
180
- },
181
- iconWrapper: {
182
- width: 36,
183
- height: 36,
184
- backgroundColor: Colors.black_02,
185
- borderRadius: Radius.M,
186
- marginRight: Spacing.S,
187
- alignItems: 'center',
188
- justifyContent: 'center',
189
- },
190
- });
191
-
192
- export {BottomSheetHelpCenter};