ordering-ui-react-native 0.17.75 → 0.17.76-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 (225) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -25
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +128 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +102 -40
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +20 -22
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +139 -174
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  43. package/themes/business/src/components/StoresList/index.tsx +3 -4
  44. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  45. package/themes/business/src/components/shared/OLink.tsx +9 -2
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/components/shared/OText.tsx +6 -1
  48. package/themes/business/src/types/index.tsx +25 -10
  49. package/themes/business/src/utils/index.tsx +29 -2
  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/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  55. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/original/index.tsx +1 -1
  62. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  63. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  64. package/themes/original/src/components/AddressList/index.tsx +11 -6
  65. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  66. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  67. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  68. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  69. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  70. package/themes/original/src/components/BusinessController/index.tsx +81 -68
  71. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  72. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  73. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  74. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  75. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  76. package/themes/original/src/components/BusinessListingSearch/index.tsx +348 -340
  77. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  78. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  79. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  80. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  81. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  82. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  83. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -559
  84. package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  88. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  89. package/themes/original/src/components/Cart/index.tsx +76 -79
  90. package/themes/original/src/components/CartContent/index.tsx +112 -19
  91. package/themes/original/src/components/CartContent/styles.tsx +16 -6
  92. package/themes/original/src/components/Checkout/index.tsx +281 -55
  93. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  94. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  95. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  96. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  97. package/themes/original/src/components/Favorite/index.tsx +2 -6
  98. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  99. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  100. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +7 -3
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
  104. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  105. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  106. package/themes/original/src/components/Help/index.tsx +2 -2
  107. package/themes/original/src/components/HelpGuide/index.tsx +2 -2
  108. package/themes/original/src/components/HelpGuide/styles.tsx +1 -0
  109. package/themes/original/src/components/Home/index.tsx +13 -4
  110. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  111. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  112. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  113. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  114. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  115. package/themes/original/src/components/Messages/index.tsx +14 -7
  116. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  117. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  118. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  119. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  120. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  121. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  122. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  123. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  124. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  125. package/themes/original/src/components/MyOrders/index.tsx +37 -24
  126. package/themes/original/src/components/NavBar/index.tsx +20 -12
  127. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  128. package/themes/original/src/components/Notifications/styles.tsx +1 -5
  129. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  130. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  131. package/themes/original/src/components/OrderDetails/index.tsx +28 -233
  132. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  133. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  134. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  135. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  136. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  137. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  138. package/themes/original/src/components/OrdersOption/index.tsx +67 -85
  139. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  140. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  141. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  142. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  143. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  144. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  145. package/themes/original/src/components/PaymentOptions/index.tsx +77 -34
  146. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  147. package/themes/original/src/components/ProductForm/index.tsx +101 -34
  148. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  149. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  150. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  151. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  152. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  153. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  154. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  155. package/themes/original/src/components/Promotions/index.tsx +2 -2
  156. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  157. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  158. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  159. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  160. package/themes/original/src/components/Sessions/index.tsx +11 -8
  161. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  162. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  165. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  167. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  168. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  172. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  173. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  174. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  175. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  176. package/themes/original/src/components/UserProfile/index.tsx +87 -76
  177. package/themes/original/src/components/UserProfileForm/index.tsx +10 -3
  178. package/themes/original/src/components/UserProfileForm/styles.tsx +1 -1
  179. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  180. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  181. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  182. package/themes/original/src/components/Wallets/index.tsx +56 -33
  183. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  184. package/themes/original/src/components/shared/OButton.tsx +6 -2
  185. package/themes/original/src/components/shared/OInput.tsx +6 -1
  186. package/themes/original/src/components/shared/OModal.tsx +3 -3
  187. package/themes/original/src/types/index.tsx +39 -10
  188. package/themes/original/src/utils/index.tsx +273 -1
  189. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  190. package/src/navigators/BottomNavigator.tsx +0 -117
  191. package/src/navigators/CheckoutNavigator.tsx +0 -66
  192. package/src/navigators/HomeNavigator.tsx +0 -202
  193. package/src/navigators/NavigationRef.tsx +0 -7
  194. package/src/navigators/RootNavigator.tsx +0 -269
  195. package/src/pages/Account.tsx +0 -34
  196. package/src/pages/AddressForm.tsx +0 -62
  197. package/src/pages/AddressList.tsx +0 -24
  198. package/src/pages/BusinessProductsList.tsx +0 -81
  199. package/src/pages/BusinessesListing.tsx +0 -43
  200. package/src/pages/CartList.tsx +0 -49
  201. package/src/pages/Checkout.tsx +0 -101
  202. package/src/pages/ForgotPassword.tsx +0 -24
  203. package/src/pages/Help.tsx +0 -23
  204. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  205. package/src/pages/HelpGuide.tsx +0 -23
  206. package/src/pages/HelpOrder.tsx +0 -23
  207. package/src/pages/Home.tsx +0 -36
  208. package/src/pages/IntroductoryTutorial.tsx +0 -170
  209. package/src/pages/Login.tsx +0 -47
  210. package/src/pages/MomentOption.tsx +0 -30
  211. package/src/pages/MultiCheckout.tsx +0 -31
  212. package/src/pages/MultiOrdersDetails.tsx +0 -27
  213. package/src/pages/MyOrders.tsx +0 -40
  214. package/src/pages/NetworkError.tsx +0 -24
  215. package/src/pages/NotFound.tsx +0 -22
  216. package/src/pages/OrderDetails.tsx +0 -25
  217. package/src/pages/ProductDetails.tsx +0 -55
  218. package/src/pages/Profile.tsx +0 -36
  219. package/src/pages/ReviewDriver.tsx +0 -30
  220. package/src/pages/ReviewOrder.tsx +0 -32
  221. package/src/pages/ReviewProducts.tsx +0 -30
  222. package/src/pages/Sessions.tsx +0 -22
  223. package/src/pages/Signup.tsx +0 -53
  224. package/src/pages/SpinnerLoader.tsx +0 -10
  225. package/src/pages/Splash.tsx +0 -21
@@ -7,7 +7,7 @@ export const TopHeader = styled.View`
7
7
  width: 100%;
8
8
  flex-direction: row;
9
9
  align-items: center;
10
- justify-content: space-between;
10
+ justify-content: ${({ hideArrow }: any) => hideArrow ? 'flex-end' : 'space-between'};
11
11
  z-index: 1;
12
12
  height: 60px;
13
13
  min-height: 60px;
@@ -3,6 +3,7 @@ import {
3
3
  BusinessReviews as BusinessReviewController,
4
4
  useLanguage,
5
5
  useOrder,
6
+ useUtils
6
7
  } from 'ordering-components/native';
7
8
  import { useTheme } from 'styled-components/native';
8
9
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
@@ -30,6 +31,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
30
31
  const theme = useTheme();
31
32
  const [searchReview, setSearchReview] = useState('')
32
33
  const [orderState] = useOrder();
34
+ const [{ parseDate }] = useUtils()
33
35
 
34
36
  const styles = StyleSheet.create({
35
37
  starIcon: {
@@ -94,7 +96,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
94
96
  const ReviewItem = ({ comment, created_at, total }: any) => (
95
97
  <View style={{ marginBottom: 30 }}>
96
98
  <OText size={12} color={theme.colors.textSecondary}>
97
- {moment(created_at).format('MMMM d, yyyy • hh:mm')}
99
+ {parseDate(created_at, { outputFormat: 'MMMM D, YYYY • hh:mm A' })}
98
100
  </OText>
99
101
  <OText size={12} color={theme.colors.textNormal}>{comment}</OText>
100
102
  </View>
@@ -18,8 +18,7 @@ import {
18
18
  useSession,
19
19
  useOrder,
20
20
  useConfig,
21
- useUtils,
22
- useOrderingTheme
21
+ useUtils
23
22
  } from 'ordering-components/native';
24
23
  import { useTheme } from 'styled-components/native';
25
24
  import Ionicons from 'react-native-vector-icons/Ionicons'
@@ -74,13 +73,26 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
74
73
  logosLayout
75
74
  } = props;
76
75
  const theme = useTheme();
77
- const [orderingTheme] = useOrderingTheme()
78
76
  const isFocused = useIsFocused();
77
+
78
+ const [, t] = useLanguage();
79
+ const [{ user, auth }] = useSession();
80
+ const [orderState, { changeCityFilter }] = useOrder();
81
+ const [{ configs }] = useConfig();
82
+ const [{ parseDate }] = useUtils();
83
+
79
84
  const appState = useRef(AppState.currentState)
80
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
81
- const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
85
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
82
86
  const [refreshing] = useState(false);
83
- const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
87
+ const allCitiesDisabled = citiesState?.cities?.every((city: any) => !city.enabled)
88
+ const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
89
+ const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
90
+ const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
91
+ const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
92
+ const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
93
+ const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
94
+ const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
95
+
84
96
  const styles = StyleSheet.create({
85
97
  container: {
86
98
  marginBottom: 0,
@@ -144,19 +156,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
144
156
  },
145
157
  });
146
158
 
147
-
148
- const [, t] = useLanguage();
149
- const [{ user, auth }] = useSession();
150
- const [orderState, { changeCityFilter }] = useOrder();
151
- const [{ configs }] = useConfig();
152
- const [{ parseDate }] = useUtils();
153
-
154
159
  const { top } = useSafeAreaInsets();
155
160
 
156
161
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
157
162
  const [isFarAway, setIsFarAway] = useState(false)
158
163
  const [businessTypes, setBusinessTypes] = useState(null)
159
- const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
164
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
160
165
  const [isOpenCities, setIsOpenCities] = useState(false)
161
166
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
162
167
  Number(configs?.max_days_preorder?.value) > 0
@@ -220,7 +225,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
220
225
 
221
226
  useEffect(() => {
222
227
  if (!businessesList?.loading) {
223
- const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
228
+ const fb = businessesList.businesses.filter((b) => b?.featured && b?.open);
224
229
  const ary = [];
225
230
  while (fb.length > 0) {
226
231
  ary.push(fb.splice(0, 2));
@@ -289,6 +294,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
289
294
  setIsOpenCities(false)
290
295
  }, [orderState?.options?.city_id])
291
296
 
297
+ useEffect(() => {
298
+ if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
299
+ const selectedCity = citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)
300
+ if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
301
+ }, [citiesState, orderState?.options?.city_id])
302
+
292
303
  if (logosLayout) {
293
304
  return (
294
305
  <BusinessLogosContainer
@@ -364,7 +375,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
364
375
  )}
365
376
  <View style={{
366
377
  height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
367
- marginTop: Platform.OS == 'ios' ? 0 : 50,
378
+ marginTop: isChewLayout ? 0 : Platform.OS == 'ios' ? 0 : 50,
368
379
  backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
369
380
  }}
370
381
  >
@@ -466,18 +477,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
466
477
  )}
467
478
  </View>
468
479
  {!isChewLayout ? (
469
- <HeaderWrapper
470
- source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
471
- style={{ paddingTop: top + 20 }}
472
- resizeMode='cover'
473
- >
474
- {!auth && (
475
-
476
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
477
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
478
- </TouchableOpacity>
480
+ <>
481
+ {!hideHero ? (
482
+ <HeaderWrapper
483
+ source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
484
+ style={{ paddingTop: top + 20 }}
485
+ resizeMode='cover'
486
+ bgHeaderHeight={bgHeaderHeight}
487
+ >
488
+ {!auth && (
489
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
490
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
491
+ </TouchableOpacity>
492
+ )}
493
+ </HeaderWrapper>
494
+ ) : (
495
+ <>
496
+ {!auth && (
497
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
498
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
499
+ </TouchableOpacity>
500
+ )}
501
+ </>
479
502
  )}
480
- </HeaderWrapper>
503
+ </>
481
504
  ) : (
482
505
  <OrderTypesContainer>
483
506
  <OrderTypeSelector
@@ -502,10 +525,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
502
525
  </TouchableOpacity>
503
526
  </View>
504
527
  )}
505
- <OrderProgress
506
- {...props}
507
- isFocused={isFocused}
508
- />
528
+ {!hidePreviousOrders && (
529
+ <OrderProgress
530
+ {...props}
531
+ isFocused={isFocused}
532
+ />
533
+ )}
509
534
  {
510
535
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
511
536
  <FeaturedWrapper>
@@ -538,12 +563,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
538
563
  </FeaturedWrapper>
539
564
  )
540
565
  }
541
- {!isChewLayout && (
566
+ {!isChewLayout && !hideHighestBusiness && (
542
567
  <>
543
568
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
544
569
  {
545
570
  !businessId && !props.franchiseId && (
546
571
  <HighestRatedBusinesses
572
+ propsToFetch={props.propsToFetch}
547
573
  onBusinessClick={handleBusinessClick}
548
574
  navigation={navigation}
549
575
  favoriteIds={favoriteIds}
@@ -554,11 +580,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
554
580
  </>
555
581
  )}
556
582
 
557
- <PageBanner position='app_business_listing' />
583
+ <PageBanner position='app_business_listing' navigation={navigation} />
558
584
 
559
585
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
560
- <ListWrapper ph={isChewLayout && 20}>
561
- {!businessId && (
586
+ <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
587
+ {!businessId && !isAllCategoriesHidden && (
562
588
  <BusinessTypeFilter
563
589
  images={props.images}
564
590
  businessTypes={props.businessTypes}
@@ -567,7 +593,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
567
593
  setBusinessTypes={setBusinessTypes}
568
594
  />
569
595
  )}
570
- {!businessesList.loading && businessesList.businesses.length === 0 && (
596
+ {!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
571
597
  <NotFoundSource
572
598
  content={t(
573
599
  'NOT_FOUND_BUSINESSES',
@@ -580,7 +606,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
580
606
  <BusinessController
581
607
  key={`${business.id}_` + i}
582
608
  enableIntersection
583
- isCustomLayout={isChewLayout}
584
609
  business={business}
585
610
  isBusinessOpen={business.open}
586
611
  handleCustomClick={handleBusinessClick}
@@ -600,7 +625,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
600
625
  />
601
626
  )
602
627
  )}
603
- {businessesList.loading && (
628
+ {(businessesList.loading || !businessesList?.fetched) && (
604
629
  <>
605
630
  {[
606
631
  ...Array(
@@ -668,10 +693,16 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
668
693
  };
669
694
 
670
695
  export const BusinessesListing = (props: BusinessesListingParams) => {
696
+
671
697
  const BusinessesListingProps = {
672
698
  ...props,
673
699
  isForceSearch: Platform.OS === 'ios',
674
700
  UIComponent: BusinessesListingUI,
701
+ paginationSettings: {
702
+ initialPage: 1,
703
+ pageSize: 50,
704
+ controlType: 'infinity'
705
+ }
675
706
  };
676
707
 
677
708
  return <BusinessesListingController {...BusinessesListingProps} />;
@@ -67,7 +67,6 @@ export const HeaderWrapper = styled.ImageBackground`
67
67
 
68
68
  export const ListWrapper = styled.View`
69
69
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
70
- padding-horizontal: ${(props: any) => props.ph ?? 40}px;
71
70
  `;
72
71
 
73
72
  export const FeaturedWrapper = styled.View`
@@ -1,4 +1,3 @@
1
-
2
1
  import React, { useState, useEffect } from 'react'
3
2
  import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
4
3
 
@@ -8,7 +8,7 @@ import {
8
8
  useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
- import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
11
+ import { CContainer, CheckoutAction, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -23,7 +23,7 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
23
23
  import AntIcon from 'react-native-vector-icons/AntDesign'
24
24
  import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
- import { OAlert } from '../../../../../src/components/shared'
26
+ import { OAlert } from '../shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
28
  import { DriverTips } from '../DriverTips'
29
29
 
@@ -41,7 +41,17 @@ const CartUI = (props: any) => {
41
41
  commentState,
42
42
  onNavigationRedirect,
43
43
  handleRemoveOfferClick,
44
- isMultiCheckout
44
+ isMultiCheckout,
45
+ hideDeliveryFee,
46
+ hideDriverTip,
47
+ hideCouponInput,
48
+ preorderSlotInterval,
49
+ preorderLeadTime,
50
+ preorderTimeRange,
51
+ preorderMaximumDays,
52
+ preorderMinimumDays,
53
+ cateringTypes,
54
+ isFromUpselling
45
55
  } = props
46
56
 
47
57
  const theme = useTheme();
@@ -56,18 +66,15 @@ const CartUI = (props: any) => {
56
66
  const [openChangeStore, setOpenChangeStore] = useState(false)
57
67
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
58
68
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
59
- const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
60
69
  const [openPlaceModal, setOpenPlaceModal] = useState(false)
61
70
 
62
71
  const isCartPending = cart?.status === 2
63
72
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
64
- const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
65
- const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
66
-
67
73
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
68
74
  const businessId = business?.business_id ?? null
69
75
  const placeSpotTypes = [4]
70
-
76
+ const hideCartComments = theme?.business_view?.components?.cart?.components?.comments?.hidden
77
+ const hideCartDiscount = theme?.business_view?.components?.cart?.components?.discount?.hidden
71
78
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
72
79
  ? JSON.parse(configs?.driver_tip_options?.value) || []
73
80
  : configs?.driver_tip_options?.value || []
@@ -101,50 +108,45 @@ const CartUI = (props: any) => {
101
108
  }
102
109
  }
103
110
 
104
- const handleUpsellingPage = () => {
111
+ const handleUpsellingPage = (individualCart : any) => {
112
+ const isProductCartParam = !!individualCart?.products?.length
105
113
  setOpenUpselling(false)
106
114
  setCanOpenUpselling(false)
107
- const cartSelectedHasGroup = cart?.group?.uuid
108
- const cartFilterValidation = (cart : any) => cart?.valid && cart?.status !== 2
109
- const cartsGroupLength = cartSelectedHasGroup ? Object.values(orderState.carts).filter((_cart : any) => _cart?.group?.uuid === cartSelectedHasGroup && cartFilterValidation(_cart))?.length : 0
110
- if (cartsGroupLength > 1 && isCheckoutMultiBusinessEnabled) {
111
- props.onNavigationRedirect('CheckoutNavigator', {
112
- screen: 'MultiCheckout',
113
- cartUuid: cart?.group?.uuid
114
- })
115
- return
116
- }
117
- const cartGroupsCount : any = {}
118
- Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach((_cart : any) => {
119
- if (cartGroupsCount[_cart?.group?.uuid]) {
120
- cartGroupsCount[_cart?.group?.uuid] += 1
121
- } else {
122
- cartGroupsCount[_cart?.group?.uuid] = 1
123
- }
124
- })
125
- let groupForTheCart
126
- const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
127
- const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
128
- const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
129
- if (indexes?.length > 1) {
130
- groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
131
- } else {
132
- groupForTheCart = indexes[0]
133
- }
134
- if (isCheckoutMultiBusinessEnabled && openCarts.length > 1 && groupForTheCart) {
135
- props.onNavigationRedirect('CheckoutNavigator', {
136
- screen: 'MultiCart',
137
- cartUuid: cart.uuid,
138
- cartGroup: groupForTheCart === 'undefined' ? 'create' : groupForTheCart
139
- })
140
- } else {
141
- props.onNavigationRedirect('CheckoutNavigator', {
115
+
116
+ const cartsAvailable: any = Object.values(orderState?.carts)
117
+ ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
118
+ ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
119
+ if (cartsAvailable.length === 1 || !isMultiCheckout) {
120
+ const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
121
+ onNavigationRedirect('CheckoutNavigator', {
142
122
  screen: 'CheckoutPage',
143
123
  cartUuid: cart?.uuid,
144
124
  businessLogo: cart?.business?.logo,
145
125
  businessName: cart?.business?.name,
146
126
  cartTotal: cart?.total
127
+ }, true)
128
+ } else {
129
+ const groupKeys: any = {}
130
+ cartsAvailable.forEach((_cart: any) => {
131
+ groupKeys[_cart?.group?.uuid]
132
+ ? groupKeys[_cart?.group?.uuid] += 1
133
+ : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
147
134
  })
135
+
136
+ if (
137
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
138
+ Object.keys(groupKeys).length > 1
139
+ ) {
140
+ onNavigationRedirect('CheckoutNavigator', {
141
+ screen: 'MultiCheckout',
142
+ checkCarts: true
143
+ }, true)
144
+ } else {
145
+ onNavigationRedirect('CheckoutNavigator', {
146
+ screen: 'MultiCheckout',
147
+ cartUuid: cartsAvailable[0]?.group?.uuid
148
+ }, true)
149
+ }
148
150
  }
149
151
  }
150
152
 
@@ -162,16 +164,16 @@ const CartUI = (props: any) => {
162
164
  return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
163
165
  }
164
166
 
165
- const onRemoveOffer = (id: number) => {
166
- setConfirm({
167
- open: true,
168
- content: [t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')],
169
- title: t('OFFER', 'Offer'),
170
- handleOnAccept: () => {
171
- setConfirm({ ...confirm, open: false })
172
- handleRemoveOfferClick(id)
173
- }
174
- })
167
+ const OfferAlert = ({ offerId }: any) => {
168
+ return (
169
+ <OAlert
170
+ title={t('OFFER', 'Offer')}
171
+ message={t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')}
172
+ onAccept={() => handleRemoveOfferClick(offerId)}
173
+ >
174
+ <AntIcon style={{ marginLeft: 3 }} name='closecircle' size={16} color={theme.colors.primary} />
175
+ </OAlert>
176
+ )
175
177
  }
176
178
 
177
179
  const walletName: any = {
@@ -215,6 +217,7 @@ const CartUI = (props: any) => {
215
217
  handleClickCheckout={() => setOpenUpselling(true)}
216
218
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
217
219
  isMultiCheckout={isMultiCheckout}
220
+ isFromUpselling={isFromUpselling}
218
221
  >
219
222
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
220
223
  <ProductItemAccordion
@@ -263,9 +266,9 @@ const CartUI = (props: any) => {
263
266
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
264
267
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
265
268
  </TouchableOpacity>
266
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
267
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
268
- </TouchableOpacity>
269
+ {!!offer?.id && (
270
+ <OfferAlert offerId={offer?.id} />
271
+ )}
269
272
  </OSRow>
270
273
  <OText size={12} lineHeight={18}>
271
274
  - {parsePrice(offer?.summary?.discount)}
@@ -327,9 +330,9 @@ const CartUI = (props: any) => {
327
330
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
328
331
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
329
332
  </TouchableOpacity>
330
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
331
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
332
- </TouchableOpacity>
333
+ {!!offer?.id && (
334
+ <OfferAlert offerId={offer?.id} />
335
+ )}
333
336
  </OSRow>
334
337
  <OText size={12} lineHeight={18}>
335
338
  - {parsePrice(offer?.summary?.discount)}
@@ -337,10 +340,10 @@ const CartUI = (props: any) => {
337
340
  </OSTable>
338
341
  ))
339
342
  }
340
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
343
+ {orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
341
344
  <OSTable>
342
345
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
343
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
346
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
344
347
  </OSTable>
345
348
  )}
346
349
  {
@@ -354,9 +357,9 @@ const CartUI = (props: any) => {
354
357
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
355
358
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
356
359
  </TouchableOpacity>
357
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
358
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
359
- </TouchableOpacity>
360
+ {!!offer?.id && (
361
+ <OfferAlert offerId={offer?.id} />
362
+ )}
360
363
  </OSRow>
361
364
  <OText size={12} lineHeight={18}>
362
365
  - {parsePrice(offer?.summary?.discount)}
@@ -364,7 +367,7 @@ const CartUI = (props: any) => {
364
367
  </OSTable>
365
368
  ))
366
369
  }
367
- {cart?.driver_tip > 0 && (
370
+ {cart?.driver_tip > 0 && !hideDriverTip && (
368
371
  <OSTable>
369
372
  <OText size={12} lineHeight={18}>
370
373
  {t('DRIVER_TIP', 'Driver tip')}
@@ -386,18 +389,19 @@ const CartUI = (props: any) => {
386
389
  <OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
387
390
  </OSTable>
388
391
  ))}
389
- {isCouponEnabled && !isCartPending && (
392
+ {isCouponEnabled && !isCartPending && !hideCouponInput && (
390
393
  <OSTable>
391
394
  <OSCoupon>
392
395
  <CouponControl
393
396
  businessId={businessId}
394
397
  price={cart.total}
398
+ cart={cart}
395
399
  />
396
400
  </OSCoupon>
397
401
  </OSTable>
398
402
  )}
399
403
 
400
- {isMultiCheckout &&
404
+ {!isMultiCheckout &&
401
405
  cart &&
402
406
  cart?.valid &&
403
407
  orderState?.options?.type === 1 &&
@@ -412,13 +416,14 @@ const CartUI = (props: any) => {
412
416
  <DriverTips
413
417
  uuid={cart?.uuid}
414
418
  businessId={cart?.business_id}
415
- driverTipsOptions={driverTipsOptions}
416
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
419
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
420
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
417
421
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
418
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
422
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
419
423
  ? cart?.driver_tip
420
424
  : cart?.driver_tip_rate}
421
425
  useOrderContext
426
+ cart={cart}
422
427
  />
423
428
  </DriverTipsContainer>
424
429
  )}
@@ -552,14 +557,6 @@ const CartUI = (props: any) => {
552
557
  setOpenPlaceModal={setOpenPlaceModal}
553
558
  />
554
559
  </OModal>
555
- <OAlert
556
- open={confirm.open}
557
- title={confirm.title}
558
- content={confirm.content}
559
- onAccept={confirm.handleOnAccept}
560
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
561
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
562
- />
563
560
  </CContainer>
564
561
  )
565
562
  }