ordering-ui-react-native 0.12.58 → 0.12.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.58",
3
+ "version": "0.12.62",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -10,8 +10,7 @@ import { useTheme } from 'styled-components/native';
10
10
  import { OText } from '../shared';
11
11
  import { AppleLoginParams } from '../../types';
12
12
 
13
- export const AppleLogin = (props : AppleLoginParams) => {
14
-
13
+ export const AppleLogin = (props: AppleLoginParams) => {
15
14
  const {
16
15
  notificationState,
17
16
  handleErrors,
@@ -55,7 +54,7 @@ export const AppleLogin = (props : AppleLoginParams) => {
55
54
  handleErrors && handleErrors(t('ERROR_LOGIN_APPLE', 'Error login with apple'))
56
55
  }
57
56
 
58
- } catch (error : any) {
57
+ } catch (error: any) {
59
58
  handleErrors && handleErrors(error.message)
60
59
  }
61
60
  } else {
@@ -70,15 +69,22 @@ export const AppleLogin = (props : AppleLoginParams) => {
70
69
  });
71
70
  const { code } = await appleAuthAndroid.signIn();
72
71
  handleLoginApple(code)
73
- } catch (error : any) {
72
+ } catch (error: any) {
74
73
  handleErrors && handleErrors(error?.message)
75
74
  }
76
75
  }
77
76
  }
78
77
  const handleLoginApple = async (code: string) => {
79
- const body: any = {
80
- code,
81
- platform: Platform.OS === 'ios' && 'ios'
78
+ let body: any
79
+ if (Platform.OS === 'ios') {
80
+ body = {
81
+ code,
82
+ platform: 'ios'
83
+ }
84
+ } else {
85
+ body = {
86
+ code
87
+ }
82
88
  }
83
89
  if (notificationState?.notification_token) {
84
90
  body.notification_token = notificationState.notification_token
@@ -99,7 +105,7 @@ export const AppleLogin = (props : AppleLoginParams) => {
99
105
  } else {
100
106
  handleErrors && handleErrors(result || t('ERROR_LOGIN_AUTH_APPLE', 'Error login auth with apple'))
101
107
  }
102
- } catch (error : any) {
108
+ } catch (error: any) {
103
109
  handleLoading && handleLoading(false)
104
110
  handleErrors && handleErrors(error?.message)
105
111
  }
@@ -242,6 +242,7 @@ const CartUI = (props: any) => {
242
242
  marginTop: 10
243
243
  }}
244
244
  multiline
245
+ inputStyle={{color: theme.colors.textPrimary}}
245
246
  />
246
247
  {commentState?.loading && (
247
248
  <View style={{ position: 'absolute', right: 20 }}>
@@ -43,7 +43,7 @@ const LastOrdersUI = (props: LastOrdersParams) => {
43
43
  })
44
44
 
45
45
  const goToOrders = useCallback((order) => {
46
- navigation.navigate('BottomTab', { screen: 'MyOrders' });
46
+ navigation.navigate('OrderDetails', { orderId: order.uuid });
47
47
  }, [])
48
48
 
49
49
  return (
@@ -255,6 +255,7 @@ const OrderSummaryUI = (props: any) => {
255
255
  marginTop: 10
256
256
  }}
257
257
  multiline
258
+ inputStyle={{color: theme.colors.textPrimary}}
258
259
  />
259
260
  {commentState?.loading && (
260
261
  <View style={{ position: 'absolute', right: 20 }}>
@@ -480,8 +480,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
480
480
  </Table>
481
481
  {order?.comment && (
482
482
  <Table>
483
- <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
484
- <OText style={{ maxWidth: '70%' }}>
483
+ <OText color={theme.colors.textPrimary} size={12} style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
484
+ <OText color={theme.colors.textPrimary} size={12} style={{ maxWidth: '70%' }}>
485
485
  {order?.comment}
486
486
  </OText>
487
487
  </Table>
@@ -8,7 +8,7 @@ import {
8
8
  useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
- import { ScrollView, View, useWindowDimensions } from 'react-native';
11
+ import { ScrollView, View, useWindowDimensions, ActivityIndicator, StyleSheet } from 'react-native';
12
12
  import {
13
13
  CheckoutAction,
14
14
  OSBill,
@@ -20,13 +20,14 @@ import {
20
20
  BIHeader,
21
21
  BIInfo,
22
22
  BIContentInfo,
23
- BITotal
23
+ BITotal,
24
+ TopHeader
24
25
  } from './styles';
25
26
 
26
27
  import { ProductItemAccordion } from '../ProductItemAccordion';
27
28
  import { CouponControl } from '../CouponControl';
28
29
 
29
- import { OButton, OIcon, OModal, OText } from '../shared';
30
+ import { OButton, OInput, OModal, OText, OIcon } from '../shared';
30
31
  import { ProductForm } from '../ProductForm';
31
32
  import { UpsellingProducts } from '../UpsellingProducts';
32
33
  import { convertHoursToMinutes, verifyDecimals } from '../../utils';
@@ -37,6 +38,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
37
38
  import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
38
39
  import { TaxInformation } from '../TaxInformation';
39
40
  import { TouchableOpacity } from 'react-native';
41
+
40
42
  const CartUI = (props: any) => {
41
43
  const {
42
44
  cart,
@@ -48,6 +50,8 @@ const CartUI = (props: any) => {
48
50
  removeProduct,
49
51
  handleCartOpen,
50
52
  setIsCartsLoading,
53
+ handleChangeComment,
54
+ commentState
51
55
  } = props
52
56
 
53
57
  const theme = useTheme();
@@ -184,6 +188,15 @@ const CartUI = (props: any) => {
184
188
  )
185
189
  }
186
190
 
191
+ const styles = StyleSheet.create({
192
+ headerItem: {
193
+ overflow: 'hidden',
194
+ backgroundColor: theme.colors.clear,
195
+ width: 35,
196
+ marginVertical: 18,
197
+ },
198
+ })
199
+
187
200
  return (
188
201
  cart?.products?.length > 0 ? (
189
202
  <ScrollView
@@ -304,6 +317,39 @@ const CartUI = (props: any) => {
304
317
  </OSTable>
305
318
  )}
306
319
 
320
+ {cart?.status !== 2 && (
321
+ <OSTable>
322
+ <View style={{ width: '100%', marginTop: 0 }}>
323
+ <OText size={14} style={{ marginBottom: 10 }}>{t('COMMENTS', 'Comments')}</OText>
324
+ <View style={{ flex: 1, width: '100%' }}>
325
+ <OInput
326
+ value={cart?.comment}
327
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
328
+ onChange={(value: string) => handleChangeComment(value)}
329
+ style={{
330
+ borderColor: theme.colors.border,
331
+ borderRadius: 10,
332
+ marginBottom: 20,
333
+ height: 104,
334
+ maxHeight: 104,
335
+ alignItems: 'flex-start',
336
+ }}
337
+ multiline
338
+ />
339
+ {commentState?.loading && (
340
+ <View style={{ position: 'absolute', right: 20 }}>
341
+ <ActivityIndicator
342
+ size='large'
343
+ style={{ height: 100 }}
344
+ color={theme.colors.primary}
345
+ />
346
+ </View>
347
+ )}
348
+ </View>
349
+ </View>
350
+ </OSTable>
351
+ )}
352
+
307
353
  <OSTotal>
308
354
  <OSTable style={{ marginTop: 15 }}>
309
355
  <OText size={14} lineHeight={21} weight={'600'}>
@@ -392,7 +438,24 @@ const CartUI = (props: any) => {
392
438
  onSave={handlerProductAction}
393
439
  onClose={() => setModalIsOpen(false)}
394
440
  />
441
+ </OModal>
395
442
 
443
+ <OModal
444
+ open={openTaxModal.open}
445
+ onClose={() => setOpenTaxModal({ open: false, data: null })}
446
+ entireModal
447
+ customClose
448
+ >
449
+ <>
450
+ <TopHeader>
451
+ <TouchableOpacity
452
+ style={styles.headerItem}
453
+ onPress={() => setOpenTaxModal({ open: false, data: null })}>
454
+ <OIcon src={theme.images.general.close} width={16} />
455
+ </TouchableOpacity>
456
+ </TopHeader>
457
+ <TaxInformation data={openTaxModal.data} products={cart?.products} />
458
+ </>
396
459
  </OModal>
397
460
  </ScrollView>
398
461
  ) : (
@@ -410,13 +473,6 @@ const CartUI = (props: any) => {
410
473
  image={theme.images.general.notFound}
411
474
  />
412
475
  </View>
413
- <OModal
414
- open={openTaxModal.open}
415
- onClose={() => setOpenTaxModal({ open: false, data: null })}
416
- entireModal
417
- >
418
- <TaxInformation data={openTaxModal.data} products={cart?.products} />
419
- </OModal>
420
476
  </Container>
421
477
  )
422
478
  )
@@ -100,3 +100,12 @@ export const BITotal = styled.View`
100
100
  flex-direction: column;
101
101
  align-items: flex-end;
102
102
  `
103
+
104
+ export const TopHeader = styled.View`
105
+ width: 100%;
106
+ flex-direction: row;
107
+ align-items: center;
108
+ justify-content: space-between;
109
+ z-index: 1;
110
+ padding-horizontal: 40px;
111
+ `