ordering-ui-react-native 0.16.79 → 0.16.80-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 (216) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +10 -10
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +2 -2
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  13. package/src/components/SingleProductReview/index.tsx +7 -4
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/components/shared/OToast.tsx +4 -4
  16. package/src/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  18. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  19. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  20. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  21. package/themes/business/src/components/Chat/index.tsx +31 -31
  22. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  23. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  24. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  25. package/themes/business/src/components/LoginForm/index.tsx +236 -80
  26. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  27. package/themes/business/src/components/MapView/index.tsx +14 -3
  28. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  30. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  31. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -47
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  33. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  34. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  35. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  36. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  37. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  40. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  44. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  46. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  47. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  48. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  49. package/themes/business/src/components/ProductItemAccordion/index.tsx +30 -5
  50. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  51. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  52. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  53. package/themes/business/src/components/shared/OLink.tsx +33 -13
  54. package/themes/business/src/components/shared/OText.tsx +8 -2
  55. package/themes/business/src/types/index.tsx +36 -3
  56. package/themes/business/src/utils/index.tsx +53 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  61. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  62. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  63. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  64. package/themes/kiosk/src/components/LoginForm/index.tsx +476 -153
  65. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  66. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  67. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  69. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  70. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  71. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  72. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  73. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  74. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  75. package/themes/kiosk/src/types/index.d.ts +14 -0
  76. package/themes/kiosk/src/utils/index.tsx +15 -0
  77. package/themes/original/index.tsx +8 -0
  78. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  79. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  80. package/themes/original/src/components/AddressList/index.tsx +18 -18
  81. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +124 -78
  84. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  85. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  86. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +102 -155
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +11 -8
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +562 -495
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  102. package/themes/original/src/components/Cart/index.tsx +75 -41
  103. package/themes/original/src/components/CartContent/index.tsx +80 -18
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +101 -106
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +42 -26
  134. package/themes/original/src/components/MomentOption/index.tsx +22 -14
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +152 -77
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +7 -6
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  150. package/themes/original/src/components/OrderProgress/index.tsx +81 -105
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +86 -92
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -254
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +78 -66
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +112 -77
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +177 -164
  206. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  207. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  208. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  209. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  210. package/themes/original/src/components/shared/OButton.tsx +9 -4
  211. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  212. package/themes/original/src/components/shared/OInput.tsx +10 -1
  213. package/themes/original/src/layouts/Container.tsx +13 -9
  214. package/themes/original/src/types/index.tsx +42 -7
  215. package/themes/original/src/utils/index.tsx +322 -58
  216. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -16,26 +16,19 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { Platform, StyleSheet, View } from 'react-native';
19
+ import { StyleSheet, View } from 'react-native';
20
20
  import { BusinessInformationParams } from '../../types';
21
21
  import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
+ import { ScheduleAccordion } from '../ScheduleAccordion';
24
25
  const BusinessInformationUI = (props: BusinessInformationParams) => {
25
26
  const { businessState, businessSchedule, businessLocation } = props;
26
27
 
27
28
  const theme = useTheme();
28
29
  const [, t] = useLanguage();
29
30
  const [{ optimizeImage }] = useUtils();
30
- const daysOfWeek = [
31
- t('SUNDAY_ABBREVIATION', 'Sun'),
32
- t('MONDAY_ABBREVIATION', 'Mon'),
33
- t('TUESDAY_ABBREVIATION', 'Tues'),
34
- t('WEDNESDAY_ABBREVIATION', 'Wed'),
35
- t('THURSDAY_ABBREVIATION', 'Thur'),
36
- t('FRIDAY_ABBREVIATION', 'Fri'),
37
- t('SATURDAY_ABBREVIATION', 'Sat'),
38
- ];
31
+
39
32
  const scheduleFormatted = ({
40
33
  hour,
41
34
  minute,
@@ -112,25 +105,11 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
112
105
  <WrapScheduleBlock>
113
106
  {businessSchedule.map((schedule: any, i: number) => (
114
107
  <ScheduleBlock key={i}>
115
- <OText
116
- lineHeight={21}
117
- mBottom={16}
118
- size={14}
119
- weight={Platform.OS === 'android' ? 'bold' : '600'}
120
- style={{ flexBasis: '20%' }}>
121
- {daysOfWeek[i].toUpperCase()}
122
- </OText>
123
- {schedule.enabled ? (
124
- <OText mBottom={16}>
125
- {scheduleFormatted(schedule.lapses[0].open) +
126
- ' - ' +
127
- scheduleFormatted(schedule.lapses[0].close)}
128
- </OText>
129
- ) : (
130
- <OText color={theme.colors.red} mBottom={16}>
131
- {t('CLOSED', 'Closed')}
132
- </OText>
133
- )}
108
+ <ScheduleAccordion
109
+ weekIndex={i}
110
+ scheduleFormatted={scheduleFormatted}
111
+ schedule={schedule}
112
+ />
134
113
  </ScheduleBlock>
135
114
  ))}
136
115
  </WrapScheduleBlock>
@@ -152,10 +131,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
152
131
  style={{ width: 210, height: 127, borderRadius: 7.6 }}
153
132
  javaScriptEnabled={true}
154
133
  domStorageEnabled={true}
155
- source={{
134
+ source={{
156
135
  html: `
157
136
  <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
158
- `,
137
+ `,
159
138
  }}
160
139
  mediaPlaybackRequiresUserAction={true}
161
140
  />
@@ -41,10 +41,16 @@ export const BusinessItemAccordion = (props: any) => {
41
41
  useEffect(() => {
42
42
  const cartsArray = Object.values(orderState?.carts)
43
43
  const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
44
- if ((cartsLength === 1) && !isClosed) {
45
- setActiveState(true)
44
+ if (cartsLength === 1) {
45
+ setActiveState(!isClosed)
46
46
  }
47
- }, [orderState?.carts])
47
+ }, [orderState?.carts, isClosed])
48
+
49
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
50
+ if (item?.type === 1)
51
+ return acc = acc + item?.summary?.tax
52
+ return acc = acc
53
+ }, cart?.subtotal)
48
54
 
49
55
  return (
50
56
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
@@ -102,7 +108,7 @@ export const BusinessItemAccordion = (props: any) => {
102
108
  <OText
103
109
  size={12}
104
110
  lineHeight={18}
105
- color={theme.colors.textSecondary}
111
+ color={theme.colors.primary}
106
112
  style={{ textDecorationLine: 'underline' }}
107
113
  >
108
114
  {t('CHANGE_STORE', 'Change store')}
@@ -149,9 +155,9 @@ export const BusinessItemAccordion = (props: any) => {
149
155
  <OButton
150
156
  onClick={handleClickCheckout}
151
157
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
158
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
159
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
160
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
161
  borderColor={theme.colors.primary}
156
162
  isDisabled={checkoutButtonDisabled}
157
163
  />
@@ -0,0 +1,57 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
+
5
+ export const BusinessControllerSkeletons = ({ paginationProps }: any) => {
6
+ return (
7
+ <>
8
+ {[
9
+ ...Array(
10
+ paginationProps.nextPageItems
11
+ ? paginationProps.nextPageItems
12
+ : 3,
13
+ ).keys(),
14
+ ].map((item, i) => (
15
+ <Placeholder
16
+ Animation={Fade}
17
+ key={i}
18
+ style={{ width: 320, marginRight: 20, marginTop: 20 }}>
19
+ <View style={{ width: 320 }}>
20
+ <PlaceholderLine
21
+ height={155}
22
+ style={{ marginBottom: 20, borderRadius: 25 }}
23
+ />
24
+ <View style={{ paddingHorizontal: 10 }}>
25
+ <View
26
+ style={{
27
+ flexDirection: 'row',
28
+ justifyContent: 'space-between',
29
+ }}>
30
+ <PlaceholderLine
31
+ height={25}
32
+ width={40}
33
+ style={{ marginBottom: 10 }}
34
+ />
35
+ <PlaceholderLine
36
+ height={25}
37
+ width={20}
38
+ style={{ marginBottom: 10 }}
39
+ />
40
+ </View>
41
+ <PlaceholderLine
42
+ height={20}
43
+ width={30}
44
+ style={{ marginBottom: 10 }}
45
+ />
46
+ <PlaceholderLine
47
+ height={20}
48
+ width={80}
49
+ style={{ marginBottom: 0 }}
50
+ />
51
+ </View>
52
+ </View>
53
+ </Placeholder>
54
+ ))}
55
+ </>
56
+ )
57
+ }
@@ -0,0 +1,59 @@
1
+ import { useLanguage, useUtils } from 'ordering-components/native'
2
+ import React from 'react'
3
+ import { View, TouchableOpacity, StyleSheet } from 'react-native'
4
+ import { OText } from '../../shared'
5
+
6
+ import { ProgressContentWrapper, ProgressBar } from './styles'
7
+
8
+ export const MaxSectionItem = (props: any) => {
9
+ const {
10
+ filters,
11
+ handleChangeFilters,
12
+ title,
13
+ options,
14
+ filter
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+ const [{ parsePrice }] = useUtils();
19
+
20
+ const styles = StyleSheet.create({
21
+ maxContainer: {
22
+ flexDirection: 'row',
23
+ justifyContent: 'space-between'
24
+ }
25
+ });
26
+
27
+ const parseValue = (option: number) => {
28
+ return filter === 'max_distance'
29
+ ? `${option / 1000} ${t('KM', 'Km')}`
30
+ : filter === 'max_eta'
31
+ ? `${option} ${t('MIN', 'min')}`
32
+ : parsePrice(option)
33
+ }
34
+ return (
35
+ <View style={{ marginBottom: 20 }}>
36
+ <OText weight='bold' mBottom={10} size={16}>
37
+ {title}
38
+ </OText>
39
+ <ProgressContentWrapper>
40
+ <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
41
+ </ProgressContentWrapper>
42
+ <View style={styles.maxContainer}>
43
+ {options.map((option: any, i: number) => (
44
+ <TouchableOpacity
45
+ onPress={() => handleChangeFilters(filter, option)}
46
+ key={option}
47
+ >
48
+ <OText
49
+ size={12}
50
+ weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
51
+ >
52
+ {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
53
+ </OText>
54
+ </TouchableOpacity>
55
+ ))}
56
+ </View>
57
+ </View>
58
+ )
59
+ }
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const ProgressBar = styled.View`
4
+ height: 4px;
5
+ background: ${(props: any) => props.theme.colors.textNormal};
6
+ `
7
+
8
+ export const ProgressContentWrapper = styled.View`
9
+ height: 4px;
10
+ background: #F8F9FA;
11
+ margin-bottom: 10px;
12
+ flex: 1;
13
+ `
@@ -3,7 +3,7 @@ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastTy
3
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
- import { OButton, OIcon, OModal, OText } from '../shared'
6
+ import { OButton, OModal, OText } from '../shared'
7
7
  import { SearchBar } from '../SearchBar';
8
8
  import { BusinessController } from '../BusinessController'
9
9
  import { NotFoundSource } from '../NotFoundSource'
@@ -19,14 +19,14 @@ import {
19
19
  Metadata,
20
20
  SingleBusinessContainer,
21
21
  LoadMoreBusinessContainer,
22
- ProgressContentWrapper,
23
- ProgressBar,
24
22
  TagsContainer,
25
23
  SortContainer,
26
24
  BrandContainer,
27
25
  BrandItem,
28
26
  PriceFilterWrapper,
29
- OptionTitle
27
+ OptionTitle,
28
+ BContainer,
29
+ WrapperButtons
30
30
  } from './styles'
31
31
  import FastImage from 'react-native-fast-image'
32
32
  import { convertHoursToMinutes } from '../../utils'
@@ -34,8 +34,8 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
34
  import { BusinessSearchParams } from '../../types'
35
35
  import { MyOrders } from '../MyOrders'
36
36
  import { useIsFocused } from '@react-navigation/native';
37
-
38
-
37
+ import { MaxSectionItem } from './MaxSectionItem'
38
+ import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
39
39
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
40
40
  const {
41
41
  navigation,
@@ -52,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
52
52
  brandList,
53
53
  onNavigationRedirect,
54
54
  handleUpdateBusinessList,
55
- handleUpdateProducts
55
+ handleUpdateProducts,
56
+ brandId
56
57
  } = props
57
58
 
58
59
  const screenHeight = Dimensions.get('window').height;
@@ -75,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
75
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
76
77
  ]
77
78
 
79
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
+
78
81
  const priceList = [
79
82
  { level: '1', content: '$' },
80
83
  { level: '2', content: '$$' },
@@ -96,15 +99,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
96
99
  width: '100%'
97
100
  },
98
101
  searchInput: {
99
- fontSize: 10,
102
+ fontSize: 12,
100
103
  },
101
104
  productsContainer: {
102
105
  marginTop: 20
103
106
  },
104
- maxContainer: {
105
- flexDirection: 'row',
106
- justifyContent: 'space-between'
107
- },
108
107
  businessTypesContainer: {
109
108
  width: '100%',
110
109
  flexDirection: 'row',
@@ -139,7 +138,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
139
138
  borderWidth: 0
140
139
  },
141
140
  applyButton: {
142
- paddingHorizontal: 40,
141
+ paddingHorizontal: 10,
143
142
  width: '100%',
144
143
  marginTop: 20
145
144
  }
@@ -150,10 +149,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
150
149
  }
151
150
 
152
151
  const handleCloseFilters = () => {
153
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
152
+ clearFilters()
154
153
  setOpenFilters(false)
155
154
  }
156
155
 
156
+ const clearFilters = () => {
157
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
158
+ }
159
+
157
160
  const handleChangeActiveBusinessType = (type: any) => {
158
161
  if (type?.id === null) {
159
162
  handleChangeFilters('business_types', [])
@@ -188,7 +191,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
188
191
 
189
192
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
190
193
 
191
- const onProductClick = (business: any, categoryId: any, productId: any) => {
194
+
195
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
192
196
  if (!isInteger(business?.id) ||
193
197
  !isInteger(categoryId) ||
194
198
  !isInteger(productId) ||
@@ -196,17 +200,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
196
200
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
197
201
  return
198
202
  }
199
-
203
+ const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
204
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
200
205
  navigation.navigate('ProductDetails', {
201
206
  isRedirect: 'business',
202
207
  businessId: business?.id,
203
208
  categoryId: categoryId,
204
209
  productId: productId,
210
+ product: product,
205
211
  business: {
206
212
  store: business.slug,
207
213
  header: business.header,
208
214
  logo: business.logo,
209
- }
215
+ },
216
+ productAddedToCartLength
210
217
  })
211
218
  }
212
219
 
@@ -220,125 +227,29 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
220
227
  handleSearchbusinessAndProducts(true)
221
228
  }, [])
222
229
 
223
-
230
+
224
231
  useEffect(() => {
225
232
  handleChangeTermValue('')
226
233
  }, [isFocused])
227
234
 
228
- const MaxSectionItem = ({ title, options, filter }: any) => {
229
- const parseValue = (option: number) => {
230
- return filter === 'max_distance'
231
- ? `${option / 1000} ${t('KM', 'Km')}`
232
- : filter === 'max_eta'
233
- ? `${option} ${t('MIN', 'min')}`
234
- : parsePrice(option)
235
- }
236
- return (
237
- <View style={{ marginBottom: 20 }}>
238
- <OText weight='bold' mBottom={10} size={16}>
239
- {title}
240
- </OText>
241
- <ProgressContentWrapper>
242
- <ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
243
- </ProgressContentWrapper>
244
- <View style={styles.maxContainer}>
245
- {options.map((option: any, i: number) => (
246
- <TouchableOpacity
247
- onPress={() => handleChangeFilters(filter, option)}
248
- key={option}
249
- >
250
- <OText
251
- size={12}
252
- weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
253
- >
254
- {option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
255
- </OText>
256
- </TouchableOpacity>
257
- ))}
258
- </View>
259
- </View>
260
- )
261
- }
262
-
263
- const BusinessControllerSkeletons = () => {
264
- return (
265
- <>
266
- {[
267
- ...Array(
268
- paginationProps.nextPageItems
269
- ? paginationProps.nextPageItems
270
- : 3,
271
- ).keys(),
272
- ].map((item, i) => (
273
- <Placeholder
274
- Animation={Fade}
275
- key={i}
276
- style={{ width: 320, marginRight: 20, marginTop: 20 }}>
277
- <View style={{ width: 320 }}>
278
- <PlaceholderLine
279
- height={155}
280
- style={{ marginBottom: 20, borderRadius: 25 }}
281
- />
282
- <View style={{ paddingHorizontal: 10 }}>
283
- <View
284
- style={{
285
- flexDirection: 'row',
286
- justifyContent: 'space-between',
287
- }}>
288
- <PlaceholderLine
289
- height={25}
290
- width={40}
291
- style={{ marginBottom: 10 }}
292
- />
293
- <PlaceholderLine
294
- height={25}
295
- width={20}
296
- style={{ marginBottom: 10 }}
297
- />
298
- </View>
299
- <PlaceholderLine
300
- height={20}
301
- width={30}
302
- style={{ marginBottom: 10 }}
303
- />
304
- <PlaceholderLine
305
- height={20}
306
- width={80}
307
- style={{ marginBottom: 0 }}
308
- />
309
- </View>
310
- </View>
311
- </Placeholder>
312
- ))}
313
- </>
314
- )
315
- }
316
-
317
235
  return (
318
- <ScrollView style={styles.container}>
319
- <WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
320
- <OText
321
- size={20}
322
- mBottom={15}
323
- weight='bold'
324
- style={{ marginTop: 10 }}
325
- >
326
- {t('SEARCH', 'Search')}
327
- </OText>
328
- </WrapHeader>
236
+ <BContainer
237
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
238
+ >
329
239
  <SearchWrapper>
330
- {isFocused && (
331
- <SearchBar
332
- autoFocus
333
- lazyLoad
334
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
335
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
336
- onSearch={(val: string) => handleChangeTermValue(val)}
337
- value={termValue}
338
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
339
- />
340
- )}
240
+ <SearchBar
241
+ lazyLoad
242
+ {...(isChewLayout && { height: 55 })}
243
+ inputStyle={{ ...styles.searchInput }}
244
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
245
+ onSearch={(val: string) => handleChangeTermValue(val)}
246
+ value={termValue}
247
+ iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
248
+ />
341
249
  </SearchWrapper>
250
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
251
+ {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
252
+ </OText>
342
253
  {
343
254
  noResults && (
344
255
  <View>
@@ -348,32 +259,48 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
348
259
  </View>
349
260
  )
350
261
  }
351
- {businessesSearchList.businesses?.length > 0 && (
262
+ {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
352
263
  <MyOrders
353
264
  hideOrders
354
265
  businessesSearchList={businessesSearchList}
355
266
  onNavigationRedirect={onNavigationRedirect}
356
267
  BusinessControllerSkeletons={BusinessControllerSkeletons}
268
+ businessPaginationProps={paginationProps}
269
+ franchiseId={brandId}
270
+ hideBackBtn
271
+ titleStyle={{
272
+ paddingHorizontal: 0,
273
+ marginTop: 0,
274
+ marginLeft: 0
275
+ }}
357
276
  />
358
277
  )}
359
278
 
360
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
361
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
362
- {t('BUSINESSES', 'Businesses')}
363
- </OText>
364
- </OptionTitle>
365
- <ScrollView horizontal>
279
+ {businessesSearchList.businesses?.length > 0 && (
280
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
282
+ {t('BUSINESSES', 'Businesses')}
283
+ </OText>
284
+ </OptionTitle>
285
+ )}
286
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
366
287
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
367
- <BusinessController
288
+ <View
368
289
  key={business.id}
369
- business={business}
370
- isBusinessOpen={business.open}
371
- enableIntersection={false}
372
- handleCustomClick={() => onBusinessClick(business)}
373
- handleUpdateBusinessList={handleUpdateBusinessList}
374
- orderType={orderState?.options?.type}
375
- style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
376
- />
290
+ style={{
291
+ width: screenWidth - 120,
292
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
293
+ }}
294
+ >
295
+ <BusinessController
296
+ business={business}
297
+ isBusinessOpen={business.open}
298
+ enableIntersection={false}
299
+ handleCustomClick={() => onBusinessClick(business)}
300
+ handleUpdateBusinessList={handleUpdateBusinessList}
301
+ orderType={orderState?.options?.type}
302
+ />
303
+ </View>
377
304
  ))}
378
305
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
379
306
  <LoadMoreBusinessContainer>
@@ -387,7 +314,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
387
314
  </LoadMoreBusinessContainer>
388
315
  )}
389
316
  {businessesSearchList.loading && (
390
- <BusinessControllerSkeletons />
317
+ <BusinessControllerSkeletons paginationProps={paginationProps} />
391
318
  )}
392
319
  </ScrollView>
393
320
  <ProductsList>
@@ -442,7 +369,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
442
369
  product={product}
443
370
  enableIntersection={false}
444
371
  businessId={business?.id}
445
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
372
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
446
373
  productAddedToCartLength={0}
447
374
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
448
375
  style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
@@ -471,7 +398,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
471
398
  </View>
472
399
  </Placeholder>
473
400
  <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
474
- <View style={{ flexDirection: 'row-reverse' }}>
401
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
475
402
  <PlaceholderLine
476
403
  width={24}
477
404
  height={70}
@@ -588,22 +515,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
588
515
  </PriceFilterWrapper>
589
516
  {orderState?.options?.type === 1 && (
590
517
  <MaxSectionItem
518
+ filters={filters}
591
519
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
592
520
  options={maxDeliveryFeeOptions}
593
521
  filter='max_delivery_price'
522
+ handleChangeFilters={handleChangeFilters}
594
523
  />
595
524
  )}
596
525
  {[1, 2].includes(orderState?.options?.type) && (
597
526
  <MaxSectionItem
527
+ filters={filters}
598
528
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
599
529
  options={maxTimeOptions}
600
530
  filter='max_eta'
531
+ handleChangeFilters={handleChangeFilters}
601
532
  />
602
533
  )}
603
534
  <MaxSectionItem
535
+ filters={filters}
604
536
  title={t('MAX_DISTANCE', 'Max distance')}
605
537
  options={maxDistanceOptions}
606
538
  filter='max_distance'
539
+ handleChangeFilters={handleChangeFilters}
607
540
  />
608
541
  {businessTypes?.length > 0 && (
609
542
  <TagsContainer>
@@ -623,14 +556,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
623
556
  </TagsContainer>
624
557
  )}
625
558
  </ScrollView>
626
- <OButton
627
- text={t('APPLY', 'Apply')}
628
- parentStyle={styles.applyButton}
629
- textStyle={{ color: '#fff' }}
630
- onClick={() => handleApplyFilters()}
631
- />
559
+ <WrapperButtons>
560
+ <View style={{ width: '50%' }}>
561
+ <OButton
562
+ text={t('APPLY', 'Apply')}
563
+ parentStyle={styles.applyButton}
564
+ textStyle={{ color: '#fff' }}
565
+ onClick={() => handleApplyFilters()}
566
+ />
567
+ </View>
568
+ <View style={{ width: '50%' }}>
569
+ <OButton
570
+ text={t('CLEAR_FILTERS', 'Clear')}
571
+ bgColor={theme.colors.white}
572
+ borderColor={theme.colors.primary}
573
+ parentStyle={styles.applyButton}
574
+ textStyle={{ color: theme.colors.primary }}
575
+ onClick={() => clearFilters()}
576
+ />
577
+ </View>
578
+ </WrapperButtons>
632
579
  </OModal>
633
- </ScrollView>
580
+ </BContainer>
634
581
  )
635
582
  }
636
583