ordering-ui-react-native 0.17.11 → 0.17.12-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 (215) 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 +0 -24
  9. package/src/components/SingleProductReview/styles.tsx +0 -12
  10. package/src/components/StripeMethodForm/index.tsx +108 -77
  11. package/src/components/VerifyPhone/styles.tsx +1 -2
  12. package/src/components/shared/OToast.tsx +4 -4
  13. package/src/types/index.tsx +5 -0
  14. package/src/utils/index.tsx +7 -1
  15. package/themes/business/index.tsx +2 -0
  16. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  17. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  18. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  19. package/themes/business/src/components/Chat/index.tsx +118 -107
  20. package/themes/business/src/components/DriverMap/index.tsx +17 -7
  21. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  22. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  23. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  24. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  25. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  26. package/themes/business/src/components/MapView/index.tsx +18 -7
  27. package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +98 -50
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  34. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  35. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  36. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  37. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  38. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  39. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  40. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  41. package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
  42. package/themes/business/src/components/StoresList/index.tsx +2 -2
  43. package/themes/business/src/components/shared/OLink.tsx +33 -13
  44. package/themes/business/src/components/shared/OModal.tsx +16 -9
  45. package/themes/business/src/components/shared/OText.tsx +8 -2
  46. package/themes/business/src/types/index.tsx +33 -2
  47. package/themes/business/src/utils/index.tsx +44 -1
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  52. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  53. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  54. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  55. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  56. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  60. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  61. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  62. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  65. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  66. package/themes/kiosk/src/types/index.d.ts +13 -0
  67. package/themes/kiosk/src/utils/index.tsx +15 -0
  68. package/themes/original/index.tsx +8 -0
  69. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  70. package/themes/original/src/components/AddressForm/index.tsx +41 -16
  71. package/themes/original/src/components/AddressList/index.tsx +26 -21
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  77. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  81. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  82. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +350 -323
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -492
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  91. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  94. package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
  95. package/themes/original/src/components/Cart/index.tsx +88 -43
  96. package/themes/original/src/components/CartContent/index.tsx +110 -19
  97. package/themes/original/src/components/CartContent/styles.tsx +15 -1
  98. package/themes/original/src/components/Checkout/index.tsx +323 -178
  99. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  100. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  101. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  102. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  103. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  104. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  105. package/themes/original/src/components/Favorite/index.tsx +7 -4
  106. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  107. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  108. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  109. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  110. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  111. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  112. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  113. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  114. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +178 -0
  116. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  117. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  118. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/Home/index.tsx +13 -4
  127. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  128. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  129. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  130. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  131. package/themes/original/src/components/LoginForm/index.tsx +48 -19
  132. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  133. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  134. package/themes/original/src/components/Messages/index.tsx +32 -10
  135. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  136. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  137. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +195 -116
  138. package/themes/original/src/components/MultiCheckout/index.tsx +262 -83
  139. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  140. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  141. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  142. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  143. package/themes/original/src/components/NavBar/index.tsx +6 -11
  144. package/themes/original/src/components/Notifications/index.tsx +144 -0
  145. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  146. package/themes/original/src/components/OrderDetails/OrderEta.tsx +61 -0
  147. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +10 -3
  148. package/themes/original/src/components/OrderDetails/index.tsx +262 -347
  149. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  150. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  151. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  152. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  153. package/themes/original/src/components/OrderSummary/index.tsx +67 -29
  154. package/themes/original/src/components/OrderTypeSelector/index.tsx +3 -2
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  156. package/themes/original/src/components/OrdersOption/index.tsx +99 -89
  157. package/themes/original/src/components/PageBanner/index.tsx +171 -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 +34 -6
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  163. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +231 -253
  166. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +197 -138
  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 -50
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +7 -4
  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 +358 -275
  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 +82 -67
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +148 -62
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
  189. package/themes/original/src/components/SingleProductCard/index.tsx +99 -55
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -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 +9 -2
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  198. package/themes/original/src/components/UserFormDetails/index.tsx +53 -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/Wallets/index.tsx +31 -17
  204. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  205. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  206. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  208. package/themes/original/src/components/shared/OButton.tsx +6 -2
  209. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  210. package/themes/original/src/components/shared/OInput.tsx +10 -1
  211. package/themes/original/src/components/shared/OModal.tsx +3 -3
  212. package/themes/original/src/layouts/Container.tsx +13 -9
  213. package/themes/original/src/types/index.tsx +43 -9
  214. package/themes/original/src/utils/index.tsx +375 -58
  215. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -6,7 +6,7 @@ export const ChContainer = styled.View`
6
6
  `
7
7
 
8
8
  export const ChSection = styled.View`
9
- padding-top: 30px;
9
+ padding-top: 20px;
10
10
  `
11
11
 
12
12
  export const ChHeader = styled.View`
@@ -40,7 +40,9 @@ export const ChMoment = styled(ChAddress)`
40
40
  `
41
41
 
42
42
  export const CHMomentWrapper = styled.TouchableOpacity`
43
- background-color: ${(props: any) => props.theme.colors.backgroundGray100};
43
+ background-color: ${(props: any) => props.isCustomColor
44
+ ? props.theme.colors.primary
45
+ : props.theme.colors.backgroundGray100};
44
46
  border-radius: 7.6px;
45
47
  font-size: 12px;
46
48
  max-width: 240px;
@@ -0,0 +1,89 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { StyleSheet, useWindowDimensions, Keyboard, View } from 'react-native';
3
+ import { useLanguage, useOrder } from 'ordering-components/native';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ import { useTheme } from 'styled-components/native';
6
+
7
+ import { OButton, OIcon, OText } from '../shared';
8
+
9
+ import { CityElement, Container } from './styles'
10
+
11
+ export const CitiesControl = (props: any) => {
12
+ const {
13
+ cities,
14
+ onClose,
15
+ handleChangeCity
16
+ } = props;
17
+
18
+ const theme = useTheme();
19
+ const [, t] = useLanguage();
20
+ const [orderState] = useOrder();
21
+ const { height } = useWindowDimensions();
22
+ const { top, bottom } = useSafeAreaInsets();
23
+
24
+ const [isKeyboardShow, setIsKeyboardShow] = useState(false);
25
+ const [cityState, setCityState] = useState(orderState?.options?.city_id)
26
+
27
+ const handleClick = () => {
28
+ cityState !== orderState?.options?.city_id && handleChangeCity(cityState)
29
+ onClose && onClose()
30
+ }
31
+
32
+ useEffect(() => {
33
+ const keyboardDidShowListener = Keyboard.addListener(
34
+ 'keyboardDidShow',
35
+ () => setIsKeyboardShow(true)
36
+ );
37
+ const keyboardDidHideListener = Keyboard.addListener(
38
+ 'keyboardDidHide',
39
+ () => setIsKeyboardShow(false)
40
+ );
41
+ return () => {
42
+ keyboardDidShowListener.remove();
43
+ keyboardDidHideListener.remove();
44
+ };
45
+ }, []);
46
+
47
+ return (
48
+ <Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
49
+ <View>
50
+ {cities?.map((city: any) => (
51
+ <CityElement
52
+ key={city?.id}
53
+ activeOpacity={1}
54
+ disabled={orderState?.loading}
55
+ onPress={() => setCityState(city?.id === cityState ? null : city?.id)}
56
+ >
57
+ <OIcon
58
+ src={cityState === city?.id
59
+ ? theme.images.general.option_checked
60
+ : theme.images.general.option_normal}
61
+ width={16}
62
+ style={{ marginEnd: 24 }}
63
+ />
64
+ <OText color={theme.colors.black}>
65
+ {city?.name}
66
+ </OText>
67
+ </CityElement>
68
+ ))}
69
+ </View>
70
+ <OButton
71
+ text={t('CONTINUE', 'Continue')}
72
+ bgColor={theme.colors.primary}
73
+ borderColor={theme.colors.primary}
74
+ style={styles.btnStyle}
75
+ textStyle={{ color: 'white' }}
76
+ onClick={() => handleClick()}
77
+ />
78
+ </Container>
79
+ )
80
+ }
81
+
82
+ const styles = StyleSheet.create({
83
+ btnStyle: {
84
+ marginTop: 20,
85
+ borderRadius: 8,
86
+ shadowOpacity: 0,
87
+ height: 44
88
+ },
89
+ })
@@ -0,0 +1,17 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ width: 100%;
5
+ padding: 0 40px;
6
+ justify-content: space-between;
7
+ padding-bottom: 12px;
8
+
9
+ ${(props: any) => props.height && css`
10
+ height: ${props.height}px;
11
+ `}
12
+ `
13
+
14
+ export const CityElement = styled.TouchableOpacity`
15
+ padding: 10px;
16
+ flex-direction: row;
17
+ `
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { StyleSheet, Alert, Text } from 'react-native';
3
- import { CouponControl as CouponController, useLanguage } from 'ordering-components/native';
3
+ import { CouponControl as CouponController, useLanguage, useEvent } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  CContainer,
@@ -18,11 +18,13 @@ const CouponControlUI = (props: any) => {
18
18
  handleRemoveCouponClick,
19
19
  onChangeInputCoupon,
20
20
  confirm,
21
- setConfirm
21
+ setConfirm,
22
+ cart
22
23
  } = props
23
24
 
24
25
  const [, t] = useLanguage()
25
26
  const theme = useTheme();
27
+ const [events] = useEvent()
26
28
 
27
29
  const styles = StyleSheet.create({
28
30
  inputsStyle: {
@@ -45,6 +47,11 @@ const CouponControlUI = (props: any) => {
45
47
  setConfirm({ ...confirm, open: false, error: false })
46
48
  }
47
49
 
50
+ const onButtonApplyClick = () => {
51
+ events.emit('coupon_entered', { ...cart, coupon: couponInput })
52
+ handleButtonApplyClick()
53
+ }
54
+
48
55
  useEffect(() => {
49
56
  if (confirm.content) {
50
57
  Alert.alert(
@@ -94,7 +101,7 @@ const CouponControlUI = (props: any) => {
94
101
  inputStyle={{ fontSize: 12 }}
95
102
  />
96
103
  <OButton
97
- onClick={() => handleButtonApplyClick()}
104
+ onClick={() => onButtonApplyClick()}
98
105
  bgColor={theme.colors.primary}
99
106
  borderColor={theme.colors.primary}
100
107
  textStyle={{ color: 'white', fontSize: 12 }}
@@ -22,21 +22,25 @@ const DriverTipsUI = (props: any) => {
22
22
  const {
23
23
  driverTip,
24
24
  driverTipsOptions,
25
- optionSelected,
26
- isFixedPrice,
25
+ isMulti,
26
+ cart,
27
+ carts,
27
28
  isDriverTipUseCustom,
28
- handlerChangeOption
29
+ handlerChangeOption,
30
+ isFixedPrice
29
31
  } = props;
30
32
 
31
33
  const [{ parsePrice }] = useUtils();
34
+ const theme = useTheme();
32
35
  const [, t] = useLanguage();
33
36
  const [{ configs }] = useConfig();
34
-
35
- const theme = useTheme();
37
+ const [customTip, setCustomTip] = useState((!isMulti && isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
38
+ const currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0
39
+ const [value, setvalue] = useState('');
36
40
 
37
41
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
42
+ semicircle: {
43
+ borderRadius: 8
40
44
  },
41
45
  inputStyle: {
42
46
  flex: 1,
@@ -48,53 +52,63 @@ const DriverTipsUI = (props: any) => {
48
52
  }
49
53
  })
50
54
 
51
- const [value, setvalue] = useState('');
52
-
53
- const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
55
+ const placeholderCurrency = !isFixedPrice ? `0%` : (configs?.currency_position?.value || 'left') === 'left'
54
56
  ? `${configs?.format_number_currency?.value}0`
55
57
  : `0${configs?.format_number_currency?.value}`
56
58
 
57
59
  const handleChangeDriverTip = (val: any) => {
58
60
  const tip = Number(val)
59
61
  if ((isNaN(tip) || tip < 0)) {
60
- setvalue(value)
61
- return
62
+ setvalue(value)
63
+ return
62
64
  }
63
65
  setvalue(val)
64
66
  }
65
-
67
+
68
+ const multiCartTipsAmmout = carts?.reduce((total: any, cart: any) => {
69
+ return total + parseFloat(cart?.driver_tip || 0)
70
+ }, 0)
71
+
66
72
  return (
67
73
  <DTContainer>
68
74
  <DTLabel>
69
75
  {t('CUSTOM_DRIVER_TIP_MESSAGE', '100% of these tips go directly to your driver')}
70
76
  </DTLabel>
71
77
  <DTWrapperTips>
72
- {!isDriverTipUseCustom && driverTipsOptions.map((option: any, i: number) => (
78
+ {driverTipsOptions.map((option: any, i: number) => (
73
79
  <TouchableOpacity
74
80
  key={i}
75
- onPress={() => handlerChangeOption(option)}
81
+ onPress={() => {
82
+ handlerChangeOption(option)
83
+ setCustomTip(false)
84
+ }}
76
85
  >
77
86
  <DTCard
78
- style={style.circle}
79
- isActive={option === optionSelected}
87
+ style={style.semicircle}
88
+ isActive={(option === driverTip && !customTip)}
80
89
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
90
+ <OText size={12} numberOfLines={2} color={(option === driverTip && !customTip) ? '#FFF' : theme.colors.textSecondary}>
82
91
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
92
  </OText>
84
93
  </DTCard>
85
94
  </TouchableOpacity>
86
95
  ))}
96
+ {isDriverTipUseCustom && (
97
+ <TouchableOpacity
98
+ onPress={() => setCustomTip(true)}
99
+ >
100
+ <DTCard
101
+ style={style.semicircle}
102
+ isActive={customTip}
103
+ >
104
+ <OText size={12} numberOfLines={2} color={customTip ? '#FFF' : theme.colors.textSecondary}>
105
+ {t('CUSTOM_TIP', 'Custom')}
106
+ </OText>
107
+ </DTCard>
108
+ </TouchableOpacity>
109
+ )}
87
110
  </DTWrapperTips>
88
- {(!isDriverTipUseCustom && !driverTipsOptions.includes(driverTip) && driverTip > 0) && (
89
- <OText
90
- color={theme.colors.error}
91
- size={16}
92
- style={{ marginTop: 10, textAlign: 'center' }}
93
- >
94
- {t('CUSTOM_DRIVER_TIP_AMOUNT', 'The driver\'s current tip comes from a custom option')}
95
- </OText>
96
- )}
97
- {isDriverTipUseCustom && (
111
+ {customTip && (
98
112
  <DTForm>
99
113
  <DTWrapperInput>
100
114
  <OInput
@@ -120,17 +134,18 @@ const DriverTipsUI = (props: any) => {
120
134
  }}
121
135
  />
122
136
  </DTWrapperInput>
123
- {parseFloat(driverTip || 0) > 0 && (
124
- <OText
125
- color={theme.colors.error}
126
- size={16}
127
- style={{ marginTop: 10, textAlign: 'center' }}
128
- >
129
- {t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}: {parsePrice(driverTip)}
130
- </OText>
131
- )}
132
137
  </DTForm>
133
138
  )}
139
+ {currentTip && (
140
+ <OText
141
+ color={theme.colors.primary}
142
+ size={16}
143
+ style={{ marginTop: 10, textAlign: 'center' }}
144
+ >
145
+ {t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
146
+ ` (${driverTip}%)`}: {isFixedPrice ? parsePrice(multiCartTipsAmmout ?? driverTip) : parsePrice(multiCartTipsAmmout ?? cart?.driver_tip)}
147
+ </OText>
148
+ )}
134
149
  </DTContainer>
135
150
  )
136
151
  }
@@ -26,11 +26,12 @@ export const DTCard = styled.View`
26
26
  text-transform: capitalize;
27
27
  min-height: 55px;
28
28
  min-width: 55px;
29
- max-width: 55px;
29
+ max-width: 80px;
30
30
  max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
34
+ padding-horizontal: 10px;
34
35
 
35
36
  ${(props: any) => props.isActive && css`
36
37
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { useLanguage, useOrder } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native'
4
+ import { Platform } from 'react-native'
4
5
  import { FavoriteList } from '../FavoriteList'
5
6
  import NavBar from '../NavBar'
6
7
  import { OText } from '../shared'
@@ -33,7 +34,9 @@ export const Favorite = (props: any) => {
33
34
  }
34
35
 
35
36
  return (
36
- <Container>
37
+ <Container
38
+ pdng={Platform.OS === 'ios' ? '10px' : '20px'}
39
+ >
37
40
  <NavBar
38
41
  title={t('FAVORITE', 'Favorite')}
39
42
  titleAlign={'center'}
@@ -51,9 +54,9 @@ export const Favorite = (props: any) => {
51
54
  >
52
55
  <OText
53
56
  color={menu.key === tabSelected ? theme.colors.textNormal : theme.colors.disabled}
54
- size={14}
55
- weight={menu.key === tabSelected ? '500' : '400'}
56
- style={{ marginBottom: 12 }}
57
+ size={14}
58
+ weight={menu.key === tabSelected ? '500' : '400'}
59
+ style={{ marginBottom: 12 }}
57
60
  >
58
61
  {menu.name}
59
62
  </OText>
@@ -18,5 +18,5 @@ export const Tab = styled.TouchableOpacity`
18
18
  export const Container = styled.View`
19
19
  padding-horizontal: 40px;
20
20
  padding-bottom: 20px;
21
- padding-top: 30px;
21
+ padding-top: ${(props: any) => props.pdng};
22
22
  `
@@ -4,8 +4,8 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
4
4
  import { FavoriteParams } from '../../types';
5
5
  import { SingleOrderCard } from '../SingleOrderCard';
6
6
  import {
7
- FavoriteList as FavoriteListController,
8
- useOrder,
7
+ FavoriteList as FavoriteListController,
8
+ useOrder,
9
9
  useLanguage
10
10
  } from 'ordering-components/native';
11
11
  import { useTheme } from 'styled-components/native';
@@ -16,10 +16,10 @@ import { BusinessController } from '../BusinessController';
16
16
  import { SingleProductCard } from '../SingleProductCard';
17
17
  import { NotFoundSource } from '../NotFoundSource';
18
18
  import moment from 'moment';
19
-
19
+ import { getOrderStatus } from '../../utils'
20
20
 
21
21
  const FavoriteListUI = (props: FavoriteParams) => {
22
- const {
22
+ const {
23
23
  favoriteList,
24
24
  handleUpdateFavoriteList,
25
25
  pagination,
@@ -31,82 +31,53 @@ const FavoriteListUI = (props: FavoriteParams) => {
31
31
  isBusiness,
32
32
  isOrder,
33
33
  isProduct
34
- } = props
34
+ } = props
35
35
 
36
- const theme = useTheme();
36
+ const theme = useTheme();
37
37
  const [, t] = useLanguage()
38
38
  const [orderState] = useOrder();
39
39
  const [{ carts }] = useOrder()
40
40
 
41
41
  const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
42
42
 
43
- const getOrderStatus = (s: any) => {
44
- const status = parseInt(s)
45
- const orderStatus = [
46
- { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
47
- { key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
48
- { key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
49
- { key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
50
- { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
51
- { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
52
- { key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
53
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
54
- { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
55
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
56
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
57
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
58
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
59
- { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
60
- { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
61
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
62
- { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
63
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
64
- { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
65
- { key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
66
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
67
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
68
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
69
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
70
- ]
71
-
72
- const objectStatus = orderStatus.find((o) => o.key === status)
73
-
74
- return objectStatus && objectStatus
75
- }
76
-
77
43
  const onProductClick = (product: any) => {
78
44
  const categoryId = product?.category?.id
79
45
  const businessId = product?.category?.business?.id
80
46
  if (!categoryId || !businessId) return
81
47
  onNavigationRedirect && onNavigationRedirect('ProductDetails', {
82
- productId: product?.id,
83
- categoryId: categoryId,
84
- businessId: businessId
85
- })
48
+ isRedirect: 'business',
49
+ productId: product?.id,
50
+ businessId: businessId,
51
+ categoryId: categoryId,
52
+ business: {
53
+ store: product?.category?.business.slug,
54
+ header: product?.category?.header,
55
+ }
56
+ })
86
57
  }
87
58
 
88
59
  useEffect(() => {
89
- const _businessId = 'businessId:' + reorderState?.result?.business_id
90
- if (reorderState?.error) {
91
- if (reorderState?.result?.business_id) {
92
- _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
93
- onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
94
- }
95
- }
96
- if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
97
- const cartProducts = carts?.[_businessId]?.products
98
- const available = cartProducts.every((product: any) => product.valid === true)
99
- const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
60
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
61
+ if (reorderState?.error) {
62
+ if (reorderState?.result?.business_id) {
63
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
64
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
65
+ }
66
+ }
67
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
68
+ const cartProducts = carts?.[_businessId]?.products
69
+ const available = cartProducts.every((product: any) => product.valid === true)
70
+ const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
100
71
 
101
- if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
102
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
103
- } else {
104
- _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
105
- cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
106
- onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
107
- }
108
- }
109
- }, [reorderState])
72
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
73
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
74
+ } else {
75
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
76
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
77
+ onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
78
+ }
79
+ }
80
+ }, [reorderState])
110
81
 
111
82
  const handleBusinessClick = (business: any) => {
112
83
  onNavigationRedirect && onNavigationRedirect('Business', {
@@ -195,12 +166,12 @@ const FavoriteListUI = (props: FavoriteParams) => {
195
166
  )
196
167
  }
197
168
 
198
- return (
199
- <Container>
169
+ return (
170
+ <Container>
200
171
  {isBusiness && (
201
172
  <>
202
173
  {favoriteList?.favorites?.length > 0 && (
203
- favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i:number) => (
174
+ favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((business: any, i: number) => (
204
175
  <BusinessController
205
176
  key={`${business.id}_` + i}
206
177
  business={business}
@@ -237,7 +208,7 @@ const FavoriteListUI = (props: FavoriteParams) => {
237
208
  {isOrder && (
238
209
  <>
239
210
  {favoriteList?.favorites?.length > 0 && (
240
- favoriteList.favorites?.sort((a: any, b:any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
211
+ favoriteList.favorites?.sort((a: any, b: any) => moment(a?.delivery_datetime_utc).valueOf() - moment(b?.delivery_datetime_utc).valueOf())
241
212
  .map((order: any, i: number) => (
242
213
  <SingleOrderCard
243
214
  key={`${order?.id}_${i}`}
@@ -250,7 +221,7 @@ const FavoriteListUI = (props: FavoriteParams) => {
250
221
  handleReorder={handleReorder}
251
222
  reorderLoading={reorderState?.loading}
252
223
  />
253
- ))
224
+ ))
254
225
  )}
255
226
  {favoriteList?.loading && (
256
227
  [...Array(5).keys()].map(i => (
@@ -294,18 +265,18 @@ const FavoriteListUI = (props: FavoriteParams) => {
294
265
  )}
295
266
 
296
267
  {!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
297
- <WrappButton>
298
- <OButton
299
- onClick={() => getFavoriteList(pagination?.currentPage + 1)}
300
- text={t('LOAD_MORE_ITEMS', 'Load more items')}
301
- imgRightSrc={null}
302
- textStyle={{ color: theme.colors.white }}
303
- style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
304
- />
305
- </WrappButton>
306
- )}
268
+ <WrappButton>
269
+ <OButton
270
+ onClick={() => getFavoriteList(pagination?.currentPage + 1)}
271
+ text={t('LOAD_MORE_ITEMS', 'Load more items')}
272
+ imgRightSrc={null}
273
+ textStyle={{ color: theme.colors.white }}
274
+ style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
275
+ />
276
+ </WrappButton>
277
+ )}
307
278
  </Container>
308
- )
279
+ )
309
280
  }
310
281
 
311
282
  export const FavoriteList = (props: any) => {
@@ -62,7 +62,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
62
62
  return (
63
63
  <Container
64
64
  style={{
65
- paddingBottom: Platform.OS === 'ios' ? iosBottom ?? 0 : bottom + 16
65
+ paddingBottom: Platform.OS === 'ios' ? 20 : bottom + 16
66
66
  }}>
67
67
 
68
68
  <View style={styles.infoCont}>
@@ -86,7 +86,6 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
86
86
  {btnText}
87
87
  </OText>
88
88
  </Button>
89
-
90
89
  </Container>
91
90
  );
92
91
  };
@@ -12,7 +12,7 @@ export const Container = styled.View`
12
12
  width: 100%;
13
13
  justify-content: space-between;
14
14
  background-color: #FFF;
15
- z-index: 1000;
15
+ z-index: 20001;
16
16
  justify-content: space-between;
17
17
  `
18
18
 
@@ -1,6 +1,6 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const GpsButtonStyle = styled.TouchableOpacity`
4
- width: 30px;
5
- height: 30px;
6
- `
4
+ width: 16px;
5
+ height: 16px;
6
+ `