ordering-ui-react-native 0.17.89 → 0.17.90-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +37 -27
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  22. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  23. package/themes/business/src/components/MapView/index.tsx +14 -10
  24. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  26. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  27. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  34. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  35. package/themes/business/src/components/OrdersOption/index.tsx +22 -22
  36. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  37. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  38. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  39. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  40. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  41. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/types/index.tsx +25 -10
  48. package/themes/business/src/utils/index.tsx +29 -2
  49. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  51. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  53. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  54. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  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 +2 -2
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +1 -1
  61. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  62. package/themes/original/src/components/AddressForm/index.tsx +35 -17
  63. package/themes/original/src/components/AddressList/index.tsx +5 -8
  64. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  65. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  66. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +73 -37
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  69. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  70. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  71. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  72. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  73. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  74. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -336
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  81. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  82. package/themes/original/src/components/BusinessProductsListing/index.tsx +663 -556
  83. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  84. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +38 -405
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +60 -51
  91. package/themes/original/src/components/CartContent/index.tsx +102 -58
  92. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  93. package/themes/original/src/components/Checkout/index.tsx +280 -35
  94. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  95. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  96. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  97. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  98. package/themes/original/src/components/Favorite/index.tsx +1 -5
  99. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  100. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
  104. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  105. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  106. package/themes/original/src/components/Home/index.tsx +13 -4
  107. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  110. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  111. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  112. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  113. package/themes/original/src/components/Messages/index.tsx +15 -4
  114. package/themes/original/src/components/MomentOption/index.tsx +193 -92
  115. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  116. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  117. package/themes/original/src/components/MultiCheckout/index.tsx +385 -46
  118. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  119. package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
  120. package/themes/original/src/components/MyOrders/index.tsx +25 -16
  121. package/themes/original/src/components/NavBar/index.tsx +20 -13
  122. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  123. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  124. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  125. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  126. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  127. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  128. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  129. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  130. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  131. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  132. package/themes/original/src/components/OrdersOption/index.tsx +59 -48
  133. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  134. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  135. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  136. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  137. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  138. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  139. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  140. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  141. package/themes/original/src/components/ProductForm/index.tsx +87 -31
  142. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  143. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  144. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  145. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  146. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  147. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  148. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  149. package/themes/original/src/components/Promotions/index.tsx +2 -2
  150. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  151. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  152. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  153. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  154. package/themes/original/src/components/Sessions/styles.tsx +1 -0
  155. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  156. package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
  157. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  158. package/themes/original/src/components/SingleProductCard/index.tsx +14 -11
  159. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  160. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  161. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  162. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  163. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  164. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  165. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  166. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  167. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  168. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  169. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  170. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  171. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  172. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  173. package/themes/original/src/components/Wallets/index.tsx +52 -62
  174. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  175. package/themes/original/src/components/shared/OButton.tsx +3 -3
  176. package/themes/original/src/components/shared/OInput.tsx +4 -5
  177. package/themes/original/src/components/shared/OModal.tsx +3 -3
  178. package/themes/original/src/types/index.tsx +37 -10
  179. package/themes/original/src/utils/index.tsx +185 -13
  180. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  181. package/src/navigators/BottomNavigator.tsx +0 -117
  182. package/src/navigators/CheckoutNavigator.tsx +0 -66
  183. package/src/navigators/HomeNavigator.tsx +0 -202
  184. package/src/navigators/NavigationRef.tsx +0 -7
  185. package/src/navigators/RootNavigator.tsx +0 -269
  186. package/src/pages/Account.tsx +0 -34
  187. package/src/pages/AddressForm.tsx +0 -62
  188. package/src/pages/AddressList.tsx +0 -24
  189. package/src/pages/BusinessProductsList.tsx +0 -81
  190. package/src/pages/BusinessesListing.tsx +0 -43
  191. package/src/pages/CartList.tsx +0 -49
  192. package/src/pages/Checkout.tsx +0 -101
  193. package/src/pages/ForgotPassword.tsx +0 -24
  194. package/src/pages/Help.tsx +0 -23
  195. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  196. package/src/pages/HelpGuide.tsx +0 -23
  197. package/src/pages/HelpOrder.tsx +0 -23
  198. package/src/pages/Home.tsx +0 -36
  199. package/src/pages/IntroductoryTutorial.tsx +0 -170
  200. package/src/pages/Login.tsx +0 -47
  201. package/src/pages/MomentOption.tsx +0 -30
  202. package/src/pages/MultiCheckout.tsx +0 -31
  203. package/src/pages/MultiOrdersDetails.tsx +0 -27
  204. package/src/pages/MyOrders.tsx +0 -40
  205. package/src/pages/NetworkError.tsx +0 -24
  206. package/src/pages/NotFound.tsx +0 -22
  207. package/src/pages/OrderDetails.tsx +0 -25
  208. package/src/pages/ProductDetails.tsx +0 -55
  209. package/src/pages/Profile.tsx +0 -36
  210. package/src/pages/ReviewDriver.tsx +0 -30
  211. package/src/pages/ReviewOrder.tsx +0 -32
  212. package/src/pages/ReviewProducts.tsx +0 -30
  213. package/src/pages/Sessions.tsx +0 -22
  214. package/src/pages/Signup.tsx +0 -53
  215. package/src/pages/SpinnerLoader.tsx +0 -10
  216. package/src/pages/Splash.tsx +0 -21
@@ -23,7 +23,7 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
23
23
  import AntIcon from 'react-native-vector-icons/AntDesign'
24
24
  import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
- import { OAlert } from '../../../../../src/components/shared'
26
+ import { OAlert } from '../shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
28
  import { DriverTips } from '../DriverTips'
29
29
 
@@ -43,7 +43,15 @@ const CartUI = (props: any) => {
43
43
  handleRemoveOfferClick,
44
44
  isMultiCheckout,
45
45
  hideDeliveryFee,
46
- hideDriverTip
46
+ hideDriverTip,
47
+ hideCouponInput,
48
+ preorderSlotInterval,
49
+ preorderLeadTime,
50
+ preorderTimeRange,
51
+ preorderMaximumDays,
52
+ preorderMinimumDays,
53
+ cateringTypes,
54
+ isFromUpselling
47
55
  } = props
48
56
 
49
57
  const theme = useTheme();
@@ -58,7 +66,6 @@ const CartUI = (props: any) => {
58
66
  const [openChangeStore, setOpenChangeStore] = useState(false)
59
67
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
60
68
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
61
- const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
62
69
  const [openPlaceModal, setOpenPlaceModal] = useState(false)
63
70
 
64
71
  const isCartPending = cart?.status === 2
@@ -101,18 +108,23 @@ const CartUI = (props: any) => {
101
108
  }
102
109
  }
103
110
 
104
- const handleUpsellingPage = () => {
111
+ const handleUpsellingPage = (individualCart : any) => {
112
+ const isProductCartParam = !!individualCart?.products?.length
105
113
  setOpenUpselling(false)
106
114
  setCanOpenUpselling(false)
107
- const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
108
- if (cartsAvailable.length === 1) {
115
+
116
+ const cartsAvailable: any = Object.values(orderState?.carts)
117
+ ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
118
+ ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
119
+ if (cartsAvailable.length === 1 || !isMultiCheckout) {
120
+ const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
109
121
  onNavigationRedirect('CheckoutNavigator', {
110
122
  screen: 'CheckoutPage',
111
- cartUuid: cartsAvailable[0]?.uuid,
112
- businessLogo: cartsAvailable[0]?.business?.logo,
113
- businessName: cartsAvailable[0]?.business?.name,
114
- cartTotal: cartsAvailable[0]?.total
115
- })
123
+ cartUuid: cart?.uuid,
124
+ businessLogo: cart?.business?.logo,
125
+ businessName: cart?.business?.name,
126
+ cartTotal: cart?.total
127
+ }, true)
116
128
  } else {
117
129
  const groupKeys: any = {}
118
130
  cartsAvailable.forEach((_cart: any) => {
@@ -125,12 +137,15 @@ const CartUI = (props: any) => {
125
137
  (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
126
138
  Object.keys(groupKeys).length > 1
127
139
  ) {
128
- onNavigationRedirect('CheckoutNavigator', { screen: 'MultiCart' })
140
+ onNavigationRedirect('CheckoutNavigator', {
141
+ screen: 'MultiCheckout',
142
+ checkCarts: true
143
+ }, true)
129
144
  } else {
130
145
  onNavigationRedirect('CheckoutNavigator', {
131
146
  screen: 'MultiCheckout',
132
147
  cartUuid: cartsAvailable[0]?.group?.uuid
133
- })
148
+ }, true)
134
149
  }
135
150
  }
136
151
  }
@@ -149,16 +164,16 @@ const CartUI = (props: any) => {
149
164
  return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
150
165
  }
151
166
 
152
- const onRemoveOffer = (id: number) => {
153
- setConfirm({
154
- open: true,
155
- content: [t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')],
156
- title: t('OFFER', 'Offer'),
157
- handleOnAccept: () => {
158
- setConfirm({ ...confirm, open: false })
159
- handleRemoveOfferClick(id)
160
- }
161
- })
167
+ const OfferAlert = ({ offerId }: any) => {
168
+ return (
169
+ <OAlert
170
+ title={t('OFFER', 'Offer')}
171
+ message={t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')}
172
+ onAccept={() => handleRemoveOfferClick(offerId)}
173
+ >
174
+ <AntIcon style={{ marginLeft: 3 }} name='closecircle' size={16} color={theme.colors.primary} />
175
+ </OAlert>
176
+ )
162
177
  }
163
178
 
164
179
  const walletName: any = {
@@ -202,6 +217,7 @@ const CartUI = (props: any) => {
202
217
  handleClickCheckout={() => setOpenUpselling(true)}
203
218
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
204
219
  isMultiCheckout={isMultiCheckout}
220
+ isFromUpselling={isFromUpselling}
205
221
  >
206
222
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
207
223
  <ProductItemAccordion
@@ -215,7 +231,6 @@ const CartUI = (props: any) => {
215
231
  offsetDisabled={offsetDisabled}
216
232
  onDeleteProduct={handleDeleteClick}
217
233
  onEditProduct={handleEditProduct}
218
- viewString='business_view'
219
234
  />
220
235
  ))}
221
236
 
@@ -227,7 +242,7 @@ const CartUI = (props: any) => {
227
242
  {parsePrice(cart?.subtotal + getIncludedTaxes())}
228
243
  </OText>
229
244
  </OSTable>
230
- {!hideCartDiscount && cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
245
+ {cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
231
246
  <OSTable>
232
247
  {cart?.discount_type === 1 ? (
233
248
  <OText size={12} lineHeight={18}>
@@ -241,7 +256,7 @@ const CartUI = (props: any) => {
241
256
  </OSTable>
242
257
  )}
243
258
  {
244
- !hideCartDiscount && cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
259
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
245
260
  <OSTable key={`${offer.id}_${i}`}>
246
261
  <OSRow>
247
262
  <OText size={12} lineHeight={18}>{offer.name}</OText>
@@ -251,9 +266,9 @@ const CartUI = (props: any) => {
251
266
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
252
267
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
253
268
  </TouchableOpacity>
254
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
255
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
256
- </TouchableOpacity>
269
+ {!!offer?.id && (
270
+ <OfferAlert offerId={offer?.id} />
271
+ )}
257
272
  </OSRow>
258
273
  <OText size={12} lineHeight={18}>
259
274
  - {parsePrice(offer?.summary?.discount)}
@@ -262,7 +277,7 @@ const CartUI = (props: any) => {
262
277
  ))
263
278
  }
264
279
  {/* <Divider /> */}
265
- {!hideCartDiscount && cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
280
+ {cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
266
281
  <OSTable>
267
282
  <OText size={12} lineHeight={18} numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
268
283
  {cart?.business?.tax_type === 1 ? (
@@ -315,9 +330,9 @@ const CartUI = (props: any) => {
315
330
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
316
331
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
317
332
  </TouchableOpacity>
318
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
319
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
320
- </TouchableOpacity>
333
+ {!!offer?.id && (
334
+ <OfferAlert offerId={offer?.id} />
335
+ )}
321
336
  </OSRow>
322
337
  <OText size={12} lineHeight={18}>
323
338
  - {parsePrice(offer?.summary?.discount)}
@@ -325,10 +340,10 @@ const CartUI = (props: any) => {
325
340
  </OSTable>
326
341
  ))
327
342
  }
328
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
343
+ {orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
329
344
  <OSTable>
330
345
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
331
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
346
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
332
347
  </OSTable>
333
348
  )}
334
349
  {
@@ -342,9 +357,9 @@ const CartUI = (props: any) => {
342
357
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
343
358
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
344
359
  </TouchableOpacity>
345
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
346
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
347
- </TouchableOpacity>
360
+ {!!offer?.id && (
361
+ <OfferAlert offerId={offer?.id} />
362
+ )}
348
363
  </OSRow>
349
364
  <OText size={12} lineHeight={18}>
350
365
  - {parsePrice(offer?.summary?.discount)}
@@ -374,18 +389,19 @@ const CartUI = (props: any) => {
374
389
  <OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
375
390
  </OSTable>
376
391
  ))}
377
- {isCouponEnabled && !isCartPending && (
392
+ {isCouponEnabled && !isCartPending && !hideCouponInput && (
378
393
  <OSTable>
379
394
  <OSCoupon>
380
395
  <CouponControl
381
396
  businessId={businessId}
382
397
  price={cart.total}
398
+ cart={cart}
383
399
  />
384
400
  </OSCoupon>
385
401
  </OSTable>
386
402
  )}
387
403
 
388
- {isMultiCheckout &&
404
+ {!isMultiCheckout &&
389
405
  cart &&
390
406
  cart?.valid &&
391
407
  orderState?.options?.type === 1 &&
@@ -401,12 +417,13 @@ const CartUI = (props: any) => {
401
417
  uuid={cart?.uuid}
402
418
  businessId={cart?.business_id}
403
419
  driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
404
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
420
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
405
421
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
406
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
422
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
407
423
  ? cart?.driver_tip
408
424
  : cart?.driver_tip_rate}
409
425
  useOrderContext
426
+ cart={cart}
410
427
  />
411
428
  </DriverTipsContainer>
412
429
  )}
@@ -439,7 +456,7 @@ const CartUI = (props: any) => {
439
456
  </TouchableOpacity>
440
457
  </OSTable>
441
458
  )}
442
- {cart?.status !== 2 && !hideCartComments && (
459
+ {cart?.status !== 2 && (
443
460
  <OSTable>
444
461
  <View style={{ width: '100%', marginTop: 20 }}>
445
462
  <OText size={16} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
@@ -540,14 +557,6 @@ const CartUI = (props: any) => {
540
557
  setOpenPlaceModal={setOpenPlaceModal}
541
558
  />
542
559
  </OModal>
543
- <OAlert
544
- open={confirm.open}
545
- title={confirm.title}
546
- content={confirm.content}
547
- onAccept={confirm.handleOnAccept}
548
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
549
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
550
- />
551
560
  </CContainer>
552
561
  )
553
562
  }
@@ -1,58 +1,69 @@
1
1
  import React, { useState } from 'react';
2
2
  import { View } from 'react-native';
3
- import { useLanguage, useConfig } from 'ordering-components/native';
3
+ import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
- import { CCContainer, CCNotCarts, CCList, CheckoutAction } from './styles';
5
+ import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
6
6
 
7
7
  import { Cart } from '../Cart';
8
8
  import { OButton, OText } from '../shared';
9
9
  import Spinner from 'react-native-loading-spinner-overlay';
10
+ import { NotFoundSource } from '../NotFoundSource';
10
11
 
11
12
  export const CartContent = (props: any) => {
12
13
  const {
13
14
  carts,
14
15
  isOrderStateCarts,
15
- onNavigationRedirect
16
+ onNavigationRedirect,
17
+ singleBusiness
16
18
  } = props
17
19
 
18
20
  const theme = useTheme();
19
21
  const [, t] = useLanguage()
20
22
  const [{ configs }] = useConfig()
23
+ const [{ parsePrice }] = useUtils();
21
24
  const [isCartsLoading, setIsCartsLoading] = useState(false)
22
25
 
23
26
  const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
24
27
  const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
25
28
  const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
26
29
 
30
+ const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
31
+ const totalCartsFee = cartsAvailable?.length && cartsAvailable
32
+ ?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
33
+ ?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
34
+
27
35
  const handleCheckoutRedirect = () => {
28
- if (cartsAvailable.length === 1) {
29
- onNavigationRedirect('CheckoutNavigator', {
30
- screen: 'CheckoutPage',
31
- cartUuid: cartsAvailable[0]?.uuid,
32
- businessLogo: cartsAvailable[0]?.business?.logo,
33
- businessName: cartsAvailable[0]?.business?.name,
34
- cartTotal: cartsAvailable[0]?.total
35
- })
36
- } else {
37
- const groupKeys: any = {}
38
- cartsAvailable.forEach((_cart: any) => {
39
- groupKeys[_cart?.group?.uuid]
40
- ? groupKeys[_cart?.group?.uuid] += 1
41
- : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
42
- })
36
+ if (cartsAvailable.length === 1) {
37
+ onNavigationRedirect('CheckoutNavigator', {
38
+ screen: 'CheckoutPage',
39
+ cartUuid: cartsAvailable[0]?.uuid,
40
+ businessLogo: cartsAvailable[0]?.business?.logo,
41
+ businessName: cartsAvailable[0]?.business?.name,
42
+ cartTotal: cartsAvailable[0]?.total
43
+ })
44
+ } else {
45
+ const groupKeys: any = {}
46
+ cartsAvailable.forEach((_cart: any) => {
47
+ groupKeys[_cart?.group?.uuid]
48
+ ? groupKeys[_cart?.group?.uuid] += 1
49
+ : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
50
+ })
43
51
 
44
- if (
45
- (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
46
- Object.keys(groupKeys).length > 1
47
- ) {
48
- onNavigationRedirect('CheckoutNavigator', { screen: 'MultiCart' })
49
- } else {
50
- onNavigationRedirect('CheckoutNavigator', {
51
- screen: 'MultiCheckout',
52
- cartUuid: cartsAvailable[0]?.group?.uuid
53
- })
54
- }
55
- }
52
+ if (
53
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
54
+ Object.keys(groupKeys).length > 1
55
+ ) {
56
+ onNavigationRedirect('CheckoutNavigator', {
57
+ screen: 'MultiCheckout',
58
+ checkCarts: true
59
+ })
60
+ } else {
61
+ onNavigationRedirect('CheckoutNavigator', {
62
+ screen: 'MultiCheckout',
63
+ cartUuid: cartsAvailable[0]?.group?.uuid
64
+ })
65
+ }
66
+ }
56
67
  }
57
68
 
58
69
  return (
@@ -62,7 +73,7 @@ export const CartContent = (props: any) => {
62
73
  {isOrderStateCarts && carts?.length > 0 && (
63
74
  <>
64
75
  {carts.map((cart: any, i: number) => (
65
- <CCList key={i} style={{ overflow: 'visible' }}>
76
+ <CCList nestedScrollEnabled={true} key={i} style={{ overflow: 'visible' }}>
66
77
  {cart.products.length > 0 && (
67
78
  <>
68
79
  <Cart
@@ -75,6 +86,10 @@ export const CartContent = (props: any) => {
75
86
  setIsCartsLoading={setIsCartsLoading}
76
87
  isMultiCheckout={isMultiCheckout}
77
88
  hideUpselling
89
+ businessConfigs={cart?.business?.configs}
90
+ hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
91
+ hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
92
+ hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
78
93
  />
79
94
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
80
95
  </>
@@ -82,38 +97,67 @@ export const CartContent = (props: any) => {
82
97
  </CCList>
83
98
  ))}
84
99
  {isMultiCheckout && (
85
- <CheckoutAction style={{ marginTop: 0 }}>
86
- <OButton
87
- text={t('CHECKOUT', 'Checkout')}
88
- bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
89
- isDisabled={!cartsAvailable.length}
90
- borderColor={theme.colors.primary}
91
- imgRightSrc={null}
92
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
93
- onClick={() => handleCheckoutRedirect()}
94
- style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
95
- />
96
- </CheckoutAction>
100
+ <>
101
+ {!!cartsAvailable.length && (
102
+ <ChCartsTotal>
103
+ {!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
104
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
105
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
106
+ {t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
107
+ </OText>
108
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
109
+ {parsePrice(totalCartsFee)}
110
+ </OText>
111
+ </View>
112
+ )}
113
+ {cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
114
+ configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
115
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
116
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
117
+ {t('DRIVER_TIP', 'Driver tip')}
118
+ </OText>
119
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
120
+ {parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
121
+ </OText>
122
+ </View>
123
+ )}
124
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
125
+ <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
126
+ {t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
127
+ </OText>
128
+ <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
129
+ </View>
130
+ <View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
131
+ <OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
132
+ {t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
133
+ </OText>
134
+ </View>
135
+ </ChCartsTotal>
136
+ )}
137
+ <CheckoutAction style={{ marginTop: 0 }}>
138
+ <OButton
139
+ text={t('CHECKOUT', 'Checkout')}
140
+ bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
141
+ isDisabled={!cartsAvailable.length}
142
+ borderColor={theme.colors.primary}
143
+ imgRightSrc={null}
144
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
145
+ onClick={() => handleCheckoutRedirect()}
146
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
147
+ />
148
+ </CheckoutAction>
149
+ </>
97
150
  )}
98
151
  </>
99
152
  )}
100
153
  {(!carts || carts?.length === 0) && (
101
154
  <CCNotCarts>
102
- <OText size={24} style={{ textAlign: 'center' }}>
103
- {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
104
- </OText>
105
- <OButton
106
- text={t('START_SHOPPING', 'Start shopping')}
107
- bgColor={theme.colors.primary}
108
- borderColor={theme.colors.primary}
109
- textStyle={{
110
- color: theme.colors.white,
111
- fontSize: 14,
112
- paddingRight: 0
113
- }}
114
- style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
115
- imgRightSrc={null}
116
- onClick={() => onNavigationRedirect('BusinessList')}
155
+ <NotFoundSource
156
+ hideImage
157
+ btnStyle={{ borderRadius: 8 }}
158
+ content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
159
+ btnTitle={t('START_SHOPPING', 'Start shopping')}
160
+ onClickButton={() => singleBusiness ? onNavigationRedirect('Business') : onNavigationRedirect('BusinessList')}
117
161
  />
118
162
  </CCNotCarts>
119
163
  )}
@@ -5,13 +5,9 @@ export const CCContainer = styled.View`
5
5
  `
6
6
 
7
7
  export const CCNotCarts = styled.View`
8
- height: 300px;
9
- display: flex;
10
8
  flex-direction: column;
11
- justify-content: center;
12
- align-items: center;
13
- width: 80%;
14
- margin: auto;
9
+ align-items: center;
10
+ margin-top: 40px;
15
11
  `
16
12
 
17
13
  export const CCList = styled.ScrollView`
@@ -27,3 +23,7 @@ export const CheckoutAction = styled.View`
27
23
  margin-top: 10px;
28
24
  margin-bottom: 10px;
29
25
  `
26
+
27
+ export const ChCartsTotal = styled.View`
28
+ margin-bottom: 16px;
29
+ `