ordering-ui-react-native 0.17.7 → 0.17.8-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 (212) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +11 -4
  4. package/src/components/BusinessInformation/styles.tsx +2 -2
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/OrderCreating/index.tsx +1 -21
  7. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  8. package/src/components/SingleProductReview/index.tsx +7 -4
  9. package/src/components/StripeMethodForm/index.tsx +6 -14
  10. package/src/components/VerifyPhone/styles.tsx +1 -2
  11. package/src/components/shared/OToast.tsx +4 -4
  12. package/src/utils/index.tsx +7 -1
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  15. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  16. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  17. package/themes/business/src/components/Chat/index.tsx +118 -107
  18. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  21. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  22. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  23. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  24. package/themes/business/src/components/MapView/index.tsx +18 -7
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  30. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  31. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  32. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  33. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  36. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
  40. package/themes/business/src/components/StoresList/index.tsx +2 -2
  41. package/themes/business/src/components/shared/OLink.tsx +33 -13
  42. package/themes/business/src/components/shared/OModal.tsx +16 -9
  43. package/themes/business/src/components/shared/OText.tsx +8 -2
  44. package/themes/business/src/types/index.tsx +33 -2
  45. package/themes/business/src/utils/index.tsx +51 -0
  46. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  48. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  50. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  51. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  52. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  54. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  59. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  60. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  63. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  64. package/themes/kiosk/src/types/index.d.ts +13 -0
  65. package/themes/kiosk/src/utils/index.tsx +15 -0
  66. package/themes/original/index.tsx +8 -0
  67. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  68. package/themes/original/src/components/AddressForm/index.tsx +41 -16
  69. package/themes/original/src/components/AddressList/index.tsx +26 -21
  70. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  71. package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
  72. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  75. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  76. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  77. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  78. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  79. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +24 -23
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  83. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  84. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  85. package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -492
  86. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  87. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  88. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  92. package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
  93. package/themes/original/src/components/Cart/index.tsx +88 -43
  94. package/themes/original/src/components/CartContent/index.tsx +110 -19
  95. package/themes/original/src/components/CartContent/styles.tsx +15 -1
  96. package/themes/original/src/components/Checkout/index.tsx +311 -178
  97. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  98. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  99. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  100. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  101. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  102. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  103. package/themes/original/src/components/Favorite/index.tsx +7 -4
  104. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  105. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  106. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  107. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  108. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  109. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  110. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  111. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  112. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +178 -0
  114. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  116. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  117. package/themes/original/src/components/Help/index.tsx +8 -8
  118. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  119. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  120. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  121. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  123. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  124. package/themes/original/src/components/Home/index.tsx +13 -4
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  127. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  128. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  129. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  130. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  131. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  132. package/themes/original/src/components/Messages/index.tsx +32 -10
  133. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  134. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  135. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
  136. package/themes/original/src/components/MultiCheckout/index.tsx +248 -83
  137. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  139. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  140. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  141. package/themes/original/src/components/NavBar/index.tsx +6 -11
  142. package/themes/original/src/components/Notifications/index.tsx +144 -0
  143. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +61 -0
  145. package/themes/original/src/components/OrderDetails/index.tsx +262 -347
  146. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  147. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  148. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  149. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  150. package/themes/original/src/components/OrderSummary/index.tsx +67 -29
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  153. package/themes/original/src/components/OrdersOption/index.tsx +99 -89
  154. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  155. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  156. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  157. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  158. package/themes/original/src/components/PaymentOptions/index.tsx +3 -3
  159. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  160. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  161. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  162. package/themes/original/src/components/ProductForm/index.tsx +231 -253
  163. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  164. package/themes/original/src/components/ProductItemAccordion/index.tsx +197 -138
  165. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  166. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  167. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  168. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  169. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  170. package/themes/original/src/components/Promotions/index.tsx +234 -220
  171. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  172. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  173. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  174. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  175. package/themes/original/src/components/ReviewProducts/index.tsx +7 -4
  176. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  177. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  178. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  179. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  180. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  181. package/themes/original/src/components/Sessions/index.tsx +11 -8
  182. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  183. package/themes/original/src/components/SignupForm/index.tsx +82 -67
  184. package/themes/original/src/components/SingleOrderCard/index.tsx +148 -62
  185. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
  186. package/themes/original/src/components/SingleProductCard/index.tsx +99 -55
  187. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
  188. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  189. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  190. package/themes/original/src/components/StripeCardsList/index.tsx +9 -2
  191. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  192. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  193. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  194. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  195. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  196. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  197. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  198. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  199. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  200. package/themes/original/src/components/Wallets/index.tsx +31 -17
  201. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  202. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  203. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  204. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  205. package/themes/original/src/components/shared/OButton.tsx +6 -2
  206. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  207. package/themes/original/src/components/shared/OInput.tsx +10 -1
  208. package/themes/original/src/components/shared/OModal.tsx +3 -3
  209. package/themes/original/src/layouts/Container.tsx +13 -9
  210. package/themes/original/src/types/index.tsx +43 -9
  211. package/themes/original/src/utils/index.tsx +375 -58
  212. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,8 +1,5 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const ContainerSafeAreaView = styled.SafeAreaView`
4
- `
5
-
6
3
  export const WrapHeader = styled.View`
7
4
  position: relative;
8
5
  `
@@ -10,11 +7,10 @@ export const TopHeader = styled.View`
10
7
  width: 100%;
11
8
  flex-direction: row;
12
9
  align-items: center;
13
- justify-content: space-between;
10
+ justify-content: ${({ hideArrow }: any) => hideArrow ? 'flex-end' : 'space-between'};
14
11
  z-index: 1;
15
12
  height: 60px;
16
13
  min-height: 60px;
17
- margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
18
14
  `
19
15
  export const AddressInput = styled.TouchableOpacity`
20
16
  flex: 1;
@@ -28,7 +24,7 @@ export const WrapSearchBar = styled.View`
28
24
  flex: 1;
29
25
  `
30
26
  export const WrapContent = styled.View`
31
- padding: 10px 40px;
27
+ padding-vertical: 10px;
32
28
  `
33
29
 
34
30
  export const BusinessProductsListingContainer = styled.ScrollView`
@@ -41,18 +37,16 @@ export const BusinessProductsListingContainer = styled.ScrollView`
41
37
  export const FiltProductsContainer = styled.ScrollView`
42
38
  position: absolute;
43
39
  width: 100%;
44
- z-index: 2000;
45
- top: ${(props : any) => props.isIos ? '40px': '80px'};
46
- margin-top: 20px;
40
+ z-index: 20000;
47
41
  `
48
42
 
49
43
  export const BackgroundGray = styled.View`
50
44
  flex: 1;
51
- height: 100%;
45
+ height: ${(props: any) => props.isIos ? '80%' : '100%'};
52
46
  background-color: rgba(0,0,0,0.5);
53
- position: absolute;
54
- margin-top: 100px;
55
- z-index: 100;
47
+ position: absolute;
48
+ margin-top: 100px;
49
+ z-index: 10000;
56
50
  width: 100%;
57
51
  `
58
52
 
@@ -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>
@@ -38,7 +38,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
38
38
 
39
39
  const theme = useTheme();
40
40
  const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
41
- const defaultImage = (name : string) => theme.images?.categories?.[name.toLowerCase()]
41
+ const defaultImage = (name : string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
42
42
 
43
43
  useEffect(() => {
44
44
  if(typesState?.types?.length > 0){
@@ -198,9 +198,9 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
198
198
  isOpenAllCategories && setIsOpenAllCategories(false)
199
199
  }}
200
200
  >
201
- {(item.image || defaultImage(item.name)) ? (
201
+ {(defaultImage(item.name) || item.image) ? (
202
202
  <OIcon
203
- url={item.image || defaultImage(item.name)}
203
+ url={typeof item.name === 'number' ? item.image || defaultImage(item.name) : defaultImage(item.name) || item.image}
204
204
  style={styles.logo}
205
205
  />
206
206
  ) : (
@@ -284,7 +284,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
284
284
  style={{ paddingTop: top + 20 }}>
285
285
  {!auth && (
286
286
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
287
- <IconAntDesign name='arrowleft' size={26} />
287
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
288
288
  </TouchableOpacity>
289
289
  )}
290
290
  <Search>
@@ -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'
@@ -32,7 +31,6 @@ import {
32
31
  HeaderWrapper,
33
32
  ListWrapper,
34
33
  FeaturedWrapper,
35
- OrderProgressWrapper,
36
34
  FarAwayMessage,
37
35
  AddressInputContainer,
38
36
  PreorderInput,
@@ -40,8 +38,7 @@ import {
40
38
  BusinessLogosContainer
41
39
  } from './styles';
42
40
 
43
- import { SearchBar } from '../../../SearchBar';
44
- import { OButton, OIcon, OText, OBottomPopup, OModal } from '../../../shared';
41
+ import { OIcon, OText, OModal } from '../../../shared';
45
42
  import { BusinessesListingParams } from '../../../../types';
46
43
  import { NotFoundSource } from '../../../NotFoundSource';
47
44
  import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
@@ -50,11 +47,13 @@ import { OrderTypeSelector } from '../../../OrderTypeSelector';
50
47
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
51
48
  import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
52
49
  import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
53
- import { getTypesText, convertToRadian } from '../../../../utils';
50
+ import { getTypesText } from '../../../../utils';
54
51
  import { OrderProgress } from '../../../OrderProgress';
55
52
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
56
53
  import FastImage from 'react-native-fast-image';
57
54
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
55
+ import { PageBanner } from '../../../PageBanner'
56
+ import { CitiesControl } from '../../../CitiesControl'
58
57
 
59
58
  const PIXELS_TO_SCROLL = 2000;
60
59
 
@@ -62,12 +61,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
62
61
  const {
63
62
  navigation,
64
63
  businessesList,
65
- searchValue,
66
64
  getBusinesses,
67
65
  handleChangeBusinessType,
68
66
  handleBusinessClick,
69
67
  paginationProps,
70
- handleChangeSearch,
71
68
  businessId,
72
69
  isGuestUser,
73
70
  handleUpdateBusinessList,
@@ -76,15 +73,25 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
76
73
  logosLayout
77
74
  } = props;
78
75
  const theme = useTheme();
79
- const [orderingTheme] = useOrderingTheme()
80
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
+
81
84
  const appState = useRef(AppState.currentState)
82
- const searchBarRef = useRef<any>()
83
- const [appStateVisible, setAppStateVisible] = useState(appState.current);
84
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
85
- const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
85
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
86
86
  const [refreshing] = useState(false);
87
- const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
87
+ const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
88
+ const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
89
+ const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
90
+ const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
91
+ const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
92
+ const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
93
+ const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
94
+
88
95
  const styles = StyleSheet.create({
89
96
  container: {
90
97
  marginBottom: 0,
@@ -137,7 +144,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
137
144
  minHeight: 45,
138
145
  paddingVertical: 5,
139
146
  paddingHorizontal: 20,
140
- borderWidth: 1
147
+ borderWidth: 1,
148
+ justifyContent: 'center'
141
149
  },
142
150
  businessSkeleton: {
143
151
  borderRadius: 8,
@@ -147,19 +155,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
147
155
  },
148
156
  });
149
157
 
150
-
151
- const [, t] = useLanguage();
152
- const [{ user, auth }] = useSession();
153
- const [orderState, { changeCityFilter }] = useOrder();
154
- const [{ configs }] = useConfig();
155
- const [{ parseDate }] = useUtils();
156
-
157
158
  const { top } = useSafeAreaInsets();
158
159
 
159
160
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
160
161
  const [isFarAway, setIsFarAway] = useState(false)
161
162
  const [businessTypes, setBusinessTypes] = useState(null)
162
- const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
163
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options?.value)
163
164
  const [isOpenCities, setIsOpenCities] = useState(false)
164
165
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
165
166
  Number(configs?.max_days_preorder?.value) > 0
@@ -167,6 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
167
168
  const timerId = useRef<any>(false)
168
169
  const [favoriteIds, setFavoriteIds] = useState<any>([])
169
170
  const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
171
+ const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
170
172
 
171
173
  const handleMomentClick = () => {
172
174
  if (isPreorderEnabled) {
@@ -186,11 +188,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
186
188
  paginationProps.totalPages === paginationProps.currentPage
187
189
  );
188
190
 
189
- if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
191
+ if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore && businessesList?.businesses?.length > 0) {
190
192
  getBusinesses();
191
193
  }
192
194
  };
193
195
 
196
+ const convertToRadian = (value: number) => {
197
+ return value * Math.PI / 180
198
+ }
199
+
194
200
  const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
195
201
  const R = 6371 // km
196
202
  const dLat = convertToRadian(lat2 - lat1)
@@ -218,7 +224,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
218
224
 
219
225
  useEffect(() => {
220
226
  if (!businessesList?.loading) {
221
- const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
227
+ const fb = businessesList.businesses.filter((b) => b?.featured && b?.open);
222
228
  const ary = [];
223
229
  while (fb.length > 0) {
224
230
  ary.push(fb.splice(0, 2));
@@ -312,10 +318,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
312
318
  key={business?.id}
313
319
  onPress={() => handleBusinessClick && handleBusinessClick(business)}
314
320
  style={{
315
- width: 57,
316
- height: 58,
317
- borderBottomColor: theme.colors.primary,
318
- borderBottomWidth: business?.slug === actualSlug ? 2 : 0,
321
+ width: 60,
322
+ height: 60,
323
+ borderRadius: 8,
319
324
  marginRight: 5
320
325
  }}
321
326
  >
@@ -324,8 +329,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
324
329
  width: 56,
325
330
  height: 56,
326
331
  marginRight: 20,
327
- borderTopLeftRadius: 7.6,
328
- borderTopRightRadius: 7.6
332
+ borderRadius: 8,
333
+ borderColor: theme.colors.primary,
334
+ borderWidth: business?.slug === actualSlug ? 2 : 0
329
335
  }}
330
336
  source={{
331
337
  uri: business?.logo,
@@ -353,6 +359,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
353
359
  />
354
360
  }
355
361
  >
362
+ {enabledPoweredByOrdering && auth && (
363
+ <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
364
+ <OText>
365
+ Powered By Ordering.co
366
+ </OText>
367
+ </View>
368
+ )}
356
369
  <View style={{
357
370
  height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
358
371
  marginTop: Platform.OS == 'ios' ? 0 : 50,
@@ -361,8 +374,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
361
374
  >
362
375
  {isChewLayout && (
363
376
  <View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
364
- <OText size={18} weight={700} color={theme.colors?.white}>
365
- {t('WELCOME', 'Welcome')} {user?.name}!
377
+ <OText size={24} weight={700} color={theme.colors?.white}>
378
+ {t('WELCOME', 'Welcome')} {user?.name}
366
379
  </OText>
367
380
  </View>
368
381
  )}
@@ -457,18 +470,30 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
457
470
  )}
458
471
  </View>
459
472
  {!isChewLayout ? (
460
- <HeaderWrapper
461
- source={bgHeader ? {uri: bgHeader} : theme.images.backgrounds.business_list_header}
462
- style={{ paddingTop: top + 20 }}
463
- resizeMode='cover'
464
- >
465
- {!auth && (
466
-
467
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
468
- <IconAntDesign name='arrowleft' size={26} />
469
- </TouchableOpacity>
473
+ <>
474
+ {!hideHero ? (
475
+ <HeaderWrapper
476
+ source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
477
+ style={{ paddingTop: top + 20 }}
478
+ resizeMode='cover'
479
+ bgHeaderHeight={bgHeaderHeight}
480
+ >
481
+ {!auth && (
482
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
483
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
484
+ </TouchableOpacity>
485
+ )}
486
+ </HeaderWrapper>
487
+ ) : (
488
+ <>
489
+ {!auth && (
490
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
491
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
492
+ </TouchableOpacity>
493
+ )}
494
+ </>
470
495
  )}
471
- </HeaderWrapper>
496
+ </>
472
497
  ) : (
473
498
  <OrderTypesContainer>
474
499
  <OrderTypeSelector
@@ -485,6 +510,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
485
510
  <TouchableOpacity
486
511
  style={styles.buttonCityStyle}
487
512
  onPress={() => setIsOpenCities(true)}
513
+ disabled={orderState?.loading}
488
514
  >
489
515
  <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
490
516
  {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
@@ -492,12 +518,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
492
518
  </TouchableOpacity>
493
519
  </View>
494
520
  )}
495
- <OrderProgressWrapper>
521
+ {!hidePreviousOrders && (
496
522
  <OrderProgress
497
523
  {...props}
498
524
  isFocused={isFocused}
499
525
  />
500
- </OrderProgressWrapper>
526
+ )}
501
527
  {
502
528
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
503
529
  <FeaturedWrapper>
@@ -530,20 +556,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
530
556
  </FeaturedWrapper>
531
557
  )
532
558
  }
559
+ {!isChewLayout && !hideHighestBusiness && (
560
+ <>
561
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
562
+ {
563
+ !businessId && !props.franchiseId && (
564
+ <HighestRatedBusinesses
565
+ onBusinessClick={handleBusinessClick}
566
+ navigation={navigation}
567
+ favoriteIds={favoriteIds}
568
+ setFavoriteIds={setFavoriteIds}
569
+ />
570
+ )
571
+ }
572
+ </>
573
+ )}
574
+
575
+ <PageBanner position='app_business_listing' navigation={navigation} />
576
+
533
577
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
534
- {
535
- !businessId && !props.franchiseId && (
536
- <HighestRatedBusinesses
537
- onBusinessClick={handleBusinessClick}
538
- navigation={navigation}
539
- favoriteIds={favoriteIds}
540
- setFavoriteIds={setFavoriteIds}
541
- />
542
- )
543
- }
544
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
545
- <ListWrapper>
546
- {!businessId && (
578
+ <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
579
+ {!businessId && !isAllCategoriesHidden && (
547
580
  <BusinessTypeFilter
548
581
  images={props.images}
549
582
  businessTypes={props.businessTypes}
@@ -565,6 +598,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
565
598
  <BusinessController
566
599
  key={`${business.id}_` + i}
567
600
  enableIntersection
601
+ isCustomLayout={isChewLayout}
568
602
  business={business}
569
603
  isBusinessOpen={business.open}
570
604
  handleCustomClick={handleBusinessClick}
@@ -641,25 +675,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
641
675
  onClose={() => setIsOpenCities(false)}
642
676
  title={t('SELECT_A_CITY', 'Select a city')}
643
677
  >
644
- <View style={{ padding: 40, width: '100%' }}>
645
- {citiesState?.cities?.map((city: any) => (
646
- <TouchableOpacity
647
- key={city?.id}
648
- style={{
649
- padding: 10,
650
- borderBottomWidth: 1,
651
- borderBottomColor: orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.backgroundGray,
652
- marginBottom: 10,
653
- }}
654
- onPress={() => handleChangeCity(city?.id)}
655
- disabled={orderState?.loading}
656
- >
657
- <OText color={orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.black}>
658
- {city?.name}
659
- </OText>
660
- </TouchableOpacity>
661
- ))}
662
- </View>
678
+ <CitiesControl
679
+ cities={citiesState?.cities}
680
+ onClose={() => setIsOpenCities(false)}
681
+ handleChangeCity={handleChangeCity}
682
+ />
663
683
  </OModal>
664
684
  </IOScrollView>
665
685
  );
@@ -60,28 +60,20 @@ export const WrapMomentOption = styled.TouchableOpacity`
60
60
 
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
- height: 270px;
63
+ height: 270px;
64
64
  padding: 20px 40px;
65
65
  background-color: transparent;
66
66
  `;
67
67
 
68
68
  export const ListWrapper = styled.View`
69
69
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
70
- padding-horizontal: 40px;
71
70
  `;
72
71
 
73
72
  export const FeaturedWrapper = styled.View`
74
73
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
75
- height: 220px;
76
74
  paddingVertical: 30px;
77
75
  `;
78
76
 
79
- export const OrderProgressWrapper = styled.View`
80
- margin-top: 37px;
81
- margin-bottom: 20px;
82
- padding-horizontal: 40px;
83
- `
84
-
85
77
  export const FarAwayMessage = styled.View`
86
78
  flex-direction: row;
87
79
  align-items: center;
@@ -1,6 +1,5 @@
1
-
2
1
  import React, { useState, useEffect } from 'react'
3
- import { useOrder, useSession, useLanguage } from 'ordering-components/native';
2
+ import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
4
3
 
5
4
  import { useTheme } from 'styled-components/native'
6
5
  import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
@@ -16,6 +15,8 @@ export const BusinessesListing = (props: any) => {
16
15
  const [, t] = useLanguage();
17
16
  const [{ auth }] = useSession()
18
17
  const [, { getLastOrderHasNoReview }] = useOrder();
18
+ const [{ configs }] = useConfig()
19
+ const isShowReviewsPopupEnabled = configs?.show_reviews_popups_enabled?.value === '1'
19
20
 
20
21
  const [, setIsReviewed] = useState()
21
22
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
@@ -74,8 +75,9 @@ export const BusinessesListing = (props: any) => {
74
75
  }
75
76
 
76
77
  useEffect(() => {
78
+ if (!isShowReviewsPopupEnabled) return
77
79
  (checkNotificationStatus?.checked && auth) && _getLastOrderHasNoReview()
78
- }, [checkNotificationStatus, auth])
80
+ }, [checkNotificationStatus, auth, isShowReviewsPopupEnabled])
79
81
 
80
82
  return (
81
83
  <>