@momo-kits/template 0.102.4 → 0.103.1-beta.0

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.
@@ -2,8 +2,8 @@ import React, {FC, useContext, useEffect, useState} from 'react';
2
2
  import {NativeModules, TouchableOpacity, View} from 'react-native';
3
3
  import {TrustBannerCallbackParams, TrustBannerProps} from './types';
4
4
  import styles from './styles';
5
- import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
6
- import CustomAvatar from './CustomAvatar';
5
+ import {ApplicationContext, Icon, Image, Text} from '@momo-kits/foundation';
6
+ // @ts-ignore
7
7
  import MaxApi from '@momo-platform/api';
8
8
 
9
9
  const defaultData = {
@@ -11,10 +11,13 @@ const defaultData = {
11
11
  vi: 'Bảo mật thông tin & An toàn tài sản của bạn là ưu tiên hàng đầu của MoMo.',
12
12
  en: "Your data security and money safety are MoMo's top priorities.",
13
13
  },
14
- pciImage: 'https://static.momocdn.net/app/img/kits/trustBanner/pci.png',
14
+ subContent: {
15
+ vi: 'Tìm hiểu thêm',
16
+ en: 'Learn more',
17
+ },
18
+ pciImage: 'https://static.momocdn.net/app/img/kits/trustBanner/pci_dss.png',
15
19
  sslImage: 'https://static.momocdn.net/app/img/kits/trustBanner/ssl.png',
16
- momoImage:
17
- 'https://static.momocdn.net/app/img/kits/trustBanner/ic_momo_secu.png',
20
+ momoImage: 'https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png',
18
21
  urlConfig: 'login_and_security',
19
22
  icons: [
20
23
  'https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png',
@@ -22,6 +25,10 @@ const defaultData = {
22
25
  'https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png',
23
26
  'https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png',
24
27
  ],
28
+ titleWeb: {
29
+ vi: 'Thông tin',
30
+ en: 'Information',
31
+ },
25
32
  };
26
33
 
27
34
  const TrustBanner: FC<TrustBannerProps> = ({
@@ -29,11 +36,21 @@ const TrustBanner: FC<TrustBannerProps> = ({
29
36
  screenName = '',
30
37
  serviceName = '',
31
38
  trackEvent,
32
- disabledPress = false,
33
39
  }) => {
34
- const {theme, language} = useContext(ApplicationContext);
40
+ const {theme, language = 'vi'} = useContext(ApplicationContext);
41
+ const currentLanguage: 'en' | 'vi' = language;
35
42
  const [data, setData] = useState(defaultData);
36
- const {icons, sslImage, pciImage, momoImage, urlConfig, content} = data;
43
+
44
+ const {
45
+ sslImage,
46
+ pciImage,
47
+ momoImage,
48
+ urlConfig,
49
+ content,
50
+ subContent,
51
+ titleWeb,
52
+ } = data;
53
+
37
54
  const trackingParams: TrustBannerCallbackParams = {
38
55
  screen_name: screenName,
39
56
  service_name: serviceName,
@@ -48,7 +65,7 @@ const TrustBanner: FC<TrustBannerProps> = ({
48
65
  const fetchJson = () => {
49
66
  try {
50
67
  const config = JSON.parse(
51
- NativeModules?.ConfigsModule?.getConfigSync?.('DESIGN_SYSTEM'),
68
+ NativeModules?.ConfigsModule?.getConfigSync?.('DESIGN_SYSTEM')
52
69
  );
53
70
  const dataJSon = config?.trustBanner;
54
71
 
@@ -59,7 +76,9 @@ const TrustBanner: FC<TrustBannerProps> = ({
59
76
  pciImage: dataJSon.trustBanner.pciImage || defaultData.pciImage,
60
77
  momoImage: dataJSon.trustBanner.momoImage || defaultData.momoImage,
61
78
  content: dataJSon.trustBanner.content || defaultData.content,
79
+ subContent: dataJSon.trustBanner.subContent || defaultData.subContent,
62
80
  urlConfig: dataJSon.trustBanner.urlConfig || defaultData.urlConfig,
81
+ titleWeb: dataJSon.trustBanner.titleWeb || defaultData.titleWeb,
63
82
  });
64
83
  }
65
84
  } catch (e) {
@@ -67,33 +86,32 @@ const TrustBanner: FC<TrustBannerProps> = ({
67
86
  }
68
87
  };
69
88
 
70
- const renderIconList = () => {
71
- return (
72
- <View style={styles.iconList}>
73
- {icons.map(icon => {
74
- return <CustomAvatar image={icon} />;
75
- })}
76
- <CustomAvatar
77
- style={[
78
- styles.customAvatar,
79
- {
80
- borderColor: theme.colors.border.default,
81
- backgroundColor: Colors.pink_09,
82
- },
83
- ]}
84
- text="36+"
85
- />
86
- </View>
87
- );
89
+ const _onPress = () => {
90
+ trackEvent?.('service_component_clicked', {...trackingParams, urlConfig});
91
+ if (urlConfig.indexOf('https') > -1) {
92
+ const openWebData = {
93
+ url: urlConfig,
94
+ title: titleWeb?.[currentLanguage] || defaultData.subContent.vi,
95
+ };
96
+ MaxApi.openWeb(openWebData);
97
+ } else {
98
+ MaxApi.startFeatureCode(urlConfig, {}, () => {});
99
+ }
88
100
  };
89
101
 
90
102
  const renderFooter = () => {
91
103
  return (
92
- <View style={styles.footer}>
104
+ <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
105
+ <View style={{flexDirection: 'row', alignItems: 'center'}}>
106
+ <Text typography={'action_xs_bold'} color={'#eb2f96'}>
107
+ {subContent?.[currentLanguage] || defaultData.subContent.vi}
108
+ </Text>
109
+ <Icon source={'arrow_chevron_right_small'} color={'#eb2f96'} />
110
+ </View>
93
111
  <View style={styles.imageList}>
94
112
  <Image
95
113
  resizeMode={'contain'}
96
- style={[styles.image, styles.pciImage]}
114
+ style={styles.pciImage}
97
115
  source={{uri: pciImage}}
98
116
  />
99
117
  <Image
@@ -102,23 +120,12 @@ const TrustBanner: FC<TrustBannerProps> = ({
102
120
  source={{uri: sslImage}}
103
121
  />
104
122
  </View>
105
- {renderIconList()}
106
123
  </View>
107
124
  );
108
125
  };
109
126
 
110
- const _onPress = () => {
111
- trackEvent?.('service_component_clicked', {...trackingParams, urlConfig});
112
- if (urlConfig.indexOf('https') > -1) {
113
- MaxApi.openWeb(urlConfig, {}, () => {});
114
- } else {
115
- MaxApi.startFeatureCode(urlConfig, {}, () => {});
116
- }
117
- };
118
-
119
127
  return (
120
128
  <TouchableOpacity
121
- disabled={disabledPress}
122
129
  onPress={_onPress}
123
130
  activeOpacity={0.7}
124
131
  style={[style, styles.container]}>
@@ -134,7 +141,7 @@ const TrustBanner: FC<TrustBannerProps> = ({
134
141
  style={styles.message}
135
142
  color={theme.colors.text.secondary}
136
143
  typography={'description_default_regular'}>
137
- {content?.[language || 'vi'] || defaultData.content.vi}
144
+ {content?.[currentLanguage] || defaultData.content.vi}
138
145
  </Text>
139
146
  {renderFooter()}
140
147
  </View>
@@ -24,6 +24,8 @@ export default StyleSheet.create({
24
24
  },
25
25
  pciImage: {
26
26
  marginRight: Spacing.XS,
27
+ width: 25,
28
+ height: 20,
27
29
  },
28
30
  message: {marginBottom: Spacing.S},
29
31
  footer: {
@@ -41,8 +41,6 @@ export type TrustBannerProps = {
41
41
  * Optional. instance of maxApi trackEvent function.
42
42
  */
43
43
  trackEvent?: (eventName: string, params: TrustBannerCallbackParams) => void;
44
-
45
- disabledPress?: boolean;
46
44
  };
47
45
 
48
46
  export type CustomAvatarProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/template",
3
- "version": "0.102.4",
3
+ "version": "0.103.1-beta.0",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "dependencies": {},
@@ -13,4 +13,4 @@
13
13
  "@momo-platform/api": "0.1.67-rc.3"
14
14
  },
15
15
  "license": "MoMo"
16
- }
16
+ }
package/publish.sh CHANGED
@@ -7,15 +7,15 @@ rsync -r --exclude=/dist ./* dist
7
7
  cd dist
8
8
 
9
9
  if [ "$1" == "stable" ]; then
10
- #npm version $(npm view @momo-kits/template@stable version)
11
- #npm version patch
10
+ npm version $(npm view @momo-kits/foundation@stable version)
11
+ npm version patch
12
12
  npm publish --tag stable --access=public
13
13
  elif [ "$1" == "latest" ]; then
14
- #npm version $(npm view @momo-kits/foundation@latest version)
14
+ npm version $(npm view @momo-kits/foundation@latest version)
15
15
  npm publish --tag latest --access=public
16
16
  else
17
- #npm version $(npm view @momo-kits/template@beta version)
18
- #npm version prerelease --preid=beta
17
+ npm version $(npm view @momo-kits/template@beta version)
18
+ npm version prerelease --preid=beta
19
19
  npm publish --tag beta --access=public
20
20
  fi
21
21