ordering-ui-react-native 0.11.24 → 0.11.28

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.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/src/components/BusinessTypeFilter/index.tsx +155 -105
  3. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -2
  4. package/themes/business/src/components/OrdersOption/index.tsx +4 -4
  5. package/themes/business/src/types/index.tsx +6 -0
  6. package/themes/doordash/src/components/BusinessTypeFilter/index.tsx +152 -84
  7. package/themes/doordash/src/components/BusinessTypeFilter/styles.tsx +1 -2
  8. package/themes/kiosk/src/components/BusinessMenu/index.tsx +5 -6
  9. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +6 -14
  10. package/themes/kiosk/src/components/Cart/index.tsx +75 -60
  11. package/themes/kiosk/src/components/Cart/styles.tsx +19 -1
  12. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +5 -2
  13. package/themes/kiosk/src/components/CartItem/index.tsx +144 -57
  14. package/themes/kiosk/src/components/CartItem/styles.tsx +24 -0
  15. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +9 -18
  16. package/themes/kiosk/src/components/LoginForm/index.tsx +1 -8
  17. package/themes/kiosk/src/components/OrderDetails/index.tsx +132 -82
  18. package/themes/kiosk/src/components/OrderDetails/styles.tsx +22 -1
  19. package/themes/kiosk/src/components/PaymentOptions/index.tsx +2 -1
  20. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -2
  21. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  22. package/themes/kiosk/src/components/ProductOption/styles.tsx +2 -2
  23. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +56 -52
  24. package/themes/kiosk/src/components/ProductOptionSubOption/styles.tsx +10 -0
  25. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +41 -38
  26. package/themes/kiosk/src/components/shared/OCard.tsx +1 -1
  27. package/themes/kiosk/src/components/shared/OInput.tsx +4 -0
  28. package/themes/kiosk/src/types/index.d.ts +3 -0
  29. package/themes/original/src/components/BusinessTypeFilter/index.tsx +118 -44
  30. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +4 -4
  31. package/themes/original/src/components/BusinessesListing/index.tsx +3 -0
  32. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +122 -0
  33. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +7 -0
  34. package/themes/original/src/types/index.tsx +4 -0
  35. package/themes/uber-eats/src/components/BusinessTypeFilter/index.tsx +151 -76
  36. package/themes/uber-eats/src/components/BusinessTypeFilter/styles.tsx +0 -9
@@ -206,47 +206,50 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
206
206
  <GridContainer>
207
207
  {
208
208
  !upsellingProducts.error ? upsellingProducts.products.map((product: any) => (
209
- <Item key={product.id}>
210
- <OImage source={{ uri: product.images }} style={styles.imageStyle} />
211
- <Details>
212
- <OText
213
- weight="500"
214
- size={18}
215
- numberOfLines={3}
216
- mBottom={10}
217
- >
218
- {product.name}
219
- </OText>
220
-
221
- {product?.price && (
222
- <OText>
223
- <OText
224
- color={theme.colors.primary}
225
- weight="500"
226
- >
227
- {parsePrice(product.price)}
228
- </OText>
229
-
230
- <OText
231
- color={theme.colors.mediumGray}
232
- size={12}
233
- style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
209
+ <React.Fragment key={product.id}>
210
+ {!product?.inventoried && (
211
+ <Item>
212
+ <OImage source={{ uri: product.images }} style={styles.imageStyle} />
213
+ <Details>
214
+ <OText
215
+ weight="500"
216
+ size={18}
217
+ numberOfLines={3}
218
+ mBottom={10}
234
219
  >
235
- {product?.offer_price ? parsePrice(product?.offer_price) : ''}
236
- </OText>
220
+ {product.name}
237
221
  </OText>
238
- )}
239
- </Details>
240
222
 
241
- <OButton
242
- text={t('ADD_PRODUCT', 'add product')}
243
- textStyle={{ color: theme.colors.primary, textAlign: "center" }}
244
- style={{ minHeight: 40, height: 'auto', width: '100%' }}
245
- bgColor="#EAF2FE"
246
- borderColor="#EAF2FE"
247
- onClick={() => handleFormProduct(product)}
248
- />
249
- </Item>
223
+ {product?.price && (
224
+ <OText>
225
+ <OText
226
+ color={theme.colors.primary}
227
+ weight="500"
228
+ >
229
+ {parsePrice(product.price)}
230
+ </OText>
231
+
232
+ <OText
233
+ color={theme.colors.mediumGray}
234
+ size={12}
235
+ style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
236
+ >
237
+ {product?.offer_price ? parsePrice(product?.offer_price) : ''}
238
+ </OText>
239
+ </OText>
240
+ )}
241
+ </Details>
242
+ <OButton
243
+ text={t('ADD_PRODUCT', 'add product')}
244
+ textStyle={{ color: theme.colors.primary, textAlign: "center" }}
245
+ style={{ minHeight: 40, height: 'auto', width: '100%' }}
246
+ bgColor="#EAF2FE"
247
+ borderColor="#EAF2FE"
248
+ onClick={() => handleFormProduct(product)}
249
+ />
250
+ </Item>
251
+ )}
252
+ </React.Fragment>
250
253
  )) : (
251
254
  <OText>
252
255
  {upsellingProducts.message}
@@ -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
@@ -164,6 +164,9 @@ export interface Product {
164
164
  extras: Extra[];
165
165
  gallery: any[];
166
166
  ingredients: Ingredient[];
167
+ options: any;
168
+ comment: string;
169
+ valid_menu: boolean;
167
170
  }
168
171
 
169
172
  export interface Gallery {
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import {
3
3
  StyleSheet,
4
4
  FlatList,
5
5
  View,
6
6
  ScrollView,
7
7
  TouchableOpacity,
8
+ Dimensions
8
9
  } from 'react-native';
9
10
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
10
11
  import {
@@ -13,20 +14,22 @@ import {
13
14
  } from 'ordering-components/native';
14
15
  import { useTheme } from 'styled-components/native';
15
16
  import {
16
- BusinessCategoriesTitle,
17
17
  BusinessCategories,
18
18
  Category,
19
19
  BCContainer,
20
20
  } from './styles';
21
- import { OIcon, OText } from '../shared';
21
+ import { OIcon, OText, OModal } from '../shared';
22
22
  import { BusinessTypeFilterParams } from '../../types';
23
23
 
24
+ const windowWidth = Dimensions.get('window').width;
25
+
24
26
  export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
25
27
  const { typesState, currentTypeSelected, handleChangeBusinessType } = props;
26
28
 
27
29
  const [, t] = useLanguage();
28
30
 
29
31
  const theme = useTheme();
32
+ const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
30
33
 
31
34
  const renderTypes = ({ item }: any) => {
32
35
  return (
@@ -36,7 +39,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
36
39
  style={{
37
40
  height: 34,
38
41
  justifyContent: 'center',
39
- borderBottomWidth: 1,
42
+ borderBottomWidth: currentTypeSelected === item.id ? 1 : 0,
40
43
  borderBottomColor: currentTypeSelected === item.id ? theme.colors.textNormal : theme.colors.border,
41
44
  }}>
42
45
  <OText
@@ -58,45 +61,99 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
58
61
  };
59
62
 
60
63
  return (
61
- <BCContainer>
62
- {typesState?.loading && (
63
- <View>
64
- <Placeholder style={{ marginVertical: 10 }} Animation={Fade}>
65
- <ScrollView
66
- horizontal
67
- showsVerticalScrollIndicator={false}
68
- showsHorizontalScrollIndicator={false}>
69
- {[...Array(4)].map((_, i) => (
70
- <View
71
- key={i}
72
- style={{ width: 80, borderRadius: 10, marginRight: 15 }}>
73
- <PlaceholderLine height={80} noMargin />
74
- </View>
75
- ))}
76
- </ScrollView>
77
- </Placeholder>
78
- </View>
79
- )}
80
- {!typesState?.loading &&
81
- !typesState?.error &&
82
- typesState?.types &&
83
- typesState?.types.length > 0 && (
84
- <>
85
- <BusinessCategoriesTitle>
86
-
87
- </BusinessCategoriesTitle>
88
- <BusinessCategories>
89
- <FlatList
64
+ <>
65
+ <BCContainer>
66
+ {typesState?.loading && (
67
+ <View>
68
+ <Placeholder style={{ marginVertical: 10 }} Animation={Fade}>
69
+ <ScrollView
90
70
  horizontal
91
- showsHorizontalScrollIndicator={false}
92
- data={typesState?.types}
93
- renderItem={renderTypes}
94
- keyExtractor={(type) => type.name}
95
- />
96
- </BusinessCategories>
97
- </>
71
+ showsVerticalScrollIndicator={false}
72
+ showsHorizontalScrollIndicator={false}>
73
+ {[...Array(4)].map((_, i) => (
74
+ <View
75
+ key={i}
76
+ style={{ width: 80, borderRadius: 10, marginRight: 15 }}>
77
+ <PlaceholderLine height={80} noMargin />
78
+ </View>
79
+ ))}
80
+ </ScrollView>
81
+ </Placeholder>
82
+ </View>
98
83
  )}
99
- </BCContainer>
84
+ {!typesState?.loading &&
85
+ !typesState?.error &&
86
+ typesState?.types &&
87
+ typesState?.types.length > 0 && (
88
+ <>
89
+ <BusinessCategories>
90
+ <FlatList
91
+ horizontal
92
+ showsHorizontalScrollIndicator={false}
93
+ data={typesState?.types}
94
+ renderItem={renderTypes}
95
+ keyExtractor={(type) => type.name}
96
+ />
97
+ <TouchableOpacity
98
+ style={{ marginLeft: 15 }}
99
+ onPress={() => setIsOpenAllCategories(true)}
100
+ >
101
+ <OText size={12} color={theme.colors.primary}>{t('SEE_ALL', 'See All')}</OText>
102
+ </TouchableOpacity>
103
+ </BusinessCategories>
104
+ </>
105
+ )}
106
+ </BCContainer>
107
+ <OModal
108
+ open={isOpenAllCategories}
109
+ onClose={() => setIsOpenAllCategories(false)}
110
+ entireModal
111
+ >
112
+ <ScrollView style={styles.allCategoriesContainer}>
113
+ <OText
114
+ size={20}
115
+ mBottom={30}
116
+ color={theme.colors.textSecondary}
117
+ style={{ paddingHorizontal: 10 }}
118
+ >
119
+ {t('ALL_CATEGORIES', 'All categories')}
120
+ </OText>
121
+ <View style={styles.allCategoriesWrapper}>
122
+ {typesState?.types.map((item: any) => (
123
+ <TouchableOpacity
124
+ key={item.id}
125
+ style={styles.categoryStyle}
126
+ onPress={() => {
127
+ handleChangeBusinessType(item.id)
128
+ isOpenAllCategories && setIsOpenAllCategories(false)
129
+ }}
130
+ >
131
+ {item.image ? (
132
+ <OIcon
133
+ url={item.image}
134
+ style={styles.logo}
135
+ />
136
+ ) : (
137
+ <OIcon
138
+ src={theme.images.categories.all}
139
+ style={styles.logo}
140
+ />
141
+ )}
142
+ <OText
143
+ style={{ textAlign: 'center' }}
144
+ size={14}
145
+ color={currentTypeSelected === item.id ? theme.colors.primary : theme.colors.textSecondary}
146
+ numberOfLines={1}
147
+ ellipsizeMode='tail'
148
+ >
149
+ {t(`BUSINESS_TYPE_${item.name.replace(/\s/g, '_').toUpperCase()}`, item.name)}
150
+ </OText>
151
+ </TouchableOpacity>
152
+ ))}
153
+ </View>
154
+ </ScrollView>
155
+ </OModal>
156
+ </>
100
157
  );
101
158
  };
102
159
 
@@ -105,13 +162,30 @@ const styles = StyleSheet.create({
105
162
  padding: 10,
106
163
  },
107
164
  logo: {
108
- width: 75,
109
- height: 75,
165
+ width: windowWidth / 3 - 40,
166
+ height: windowWidth / 3 - 40,
110
167
  marginBottom: 15,
111
- borderRadius: 25,
168
+ borderRadius: 8,
112
169
  justifyContent: 'center',
113
170
  alignItems: 'center',
114
171
  },
172
+ categoryStyle: {
173
+ width: windowWidth / 3 - 40,
174
+ height: 150,
175
+ flexDirection: 'column',
176
+ justifyContent: 'center',
177
+ alignItems: 'center',
178
+ marginHorizontal: 10,
179
+ marginBottom: 40
180
+ },
181
+ allCategoriesContainer : {
182
+ paddingHorizontal: 30,
183
+ paddingVertical: 30
184
+ },
185
+ allCategoriesWrapper: {
186
+ flexDirection: 'row',
187
+ flexWrap: 'wrap',
188
+ }
115
189
  });
116
190
 
117
191
  export const BusinessTypeFilter = (props: BusinessTypeFilterParams) => {
@@ -7,17 +7,17 @@ export const BCContainer = styled.View`
7
7
  text-align: center;
8
8
  `
9
9
 
10
- export const BusinessCategoriesTitle = styled.View`
11
- flex: 1;
12
- `
13
-
14
10
  export const BusinessCategories = styled.View`
15
11
  flex: 1;
16
12
  display: flex;
17
13
  flex-direction: row;
18
14
  justify-content: space-between;
15
+ align-items: center;
19
16
  margin: 10px 0px;
20
17
  width: 100%;
18
+ min-height: 35px;
19
+ border-bottom-width: 1px;
20
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
21
21
  `
22
22
  export const Category = styled.View`
23
23
  height: 150px;
@@ -36,6 +36,7 @@ import { BusinessController } from '../BusinessController';
36
36
  import { OrderTypeSelector } from '../OrderTypeSelector';
37
37
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
38
38
  import { BusinessFeaturedController } from '../BusinessFeaturedController';
39
+ import { HighestRatedBusinesses } from '../HighestRatedBusinesses';
39
40
  import { getTypesText } from '../../utils';
40
41
 
41
42
  const PIXELS_TO_SCROLL = 1000;
@@ -252,6 +253,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
252
253
  </FeaturedWrapper>
253
254
  )}
254
255
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
256
+ <HighestRatedBusinesses onBusinessClick={handleBusinessClick} />
257
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
255
258
  <ListWrapper>
256
259
  <BusinessTypeFilter
257
260
  images={props.images}
@@ -0,0 +1,122 @@
1
+ import React from 'react';
2
+ import {
3
+ BusinessList as BusinessesListingController,
4
+ useLanguage,
5
+ useOrder
6
+ } from 'ordering-components/native';
7
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
8
+ import { View, ScrollView, Platform, Dimensions } from 'react-native';
9
+ import { OText } from '../shared';
10
+ import { HighestRatedBusinessesParams } from '../../types';
11
+ import { BusinessController } from '../BusinessController'
12
+ import {
13
+ ListWrapper
14
+ } from './styles'
15
+
16
+ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
17
+ const {
18
+ businessesList,
19
+ onBusinessClick
20
+ } = props;
21
+
22
+ const [, t] = useLanguage()
23
+ const [orderState] = useOrder();
24
+
25
+ const windowWidth = Dimensions.get('window').width;
26
+
27
+ return (
28
+ <>
29
+ <ListWrapper>
30
+ <OText size={16} mBottom={5} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('HIGHEST_RATED', 'Highest rated')}</OText>
31
+ <OText size={12}>{t('TOP_RATINGS_AND_GREAT_SERVICE', 'Top ratings and great service')}</OText>
32
+ <ScrollView
33
+ showsHorizontalScrollIndicator={false}
34
+ nestedScrollEnabled
35
+ horizontal
36
+ style={{ height: 300 }}
37
+ >
38
+ {businessesList.businesses?.map(
39
+ (business: any) => (
40
+ <View
41
+ key={business.id}
42
+ style={{
43
+ width: windowWidth - 100,
44
+ paddingHorizontal: 5,
45
+ height: '100%'
46
+ }}
47
+ >
48
+ <BusinessController
49
+ business={business}
50
+ handleCustomClick={onBusinessClick}
51
+ orderType={orderState?.options?.type}
52
+ />
53
+ </View>
54
+ )
55
+ )}
56
+ {businessesList.loading && (
57
+ <>
58
+ {[
59
+ ...Array(10).keys()
60
+ ].map((item, i) => (
61
+ <Placeholder
62
+ Animation={Fade}
63
+ key={i}
64
+ style={{
65
+ marginBottom: 20,
66
+ width: windowWidth - 100,
67
+ paddingHorizontal: 5,
68
+ height: '100%'
69
+ }}>
70
+ <View style={{ width: '100%' }}>
71
+ <PlaceholderLine
72
+ height={150}
73
+ style={{ marginBottom: 20, borderRadius: 8 }}
74
+ />
75
+ <View style={{ paddingHorizontal: 10 }}>
76
+ <View
77
+ style={{
78
+ flexDirection: 'row',
79
+ justifyContent: 'space-between',
80
+ }}>
81
+ <PlaceholderLine
82
+ height={15}
83
+ width={40}
84
+ style={{ marginBottom: 15 }}
85
+ />
86
+ <PlaceholderLine
87
+ height={15}
88
+ width={20}
89
+ style={{ marginBottom: 15 }}
90
+ />
91
+ </View>
92
+ <PlaceholderLine
93
+ height={15}
94
+ width={30}
95
+ style={{ marginBottom: 10 }}
96
+ />
97
+ <PlaceholderLine
98
+ height={15}
99
+ width={80}
100
+ style={{ marginBottom: 10 }}
101
+ />
102
+ </View>
103
+ </View>
104
+ </Placeholder>
105
+ ))}
106
+ </>
107
+ )}
108
+ </ScrollView>
109
+ </ListWrapper>
110
+ </>
111
+ )
112
+ }
113
+
114
+ export const HighestRatedBusinesses = (props: any) => {
115
+ const highestRatedBusinessesProps = {
116
+ ...props,
117
+ UIComponent: HighestRatedBusinessesUI,
118
+ initialOrderByValue: 'rating'
119
+ };
120
+
121
+ return <BusinessesListingController {...highestRatedBusinessesProps} />;
122
+ };
@@ -0,0 +1,7 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: 40px;
6
+ padding-top: 30px;
7
+ `;
@@ -129,6 +129,10 @@ export interface BusinessesListingParams {
129
129
  businessTypes?: any;
130
130
  defaultBusinessType?: any;
131
131
  }
132
+ export interface HighestRatedBusinessesParams {
133
+ businessesList: { businesses: Array<any>, loading: boolean, error: null | string };
134
+ onBusinessClick?: void;
135
+ }
132
136
  export interface BusinessTypeFilterParams {
133
137
  businessTypes?: Array<any>;
134
138
  handleChangeBusinessType: any;