ordering-ui-react-native 0.16.38 → 0.16.39-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 (204) hide show
  1. package/package.json +7 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +1 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  35. package/themes/business/src/components/Chat/index.tsx +38 -30
  36. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  37. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  38. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  39. package/themes/business/src/components/MapView/index.tsx +12 -1
  40. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  41. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  42. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  43. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  44. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  45. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  46. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  47. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  50. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  54. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  55. package/themes/business/src/components/PreviousOrders/index.tsx +22 -24
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  57. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  58. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  59. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  60. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  61. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  62. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  63. package/themes/business/src/types/index.tsx +15 -9
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +4 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  80. package/themes/original/src/components/AddressForm/index.tsx +157 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +260 -176
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +216 -113
  86. package/themes/original/src/components/BusinessController/styles.tsx +1 -8
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +109 -139
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -60
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +255 -108
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  105. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  106. package/themes/original/src/components/Cart/index.tsx +54 -16
  107. package/themes/original/src/components/Cart/styles.tsx +4 -0
  108. package/themes/original/src/components/CartContent/index.tsx +22 -16
  109. package/themes/original/src/components/Checkout/index.tsx +110 -116
  110. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  111. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  112. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  113. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  114. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  115. package/themes/original/src/components/Favorite/index.tsx +1 -0
  116. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  117. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  118. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  119. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  120. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  121. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  122. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  123. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  124. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -73
  127. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  128. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  129. package/themes/original/src/components/Messages/index.tsx +17 -17
  130. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  132. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  133. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  134. package/themes/original/src/components/MyOrders/index.tsx +88 -22
  135. package/themes/original/src/components/NavBar/index.tsx +15 -9
  136. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  137. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  138. package/themes/original/src/components/Notifications/index.tsx +148 -0
  139. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  140. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  142. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  143. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  144. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  145. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  146. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  149. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  150. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  151. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  152. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  156. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +639 -664
  160. package/themes/original/src/components/ProductForm/styles.tsx +10 -11
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  163. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  167. package/themes/original/src/components/Promotions/index.tsx +232 -219
  168. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  169. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  170. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  171. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  172. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  173. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  174. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  175. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  176. package/themes/original/src/components/SignupForm/index.tsx +184 -127
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  178. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  179. package/themes/original/src/components/SingleProductCard/index.tsx +198 -112
  180. package/themes/original/src/components/SingleProductCard/styles.tsx +3 -10
  181. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  182. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  183. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  184. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  185. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  186. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  187. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  188. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  189. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  190. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  192. package/themes/original/src/components/Wallets/index.tsx +176 -164
  193. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  194. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  195. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  196. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  197. package/themes/original/src/components/shared/OButton.tsx +10 -3
  198. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  199. package/themes/original/src/components/shared/OInput.tsx +13 -3
  200. package/themes/original/src/layouts/Container.tsx +13 -9
  201. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  202. package/themes/original/src/types/index.tsx +82 -29
  203. package/themes/original/src/utils/index.tsx +121 -10
  204. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const WelcomeTitle = styled.View`
4
4
  flex: 1;
@@ -16,6 +16,9 @@ export const Search = styled.View`
16
16
  align-items: center;
17
17
  margin-vertical: 10px;
18
18
  margin-horizontal: 20px;
19
+ ${(props: any) => props.isChewLayout && css`
20
+ margin-horizontal: 30px;
21
+ `}
19
22
  `
20
23
 
21
24
  export const AddressInput = styled.TouchableOpacity`
@@ -27,6 +30,9 @@ export const AddressInput = styled.TouchableOpacity`
27
30
  width: 100%;
28
31
  height: 44px;
29
32
  max-height: 44px;
33
+ ${(props: any) => props.isChewLayout && css`
34
+ border-radius: 8px;
35
+ `}
30
36
  `
31
37
 
32
38
  export const OrderControlContainer = styled.View`
@@ -54,7 +60,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
54
60
 
55
61
  export const HeaderWrapper = styled.ImageBackground`
56
62
  width: 100%;
57
- height: 270px;
63
+ height: 270px;
58
64
  padding: 20px 40px;
59
65
  background-color: transparent;
60
66
  `;
@@ -66,16 +72,9 @@ export const ListWrapper = styled.View`
66
72
 
67
73
  export const FeaturedWrapper = styled.View`
68
74
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
69
- height: 220px;
70
75
  paddingVertical: 30px;
71
76
  `;
72
77
 
73
- export const OrderProgressWrapper = styled.View`
74
- margin-top: 37px;
75
- margin-bottom: 20px;
76
- padding-horizontal: 40px;
77
- `
78
-
79
78
  export const FarAwayMessage = styled.View`
80
79
  flex-direction: row;
81
80
  align-items: center;
@@ -89,5 +88,43 @@ export const AddressInputContainer = styled.View`
89
88
  flex-direction: row;
90
89
  width: 100%;
91
90
  align-items: center;
92
- justify-content: center
91
+ justify-content: center;
92
+ ${(props: any) => props.isChewLayout && css`
93
+ flex-direction: row-reverse;
94
+ `}
95
+ `
96
+
97
+ export const PreorderInput = styled(AddressInput)`
98
+ justify-content: center;
99
+ `
100
+
101
+ export const OTabs = styled.View`
102
+ flex-direction: row;
103
+ justify-content: space-between;
104
+ align-items: center;
105
+ margin-bottom: -1px;
106
+ width: 100%;
107
+ `;
108
+
109
+ export const OTab = styled.TouchableOpacity`
110
+ padding-bottom: 10px;
111
+ border-bottom-width: 1px;
112
+ margin-end: 14px;
113
+ padding-horizontal: 5px;
114
+ `;
115
+
116
+ export const OrderTypesContainer = styled.View`
117
+ flex-direction: row;
118
+ font-size: 14px;
119
+ width: 180px;
120
+ justify-content: space-between;
121
+ align-items: center;
122
+ border-bottom-width: 1px;
123
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
124
+ margin-top: 10px;
125
+ align-self: center;
126
+ `
127
+
128
+ export const BusinessLogosContainer = styled.ScrollView`
129
+ padding-bottom: 10px;
93
130
  `
@@ -1,17 +1,105 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
1
3
 
2
- import React from 'react'
3
4
  import { useTheme } from 'styled-components/native'
4
5
  import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
5
6
  import { BusinessesListing as AppointmentBusinessListing } from './Layout/Appointment'
7
+ import { OBottomPopup } from '../shared';
8
+ import { ReviewTrigger } from '../ReviewTrigger';
9
+ import { NotificationSetting } from '../../../../../src/components/NotificationSetting';
6
10
 
7
11
  export const BusinessesListing = (props: any) => {
8
- const theme = useTheme()
9
- const layout = theme?.layout?.businessListing?.layout?.type || 'original'
12
+ const { logosLayout } = props
13
+ const theme = useTheme()
14
+ const layout = theme?.business_listing_view?.components?.layout?.type || 'original'
15
+ const [, t] = useLanguage();
16
+ const [{ auth }] = useSession()
17
+ const [, { getLastOrderHasNoReview }] = useOrder();
18
+ const [{ configs }] = useConfig()
19
+ const isShowReviewsPopupEnabled = configs?.show_reviews_popups_enabled?.value === '1'
10
20
 
11
- return (
21
+ const [, setIsReviewed] = useState()
22
+ const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
23
+ const defaultOrder = {
24
+ id: 0,
25
+ business_id: 0,
26
+ business_name: '',
27
+ logo: '',
28
+ driver: {},
29
+ products: [],
30
+ review: {},
31
+ user_review: {},
32
+ delivery_datetime: ''
33
+ }
34
+ const [lastOrderReview, setLastOrderReview] = useState({
35
+ isReviewOpen: false,
36
+ order: defaultOrder,
37
+ defaultStar: 5,
38
+ })
39
+
40
+ const _getLastOrderHasNoReview = async () => {
41
+ const lastOrderHasNoReview = await getLastOrderHasNoReview()
42
+ lastOrderHasNoReview && OrderReviewRequired(lastOrderHasNoReview)
43
+ }
44
+
45
+ const OrderReviewRequired = (order: any) => {
46
+ setLastOrderReview({
47
+ isReviewOpen: true,
48
+ order: {
49
+ id: order?.id,
50
+ business_id: order?.business_id,
51
+ business_name: order?.business?.name,
52
+ logo: order.business?.logo,
53
+ driver: order?.driver,
54
+ products: order?.products,
55
+ review: order?.review,
56
+ user_review: order?.user_review,
57
+ delivery_datetime: order?.delivery_datetime_utc
58
+ },
59
+ defaultStar: 5
60
+ })
61
+ }
62
+
63
+ const handleOpenOrderReview = (star: number) => {
64
+ setLastOrderReview({
65
+ ...lastOrderReview, isReviewOpen: false, order: defaultOrder
66
+ })
67
+ props?.navigation && props.navigation.navigate(
68
+ 'ReviewOrder',
69
+ {
70
+ order: lastOrderReview.order,
71
+ defaultStar: star || 5,
72
+ setIsReviewed
73
+ }
74
+ )
75
+ }
76
+
77
+ useEffect(() => {
78
+ if (!isShowReviewsPopupEnabled) return
79
+ (checkNotificationStatus?.checked && auth) && _getLastOrderHasNoReview()
80
+ }, [checkNotificationStatus, auth, isShowReviewsPopupEnabled])
81
+
82
+ return (
12
83
  <>
13
- {(layout === 'original') && <OriginalBusinessListing {...props} />}
14
- {(layout === 'appointment') && <AppointmentBusinessListing {...props} />}
84
+ {((layout === 'original') || logosLayout) && <OriginalBusinessListing {...props} />}
85
+ {(layout === 'appointments') && !logosLayout && <AppointmentBusinessListing {...props} />}
86
+
87
+ {lastOrderReview?.isReviewOpen && (
88
+ <OBottomPopup
89
+ open={lastOrderReview?.isReviewOpen}
90
+ transparent={true}
91
+ onClose={() => setLastOrderReview({ ...lastOrderReview, isReviewOpen: false, order: defaultOrder })}
92
+ title={t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')}
93
+ bottomContainerStyle={{ height: 'auto', borderRadius: 10 }}
94
+ titleStyle={{ textAlign: 'center' }}
95
+ closeIcon={theme.images.general.close}
96
+ presentationStyle='overFullScreen'
97
+ >
98
+ {lastOrderReview?.order && <ReviewTrigger order={lastOrderReview?.order} handleOpenOrderReview={handleOpenOrderReview} />}
99
+ </OBottomPopup>
100
+ )}
101
+ <NotificationSetting checkNotificationStatus={checkNotificationStatus}
102
+ setCheckNotificationStatus={setCheckNotificationStatus} />
15
103
  </>
16
- )
104
+ )
17
105
  }
@@ -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 } from './styles';
11
+ import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -25,6 +25,7 @@ import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
26
  import { OAlert } from '../../../../../src/components/shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
+ import { DriverTips } from '../DriverTips'
28
29
 
29
30
  const CartUI = (props: any) => {
30
31
  const {
@@ -60,11 +61,16 @@ const CartUI = (props: any) => {
60
61
 
61
62
  const isCartPending = cart?.status === 2
62
63
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
63
- const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
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) || []
64
66
 
65
67
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
66
68
  const businessId = business?.business_id ?? null
67
- const placeSpotTypes = [3, 4]
69
+ const placeSpotTypes = [4]
70
+
71
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
72
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
73
+ : configs?.driver_tip_options?.value || []
68
74
 
69
75
  const momentFormatted = !orderState?.option?.moment
70
76
  ? t('RIGHT_NOW', 'Right Now')
@@ -98,11 +104,11 @@ const CartUI = (props: any) => {
98
104
  const handleUpsellingPage = () => {
99
105
  setOpenUpselling(false)
100
106
  setCanOpenUpselling(false)
101
- if (isCheckoutMultiBusinessEnabled) {
102
- props.onNavigationRedirect('CheckoutNavigator', {
103
- screen: 'MultiCheckout'
104
- })
105
- } else {
107
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
108
+ props.onNavigationRedirect('CheckoutNavigator', {
109
+ screen: 'MultiCheckout'
110
+ })
111
+ } else {
106
112
  props.onNavigationRedirect('CheckoutNavigator', {
107
113
  screen: 'CheckoutPage',
108
114
  cartUuid: cart?.uuid,
@@ -148,6 +154,12 @@ const CartUI = (props: any) => {
148
154
  }
149
155
  }
150
156
 
157
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
158
+ if (item?.type === 1)
159
+ return acc = acc + item?.summary?.tax
160
+ return acc = acc
161
+ }, cart?.subtotal)
162
+
151
163
  return (
152
164
  <CContainer>
153
165
  {openUpselling && (
@@ -172,7 +184,7 @@ const CartUI = (props: any) => {
172
184
  onNavigationRedirect={props.onNavigationRedirect}
173
185
  handleChangeStore={() => setOpenChangeStore(true)}
174
186
  handleClickCheckout={() => setOpenUpselling(true)}
175
- checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
187
+ checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
176
188
  isMultiCheckout={isMultiCheckout}
177
189
  >
178
190
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
@@ -355,13 +367,39 @@ const CartUI = (props: any) => {
355
367
  </OSTable>
356
368
  )}
357
369
 
370
+ {isMultiCheckout &&
371
+ cart &&
372
+ cart?.valid &&
373
+ orderState?.options?.type === 1 &&
374
+ cart?.status !== 2 &&
375
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
376
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
377
+ (
378
+ <DriverTipsContainer>
379
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
380
+ {t('DRIVER_TIPS', 'Driver Tips')}
381
+ </OText>
382
+ <DriverTips
383
+ uuid={cart?.uuid}
384
+ businessId={cart?.business_id}
385
+ driverTipsOptions={driverTipsOptions}
386
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
387
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
388
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
389
+ ? cart?.driver_tip
390
+ : cart?.driver_tip_rate}
391
+ useOrderContext
392
+ />
393
+ </DriverTipsContainer>
394
+ )}
395
+
358
396
  <OSTotal>
359
397
  <OSTable style={{ marginTop: 15 }}>
360
- <OText size={14} lineHeight={21} weight={'600'}>
398
+ <OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
361
399
  {t('TOTAL', 'Total')}
362
400
  </OText>
363
- <OText size={14} lineHeight={21} weight={'600'}>
364
- {parsePrice(cart?.total >= 0 ? cart?.total : 0)}
401
+ <OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
402
+ {parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
365
403
  </OText>
366
404
  </OSTable>
367
405
  </OSTotal>
@@ -423,15 +461,15 @@ const CartUI = (props: any) => {
423
461
  {cart?.valid_products ? (
424
462
  <CheckoutAction>
425
463
  <OButton
426
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
464
+ text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
427
465
  !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
428
466
  ) : !cart?.valid_address ? (
429
467
  `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
430
468
  ) : (
431
469
  `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
432
470
  )}
433
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
434
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
471
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
472
+ isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
435
473
  borderColor={theme.colors.primary}
436
474
  imgRightSrc={null}
437
475
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
@@ -446,7 +484,7 @@ const CartUI = (props: any) => {
446
484
  </OText>
447
485
  </View>
448
486
  )}
449
- </>
487
+ </>
450
488
  )}
451
489
  </BusinessItemAccordion>
452
490
 
@@ -33,3 +33,7 @@ export const Divider = styled.View`
33
33
  margin-top: 5px;
34
34
  margin-bottom: 10px;
35
35
  `
36
+
37
+ export const DriverTipsContainer = styled.View`
38
+ padding: 5px 0;
39
+ `
@@ -1,17 +1,18 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { useLanguage, useOrder } from 'ordering-components/native';
1
+ import React, { useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import { useLanguage } from 'ordering-components/native';
3
4
  import { useTheme } from 'styled-components/native';
4
5
  import { CCContainer, CCNotCarts, CCList } from './styles';
5
6
 
6
7
  import { Cart } from '../Cart';
7
- import { OIcon, OText } from '../shared';
8
+ import { OButton, OText } from '../shared';
8
9
  import Spinner from 'react-native-loading-spinner-overlay';
9
- import { View } from 'react-native';
10
10
 
11
11
  export const CartContent = (props: any) => {
12
12
  const {
13
13
  carts,
14
- isOrderStateCarts
14
+ isOrderStateCarts,
15
+ onNavigationRedirect
15
16
  } = props
16
17
 
17
18
  const theme = useTheme();
@@ -22,18 +23,15 @@ export const CartContent = (props: any) => {
22
23
  <CCContainer>
23
24
  {isOrderStateCarts && carts?.length > 0 && (
24
25
  <>
25
- {/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
- {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText> */}
28
26
  {carts.map((cart: any, i: number) => (
29
27
  <CCList key={i} style={{ overflow: 'visible' }}>
30
28
  {cart.products.length > 0 && (
31
29
  <>
32
30
  <Cart
33
- singleBusiness={props.singleBusiness}
34
- isFranchiseApp={props.isFranchiseApp}
31
+ singleBusiness={props.singleBusiness}
32
+ isFranchiseApp={props.isFranchiseApp}
35
33
  cart={cart}
36
- cartuuid={cart.uuid}
34
+ cartuuid={cart.uuid}
37
35
  onNavigationRedirect={props.onNavigationRedirect}
38
36
  isCartsLoading={isCartsLoading}
39
37
  setIsCartsLoading={setIsCartsLoading}
@@ -48,14 +46,22 @@ export const CartContent = (props: any) => {
48
46
  )}
49
47
  {(!carts || carts?.length === 0) && (
50
48
  <CCNotCarts>
51
- {/* <OIcon
52
- url={props.icon}
53
- width={200}
54
- height={122}
55
- /> */}
56
49
  <OText size={24} style={{ textAlign: 'center' }}>
57
50
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
58
51
  </OText>
52
+ <OButton
53
+ text={t('START_SHOPPING', 'Start shopping')}
54
+ bgColor={theme.colors.primary}
55
+ borderColor={theme.colors.primary}
56
+ textStyle={{
57
+ color: theme.colors.white,
58
+ fontSize: 14,
59
+ paddingRight: 0
60
+ }}
61
+ style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
62
+ imgRightSrc={null}
63
+ onClick={() => onNavigationRedirect('BusinessList')}
64
+ />
59
65
  </CCNotCarts>
60
66
  )}
61
67
  <Spinner visible={isCartsLoading} />