ordering-ui-react-native 0.15.30 → 0.15.32-release

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 (170) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/LoginForm/index.tsx +3 -1
  10. package/src/components/OrderDetails/index.tsx +2 -2
  11. package/src/components/PaymentOptions/index.tsx +9 -16
  12. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  13. package/src/components/SignupForm/index.tsx +3 -1
  14. package/src/components/SingleProductCard/index.tsx +16 -4
  15. package/src/components/StripeElementsForm/index.tsx +27 -48
  16. package/src/components/UpsellingProducts/index.tsx +1 -1
  17. package/src/components/UserProfileForm/index.tsx +63 -6
  18. package/src/components/UserProfileForm/styles.tsx +8 -0
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OModal.tsx +1 -1
  21. package/src/config.json +0 -2
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/HomeNavigator.tsx +6 -0
  24. package/src/pages/BusinessProductsList.tsx +1 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/Checkout.tsx +1 -1
  27. package/src/pages/Sessions.tsx +22 -0
  28. package/src/types/index.tsx +5 -11
  29. package/src/utils/index.tsx +68 -1
  30. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  31. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  32. package/themes/business/src/components/Chat/index.tsx +38 -86
  33. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  34. package/themes/business/src/components/Home/index.tsx +128 -55
  35. package/themes/business/src/components/Home/styles.tsx +8 -1
  36. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  37. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  38. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  39. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  40. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  41. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  43. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  44. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  45. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  46. package/themes/business/src/components/OrdersOption/index.tsx +58 -51
  47. package/themes/business/src/components/PreviousOrders/index.tsx +58 -17
  48. package/themes/business/src/components/shared/OModal.tsx +1 -1
  49. package/themes/business/src/types/index.tsx +5 -1
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  54. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  55. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  56. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  57. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  58. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  59. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  60. package/themes/kiosk/src/components/CustomerName/index.tsx +7 -8
  61. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderDetails/index.tsx +167 -67
  65. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  66. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  67. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  68. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  69. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  70. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  71. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  72. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  73. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/types/index.d.ts +2 -0
  76. package/themes/original/index.tsx +178 -1
  77. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  78. package/themes/original/src/components/AddressList/index.tsx +56 -18
  79. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  80. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  81. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  82. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  83. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  84. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  85. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  86. package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
  87. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  88. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  89. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  90. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  91. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +140 -37
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  94. package/themes/original/src/components/BusinessProductsListing/index.tsx +108 -14
  95. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  96. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  98. package/themes/original/src/components/BusinessesListing/index.tsx +74 -70
  99. package/themes/original/src/components/Cart/index.tsx +21 -17
  100. package/themes/original/src/components/CartContent/index.tsx +2 -2
  101. package/themes/original/src/components/Checkout/index.tsx +59 -48
  102. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  103. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  104. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  105. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  106. package/themes/original/src/components/Help/index.tsx +21 -4
  107. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  108. package/themes/original/src/components/Home/index.tsx +1 -1
  109. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  110. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  111. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  112. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  113. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  114. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  115. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  116. package/themes/original/src/components/Messages/index.tsx +34 -25
  117. package/themes/original/src/components/Messages/styles.tsx +1 -3
  118. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  119. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  120. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  121. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  122. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  123. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  124. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  125. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  126. package/themes/original/src/components/OrdersOption/index.tsx +55 -58
  127. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  128. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  129. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  130. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  131. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  132. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  133. package/themes/original/src/components/PreviousOrders/index.tsx +16 -14
  134. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  135. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  136. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  137. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  138. package/themes/original/src/components/Promotions/index.tsx +250 -0
  139. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  140. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  141. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  142. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  143. package/themes/original/src/components/Sessions/index.tsx +160 -0
  144. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  145. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  146. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  147. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  148. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
  149. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  150. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  151. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  152. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  153. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  154. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  155. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  156. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  157. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  158. package/themes/original/src/components/Wallets/index.tsx +76 -9
  159. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  160. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  161. package/themes/original/src/components/shared/OModal.tsx +4 -2
  162. package/themes/original/src/components/shared/index.tsx +2 -0
  163. package/themes/original/src/config/constants.tsx +6 -6
  164. package/themes/original/src/types/index.tsx +68 -6
  165. package/themes/original/src/utils/index.tsx +28 -2
  166. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  167. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  168. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  169. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  170. package/src/components/StripeMethodForm/index.tsx +0 -174
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import { OButton, OIcon, OModal, OText } from '../shared'
@@ -22,15 +22,18 @@ import {
22
22
  ProgressContentWrapper,
23
23
  ProgressBar,
24
24
  TagsContainer,
25
- SortContainer
25
+ SortContainer,
26
+ BrandContainer,
27
+ BrandItem,
28
+ PriceFilterWrapper
26
29
  } from './styles'
27
30
  import FastImage from 'react-native-fast-image'
28
31
  import { convertHoursToMinutes } from '../../utils'
29
32
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
30
33
  import { BusinessSearchParams } from '../../types'
31
34
 
32
- export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
33
35
 
36
+ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
34
37
  const {
35
38
  navigation,
36
39
  businessesSearchList,
@@ -42,9 +45,11 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
42
45
  handleChangeFilters,
43
46
  filters,
44
47
  businessTypes,
45
- setFilters
48
+ setFilters,
49
+ brandList
46
50
  } = props
47
-
51
+
52
+ const screenHeight = Dimensions.get('window').height;
48
53
  const theme = useTheme()
49
54
  const [orderState] = useOrder()
50
55
  const { top } = useSafeAreaInsets();
@@ -63,11 +68,24 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
63
68
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
64
69
  ]
65
70
 
71
+ const priceList = [
72
+ { level: '1', content: '$' },
73
+ { level: '2', content: '$$' },
74
+ { level: '3', content: '$$$' },
75
+ { level: '4', content: '$$$$' },
76
+ { level: '5', content: '$$$$$' }
77
+ ]
78
+
66
79
  const styles = StyleSheet.create({
67
80
  container: {
68
81
  paddingHorizontal: 40,
69
82
  width: '100%'
70
83
  },
84
+ filterContainer: {
85
+ maxHeight: screenHeight - 150,
86
+ paddingHorizontal: 40,
87
+ width: '100%'
88
+ },
71
89
  searchInput: {
72
90
  fontSize: 10,
73
91
  },
@@ -84,6 +102,12 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
84
102
  flexWrap: 'wrap',
85
103
  justifyContent: 'center'
86
104
  },
105
+ priceContainer: {
106
+ width: '100%',
107
+ flexDirection: 'row',
108
+ flexWrap: 'wrap',
109
+ justifyContent: 'space-between'
110
+ },
87
111
  categoryStyle: {
88
112
  marginRight: 10,
89
113
  marginTop: 10,
@@ -95,6 +119,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
95
119
  height: 28,
96
120
  borderWidth: 0
97
121
  },
122
+ priceItem: {
123
+ marginRight: 10,
124
+ marginTop: 10,
125
+ borderRadius: 50,
126
+ paddingVertical: 4,
127
+ paddingLeft: 5,
128
+ paddingRight: 5,
129
+ height: 27,
130
+ borderWidth: 0
131
+ },
98
132
  applyButton: {
99
133
  paddingHorizontal: 40,
100
134
  width: '100%',
@@ -107,7 +141,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
107
141
  }
108
142
 
109
143
  const handleCloseFilters = () => {
110
- setFilters({ business_types: [], orderBy: 'default' })
144
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
111
145
  setOpenFilters(false)
112
146
  }
113
147
 
@@ -126,6 +160,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
126
160
  }
127
161
  }
128
162
 
163
+ const handleChangeBrandFilter = (brandId: number) => {
164
+ let franchiseIds = [...filters?.franchise_ids]
165
+ if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
166
+ else franchiseIds.push(brandId)
167
+ handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
168
+ }
169
+
170
+ const handleChangePriceRange = (value: string) => {
171
+ if (value === filters?.price_level) handleChangeFilters('price_level', null)
172
+ else handleChangeFilters('price_level', value)
173
+ }
174
+
129
175
  const handleApplyFilters = () => {
130
176
  handleSearchbusinessAndProducts(true)
131
177
  setOpenFilters(false)
@@ -137,6 +183,10 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
137
183
  }
138
184
  }, [filters, openFilters])
139
185
 
186
+ useEffect(() => {
187
+ handleSearchbusinessAndProducts(true)
188
+ }, [])
189
+
140
190
  const MaxSectionItem = ({ title, options, filter }: any) => {
141
191
  const parseValue = (option: number) => {
142
192
  return filter === 'max_distance'
@@ -384,7 +434,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
384
434
  onCancel={() => handleCloseFilters()}
385
435
  onClose={() => handleCloseFilters()}
386
436
  >
387
- <ScrollView style={styles.container}>
437
+ <ScrollView style={styles.filterContainer}>
388
438
  <OText
389
439
  size={20}
390
440
  mBottom={15}
@@ -411,6 +461,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
411
461
  </TouchableOpacity>
412
462
  ))}
413
463
  </SortContainer>
464
+ <BrandContainer>
465
+ <OText
466
+ size={16}
467
+ weight='bold'
468
+ lineHeight={24}
469
+ style={{ marginBottom: 10 }}
470
+ >
471
+ {t('BRANDS', 'Brands')}
472
+ </OText>
473
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
474
+ <ScrollView
475
+ style={{ maxHeight: 300, marginBottom: 10 }}
476
+ showsVerticalScrollIndicator={true}
477
+ nestedScrollEnabled={true}
478
+ >
479
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
480
+ <BrandItem
481
+ key={i}
482
+ onPress={() => handleChangeBrandFilter(brand?.id)}
483
+ >
484
+ <OText
485
+ size={14}
486
+ weight={'400'}
487
+ lineHeight={24}
488
+ >
489
+ {brand?.name}
490
+ </OText>
491
+ {filters?.franchise_ids?.includes(brand?.id) && (
492
+ <AntDesignIcon
493
+ name='check'
494
+ color={theme.colors.success500}
495
+ size={16}
496
+ />
497
+ )}
498
+ </BrandItem>
499
+ ))}
500
+ </ScrollView>
501
+ )}
502
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
503
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
504
+ )}
505
+ </BrandContainer>
506
+ <PriceFilterWrapper>
507
+ <OText
508
+ size={16}
509
+ weight='bold'
510
+ lineHeight={24}
511
+ style={{ marginBottom: 5 }}
512
+ >
513
+ {t('PRICE_RANGE', 'Price range')}
514
+ </OText>
515
+ <View style={styles.priceContainer}>
516
+ {priceList.map((price: any, i: number) => (
517
+ <OButton
518
+ key={i}
519
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
520
+ onClick={() => handleChangePriceRange(price?.level)}
521
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
522
+ style={styles.priceItem}
523
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
524
+ />
525
+ ))}
526
+ </View>
527
+ </PriceFilterWrapper>
414
528
  {orderState?.options?.type === 1 && (
415
529
  <MaxSectionItem
416
530
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
@@ -68,9 +68,22 @@ export const ProgressContentWrapper = styled.View`
68
68
  `
69
69
 
70
70
  export const TagsContainer = styled.View`
71
-
71
+ padding-bottom: 10px;
72
72
  `
73
73
 
74
74
  export const SortContainer = styled.View`
75
75
  margin-bottom: 10px;
76
76
  `
77
+
78
+ export const BrandContainer = styled.View``
79
+
80
+ export const BrandItem = styled.TouchableOpacity`
81
+ flex-direction: row;
82
+ justify-content: space-between;
83
+ margin-bottom: 4px;
84
+ align-items: center;
85
+ `
86
+
87
+ export const PriceFilterWrapper = styled.View`
88
+ margin-bottom: 20px;
89
+ `
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { useLanguage, BusinessMenuListing } from 'ordering-components/native'
3
3
  import { OText } from '../shared'
4
4
  import { BusinessMenuListParams } from '../../types'
@@ -19,7 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
19
19
 
20
20
  const [, t] = useLanguage()
21
21
  const theme = useTheme()
22
- const {top} = useSafeAreaInsets()
22
+ const { top } = useSafeAreaInsets()
23
23
 
24
24
  const styles = StyleSheet.create({
25
25
  container: {
@@ -36,7 +36,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
36
36
  height: 44,
37
37
  width: '100%'
38
38
  }
39
- })
39
+ })
40
40
 
41
41
  const dropDownIcon = () => {
42
42
  return (
@@ -48,12 +48,18 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
48
48
  )
49
49
  }
50
50
 
51
+ useEffect(() => {
52
+ if (!businessMenuList?.loading && businessMenuList?.menus?.length === 1){
53
+ setMenu(businessMenuList?.menus[0])
54
+ }
55
+ }, [businessMenuList?.menus])
56
+
51
57
  return (
52
58
  <>
53
59
  {businessMenuList.loading ? (
54
60
  <Placeholder Animation={Fade}>
55
61
  <View>
56
- <PlaceholderLine height={44}/>
62
+ <PlaceholderLine height={44} />
57
63
  </View>
58
64
  </Placeholder>
59
65
  ) : (
@@ -67,6 +73,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
67
73
  onSelect={(selectedItem, index) => {
68
74
  setMenu(selectedItem)
69
75
  }}
76
+ defaultValue={businessMenuList?.menus?.length === 1 && businessMenuList?.menus[0]}
70
77
  buttonTextAfterSelection={(selectedItem, index) => {
71
78
  return selectedItem.name
72
79
  }}
@@ -51,7 +51,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
51
51
  const [selectDate, setSelectedDate] = useState<any>(null)
52
52
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
53
53
  const [isEnabled, setIsEnabled] = useState(false)
54
- const {top} = useSafeAreaInsets()
54
+ const { top } = useSafeAreaInsets()
55
+ const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
55
57
  const styles = StyleSheet.create({
56
58
  container: {
57
59
  height: windowHeight,
@@ -142,7 +144,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
142
144
 
143
145
  const validateSelectedDate = (curdate: any, menu: any) => {
144
146
  const day = moment(curdate).format('d')
145
- setIsEnabled(menu?.schedule[day]?.enabled || false)
147
+ setIsEnabled(menu?.schedule?.[day]?.enabled || false)
146
148
  }
147
149
 
148
150
  const getTimes = (curdate: any, menu: any) => {
@@ -300,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
300
302
  />
301
303
  </View>
302
304
  </BusinessInfoWrapper>
303
- <PreorderTypeWrapper>
304
- <OText
305
- size={16}
306
- style={{
307
- fontWeight: '600',
308
- lineHeight: 24,
309
- marginBottom: 12
310
- }}
311
- >
312
- {t('PREORDER_TYPE', 'Preorder type')}
313
- </OText>
314
- <SelectDropdown
315
- defaultValueByIndex={selectedPreorderType}
316
- data={preorderTypeList}
317
- // disabled={orderState.loading}
318
- onSelect={(selectedItem, index) => {
319
- setSelectedPreorderType(index)
320
- }}
321
- buttonTextAfterSelection={(selectedItem, index) => {
322
- return selectedItem.name
323
- }}
324
- rowTextForSelection={(item, index) => {
325
- return item.name
326
- }}
327
- buttonStyle={styles.selectOption}
328
- buttonTextStyle={{
329
- color: theme.colors.disabled,
330
- fontSize: 14,
331
- textAlign: 'left',
332
- marginHorizontal: 0
333
- }}
334
- dropdownStyle={{
335
- borderRadius: 8,
336
- borderColor: theme.colors.lightGray,
337
- marginTop: Platform.OS === 'ios' ? 12 : -top
338
- }}
339
- rowStyle={{
340
- borderBottomColor: theme.colors.backgroundGray100,
341
- backgroundColor: theme.colors.backgroundGray100,
342
- height: 40,
343
- flexDirection: 'column',
344
- alignItems: 'flex-start',
345
- paddingTop: 8,
346
- paddingHorizontal: 14
347
- }}
348
- rowTextStyle={{
349
- color: theme.colors.disabled,
350
- fontSize: 14,
351
- marginHorizontal: 0
352
- }}
353
- renderDropdownIcon={() => dropDownIcon()}
354
- dropdownOverlayColor='transparent'
355
- />
356
- </PreorderTypeWrapper>
305
+ {isPreOrderSetting && (
306
+ <PreorderTypeWrapper>
307
+ <OText
308
+ size={16}
309
+ style={{
310
+ fontWeight: '600',
311
+ lineHeight: 24,
312
+ marginBottom: 12
313
+ }}
314
+ >
315
+ {t('PREORDER_TYPE', 'Preorder type')}
316
+ </OText>
317
+ <SelectDropdown
318
+ defaultValueByIndex={selectedPreorderType}
319
+ data={preorderTypeList}
320
+ // disabled={orderState.loading}
321
+ onSelect={(selectedItem, index) => {
322
+ setSelectedPreorderType(index)
323
+ }}
324
+ buttonTextAfterSelection={(selectedItem, index) => {
325
+ return selectedItem.name
326
+ }}
327
+ rowTextForSelection={(item, index) => {
328
+ return item.name
329
+ }}
330
+ buttonStyle={styles.selectOption}
331
+ buttonTextStyle={{
332
+ color: theme.colors.disabled,
333
+ fontSize: 14,
334
+ textAlign: 'left',
335
+ marginHorizontal: 0
336
+ }}
337
+ dropdownStyle={{
338
+ borderRadius: 8,
339
+ borderColor: theme.colors.lightGray,
340
+ marginTop: Platform.OS === 'ios' ? 12 : -top
341
+ }}
342
+ rowStyle={{
343
+ borderBottomColor: theme.colors.backgroundGray100,
344
+ backgroundColor: theme.colors.backgroundGray100,
345
+ height: 40,
346
+ flexDirection: 'column',
347
+ alignItems: 'flex-start',
348
+ paddingTop: 8,
349
+ paddingHorizontal: 14
350
+ }}
351
+ rowTextStyle={{
352
+ color: theme.colors.disabled,
353
+ fontSize: 14,
354
+ marginHorizontal: 0
355
+ }}
356
+ renderDropdownIcon={() => dropDownIcon()}
357
+ dropdownOverlayColor='transparent'
358
+ />
359
+ </PreorderTypeWrapper>
360
+ )}
357
361
  {selectedPreorderType === 1 && (
358
362
  <MenuWrapper>
359
363
  <OText
@@ -373,78 +377,94 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
373
377
  />
374
378
  </MenuWrapper>
375
379
  )}
376
- <OrderTimeWrapper>
380
+ {isPreOrderSetting && showOrderTime && (
381
+ <OrderTimeWrapper>
382
+ <OText
383
+ size={16}
384
+ style={{
385
+ fontWeight: '600',
386
+ lineHeight: 24
387
+ }}
388
+ >
389
+ {t('ORDER_TIME', 'Order time')}
390
+ </OText>
391
+ <View style={{ flex: 1 }}>
392
+ {selectDate && datesWhitelist[0]?.start !== null && (
393
+ <CalendarStrip
394
+ scrollable
395
+ style={styles.calendar}
396
+ calendarHeaderContainerStyle={styles.calendarHeaderContainer}
397
+ calendarHeaderStyle={styles.calendarHeader}
398
+ dateNumberStyle={styles.dateNumber}
399
+ dateNameStyle={styles.dateName}
400
+ iconContainer={{ flex: 0.1 }}
401
+ highlightDateNameStyle={styles.highlightDateName}
402
+ highlightDateNumberStyle={styles.highlightDateNumber}
403
+ dayContainerStyle={{ height: '100%' }}
404
+ highlightDateContainerStyle={{ height: '100%' }}
405
+ calendarHeaderFormat='MMMM, YYYY'
406
+ iconStyle={{ borderWidth: 1 }}
407
+ selectedDate={selectDate}
408
+ datesWhitelist={datesWhitelist}
409
+ disabledDateNameStyle={styles.disabledDateName}
410
+ disabledDateNumberStyle={styles.disabledDateNumber}
411
+ disabledDateOpacity={0.6}
412
+ onDateSelected={(date) => onSelectDate(date)}
413
+ leftSelector={<LeftSelector />}
414
+ rightSelector={<RightSelector />}
415
+ />
416
+ )}
417
+ </View>
418
+ <TimeListWrapper nestedScrollEnabled={true}>
419
+ {(isEnabled && timeList?.length > 0) ? (
420
+ <TimeContentWrapper>
421
+ {timeList.map((time: any, i: number) => (
422
+ <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
+ <TimeItem active={timeSelected === time.value}>
424
+ <OText
425
+ size={14}
426
+ color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
+ style={{
428
+ lineHeight: 24
429
+ }}
430
+ >{time.text}</OText>
431
+ </TimeItem>
432
+ </TouchableOpacity>
433
+ ))}
434
+ {timeList.length % 3 === 2 && (
435
+ <TimeItem style={{ backgroundColor: 'transparent' }} />
436
+ )}
437
+ </TimeContentWrapper>
438
+ ) : (
439
+ <OText
440
+ size={16}
441
+ style={{
442
+ fontWeight: '600',
443
+ lineHeight: 24,
444
+ marginBottom: 12,
445
+ textAlign: 'center'
446
+ }}
447
+ >
448
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
449
+ </OText>
450
+ )}
451
+ </TimeListWrapper>
452
+ </OrderTimeWrapper>
453
+ )}
454
+ {!isPreOrderSetting && (
377
455
  <OText
378
456
  size={16}
379
457
  style={{
380
458
  fontWeight: '600',
381
- lineHeight: 24
459
+ lineHeight: 24,
460
+ marginTop: 30,
461
+ marginBottom: 12,
462
+ textAlign: 'center'
382
463
  }}
383
- >
384
- {t('ORDER_TIME', 'Order time')}
464
+ >
465
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
385
466
  </OText>
386
- <View style={{ flex: 1 }}>
387
- {selectDate && datesWhitelist[0]?.start !== null && (
388
- <CalendarStrip
389
- scrollable
390
- style={styles.calendar}
391
- calendarHeaderContainerStyle={styles.calendarHeaderContainer}
392
- calendarHeaderStyle={styles.calendarHeader}
393
- dateNumberStyle={styles.dateNumber}
394
- dateNameStyle={styles.dateName}
395
- iconContainer={{ flex: 0.1 }}
396
- highlightDateNameStyle={styles.highlightDateName}
397
- highlightDateNumberStyle={styles.highlightDateNumber}
398
- dayContainerStyle={{ height: '100%' }}
399
- highlightDateContainerStyle={{ height: '100%' }}
400
- calendarHeaderFormat='MMMM, YYYY'
401
- iconStyle={{ borderWidth: 1 }}
402
- selectedDate={selectDate}
403
- datesWhitelist={datesWhitelist}
404
- disabledDateNameStyle={styles.disabledDateName}
405
- disabledDateNumberStyle={styles.disabledDateNumber}
406
- disabledDateOpacity={0.6}
407
- onDateSelected={(date) => onSelectDate(date)}
408
- leftSelector={<LeftSelector />}
409
- rightSelector={<RightSelector />}
410
- />
411
- )}
412
- </View>
413
- <TimeListWrapper nestedScrollEnabled={true}>
414
- {(isEnabled && timeList?.length > 0) ? (
415
- <TimeContentWrapper>
416
- {timeList.map((time: any, i: number) => (
417
- <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
418
- <TimeItem active={timeSelected === time.value}>
419
- <OText
420
- size={14}
421
- color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
422
- style={{
423
- lineHeight: 24
424
- }}
425
- >{time.text}</OText>
426
- </TimeItem>
427
- </TouchableOpacity>
428
- ))}
429
- {timeList.length % 3 === 2 && (
430
- <TimeItem style={{ backgroundColor: 'transparent' }} />
431
- )}
432
- </TimeContentWrapper>
433
- ) : (
434
- <OText
435
- size={16}
436
- style={{
437
- fontWeight: '600',
438
- lineHeight: 24,
439
- marginBottom: 12,
440
- textAlign: 'center'
441
- }}
442
- >
443
- {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
444
- </OText>
445
- )}
446
- </TimeListWrapper>
447
- </OrderTimeWrapper>
467
+ )}
448
468
  <OButton
449
469
  text={t('GO_TO_MENU', 'Go to menu')}
450
470
  textStyle={{ color: 'white' }}
@@ -44,11 +44,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
44
44
  borderTopStartRadius: 4,
45
45
  borderTopEndRadius: 4,
46
46
  backgroundColor: theme.colors.textPrimary,
47
- },
48
- tabDeactived: {
47
+ },
48
+ tabDeactived: {
49
49
  marginTop: 10,
50
50
  height: 4
51
- }
51
+ }
52
52
  });
53
53
 
54
54
  const handleCategoryScroll = (category: any) => {
@@ -57,12 +57,12 @@ const BusinessProductsCategoriesUI = (props: any) => {
57
57
 
58
58
  if (!lazyLoadProductsRecommended) {
59
59
  if (category?.id) {
60
- scrollViewRef.current.scrollTo({
60
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
61
61
  y: categoriesLayout[`cat_${category?.id}`]?.y + productListLayout?.y - 70,
62
62
  animated: true
63
63
  })
64
64
  } else {
65
- scrollViewRef.current.scrollTo({
65
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
66
66
  y: productListLayout?.y - 70,
67
67
  animated: true
68
68
  })
@@ -111,8 +111,10 @@ const BusinessProductsCategoriesUI = (props: any) => {
111
111
  categories.length &&
112
112
  categories.map((category: any) => (
113
113
  <Tab
114
- key={category.name}
115
- onPress={() => handleCategoryScroll(category)}
114
+ key={category.id}
115
+ onPress={() => requestAnimationFrame(() => {
116
+ handleCategoryScroll(category)
117
+ })}
116
118
  style={[
117
119
  category.id === 'featured' && !featured && styles.featuredStyle,
118
120
  {
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import { OModal, OText, OIcon } from '../../shared'
3
+ import { ScrollView } from 'react-native'
4
+ import { useUtils } from 'ordering-components/native'
5
+
6
+ interface CategoryDescriptionParams {
7
+ openDescription?: {name: string, image: string, description: string} | null,
8
+ setOpenDescription: any;
9
+ }
10
+
11
+ function categoryDescriptionPropsAreEqual(prev : any, next : any) {
12
+ return prev.openDescription === next.openDescription
13
+ }
14
+
15
+ const CategoryDescription = (props : CategoryDescriptionParams) => {
16
+ const [{ optimizeImage }] = useUtils()
17
+ return (
18
+ <OModal
19
+ open={!!props.openDescription}
20
+ onClose={() => props.setOpenDescription(null)}
21
+ styleContainerCloseButton={{
22
+ marginLeft: -37,
23
+ width: 55,
24
+ height: 55,
25
+ marginTop: 2
26
+ }}
27
+ >
28
+ <OText size={20} style={{ paddingLeft: 70, paddingRight: 20, bottom: 25 }}>{props.openDescription?.name}</OText>
29
+ <ScrollView style={{ padding: 20 }}>
30
+ {!!props.openDescription?.image && (
31
+ <OIcon
32
+ url={optimizeImage(props.openDescription?.image, 'h_100,c_limit')}
33
+ width={240}
34
+ height={240}
35
+ style={{ borderRadius: 7.6 }}
36
+ />
37
+ )}
38
+ <OText mBottom={60}>{props.openDescription?.description}</OText>
39
+ </ScrollView>
40
+ </OModal>
41
+ )
42
+ }
43
+
44
+ export const CategoryDescriptionMemoized = React.memo(CategoryDescription,categoryDescriptionPropsAreEqual)