mg-library 1.0.512 → 1.0.514

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/blocks.js CHANGED
@@ -74,29 +74,6 @@ export function MGWelcome(props) {
74
74
  );
75
75
  }
76
76
 
77
- /* return (
78
- <View style={mgFunctionsLib.getBasicStyleSheet().availableArea}>
79
- <FlatList
80
- data={props.notices}
81
- keyExtractor={item => item.idNotice.toString()}
82
- renderItem={({ item }) => (
83
- <Card header={cardHeader(item)} style={{ marginBottom: 10, marginHorizontal: 10 }}>
84
- {item.imageUrl != undefined &&
85
- <View style={{ flexGrow: 1, alignItems: 'center', marginBottom: 10 }}>
86
- <Image source={{ uri: item.imageUrl }} style={{ width: '50%', height: '50%' }} />
87
- </View>
88
- }
89
- <Text>
90
- <Text style={{ marginBottom: 10 }}>{item.content}</Text>
91
- </Text>
92
- </Card>
93
- )}
94
- ListHeaderComponent={listHeaderComponent}
95
- ListFooterComponent={listFooterComponent}
96
- />
97
- </View>
98
- ) */
99
-
100
77
  return (
101
78
  <View style={mgFunctionsLib.getBasicStyleSheet().availableArea}>
102
79
  <FlatList
@@ -122,6 +99,66 @@ export function MGWelcome(props) {
122
99
 
123
100
  }
124
101
 
102
+ export function MGBenefits(props) {
103
+
104
+ let subTitle = mgFunctionsLib.i18nString('benefits', props.language);
105
+
106
+ if (props.subTitle != undefined)
107
+ subTitle = props.subTitle;
108
+
109
+ let listHeaderComponent = (
110
+ <View>
111
+ <MGSessionHeader module={subTitle} person={props.person} theme={props.theme} />
112
+ <MGDivider />
113
+ {props.beforeBenefits != undefined &&
114
+ <>
115
+ {props.beforeBenefits}
116
+ <MGDivider />
117
+ </>
118
+ }
119
+ </View>
120
+ );
121
+
122
+ function cardHeader(item) {
123
+ return (
124
+ <>
125
+ <View style={{ flex: 1, flexDirection: 'column', marginVertical: 10, marginHorizontal: 10 }}>
126
+ {item.isImportant &&
127
+ <MaterialCommunityIcons style={{ flex: 1 }} name='alert-circle-outline' color={props.theme['color-primary-500']} size={30} />
128
+ }
129
+ <Text style={{ flex: 1 }} category='h6'>{item.description}</Text>
130
+ </View>
131
+ </>
132
+ );
133
+ };
134
+
135
+ let listFooterComponent = (<View></View>);
136
+
137
+ return (
138
+ <View style={mgFunctionsLib.getBasicStyleSheet().availableArea}>
139
+ <FlatList
140
+ data={props.benefits}
141
+ keyExtractor={item => item.idNotice.toString()}
142
+ renderItem={({ item }) => (
143
+ <Card header={cardHeader(item)} style={{ marginBottom: 10, marginHorizontal: 10 }}>
144
+ {item.imageUrl != undefined &&
145
+ <View style={{ flexGrow: 1, alignItems: 'center', marginBottom: 10 }}>
146
+ <Image source={{ uri: item.imageUrl }} style={{ width: '70%', resizeMode: 'contain', height: undefined, aspectRatio: 1 }} />
147
+ </View>
148
+ }
149
+ <Text>
150
+ <Text style={{ marginBottom: 10 }}>{item.content}</Text>
151
+ </Text>
152
+ </Card>
153
+ )}
154
+ ListHeaderComponent={listHeaderComponent}
155
+ ListFooterComponent={listFooterComponent}
156
+ />
157
+ </View>
158
+ )
159
+
160
+ }
161
+
125
162
  export function MGLogin(props) {
126
163
 
127
164
  const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
package/i18n/english.js CHANGED
@@ -40,6 +40,7 @@ export const strings = {
40
40
  yes: 'Yes',
41
41
  no: 'No',
42
42
  notices: 'Notices',
43
+ benefits: 'Benefits',
43
44
  dashboard: 'Control Panel',
44
45
  period: 'Period',
45
46
  amount: 'Importe',
package/i18n/spanish.js CHANGED
@@ -40,6 +40,7 @@ export const strings = {
40
40
  yes: 'Si',
41
41
  no: 'No',
42
42
  notices: 'Noticias',
43
+ benefits: 'Beneficios en Comercios Adheridos',
43
44
  dashboard: 'Tablero de Control',
44
45
  period: 'Período',
45
46
  amount: 'Importe',
package/login.js CHANGED
@@ -2,36 +2,6 @@ import * as mgFunctionsLib from './functions.js';
2
2
  import * as mgConstantsLib from './constants.js';
3
3
  import axios from 'axios';
4
4
 
5
- /* export function onPressLogin(dispatch, actions, app, apiUrl, language, data) {
6
- try {
7
- if (validateForm(data, language)) {
8
- let requestData = {
9
- app: app,
10
- userName: data.userName.toLowerCase(),
11
- password: data.password,
12
- language: mgConstantsLib.LANGUAGE_SPANISH
13
- }
14
- dispatch(actions.apiRequest());
15
- axios.post(apiUrl + '/Login', requestData, mgFunctionsLib.getRequestHeader())
16
- .then(response => {
17
- let appSession = response.data;
18
- dispatch(actions.login(appSession));
19
- mgFunctionsLib.writeToLocalStorage(mgConstantsLib.ACCESS_TOKEN, appSession.accessToken);
20
- dispatch(actions.apiSuccess());
21
- })
22
- .catch(error => {
23
- dispatch(actions.apiError());
24
- let msg = '';
25
- if(error.message!=undefined)
26
- msg = ' |>| ' + error.message;
27
- mgFunctionsLib.showToastError(mgFunctionsLib.i18nMessage('credentialsInvalid', language) + msg);
28
- })
29
- }
30
- } catch (error) {
31
- mgFunctionsLib.showToastError(error);
32
- }
33
- } */
34
-
35
5
  export function onPressLogin(dispatch, actions, app, apiUrl, language, data) {
36
6
  try {
37
7
  if (validateForm(data, language)) {
@@ -51,20 +21,9 @@ export function onPressLogin(dispatch, actions, app, apiUrl, language, data) {
51
21
  })
52
22
  .catch(error => {
53
23
  dispatch(actions.apiError());
54
-
55
- console.log('ERROR');
56
- console.log('---');
57
- console.log(apiUrl + '/Login');
58
- console.log('---');
59
- console.log(requestData);
60
- console.log('---');
61
- console.log(mgFunctionsLib.getRequestHeader());
62
- console.log('---');
63
- console.log(error.response.data);
64
-
65
24
  let msg = '';
66
25
  if(error.message!=undefined)
67
- msg = ' |>| ' + error.message;
26
+ msg = ' |>| ' + error.message + ' |>| ' + error.response.data;
68
27
  mgFunctionsLib.showToastError(mgFunctionsLib.i18nMessage('credentialsInvalid', language) + msg);
69
28
  })
70
29
  }
package/mg-library.rar CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.512",
3
+ "version": "1.0.514",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {