ordering-ui-react-native 0.11.25 → 0.11.26

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.11.25",
3
+ "version": "0.11.26",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -72,7 +72,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
72
72
  }}
73
73
  >
74
74
  <Container nopadding nestedScrollEnabled>
75
- <View style={{ paddingVertical: 20 }}>
75
+ <View style={{ paddingTop: 20 }}>
76
76
  <NavBar
77
77
  title={t('MENU', 'Menu')}
78
78
  onActionLeft={goToBack}
@@ -1,22 +1,14 @@
1
- import React, { useEffect, useState } from 'react'
1
+ import React from 'react'
2
2
  import { View, StyleSheet } from 'react-native'
3
- import {
4
- BusinessAndProductList,
5
- useLanguage,
6
- useOrder,
7
- useSession,
8
- useConfig,
9
- useApi
10
- } from 'ordering-components/native'
3
+ import { BusinessAndProductList, useLanguage } from 'ordering-components/native'
11
4
  import Carousel from 'react-native-snap-carousel';
12
5
  import { BusinessProductsListingParams, Business, Product } from '../../types'
13
- import { OCard, OText } from '../shared'
6
+ import { OCard, OText, OIcon } from '../shared'
14
7
  import GridContainer from '../../layouts/GridContainer'
15
8
  import PromoCard from '../PromoCard';
16
9
  import Spinner from 'react-native-loading-spinner-overlay';
17
10
  import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
18
11
  import { useTheme } from 'styled-components/native';
19
- import { OIcon } from '../shared';
20
12
 
21
13
  const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
22
14
  const {navigation, businessState} = props;
@@ -40,8 +32,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
40
32
  });
41
33
 
42
34
  const _renderTitle = (title: string): React.ReactElement => (
43
- <View style={{paddingHorizontal: 20, paddingVertical: 40}}>
44
- <OText size={orientationState?.dimensions?.width * 0.035} weight="bold">
35
+ <View style={{paddingHorizontal: 20, paddingVertical: 15 }}>
36
+ <OText size={orientationState?.dimensions?.width * 0.022} weight="bold">
45
37
  {title}
46
38
  </OText>
47
39
  </View>
@@ -69,7 +61,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
69
61
 
70
62
  const _renderPromos = (): React.ReactElement => (
71
63
  <>
72
- {_renderTitle(t('PROMOS', 'Promos'))}
64
+ {_renderTitle(t('FEATURED', 'Featured'))}
73
65
  <Carousel
74
66
  keyExtractor={(item: any) => item.id}
75
67
  ref={(c: any) => {
@@ -10,7 +10,7 @@ import {
10
10
  useValidationFields,
11
11
  } from 'ordering-components/native';
12
12
 
13
- import { CheckoutAction, Actions, KeyboardView, OrderTypeWrapper } from './styles';
13
+ import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
14
14
 
15
15
  import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
16
16
 
@@ -22,8 +22,8 @@ import CartItem from '../CartItem';
22
22
  import NavBar from '../NavBar';
23
23
  import { CouponControl } from '../CouponControl';
24
24
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation} from "../../../../../src/hooks/DeviceOrientation";
25
- import { SafeAreaView } from 'react-native-safe-area-context';
26
25
  import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
26
+ import { Container } from '../../../../../src/layouts/Container';
27
27
 
28
28
  const CartUI = (props: any) => {
29
29
  const {
@@ -91,16 +91,8 @@ const CartUI = (props: any) => {
91
91
  const goToBack = () => navigation.goBack();
92
92
 
93
93
  return (
94
- <KeyboardView
95
- enabled
96
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
97
- >
98
- <SafeAreaView style={{
99
- flex: 1,
100
- padding: 20,
101
- backgroundColor: '#fff',
102
- }}>
103
-
94
+ <>
95
+ <Container>
104
96
  <NavBar
105
97
  title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
106
98
  onActionLeft={goToBack}
@@ -141,29 +133,50 @@ const CartUI = (props: any) => {
141
133
  />
142
134
  </OrderTypeWrapper>
143
135
 
144
- <ScrollView style={{flex: 1}}>
145
- {cart?.products?.length > 0 && cart?.products.map((product: any) => (
146
- <CartItem
147
- key={product.code}
148
- isCartPending={isCartPending}
149
- isCartProduct
150
- product={product}
151
- changeQuantity={changeQuantity}
152
- getProductMax={getProductMax}
153
- offsetDisabled={offsetDisabled}
154
- onDeleteProduct={handleDeleteClick}
155
- onEditProduct={handleEditProduct}
156
- />
157
- ))}
158
- </ScrollView>
159
-
160
- <Actions
136
+ <ScrollView
137
+ nestedScrollEnabled={true}
138
+ showsVerticalScrollIndicator={false}
139
+ showsHorizontalScrollIndicator={false}
161
140
  style={{
162
- flex: 1
141
+ minHeight: orientationState?.dimensions?.height * 0.05,
142
+ maxHeight: orientationState?.dimensions?.height * 0.5,
163
143
  }}
164
144
  >
145
+ <View
146
+ style={{
147
+ display: 'flex',
148
+ flexDirection: 'column',
149
+ width: '100%',
150
+ opacity: 1
151
+ }}
152
+ >
153
+ {cart?.products?.length > 0 && cart?.products.map((product: any) => (
154
+ <CartItem
155
+ isCartProduct
156
+ key={product.code}
157
+ product={product}
158
+ isCartPending={isCartPending}
159
+ changeQuantity={changeQuantity}
160
+ getProductMax={getProductMax}
161
+ offsetDisabled={offsetDisabled}
162
+ onDeleteProduct={handleDeleteClick}
163
+ onEditProduct={handleEditProduct}
164
+ />
165
+ ))}
166
+ </View>
167
+ </ScrollView>
168
+
169
+ <View style={{ marginTop: 10 }}>
165
170
  {cart?.valid_products && (
166
171
  <OSBill>
172
+ <OSTable>
173
+ <OText>{t('SUBTOTAL', 'Subtotal')}</OText>
174
+ <OText>
175
+ {cart.business.tax_type === 1
176
+ ? parsePrice((cart?.subtotal + cart?.tax) || 0)
177
+ : parsePrice(cart?.subtotal || 0)}
178
+ </OText>
179
+ </OSTable>
167
180
  {cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
168
181
  <OSTable
169
182
  style={{
@@ -260,19 +273,21 @@ const CartUI = (props: any) => {
260
273
  </OSCoupon>
261
274
  </OSTable>
262
275
  )}
263
- {/*ESTE CODIGO GENERA UNA LINEA EN LA PAGINA QUE SE VE MAL, validar si es necesario este codigo*/}
264
- {/*<OSTotal>*/}
265
- {/* <OSTable style={{ marginTop: 15 }}>*/}
266
- {/* <OText style={{ fontWeight: 'bold' }}>*/}
267
- {/* {t('TOTAL', 'Total')}*/}
268
- {/* </OText>*/}
269
- {/* <OText style={{ fontWeight: 'bold' }} color={theme.colors.primary}>*/}
270
- {/* {cart?.total >= 1 && parsePrice(cart?.total)}*/}
271
- {/* </OText>*/}
272
- {/* </OSTable>*/}
273
- {/*</OSTotal>*/}
276
+ <OSTable>
277
+ <OText weight='bold'>
278
+ {t('TOTAL', 'Total')}
279
+ </OText>
280
+ <OText weight='bold' color={theme.colors.primary}>
281
+ {cart?.total >= 1 && parsePrice(cart?.total)}
282
+ </OText>
283
+ </OSTable>
274
284
  </OSBill>
275
285
  )}
286
+ </View>
287
+ </Container>
288
+
289
+ <>
290
+ <FloatingLayout isIos={Platform.OS === 'ios'}>
276
291
  <CheckoutAction>
277
292
  <View style={{display: 'flex', flexDirection: 'row'}}>
278
293
  {cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == LANDSCAPE && (
@@ -337,7 +352,7 @@ const CartUI = (props: any) => {
337
352
  }}>
338
353
  <OButton
339
354
  text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
340
- `${t('CONFIRM_THIS', 'Confirm this')} ${parsePrice(cart?.total)} ${t('ORDER', 'order')}`
355
+ `${t('CONFIRM_THIS_ORDER', 'Confirm this order')}`
341
356
  ) : !cart?.valid_address ? (
342
357
  `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
343
358
  ) : (
@@ -354,27 +369,27 @@ const CartUI = (props: any) => {
354
369
  </View>
355
370
  </View>
356
371
  </CheckoutAction>
357
- </Actions>
372
+ </FloatingLayout>
373
+ </>
358
374
 
359
- <OModal
360
- open={openProduct}
361
- entireModal
362
- customClose
375
+ <OModal
376
+ open={openProduct}
377
+ entireModal
378
+ customClose
379
+ onClose={() => setModalIsOpen(false)}
380
+ >
381
+ <ProductForm
382
+ productCart={curProduct}
383
+ businessSlug={cart?.business?.slug}
384
+ businessId={curProduct?.business_id}
385
+ categoryId={curProduct?.category_id}
386
+ productId={curProduct?.id}
387
+ onSave={handlerProductAction}
363
388
  onClose={() => setModalIsOpen(false)}
364
- >
365
- <ProductForm
366
- productCart={curProduct}
367
- businessSlug={cart?.business?.slug}
368
- businessId={curProduct?.business_id}
369
- categoryId={curProduct?.category_id}
370
- productId={curProduct?.id}
371
- onSave={handlerProductAction}
372
- onClose={() => setModalIsOpen(false)}
373
- />
389
+ />
374
390
 
375
- </OModal>
376
- </SafeAreaView>
377
- </KeyboardView>
391
+ </OModal>
392
+ </>
378
393
  )
379
394
  }
380
395
 
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native';
1
+ import styled, { css } from 'styled-components/native';
2
2
 
3
3
  export const CContainer = styled.View`
4
4
  padding: 0 20px;
@@ -50,3 +50,21 @@ export const OrderTypeWrapper = styled.View`
50
50
  border-bottom-width: 1px;
51
51
  margin-bottom: 30px;
52
52
  `;
53
+
54
+ export const FloatingLayout = styled.View`
55
+ position: absolute;
56
+ flex: 1;
57
+ bottom: 0px;
58
+ left: 0;
59
+ padding: 10px;
60
+ width: 100%;
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ background-color: #FFF;
65
+ z-index: 1000;
66
+
67
+ ${((props: any) => props.isIos && css`
68
+ padding-bottom: 20px;
69
+ `)}
70
+ `
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Platform, View } from 'react-native';
3
3
  import { useLanguage, useOrder, useUtils } from 'ordering-components/native';
4
4
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
@@ -87,7 +87,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
87
87
  }}
88
88
  >
89
89
  <Container nopadding nestedScrollEnabled>
90
- <View style={{ paddingVertical: 20 }}>
90
+ <View style={{ paddingTop: 20 }}>
91
91
  <NavBar
92
92
  title={t('CATEGORY', 'Category')}
93
93
  onActionLeft={goToBack}
@@ -114,21 +114,12 @@ const CategoriesMenu = (props: any): React.ReactElement => {
114
114
  items={categories.map((category) => ({
115
115
  text: category.name
116
116
  }))}
117
- selectedIdx={curIndexCateg}
117
+ selectedIdx={curIndexCateg}
118
118
  onSelectItem={onChangeTabs}
119
119
  />
120
120
  </View>
121
-
122
- <View style={{ paddingHorizontal: 20, paddingVertical: 8 }}>
123
- <OText
124
- size={orientationState?.dimensions?.width * 0.048}
125
- weight="bold"
126
- >
127
- {categories[curIndexCateg].name}
128
- </OText>
129
- </View>
130
121
 
131
- <GridContainer>
122
+ <GridContainer style={{ marginTop: 20 }}>
132
123
  {categories[curIndexCateg].products.map((product) => (
133
124
  <OCard
134
125
  key={product.id}
@@ -137,7 +128,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
137
128
  style={{
138
129
  width: orientationState?.orientation === LANDSCAPE
139
130
  ? orientationState?.dimensions?.width * 0.16
140
- : orientationState?.dimensions?.width * 0.21,
131
+ : orientationState?.dimensions?.width * 0.21
141
132
  }}
142
133
  titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
143
134
  onPress={() => {
@@ -156,7 +147,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
156
147
  </Container>
157
148
  </View>
158
149
 
159
- {bottomSheetVisibility &&
150
+ {bottomSheetVisibility &&
160
151
  (<View
161
152
  style={{
162
153
  flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect } from 'react';
2
- import { Pressable, StyleSheet, View } from 'react-native';
2
+ import { StyleSheet, View } from 'react-native';
3
3
  import { useForm, Controller } from 'react-hook-form';
4
4
  import { useTheme } from 'styled-components/native';
5
5
 
@@ -22,7 +22,6 @@ import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/ho
22
22
  const LoginFormUI = (props: LoginParams) => {
23
23
  const {
24
24
  loginButtonText,
25
- forgotButtonText,
26
25
  formState,
27
26
  handleButtonLoginClick,
28
27
  } = props;
@@ -161,12 +160,6 @@ const LoginFormUI = (props: LoginParams) => {
161
160
  style={{ borderRadius: 0 }}
162
161
  textStyle={{ fontSize: 24 }}
163
162
  />
164
-
165
- <Pressable>
166
- <OText size={24} mBottom={18} style={styles.forgotStyle}>
167
- {forgotButtonText}
168
- </OText>
169
- </Pressable>
170
163
  </>
171
164
  );
172
165
 
@@ -83,7 +83,8 @@ const PaymentOptionsUI = (props: any) => {
83
83
  }
84
84
  }, [isOpenMethod.paymethod, placing, isLoading, paySelected]);
85
85
 
86
- const includePaymethods = ['cash', 'card_delivery', 'stripe'];
86
+ // const includePaymethods = ['cash', 'card_delivery', 'stripe'];
87
+ const includePaymethods = ['cash', 'card_delivery'];
87
88
 
88
89
  const supportedMethods = paymethodsList.paymethods.filter((p: any) =>
89
90
  includePaymethods.includes(p.gateway),
@@ -8,7 +8,7 @@ import OText from './OText';
8
8
 
9
9
  const CardContainer = styled.TouchableOpacity`
10
10
  width: 21%;
11
- margin: 2%;
11
+ margin: 10px 20px;
12
12
  overflow: hidden;
13
13
  `
14
14
 
@@ -54,6 +54,8 @@ interface Props {
54
54
  onSubmitEditing?: any;
55
55
  blurOnSubmit?: boolean;
56
56
  inputStyle?: TextInputProps
57
+ onFocus?: TextInputProps
58
+ onBlur?: TextInputProps
57
59
  }
58
60
 
59
61
  const OInput = (props: Props): React.ReactElement => {
@@ -93,6 +95,8 @@ const OInput = (props: Props): React.ReactElement => {
93
95
  returnKeyType={props.returnKeyType}
94
96
  onSubmitEditing={props.onSubmitEditing}
95
97
  blurOnSubmit={props.blurOnSubmit}
98
+ onFocus={props.onFocus}
99
+ onBlur={props.onBlur}
96
100
  />
97
101
  {props.iconRight && (
98
102
  <OIcon