ordering-ui-react-native 0.16.43 → 0.16.46

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.16.43",
3
+ "version": "0.16.46",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -86,6 +86,7 @@
86
86
  "react-native-google-places-autocomplete": "^2.1.3",
87
87
  "react-native-html-to-pdf": "^0.10.0",
88
88
  "react-native-image-picker": "^4.0.6",
89
+ "react-native-intersection-observer": "^0.0.9",
89
90
  "react-native-lightbox": "^0.8.1",
90
91
  "react-native-linear-gradient": "^2.5.6",
91
92
  "react-native-loading-spinner-overlay": "^2.0.0",
@@ -1,24 +1,25 @@
1
- import React, {useEffect} from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { BusinessesListing as BusinessListingController } from '../components/BusinessesListing'
3
3
  import styled from 'styled-components/native'
4
4
  import { useTheme } from 'styled-components/native'
5
5
 
6
6
  const BusinessesListing = (props: any) => {
7
7
  const theme = useTheme()
8
- const businessId = props.route.params?.businessId
8
+ const businessId = props.route.params?.businessId
9
9
  const categoryId = props.route.params?.categoryId
10
- const productId = props.route.params?.productId
11
- const store = props.route.params?.store
10
+ const productId = props.route.params?.productId
11
+ const store = props.route.params?.store
12
12
 
13
13
  useEffect(() => {
14
- if(store){
15
- props.navigation.navigate('Business', {store,businessId,categoryId,productId})
14
+ if (store) {
15
+ props.navigation.navigate('Business', { store, businessId, categoryId, productId })
16
16
  return
17
17
  }
18
18
  }, [businessId, categoryId, productId, store])
19
19
 
20
20
  const BusinessesListingProps = {
21
21
  ...props,
22
+ navigation: props?.navigation,
22
23
  isSearchByName: true,
23
24
  isSearchByDescription: true,
24
25
  propsToFetch: ['id', 'name', 'header', 'logo', 'ribbon', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import { OrderDetails as OrderDetailsController } from '../components/OrderDetails'
3
3
  import { SafeAreaContainer } from '../layouts/SafeAreaContainer'
4
4
 
5
- const OrderDetails = ({ navigation, route } : any) => {
5
+ const OrderDetails = ({ navigation, route }: any) => {
6
6
  const orderDetailsProps = {
7
7
  navigation,
8
8
  orderId: route.params?.orderId,
@@ -1,14 +1,14 @@
1
1
  import React from 'react'
2
2
  import { Platform } from 'react-native';
3
3
  import styled from 'styled-components/native';
4
- import {ReviewDriver as ReviewDriverController} from '../components/ReviewDriver'
4
+ import { ReviewDriver as ReviewDriverController } from '../components/ReviewDriver'
5
5
  import { SafeAreaContainer } from '../layouts/SafeAreaContainer';
6
6
 
7
7
  const KeyboardView = styled.KeyboardAvoidingView`
8
8
  flex: 1;
9
9
  `;
10
10
 
11
- const ReviewDriver = ({navigation, route} : any) => {
11
+ const ReviewDriver = ({ navigation, route }: any) => {
12
12
  const reviewDriverProps = {
13
13
  navigation,
14
14
  order: route?.params?.order,
@@ -1,14 +1,14 @@
1
1
  import React from 'react'
2
2
  import { Platform } from 'react-native';
3
3
  import styled from 'styled-components/native';
4
- import {ReviewOrder as ReviewOrderController} from '../components/ReviewOrder'
4
+ import { ReviewOrder as ReviewOrderController } from '../components/ReviewOrder'
5
5
  import { SafeAreaContainer } from '../layouts/SafeAreaContainer';
6
6
 
7
7
  const KeyboardView = styled.KeyboardAvoidingView`
8
8
  flex: 1;
9
9
  `;
10
10
 
11
- const ReviewOrder = ({navigation, route} : any) => {
11
+ const ReviewOrder = ({ navigation, route }: any) => {
12
12
  const reviewOrderProps = {
13
13
  navigation,
14
14
  order: route?.params?.order,
@@ -203,7 +203,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
203
203
  multiRemoveProducts && await multiRemoveProducts(unavailableProducts, _carts)
204
204
  return
205
205
  }
206
-
206
+
207
207
  if (alreadyRemoved === 'removed') {
208
208
  setAlertState({ open: true, content: [t('NOT_AVAILABLE_PRODUCT', 'This product is not available.')] })
209
209
  }
@@ -223,7 +223,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
223
223
 
224
224
  return (
225
225
  <>
226
- <ContainerSafeAreaView
226
+ <ContainerSafeAreaView
227
227
  style={{ flex: 1 }}
228
228
  isOpenFiltProducts={isOpenFiltProducts}
229
229
  >
@@ -237,7 +237,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
237
237
  imgRightSrc={null}
238
238
  style={styles.btnBackArrow}
239
239
  onClick={() => handleBackNavigation()}
240
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
240
+ imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 30 }}
241
241
  />
242
242
  </View>
243
243
  {!errorQuantityProducts && (
@@ -255,6 +255,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
255
255
  {isOpenSearchBar && (
256
256
  <WrapSearchBar>
257
257
  <SearchBar
258
+ autoFocus
258
259
  onSearch={handleChangeSearch}
259
260
  onCancel={() => handleCancel()}
260
261
  isCancelXButtonShow
@@ -268,42 +269,42 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
268
269
  </Animated.View>
269
270
 
270
271
  {business?.categories?.length > 0 && isOpenFiltProducts && (
271
- <FiltProductsContainer
272
- isIos={Platform.OS === 'ios'}
273
- style={{
274
- height: Dimensions.get('window').height - filtProductsHeight
275
- }}
276
- >
277
- <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
278
- <BusinessProductsList
279
- categories={[
280
- { id: null, name: t('ALL', 'All') },
281
- { id: 'featured', name: t('FEATURED', 'Featured') },
282
- ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
283
- ]}
284
- category={categorySelected}
285
- categoryState={categoryState}
286
- businessId={business.id}
287
- errors={errors}
288
- onProductClick={onProductClick}
289
- handleSearchRedirect={handleSearchRedirect}
290
- featured={featuredProducts}
291
- searchValue={searchValue}
292
- handleClearSearch={handleChangeSearch}
293
- errorQuantityProducts={errorQuantityProducts}
294
- handleCancelSearch={handleCancel}
295
- categoriesLayout={categoriesLayout}
296
- subcategoriesSelected={subcategoriesSelected}
297
- lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
298
- setCategoriesLayout={setCategoriesLayout}
299
- currentCart={currentCart}
300
- setSubcategoriesSelected={setSubcategoriesSelected}
301
- onClickCategory={handleChangeCategory}
302
- handleUpdateProducts={handleUpdateProducts}
303
- isFiltMode
304
- />
305
- </View>
306
- </FiltProductsContainer>
272
+ <FiltProductsContainer
273
+ isIos={Platform.OS === 'ios'}
274
+ style={{
275
+ height: Dimensions.get('window').height - filtProductsHeight
276
+ }}
277
+ >
278
+ <View style={{ padding: 20, backgroundColor: theme.colors.white }}>
279
+ <BusinessProductsList
280
+ categories={[
281
+ { id: null, name: t('ALL', 'All') },
282
+ { id: 'featured', name: t('FEATURED', 'Featured') },
283
+ ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
284
+ ]}
285
+ category={categorySelected}
286
+ categoryState={categoryState}
287
+ businessId={business.id}
288
+ errors={errors}
289
+ onProductClick={onProductClick}
290
+ handleSearchRedirect={handleSearchRedirect}
291
+ featured={featuredProducts}
292
+ searchValue={searchValue}
293
+ handleClearSearch={handleChangeSearch}
294
+ errorQuantityProducts={errorQuantityProducts}
295
+ handleCancelSearch={handleCancel}
296
+ categoriesLayout={categoriesLayout}
297
+ subcategoriesSelected={subcategoriesSelected}
298
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
299
+ setCategoriesLayout={setCategoriesLayout}
300
+ currentCart={currentCart}
301
+ setSubcategoriesSelected={setSubcategoriesSelected}
302
+ onClickCategory={handleChangeCategory}
303
+ handleUpdateProducts={handleUpdateProducts}
304
+ isFiltMode
305
+ />
306
+ </View>
307
+ </FiltProductsContainer>
307
308
  )}
308
309
  {isOpenFiltProducts && (
309
310
  <BackgroundGray />
@@ -104,8 +104,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
104
104
  },
105
105
  searchInput: {
106
106
  fontSize: 12,
107
- // backgroundColor: theme.colors.white,
108
- paddingLeft: 10,
107
+ paddingLeft: 0,
108
+ paddingRight: 17,
109
109
  paddingTop: 7
110
110
  },
111
111
  iconStyle: {
@@ -97,10 +97,10 @@ export const FilterWrapper = styled.View`
97
97
  `
98
98
 
99
99
  export const ServiceWrapper = styled.View`
100
- padding-left: 40px;
100
+ padding-horizontal: 40px;
101
101
  `
102
102
 
103
103
  export const PriceWrapper = styled.View`
104
- padding-left: 40px;
104
+ padding-horizontal: 40px;
105
105
  margin-top: 30px;
106
106
  `
@@ -332,7 +332,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
332
332
  </OrderControlContainer>
333
333
  </View>
334
334
  <HeaderWrapper
335
- source={theme.images.general.homeHero}
335
+ source={theme.images.backgrounds.business_list_header}
336
336
  style={{ paddingTop: top + 20 }}
337
337
  resizeMode='stretch'
338
338
  >
@@ -1,17 +1,50 @@
1
1
 
2
- import React from 'react'
2
+ import React, { useState, useEffect } from 'react'
3
+ import { useOrder, useSession } from 'ordering-components/native';
4
+
3
5
  import { useTheme } from 'styled-components/native'
4
6
  import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
5
7
  import { BusinessesListing as AppointmentBusinessListing } from './Layout/Appointment'
6
8
 
7
9
  export const BusinessesListing = (props: any) => {
8
- const theme = useTheme()
9
- const layout = theme?.layout?.businessListing?.layout?.type || 'original'
10
+ const theme = useTheme()
11
+ const layout = theme?.layout?.businessListing?.layout?.type || 'original'
12
+ const [{ auth }] = useSession()
13
+ const [, { getLastOrderHasNoReview }] = useOrder();
14
+ const [, setIsReviewed] = useState(false)
15
+ const handleOrderReview = (order: any) => {
16
+ props?.navigation && props.navigation.navigate(
17
+ 'ReviewOrder',
18
+ {
19
+ order: {
20
+ id: order?.id,
21
+ business_id: order?.business_id,
22
+ business_name: order?.business?.name,
23
+ delivery_datetime: order?.delivery_datetime,
24
+ logo: order.business?.logo,
25
+ driver: order?.driver,
26
+ products: order?.products,
27
+ review: order?.review,
28
+ user_review: order?.user_review
29
+ },
30
+ setIsReviewed
31
+ }
32
+ )
33
+ }
34
+
35
+ const _getLastOrderHasNoReview = async () => {
36
+ const lastOrderHasNoReview = await getLastOrderHasNoReview()
37
+ lastOrderHasNoReview && handleOrderReview(lastOrderHasNoReview)
38
+ }
39
+
40
+ useEffect(() => {
41
+ auth && _getLastOrderHasNoReview()
42
+ }, [auth])
10
43
 
11
- return (
44
+ return (
12
45
  <>
13
46
  {(layout === 'original') && <OriginalBusinessListing {...props} />}
14
47
  {(layout === 'appointment') && <AppointmentBusinessListing {...props} />}
15
48
  </>
16
- )
49
+ )
17
50
  }
@@ -62,7 +62,7 @@ const NavBar = (props: Props) => {
62
62
  <Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
63
63
  <OButton
64
64
  imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
65
- imgLeftStyle={{width: 18}}
65
+ imgLeftStyle={{ width: 18 }}
66
66
  imgRightSrc={null}
67
67
  style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
68
68
  onClick={props?.onActionLeft}
@@ -126,9 +126,9 @@ NavBar.defaultProps = {
126
126
  textAlign: 'center'
127
127
  };
128
128
 
129
- const areEqual=(prevProps: { route?: any; }, nextProps: { route?: any; })=>{
130
- return prevProps.route === nextProps.route
131
- return true
129
+ const areEqual = (prevProps: { route?: any; }, nextProps: { route?: any; }) => {
130
+ return prevProps.route === nextProps.route
131
+ return true
132
132
  }
133
133
 
134
134
  export default React.memo(NavBar, areEqual);
@@ -354,6 +354,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
354
354
  id: order?.id,
355
355
  business_id: order?.business_id,
356
356
  logo: order.business?.logo,
357
+ business_name: order?.business?.name,
358
+ delivery_datetime: order?.delivery_datetime,
357
359
  driver: order?.driver,
358
360
  products: order?.products,
359
361
  review: order?.review,
@@ -370,7 +370,7 @@ export const ProductOptionsUI = (props: any) => {
370
370
  <SafeAreaView style={{ flex: 1 }}>
371
371
  <TopHeader>
372
372
  <TopActions onPress={() => handleGoBack()}>
373
- <OIcon src={theme.images.general.arrow_left} width={15} />
373
+ <OIcon src={theme.images.general.arrow_left} width={30} />
374
374
  </TopActions>
375
375
  </TopHeader>
376
376
  <ScrollView ref={scrollViewRef}>
@@ -62,7 +62,7 @@ export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
62
62
 
63
63
  const onDateChange = (date: any) => {
64
64
  setSelectedDate(date)
65
- dropdownRef.current.reset()
65
+ dropdownRef?.current && dropdownRef.current.reset()
66
66
  }
67
67
 
68
68
  const dropDownIcon = () => {
@@ -191,9 +191,9 @@ export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
191
191
  {t('REQUIRED', 'Required')}
192
192
  </OText>
193
193
  </View>
194
- {(!!professional?.schedule && isEnabled) ? (
194
+ {!!professional?.schedule ? (
195
195
  <CalendarWrapper>
196
- {timeList?.length > 0 ? (
196
+ {(timeList?.length > 0 && isEnabled) ? (
197
197
  <SelectDropdown
198
198
  ref={dropdownRef}
199
199
  data={timeList}
@@ -237,11 +237,12 @@ export const ProfessionalProfile = (props: ProfessionalProfileParams) => {
237
237
  />
238
238
  ) : (
239
239
  <OText
240
- size={20}
240
+ size={12}
241
241
  style={{ marginBottom: 30 }}
242
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
242
+ weight={'400'}
243
+ color={theme.colors?.danger5}
243
244
  >
244
- {t('NOT_AVAILABLE', 'Not available')}
245
+ {t('PROFESSIONAL_NOT_AVAILABLE', 'Professional is not available at the moment')}
245
246
  </OText>
246
247
  )}
247
248
 
@@ -44,7 +44,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
44
44
  photoWrapper: {
45
45
  shadowColor: theme.colors.black,
46
46
  shadowRadius: 3,
47
- shadowOffset: {width: 1, height: 4},
47
+ shadowOffset: { width: 1, height: 4 },
48
48
  elevation: 3,
49
49
  borderRadius: 8,
50
50
  shadowOpacity: 0.1,
@@ -86,11 +86,11 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
86
86
  const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
87
87
 
88
88
  const qualificationList = [
89
- { key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
89
+ { key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
90
90
  { key: 2, text: t('BAD', 'Bad'), percent: 0.25, parentStyle: { left: '25%' }, isInnerStyle: true, pointerColor: true },
91
91
  { key: 3, text: t('OKAY', 'Okay'), percent: 0.5, parentStyle: { left: '50%' }, isInnerStyle: true, pointerColor: true },
92
92
  { key: 4, text: t('GOOD', 'Good'), percent: 0.75, parentStyle: { left: '75%' }, isInnerStyle: true, pointerColor: true },
93
- { key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
93
+ { key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
94
94
  ]
95
95
 
96
96
  const commentsList = reviewCommentList('driver')
@@ -204,7 +204,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
204
204
  <OIcon
205
205
  url={order?.driver?.photo}
206
206
  src={!order?.driver?.photo && theme.images.general.user}
207
- cover={order?.driver?.photo ? true: false}
207
+ cover={order?.driver?.photo ? true : false}
208
208
  width={80}
209
209
  height={80}
210
210
  />
@@ -212,7 +212,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
212
212
  <OText weight={500} style={{ marginVertical: 10 }} color={theme.colors.textNormal}>{order?.driver?.name} {order?.driver?.lastname}</OText>
213
213
  </DriverPhotoContainer>
214
214
 
215
- <View style={{flex: 1, justifyContent: 'flex-end'}}>
215
+ <View style={{ flex: 1, justifyContent: 'flex-end' }}>
216
216
  <FormReviews>
217
217
  <OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_DRIVER', 'How was your driver?')}</OText>
218
218
  <RatingBarContainer>
@@ -264,7 +264,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
264
264
  style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
265
265
  imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
266
266
  imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
267
- onClick={() => handleChangeComment(commentItem) }
267
+ onClick={() => handleChangeComment(commentItem)}
268
268
  />
269
269
  ))}
270
270
  </CommentsButtonGroup>