ordering-ui-react-native 0.17.93 → 0.17.94-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 +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 +0 -20
  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 +36 -26
  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/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +41 -46
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  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 +24 -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 -5
  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 +72 -36
  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 +346 -340
  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 +136 -31
  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 +37 -404
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +52 -55
  91. package/themes/original/src/components/CartContent/index.tsx +99 -58
  92. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  93. package/themes/original/src/components/Checkout/index.tsx +276 -32
  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 +12 -4
  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 +161 -49
  117. package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
  118. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  119. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  120. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  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 +13 -13
  132. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  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 +86 -30
  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/SignupForm/index.tsx +43 -27
  155. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  156. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  157. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  158. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  159. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  160. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  161. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  162. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  163. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  164. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  165. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  166. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  167. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  168. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  169. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  170. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  171. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  172. package/themes/original/src/components/Wallets/index.tsx +51 -61
  173. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  174. package/themes/original/src/components/shared/OButton.tsx +3 -3
  175. package/themes/original/src/components/shared/OInput.tsx +4 -5
  176. package/themes/original/src/components/shared/OModal.tsx +3 -3
  177. package/themes/original/src/types/index.tsx +37 -10
  178. package/themes/original/src/utils/index.tsx +185 -13
  179. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  180. package/src/navigators/BottomNavigator.tsx +0 -117
  181. package/src/navigators/CheckoutNavigator.tsx +0 -66
  182. package/src/navigators/HomeNavigator.tsx +0 -202
  183. package/src/navigators/NavigationRef.tsx +0 -7
  184. package/src/navigators/RootNavigator.tsx +0 -269
  185. package/src/pages/Account.tsx +0 -34
  186. package/src/pages/AddressForm.tsx +0 -62
  187. package/src/pages/AddressList.tsx +0 -24
  188. package/src/pages/BusinessProductsList.tsx +0 -81
  189. package/src/pages/BusinessesListing.tsx +0 -43
  190. package/src/pages/CartList.tsx +0 -49
  191. package/src/pages/Checkout.tsx +0 -101
  192. package/src/pages/ForgotPassword.tsx +0 -24
  193. package/src/pages/Help.tsx +0 -23
  194. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  195. package/src/pages/HelpGuide.tsx +0 -23
  196. package/src/pages/HelpOrder.tsx +0 -23
  197. package/src/pages/Home.tsx +0 -36
  198. package/src/pages/IntroductoryTutorial.tsx +0 -170
  199. package/src/pages/Login.tsx +0 -47
  200. package/src/pages/MomentOption.tsx +0 -30
  201. package/src/pages/MultiCheckout.tsx +0 -31
  202. package/src/pages/MultiOrdersDetails.tsx +0 -27
  203. package/src/pages/MyOrders.tsx +0 -40
  204. package/src/pages/NetworkError.tsx +0 -24
  205. package/src/pages/NotFound.tsx +0 -22
  206. package/src/pages/OrderDetails.tsx +0 -25
  207. package/src/pages/ProductDetails.tsx +0 -55
  208. package/src/pages/Profile.tsx +0 -36
  209. package/src/pages/ReviewDriver.tsx +0 -30
  210. package/src/pages/ReviewOrder.tsx +0 -32
  211. package/src/pages/ReviewProducts.tsx +0 -30
  212. package/src/pages/Sessions.tsx +0 -22
  213. package/src/pages/Signup.tsx +0 -53
  214. package/src/pages/SpinnerLoader.tsx +0 -10
  215. 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) => {
@@ -128,12 +140,12 @@ const CartUI = (props: any) => {
128
140
  onNavigationRedirect('CheckoutNavigator', {
129
141
  screen: 'MultiCheckout',
130
142
  checkCarts: true
131
- })
143
+ }, true)
132
144
  } else {
133
145
  onNavigationRedirect('CheckoutNavigator', {
134
146
  screen: 'MultiCheckout',
135
147
  cartUuid: cartsAvailable[0]?.group?.uuid
136
- })
148
+ }, true)
137
149
  }
138
150
  }
139
151
  }
@@ -152,16 +164,16 @@ const CartUI = (props: any) => {
152
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)
153
165
  }
154
166
 
155
- const onRemoveOffer = (id: number) => {
156
- setConfirm({
157
- open: true,
158
- content: [t('QUESTION_DELETE_OFFER', 'Are you sure that you want to delete the offer?')],
159
- title: t('OFFER', 'Offer'),
160
- handleOnAccept: () => {
161
- setConfirm({ ...confirm, open: false })
162
- handleRemoveOfferClick(id)
163
- }
164
- })
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
+ )
165
177
  }
166
178
 
167
179
  const walletName: any = {
@@ -205,6 +217,7 @@ const CartUI = (props: any) => {
205
217
  handleClickCheckout={() => setOpenUpselling(true)}
206
218
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
207
219
  isMultiCheckout={isMultiCheckout}
220
+ isFromUpselling={isFromUpselling}
208
221
  >
209
222
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
210
223
  <ProductItemAccordion
@@ -218,7 +231,6 @@ const CartUI = (props: any) => {
218
231
  offsetDisabled={offsetDisabled}
219
232
  onDeleteProduct={handleDeleteClick}
220
233
  onEditProduct={handleEditProduct}
221
- viewString='business_view'
222
234
  />
223
235
  ))}
224
236
 
@@ -230,7 +242,7 @@ const CartUI = (props: any) => {
230
242
  {parsePrice(cart?.subtotal + getIncludedTaxes())}
231
243
  </OText>
232
244
  </OSTable>
233
- {!hideCartDiscount && cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
245
+ {cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
234
246
  <OSTable>
235
247
  {cart?.discount_type === 1 ? (
236
248
  <OText size={12} lineHeight={18}>
@@ -244,7 +256,7 @@ const CartUI = (props: any) => {
244
256
  </OSTable>
245
257
  )}
246
258
  {
247
- !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) => (
248
260
  <OSTable key={`${offer.id}_${i}`}>
249
261
  <OSRow>
250
262
  <OText size={12} lineHeight={18}>{offer.name}</OText>
@@ -254,9 +266,9 @@ const CartUI = (props: any) => {
254
266
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
255
267
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
256
268
  </TouchableOpacity>
257
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
258
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
259
- </TouchableOpacity>
269
+ {!!offer?.id && (
270
+ <OfferAlert offerId={offer?.id} />
271
+ )}
260
272
  </OSRow>
261
273
  <OText size={12} lineHeight={18}>
262
274
  - {parsePrice(offer?.summary?.discount)}
@@ -265,7 +277,7 @@ const CartUI = (props: any) => {
265
277
  ))
266
278
  }
267
279
  {/* <Divider /> */}
268
- {!hideCartDiscount && cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
280
+ {cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
269
281
  <OSTable>
270
282
  <OText size={12} lineHeight={18} numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
271
283
  {cart?.business?.tax_type === 1 ? (
@@ -318,10 +330,8 @@ const CartUI = (props: any) => {
318
330
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
319
331
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
320
332
  </TouchableOpacity>
321
- {!offer?.type && (
322
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
323
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
324
- </TouchableOpacity>
333
+ {!!offer?.id && (
334
+ <OfferAlert offerId={offer?.id} />
325
335
  )}
326
336
  </OSRow>
327
337
  <OText size={12} lineHeight={18}>
@@ -330,10 +340,10 @@ const CartUI = (props: any) => {
330
340
  </OSTable>
331
341
  ))
332
342
  }
333
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
343
+ {orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
334
344
  <OSTable>
335
345
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
336
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
346
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
337
347
  </OSTable>
338
348
  )}
339
349
  {
@@ -347,9 +357,9 @@ const CartUI = (props: any) => {
347
357
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
348
358
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
349
359
  </TouchableOpacity>
350
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
351
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
352
- </TouchableOpacity>
360
+ {!!offer?.id && (
361
+ <OfferAlert offerId={offer?.id} />
362
+ )}
353
363
  </OSRow>
354
364
  <OText size={12} lineHeight={18}>
355
365
  - {parsePrice(offer?.summary?.discount)}
@@ -357,12 +367,6 @@ const CartUI = (props: any) => {
357
367
  </OSTable>
358
368
  ))
359
369
  }
360
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
361
- <OSTable>
362
- <OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
363
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
364
- </OSTable>
365
- )}
366
370
  {cart?.driver_tip > 0 && !hideDriverTip && (
367
371
  <OSTable>
368
372
  <OText size={12} lineHeight={18}>
@@ -385,12 +389,13 @@ const CartUI = (props: any) => {
385
389
  <OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
386
390
  </OSTable>
387
391
  ))}
388
- {isCouponEnabled && !isCartPending && (
392
+ {isCouponEnabled && !isCartPending && !hideCouponInput && (
389
393
  <OSTable>
390
394
  <OSCoupon>
391
395
  <CouponControl
392
396
  businessId={businessId}
393
397
  price={cart.total}
398
+ cart={cart}
394
399
  />
395
400
  </OSCoupon>
396
401
  </OSTable>
@@ -451,7 +456,7 @@ const CartUI = (props: any) => {
451
456
  </TouchableOpacity>
452
457
  </OSTable>
453
458
  )}
454
- {cart?.status !== 2 && !hideCartComments && (
459
+ {cart?.status !== 2 && (
455
460
  <OSTable>
456
461
  <View style={{ width: '100%', marginTop: 20 }}>
457
462
  <OText size={16} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
@@ -552,14 +557,6 @@ const CartUI = (props: any) => {
552
557
  setOpenPlaceModal={setOpenPlaceModal}
553
558
  />
554
559
  </OModal>
555
- <OAlert
556
- open={confirm.open}
557
- title={confirm.title}
558
- content={confirm.content}
559
- onAccept={confirm.handleOnAccept}
560
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
561
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
562
- />
563
560
  </CContainer>
564
561
  )
565
562
  }
@@ -1,61 +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', {
52
+ if (
53
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
54
+ Object.keys(groupKeys).length > 1
55
+ ) {
56
+ onNavigationRedirect('CheckoutNavigator', {
49
57
  screen: 'MultiCheckout',
50
58
  checkCarts: true
51
59
  })
52
- } else {
53
- onNavigationRedirect('CheckoutNavigator', {
54
- screen: 'MultiCheckout',
55
- cartUuid: cartsAvailable[0]?.group?.uuid
56
- })
57
- }
58
- }
60
+ } else {
61
+ onNavigationRedirect('CheckoutNavigator', {
62
+ screen: 'MultiCheckout',
63
+ cartUuid: cartsAvailable[0]?.group?.uuid
64
+ })
65
+ }
66
+ }
59
67
  }
60
68
 
61
69
  return (
@@ -65,7 +73,7 @@ export const CartContent = (props: any) => {
65
73
  {isOrderStateCarts && carts?.length > 0 && (
66
74
  <>
67
75
  {carts.map((cart: any, i: number) => (
68
- <CCList key={i} style={{ overflow: 'visible' }}>
76
+ <CCList nestedScrollEnabled={true} key={i} style={{ overflow: 'visible' }}>
69
77
  {cart.products.length > 0 && (
70
78
  <>
71
79
  <Cart
@@ -78,6 +86,10 @@ export const CartContent = (props: any) => {
78
86
  setIsCartsLoading={setIsCartsLoading}
79
87
  isMultiCheckout={isMultiCheckout}
80
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'}
81
93
  />
82
94
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
83
95
  </>
@@ -85,38 +97,67 @@ export const CartContent = (props: any) => {
85
97
  </CCList>
86
98
  ))}
87
99
  {isMultiCheckout && (
88
- <CheckoutAction style={{ marginTop: 0 }}>
89
- <OButton
90
- text={t('CHECKOUT', 'Checkout')}
91
- bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
92
- isDisabled={!cartsAvailable.length}
93
- borderColor={theme.colors.primary}
94
- imgRightSrc={null}
95
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
96
- onClick={() => handleCheckoutRedirect()}
97
- style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
98
- />
99
- </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
+ </>
100
150
  )}
101
151
  </>
102
152
  )}
103
153
  {(!carts || carts?.length === 0) && (
104
154
  <CCNotCarts>
105
- <OText size={24} style={{ textAlign: 'center' }}>
106
- {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
107
- </OText>
108
- <OButton
109
- text={t('START_SHOPPING', 'Start shopping')}
110
- bgColor={theme.colors.primary}
111
- borderColor={theme.colors.primary}
112
- textStyle={{
113
- color: theme.colors.white,
114
- fontSize: 14,
115
- paddingRight: 0
116
- }}
117
- style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
118
- imgRightSrc={null}
119
- 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')}
120
161
  />
121
162
  </CCNotCarts>
122
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
+ `