ordering-ui-react-native 0.11.58 → 0.11.59

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.58",
3
+ "version": "0.11.59",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -82,6 +82,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
82
82
  inactiveSlideOpacity={1}
83
83
  initialScrollIndex={0}
84
84
  onScrollToIndexFailed={(_: any) => {}}
85
+ enableMomentum={true}
85
86
  />
86
87
  </>
87
88
  );
@@ -13,7 +13,8 @@ import {
13
13
  StyledContent,
14
14
  StyledTopBar,
15
15
  } from './styles';
16
- import { OButton, OModal, OText } from '../shared';
16
+ import { OButton, OModal, OText, OIconButton } from '../shared';
17
+ import EvilIcons from 'react-native-vector-icons/EvilIcons';
17
18
  import CartItem from '../CartItem';
18
19
  import { Cart as TypeCart } from '../../types';
19
20
  import { ProductForm } from '../ProductForm';
@@ -109,6 +110,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
109
110
  {...props}
110
111
  handleClearProducts={handleClearProducts}
111
112
  selectedOrderType={selectedOrderType}
113
+ hideCartBottomSheet={hideCartBottomSheet}
112
114
  />
113
115
 
114
116
  {cart?.products?.length > 0 && cart?.products.map((product: any) => (
@@ -126,13 +128,27 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
126
128
  ))}
127
129
 
128
130
  </StyledContent>
129
-
130
- <StyledBottomContent
131
- minHeight={props.height * 0.1}
131
+ <TouchableOpacity
132
+ onPress={handleClearProducts}
133
+ style={{flex:1, justifyContent:'center', alignItems:'center', bottom: 20, paddingTop: 5}}
132
134
  >
135
+ <View>
136
+ <OText
137
+ size={20}
138
+ weight="700"
139
+ color={theme.colors.red}
140
+ >
141
+ {t('CANCEL_ORDER', 'Cancel order')}
142
+ </OText>
143
+ </View>
144
+ </TouchableOpacity>
145
+ <StyledBottomContent
146
+ style={{bottom:10}}
147
+ minHeight={props.height * 0.01}
148
+ >
133
149
  <OButton
134
150
  text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
135
- !openUpselling !== canOpenUpselling ? `${t('CONFIRM_THIS', 'Confirm this')} ${parsePrice(cart?.total)} ${t('ORDER', 'order')}`: t('LOADING', 'Loading')
151
+ !openUpselling !== canOpenUpselling ? `${t('CHECKOUT', 'Checkout')} ${parsePrice(cart?.total)}`: t('LOADING', 'Loading')
136
152
  ) : !cart?.valid_address ? (
137
153
  `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
138
154
  ) : (
@@ -205,20 +221,19 @@ const TopBar = (props:any) => {
205
221
  {props?.selectedOrderType === 3 && t('EAT_IN', 'Eat in')}
206
222
  </OText>
207
223
  </View>
208
-
209
- <TouchableOpacity
210
- onPress={props?.handleClearProducts}
211
- >
212
- <View>
213
- <OText
214
- size={20}
215
- weight="500"
216
- color={theme.colors.primary}
217
- >
218
- {t('CANCEL_ORDER', 'Cancel order')}
219
- </OText>
220
- </View>
221
- </TouchableOpacity>
224
+ <OIconButton
225
+ bgColor="transparent"
226
+ borderColor="transparent"
227
+ RenderIcon={() =>
228
+ <EvilIcons
229
+ name={'close'}
230
+ size={40}
231
+ color={theme.colors.primary}
232
+ />
233
+ }
234
+ style={{ flex:1, justifyContent: 'flex-end', left: 30 }}
235
+ onClick={props.hideCartBottomSheet}
236
+ />
222
237
  </StyledTopBar>
223
238
  );
224
239
  }
@@ -10,7 +10,8 @@ import {
10
10
  ProductSubOption,
11
11
  ProductComment
12
12
  } from './styles';
13
- import { OButton, OImage, OText } from '../shared';
13
+ import { OButton, OImage, OText, OIconButton } from '../shared';
14
+ import EvilIcons from 'react-native-vector-icons/EvilIcons';
14
15
  import { Product } from '../../types';
15
16
  import QuantityControl from '../QuantityControl';
16
17
  import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
@@ -52,7 +53,7 @@ const CartItem = (props: CartItemProps) => {
52
53
  }
53
54
  return product
54
55
  }
55
-
56
+ const isProductIngredients = productInfo()?.ingredients.length > 0 || productInfo()?.options.length > 0 || product?.comment
56
57
  const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price: number }) => {
57
58
  const pos = position ? `(${position})` : ''
58
59
  return `${quantity} x ${name} ${pos} +${price}`
@@ -64,7 +65,7 @@ const CartItem = (props: CartItemProps) => {
64
65
  onPress={() => (!product?.valid_menu && isCartProduct)
65
66
  ? {}
66
67
  : setActiveState(!isActive)}
67
- activeOpacity={1}
68
+ activeOpacity={0.5}
68
69
  >
69
70
  <StyledCartItem>
70
71
  <View style={{ flexDirection: 'row' }}>
@@ -105,6 +106,21 @@ const CartItem = (props: CartItemProps) => {
105
106
  }}
106
107
  onClick={() => { onEditProduct ? onEditProduct(product) : null }}
107
108
  />
109
+ <OIconButton
110
+ bgColor="transparent"
111
+ borderColor="transparent"
112
+ RenderIcon={isProductIngredients && (() =>
113
+ <EvilIcons
114
+ name={isActive ? 'chevron-up': 'chevron-down'}
115
+ size={40}
116
+ color={theme.colors.primary}
117
+ />
118
+ )}
119
+ style={{ justifyContent: 'flex-start', right: 40 }}
120
+ onClick={() => (!product?.valid_menu && isCartProduct)
121
+ ? {}
122
+ : setActiveState(!isActive)}
123
+ />
108
124
  </View>
109
125
  </View>
110
126
  </View>
@@ -90,7 +90,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
90
90
  <Container nopadding nestedScrollEnabled>
91
91
  <View style={{ paddingTop: 20 }}>
92
92
  <NavBar
93
- title={t('CATEGORY_X_ID', 'Category')}
93
+ title={categories[curIndexCateg].name}
94
94
  onActionLeft={goToBack}
95
95
  rightComponent={cart && (
96
96
  <TouchableOpacity
@@ -128,7 +128,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
128
128
  image={{ uri: product?.images }}
129
129
  style={{
130
130
  width: orientationState?.orientation === LANDSCAPE
131
- ? orientationState?.dimensions?.width * 0.16
131
+ ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.15 :orientationState?.dimensions?.width * 0.16
132
132
  : orientationState?.dimensions?.width * 0.21
133
133
  }}
134
134
  titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
2
  import styled from 'styled-components/native'
3
3
  import { OIcon, OButton, OText } from '../shared'
4
- import { TextStyle, View } from 'react-native'
4
+ import { ImageStyle, TextStyle, View } from 'react-native'
5
5
  import { OrderTypeSelector } from '../OrderTypeSelector'
6
6
  import { useConfig } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native'
@@ -53,6 +53,7 @@ interface Props {
53
53
  style?: TextStyle,
54
54
  paddingTop?: number,
55
55
  includeOrderTypeSelector?: boolean,
56
+ imgLeftStyle?: ImageStyle
56
57
  }
57
58
 
58
59
  const NavBar = (props: Props) => {
@@ -68,6 +69,7 @@ const NavBar = (props: Props) => {
68
69
  imgRightSrc={null}
69
70
  style={{ ...btnBackArrow, ...props.btnStyle }}
70
71
  onClick={props.onActionLeft}
72
+ imgLeftStyle= {props.imgLeftStyle}
71
73
  />)
72
74
  }
73
75
  <TitleTopWrapper>
@@ -210,6 +210,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
210
210
  setCustomerName(name)
211
211
  }
212
212
  getCustomerName()
213
+ const redirectHome = setTimeout(() =>{
214
+ navigation.reset({
215
+ routes: [{ name: 'Intro' }],
216
+ });
217
+ }, 60000);
218
+ return () => {
219
+ clearTimeout(redirectHome);
220
+ }
213
221
  }, [])
214
222
 
215
223
  useEffect(() => {
@@ -135,14 +135,14 @@ const PaymentOptionsUI = (props: any) => {
135
135
  cashIndex !== -1
136
136
  ? {
137
137
  style: cardStyle,
138
- title: t('CASH', supportedMethods[cashIndex]?.name),
138
+ title: t('CASH', 'Cash'),
139
139
  description: t(
140
140
  'GO_FOR_YOR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER',
141
- 'Go for yor receipt and go to the front counter',
141
+ 'Pay with cash in the front counter',
142
142
  ),
143
143
  bgImage: theme.images.general.cash,
144
144
  icon: theme.images.general.shoppingCart,
145
- callToActionText: t('TAKE_MY_RECEIPT', 'Take my receipt'),
145
+ callToActionText: t('LETS_GO', 'LETS_GO'),
146
146
  onClick: () =>
147
147
  onSelectPaymethod(supportedMethods[cashIndex], false),
148
148
  ...supportedMethods[cashIndex],
@@ -137,8 +137,6 @@ export const ProductOptionsUI = (props: any) => {
137
137
  const navBarProps = {
138
138
  style: { backgroundColor: 'transparent', width: orientationState?.dimensions?.width, borderBottomWidth: 0 },
139
139
  paddingTop: 20,
140
- title: t('YOUR_DISH', 'Your dish'),
141
- btnStyle: { backgroundColor: 'transparent' },
142
140
  onActionLeft: onClose ? onClose : navigation ? goToBack : undefined,
143
141
  };
144
142
 
@@ -238,12 +236,29 @@ export const ProductOptionsUI = (props: any) => {
238
236
  {...navBarProps}
239
237
  titleColor={theme.colors.white}
240
238
  {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left_white })}
239
+ btnStyle={{
240
+ width: 55,
241
+ height: 55,
242
+ backgroundColor: 'black',
243
+ borderRadius: 100,
244
+ opacity: 0.8,
245
+ left: 20,
246
+ }}
247
+ imgLeftStyle={{ width: 27, height: 27 }}
241
248
  />
242
249
  </Animated.View>
243
250
  <Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
244
251
  <NavBar
245
252
  {...navBarProps}
246
253
  {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
254
+ btnStyle={{
255
+ width: 55,
256
+ height: 55,
257
+ backgroundColor: 'transparent',
258
+ borderRadius: 100,
259
+ left: 20,
260
+ }}
261
+ imgLeftStyle={{ width: 27, height: 27 }}
247
262
  />
248
263
  </Animated.View>
249
264
 
@@ -178,30 +178,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
178
178
  alignItems: 'center'
179
179
  }}
180
180
  >
181
-
182
- <View style={{ height: '100%', width: '35%' }}>
183
- <OText
184
- size={orientationState?.dimensions?.width * 0.048}
185
- >
186
- {t('DO_YOU_WANT', 'Do you want')} {'\n'}
187
- <OText
188
- size={orientationState?.dimensions?.width * 0.048}
189
- weight={'700'}
190
- >
191
- {t('SOMETHING_ELSE', 'something else')} {'?'}
192
- </OText>
193
- </OText>
194
-
195
- <CloseUpsellingLand>
196
- <OButton
197
- imgRightSrc=''
198
- text={t('I_AM_FINE_THANK_YOU', 'I’m fine, thank you')}
199
- style={styles.closeUpsellingButton}
200
- onClick={() => handleUpsellingPage()}
201
- />
202
- </CloseUpsellingLand>
203
- </View>
204
-
205
181
  <View style={{ width: '65%', marginBottom: 30 }}>
206
182
  <GridContainer>
207
183
  {
@@ -258,7 +234,27 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
258
234
  }
259
235
  </GridContainer>
260
236
  </View>
261
-
237
+ <View style={{ height: '100%', width: '35%' }}>
238
+ <OText
239
+ size={orientationState?.dimensions?.width * 0.040}
240
+ >
241
+ {t('DO_YOU_WANT', 'Do you want')} {'\n'}
242
+ <OText
243
+ size={orientationState?.dimensions?.width * 0.040}
244
+ weight={'700'}
245
+ >
246
+ {t('SOMETHING_ELSE', 'something else')} {'?'}
247
+ </OText>
248
+ </OText>
249
+ <CloseUpsellingLand>
250
+ <OButton
251
+ imgRightSrc=''
252
+ text={t('I_AM_FINE_THANK_YOU', 'I’m fine, thank you')}
253
+ style={styles.closeUpsellingButton}
254
+ onClick={() => handleUpsellingPage()}
255
+ />
256
+ </CloseUpsellingLand>
257
+ </View>
262
258
  </View>
263
259
  </>
264
260
  )
@@ -48,9 +48,10 @@ interface Props {
48
48
  iconCover?: boolean,
49
49
  urlIcon?: any,
50
50
  cover?: any,
51
+ RenderIcon?: React.FunctionComponent
51
52
  }
52
-
53
53
  const OIconButton = (props: Props) => {
54
+ const { RenderIcon } = props
54
55
  const theme = useTheme()
55
56
 
56
57
  return (
@@ -66,7 +67,7 @@ const OIconButton = (props: Props) => {
66
67
  ...props.style
67
68
  }}
68
69
  >
69
- {props.icon ? (
70
+ {props.icon && typeof props.icon !== 'object' ? (
70
71
  <Icon
71
72
  source={props.icon}
72
73
  style={{
@@ -75,6 +76,9 @@ const OIconButton = (props: Props) => {
75
76
  }}
76
77
  />
77
78
  ) : null}
79
+ {RenderIcon ? (
80
+ <RenderIcon />
81
+ ) : null}
78
82
  {props.title ? (
79
83
  <Title style={{
80
84
  color: props.textColor || props.color,
@@ -97,7 +101,7 @@ const OIconButton = (props: Props) => {
97
101
  >
98
102
  {props.icon ? (
99
103
  <Icon
100
- source={props.urlIcon ? {uri: props.icon} : props.icon}
104
+ source={props.urlIcon ? { uri: props.icon } : props.icon}
101
105
  resizeMode={props.cover ? 'cover' : 'contain'}
102
106
  style={{
103
107
  tintColor: props.iconColor,
@@ -105,6 +109,9 @@ const OIconButton = (props: Props) => {
105
109
  }}
106
110
  />
107
111
  ) : null}
112
+ {RenderIcon ? (
113
+ <RenderIcon />
114
+ ) : null}
108
115
  {props.title ? (
109
116
  <Title style={{
110
117
  color: props.textColor || props.color,