ordering-ui-react-native 0.16.52 → 0.16.55

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 (34) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  3. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  4. package/themes/original/index.tsx +0 -6
  5. package/themes/original/src/components/AddressForm/index.tsx +6 -5
  6. package/themes/original/src/components/BusinessBasicInformation/index.tsx +197 -142
  7. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  8. package/themes/original/src/components/BusinessController/index.tsx +116 -78
  9. package/themes/original/src/components/BusinessListingSearch/index.tsx +9 -3
  10. package/themes/original/src/components/BusinessProductsListing/index.tsx +42 -13
  11. package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
  12. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +26 -28
  13. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +241 -95
  14. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
  15. package/themes/original/src/components/BusinessesListing/index.tsx +35 -62
  16. package/themes/original/src/components/GoogleMap/index.tsx +10 -11
  17. package/themes/original/src/components/OrderDetails/index.tsx +32 -34
  18. package/themes/original/src/components/ProductForm/index.tsx +1 -1
  19. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  20. package/themes/original/src/components/ReviewOrder/index.tsx +79 -99
  21. package/themes/original/src/components/ReviewOrder/styles.tsx +0 -9
  22. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  23. package/themes/original/src/components/{Reviews/ReviewOrder → ReviewTrigger}/styles.tsx +2 -21
  24. package/themes/original/src/components/SingleProductCard/index.tsx +122 -90
  25. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  26. package/themes/original/src/components/shared/OBottomPopup.tsx +5 -2
  27. package/themes/original/src/components/shared/OButton.tsx +2 -0
  28. package/themes/original/src/types/index.tsx +2 -5
  29. package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +0 -301
  30. package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +0 -39
  31. package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +0 -326
  32. package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +0 -101
  33. package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +0 -17
  34. package/themes/original/src/components/Reviews/index.tsx +0 -9
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react';
2
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
2
3
  import {
3
4
  BusinessController as BusinessSingleCard,
4
5
  useUtils,
@@ -138,27 +139,27 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
138
139
  }
139
140
 
140
141
  return (
141
- <InView triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(inView)}>
142
- <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
143
- {business?.ribbon?.enabled && (
144
- <RibbonBox
145
- bgColor={business?.ribbon?.color}
146
- isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
147
- isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
148
- >
149
- <OText
150
- size={10}
151
- weight={'400'}
152
- color={theme.colors.white}
153
- numberOfLines={2}
154
- ellipsizeMode='tail'
155
- lineHeight={13}
142
+ <InView style={{ minHeight: 200 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(inView)}>
143
+ {isIntersectionObserver ? (
144
+ <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
145
+ {business?.ribbon?.enabled && (
146
+ <RibbonBox
147
+ bgColor={business?.ribbon?.color}
148
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
149
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
156
150
  >
157
- {business?.ribbon?.text}
158
- </OText>
159
- </RibbonBox>
160
- )}
161
- {isIntersectionObserver && (
151
+ <OText
152
+ size={10}
153
+ weight={'400'}
154
+ color={theme.colors.white}
155
+ numberOfLines={2}
156
+ ellipsizeMode='tail'
157
+ lineHeight={13}
158
+ >
159
+ {business?.ribbon?.text}
160
+ </OText>
161
+ </RibbonBox>
162
+ )}
162
163
  <BusinessHero>
163
164
  <FastImage
164
165
  style={{ height: 120 }}
@@ -186,10 +187,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
186
187
  )}
187
188
  </BusinessState>
188
189
  </BusinessHero>
189
- )}
190
- <BusinessContent>
191
- <BusinessInfo>
192
- {isIntersectionObserver && (
190
+ <BusinessContent>
191
+ <BusinessInfo>
193
192
  <BusinessLogo style={styles.businessLogo}>
194
193
  <FastImage
195
194
  style={{ width: 56, height: 56 }}
@@ -200,64 +199,103 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
200
199
  resizeMode={FastImage.resizeMode.cover}
201
200
  />
202
201
  </BusinessLogo>
203
- )}
204
- <ReviewAndFavorite>
205
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
206
- <Reviews>
207
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
208
- <OText size={10} style={{ lineHeight: 15 }}>
209
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
210
- </OText>
211
- </Reviews>
212
- )}
213
- <TouchableOpacity
214
- onPress={handleChangeFavorite}
215
- >
216
- <IconAntDesign
217
- name={business?.favorite ? 'heart' : 'hearto'}
218
- color={theme.colors.danger5}
219
- size={18}
220
- />
221
- </TouchableOpacity>
222
- </ReviewAndFavorite>
223
- </BusinessInfo>
224
- <OText
225
- size={12}
226
- style={{ lineHeight: 18, marginBottom: 6 }}
227
- weight={'500'}>
228
- {business?.name}
229
- </OText>
230
- <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
231
- {business?.address}
232
- </OText>
233
- {/* <BusinessCategory>
202
+ <ReviewAndFavorite>
203
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
204
+ <Reviews>
205
+ <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
206
+ <OText size={10} style={{ lineHeight: 15 }}>
207
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
208
+ </OText>
209
+ </Reviews>
210
+ )}
211
+ <TouchableOpacity
212
+ onPress={handleChangeFavorite}
213
+ >
214
+ <IconAntDesign
215
+ name={business?.favorite ? 'heart' : 'hearto'}
216
+ color={theme.colors.danger5}
217
+ size={18}
218
+ />
219
+ </TouchableOpacity>
220
+ </ReviewAndFavorite>
221
+ </BusinessInfo>
222
+ <OText
223
+ size={12}
224
+ style={{ lineHeight: 18, marginBottom: 6 }}
225
+ weight={'500'}>
226
+ {business?.name}
227
+ </OText>
228
+ <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
229
+ {business?.address}
230
+ </OText>
231
+ {/* <BusinessCategory>
234
232
  <OText>{getBusinessType()}</OText>
235
233
  </BusinessCategory> */}
236
- <Metadata>
237
- {!isBusinessOpen ? (
238
- <View style={styles.closed}>
239
- <OText size={10} color={theme.colors.red}>
240
- {t('CLOSED', 'Closed')}
241
- </OText>
242
- </View>
243
- ) : (
244
- <View style={styles.bullet}>
245
- {orderState?.options?.type === 1 && (
246
- <OText size={10} color={theme.colors.textSecondary}>
247
- {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
234
+ <Metadata>
235
+ {!isBusinessOpen ? (
236
+ <View style={styles.closed}>
237
+ <OText size={10} color={theme.colors.red}>
238
+ {t('CLOSED', 'Closed')}
248
239
  </OText>
249
- )}
250
- <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
251
- orderState?.options?.type === 1
252
- ? (businessDeliveryTime ?? business?.delivery_time)
253
- : (businessPickupTime ?? business?.pickup_time),
254
- )} \u2022 `}</OText>
255
- <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
240
+ </View>
241
+ ) : (
242
+ <View style={styles.bullet}>
243
+ {orderState?.options?.type === 1 && (
244
+ <OText size={10} color={theme.colors.textSecondary}>
245
+ {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
246
+ </OText>
247
+ )}
248
+ <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
249
+ orderState?.options?.type === 1
250
+ ? (businessDeliveryTime ?? business?.delivery_time)
251
+ : (businessPickupTime ?? business?.pickup_time),
252
+ )} \u2022 `}</OText>
253
+ <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
254
+ </View>
255
+ )}
256
+ </Metadata>
257
+ </BusinessContent>
258
+ </Card>
259
+ ) : (
260
+ <Placeholder
261
+ Animation={Fade}
262
+ style={{ marginBottom: 20 }}>
263
+ <View style={{ width: '100%' }}>
264
+ <PlaceholderLine
265
+ height={200}
266
+ style={{ marginBottom: 20, borderRadius: 25 }}
267
+ />
268
+ <View style={{ paddingHorizontal: 10 }}>
269
+ <View
270
+ style={{
271
+ flexDirection: 'row',
272
+ justifyContent: 'space-between',
273
+ }}>
274
+ <PlaceholderLine
275
+ height={25}
276
+ width={40}
277
+ style={{ marginBottom: 10 }}
278
+ />
279
+ <PlaceholderLine
280
+ height={25}
281
+ width={20}
282
+ style={{ marginBottom: 10 }}
283
+ />
256
284
  </View>
257
- )}
258
- </Metadata>
259
- </BusinessContent>
260
- </Card>
285
+ <PlaceholderLine
286
+ height={20}
287
+ width={30}
288
+ style={{ marginBottom: 10 }}
289
+ />
290
+ <PlaceholderLine
291
+ height={20}
292
+ width={80}
293
+ style={{ marginBottom: 10 }}
294
+ />
295
+ </View>
296
+ </View>
297
+ </Placeholder>
298
+ )}
261
299
  </InView>
262
300
  );
263
301
  };
@@ -33,6 +33,7 @@ import { convertHoursToMinutes } from '../../utils'
33
33
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
34
  import { BusinessSearchParams } from '../../types'
35
35
  import { MyOrders } from '../MyOrders'
36
+ import { useIsFocused } from '@react-navigation/native';
36
37
 
37
38
 
38
39
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
@@ -82,6 +83,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
82
83
  { level: '5', content: '$$$$$' }
83
84
  ]
84
85
 
86
+ const isFocused = useIsFocused();
87
+
85
88
  const styles = StyleSheet.create({
86
89
  container: {
87
90
  paddingHorizontal: 40,
@@ -217,6 +220,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
217
220
  handleSearchbusinessAndProducts(true)
218
221
  }, [])
219
222
 
223
+
224
+ useEffect(() => {
225
+ handleChangeTermValue('')
226
+ }, [isFocused])
227
+
220
228
  const MaxSectionItem = ({ title, options, filter }: any) => {
221
229
  const parseValue = (option: number) => {
222
230
  return filter === 'max_distance'
@@ -309,9 +317,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
309
317
  return (
310
318
  <ScrollView style={styles.container}>
311
319
  <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
312
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', paddingVertical: 20 }}>
313
- <OIcon src={theme.images.general.arrow_left} width={20} />
314
- </TouchableOpacity>
315
320
  <OText
316
321
  size={20}
317
322
  mBottom={15}
@@ -323,6 +328,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
323
328
  </WrapHeader>
324
329
  <SearchWrapper>
325
330
  <SearchBar
331
+ autoFocus
326
332
  lazyLoad
327
333
  inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
328
334
  placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
@@ -10,7 +10,8 @@ import {
10
10
  useUtils,
11
11
  ToastType,
12
12
  useToast,
13
- useConfig
13
+ useConfig,
14
+ useOrderingTheme
14
15
  } from 'ordering-components/native'
15
16
  import { OButton, OIcon, OModal, OText } from '../shared'
16
17
  import Alert from '../../providers/AlertProvider'
@@ -24,17 +25,18 @@ import {
24
25
  TopHeader,
25
26
  WrapSearchBar,
26
27
  WrapContent,
27
- BusinessProductsListingContainer,
28
28
  FiltProductsContainer,
29
29
  ContainerSafeAreaView,
30
30
  BackgroundGray,
31
- ProfessionalFilterWrapper
31
+ ProfessionalFilterWrapper,
32
+ NearBusiness
32
33
  } from './styles'
33
34
  import { FloatingButton } from '../FloatingButton'
34
35
  import { UpsellingRedirect } from './UpsellingRedirect'
35
36
  import Animated from 'react-native-reanimated'
36
37
  import { ProfessionalFilter } from '../ProfessionalFilter';
37
38
  import { ServiceForm } from '../ServiceForm';
39
+ import { BusinessesListing } from '../BusinessesListing/Layout/Original'
38
40
 
39
41
  const PIXELS_TO_SCROLL = 2000
40
42
 
@@ -59,10 +61,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
59
61
  getNextProducts,
60
62
  handleUpdateProducts,
61
63
  professionalSelected,
62
- handleChangeProfessionalSelected
64
+ handleChangeProfessionalSelected,
65
+ onBusinessClick
63
66
  } = props
64
67
 
65
68
  const theme = useTheme();
69
+ const [orderingTheme] = useOrderingTheme()
66
70
  const [, t] = useLanguage()
67
71
  const [{ auth }] = useSession()
68
72
  const [orderState, { clearCart }] = useOrder()
@@ -70,9 +74,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
70
74
  const [, { showToast }] = useToast()
71
75
  const [{ configs }] = useConfig()
72
76
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
77
+
78
+ const isChewLayout = theme?.layouts?.business_view?.components?.header?.components?.layout?.type === 'chew'
79
+ const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
80
+ const showBusinessNearCity = !theme?.layouts?.business_view?.components?.near_business?.hidden
81
+
73
82
  const styles = StyleSheet.create({
74
83
  mainContainer: {
75
- flex: 1,
84
+ flex: 1
76
85
  },
77
86
  BackIcon: {
78
87
  paddingRight: 20,
@@ -240,6 +249,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
240
249
  onClick={() => handleBackNavigation()}
241
250
  imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 30 }}
242
251
  />
252
+
243
253
  </View>
244
254
  {!errorQuantityProducts && (
245
255
  <View style={{ ...styles.headerItem }}>
@@ -267,6 +277,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
267
277
  </WrapSearchBar>
268
278
  )}
269
279
  </TopHeader>
280
+ {showBusinessNearCity && (
281
+ <NearBusiness>
282
+ <BusinessesListing
283
+ logosLayout
284
+ propsToFetch={['id', 'logo', 'location', 'timezone', 'schedule', 'open', 'slug']}
285
+ cityId={businessState?.business?.city_id}
286
+ onBusinessClick={onBusinessClick}
287
+ actualSlug={businessState?.business?.slug}
288
+ />
289
+ </NearBusiness>
290
+ )}
270
291
  </Animated.View>
271
292
 
272
293
  {business?.categories?.length > 0 && isOpenFiltProducts && (
@@ -310,11 +331,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
310
331
  {isOpenFiltProducts && (
311
332
  <BackgroundGray />
312
333
  )}
313
- <BusinessProductsListingContainer
334
+ <IOScrollView
314
335
  stickyHeaderIndices={[2]}
315
- style={styles.mainContainer}
336
+ style={{
337
+ ...styles.mainContainer,
338
+ marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
339
+ 50 : 0
340
+ }}
316
341
  ref={scrollViewRef}
317
- isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
318
342
  onScroll={handlePageScroll}
319
343
  onScrollBeginDrag={handleTouchDrag}
320
344
  scrollEventThrottle={16}
@@ -343,7 +367,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
343
367
  />
344
368
  </ProfessionalFilterWrapper>
345
369
  )}
346
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
370
+ <View
371
+ style={{
372
+ height: 8,
373
+ backgroundColor: theme.colors.backgroundGray100,
374
+ marginTop: isChewLayout && showLogo ? 10 : 0
375
+ }}
376
+ />
347
377
  {!loading && business?.id && (
348
378
  <>
349
379
  {!(business?.categories?.length === 0) && (
@@ -366,7 +396,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
366
396
  </>
367
397
  )}
368
398
  {!loading && business?.id && (
369
- <IOScrollView rootMargin={{ top: 0, bottom: 0 }}>
399
+ <>
370
400
  <WrapContent
371
401
  onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
372
402
  >
@@ -397,7 +427,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
397
427
  handleUpdateProducts={handleUpdateProducts}
398
428
  />
399
429
  </WrapContent>
400
- </IOScrollView>
430
+ </>
401
431
  )}
402
432
  {loading && !error && (
403
433
  <>
@@ -421,8 +451,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
421
451
  </WrapContent>
422
452
  </>
423
453
  )}
424
- </BusinessProductsListingContainer>
425
-
454
+ </IOScrollView>
426
455
  {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
427
456
  <FloatingButton
428
457
  btnText={
@@ -60,3 +60,8 @@ export const ProfessionalFilterWrapper = styled.View`
60
60
  padding-left: 40px;
61
61
  margin-bottom: 35px;
62
62
  `
63
+
64
+ export const NearBusiness = styled.View`
65
+ width: 100%;
66
+ padding-left: 20px;
67
+ `
@@ -270,7 +270,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
270
270
  }, [businessesList?.businesses?.length])
271
271
 
272
272
  return (
273
- <ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
273
+ <IOScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
274
274
  refreshControl={
275
275
  <RefreshControl
276
276
  refreshing={refreshing}
@@ -469,32 +469,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
469
469
  )}
470
470
  />
471
471
  )}
472
- <IOScrollView>
473
- {businessesList.businesses?.map(
474
- (business: any, i: number) => (
475
- <BusinessController
476
- key={`${business.id}_` + i}
477
- enableIntersection
478
- business={business}
479
- isBusinessOpen={business.open}
480
- handleCustomClick={handleBusinessClick}
481
- orderType={orderState?.options?.type}
482
- navigation={navigation}
483
- businessHeader={business?.header}
484
- businessFeatured={business?.featured}
485
- businessLogo={business?.logo}
486
- businessReviews={business?.reviews}
487
- businessDeliveryPrice={business?.delivery_price}
488
- businessDeliveryTime={business?.delivery_time}
489
- businessPickupTime={business?.pickup_time}
490
- businessDistance={business?.distance}
491
- handleUpdateBusinessList={handleUpdateBusinessList}
492
- favoriteIds={favoriteIds}
493
- setFavoriteIds={setFavoriteIds}
494
- />
495
- )
496
- )}
497
- </IOScrollView>
472
+ {businessesList.businesses?.map(
473
+ (business: any, i: number) => (
474
+ <BusinessController
475
+ key={`${business.id}_` + i}
476
+ enableIntersection
477
+ business={business}
478
+ isBusinessOpen={business.open}
479
+ handleCustomClick={handleBusinessClick}
480
+ orderType={orderState?.options?.type}
481
+ navigation={navigation}
482
+ businessHeader={business?.header}
483
+ businessFeatured={business?.featured}
484
+ businessLogo={business?.logo}
485
+ businessReviews={business?.reviews}
486
+ businessDeliveryPrice={business?.delivery_price}
487
+ businessDeliveryTime={business?.delivery_time}
488
+ businessPickupTime={business?.pickup_time}
489
+ businessDistance={business?.distance}
490
+ handleUpdateBusinessList={handleUpdateBusinessList}
491
+ favoriteIds={favoriteIds}
492
+ setFavoriteIds={setFavoriteIds}
493
+ />
494
+ )
495
+ )}
498
496
  {businessesList.loading && (
499
497
  <>
500
498
  {[
@@ -547,7 +545,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
547
545
  </>
548
546
  )}
549
547
  </ListWrapper>
550
- </ScrollView>
548
+ </IOScrollView>
551
549
  );
552
550
  };
553
551