ordering-ui-react-native 0.17.92 → 0.17.93-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 (214) 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 +22 -22
  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 +17 -12
  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/ProductItemAccordion/index.tsx +7 -1
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  43. package/themes/business/src/components/StoresList/index.tsx +3 -4
  44. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  45. package/themes/business/src/components/shared/OModal.tsx +16 -9
  46. package/themes/business/src/types/index.tsx +24 -10
  47. package/themes/business/src/utils/index.tsx +29 -2
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  52. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  54. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  55. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  56. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  57. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +1 -1
  60. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  61. package/themes/original/src/components/AddressForm/index.tsx +35 -17
  62. package/themes/original/src/components/AddressList/index.tsx +5 -8
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  66. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  67. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  68. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  69. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  70. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  71. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  72. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  73. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  74. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  75. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  76. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  77. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  78. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  79. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  80. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +664 -556
  82. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  83. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  88. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  89. package/themes/original/src/components/Cart/index.tsx +55 -55
  90. package/themes/original/src/components/CartContent/index.tsx +103 -59
  91. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  92. package/themes/original/src/components/Checkout/index.tsx +276 -32
  93. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  94. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  95. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  96. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  97. package/themes/original/src/components/Favorite/index.tsx +1 -5
  98. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  99. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  100. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  102. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
  103. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  104. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  105. package/themes/original/src/components/Home/index.tsx +13 -4
  106. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  107. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  108. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  109. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  110. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  111. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  112. package/themes/original/src/components/Messages/index.tsx +15 -4
  113. package/themes/original/src/components/MomentOption/index.tsx +193 -92
  114. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  115. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  116. package/themes/original/src/components/MultiCheckout/index.tsx +373 -69
  117. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  118. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  119. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  120. package/themes/original/src/components/NavBar/index.tsx +20 -13
  121. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  122. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  123. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  124. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  125. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  126. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  127. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  128. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  129. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  130. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  131. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  132. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  133. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  134. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  135. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  136. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  137. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  138. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  139. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  140. package/themes/original/src/components/ProductForm/index.tsx +86 -30
  141. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  142. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  143. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  144. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  145. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  146. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  147. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  148. package/themes/original/src/components/Promotions/index.tsx +2 -2
  149. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  150. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  151. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  152. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  153. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  154. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  155. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  156. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  157. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  158. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  159. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  160. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  161. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  162. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  163. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  164. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  165. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  166. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  167. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  168. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  169. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  170. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  171. package/themes/original/src/components/Wallets/index.tsx +51 -61
  172. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  173. package/themes/original/src/components/shared/OButton.tsx +3 -3
  174. package/themes/original/src/components/shared/OInput.tsx +4 -5
  175. package/themes/original/src/components/shared/OModal.tsx +3 -3
  176. package/themes/original/src/types/index.tsx +37 -10
  177. package/themes/original/src/utils/index.tsx +185 -13
  178. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  179. package/src/navigators/BottomNavigator.tsx +0 -117
  180. package/src/navigators/CheckoutNavigator.tsx +0 -66
  181. package/src/navigators/HomeNavigator.tsx +0 -202
  182. package/src/navigators/NavigationRef.tsx +0 -7
  183. package/src/navigators/RootNavigator.tsx +0 -269
  184. package/src/pages/Account.tsx +0 -34
  185. package/src/pages/AddressForm.tsx +0 -62
  186. package/src/pages/AddressList.tsx +0 -24
  187. package/src/pages/BusinessProductsList.tsx +0 -81
  188. package/src/pages/BusinessesListing.tsx +0 -43
  189. package/src/pages/CartList.tsx +0 -49
  190. package/src/pages/Checkout.tsx +0 -101
  191. package/src/pages/ForgotPassword.tsx +0 -24
  192. package/src/pages/Help.tsx +0 -23
  193. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  194. package/src/pages/HelpGuide.tsx +0 -23
  195. package/src/pages/HelpOrder.tsx +0 -23
  196. package/src/pages/Home.tsx +0 -36
  197. package/src/pages/IntroductoryTutorial.tsx +0 -170
  198. package/src/pages/Login.tsx +0 -47
  199. package/src/pages/MomentOption.tsx +0 -30
  200. package/src/pages/MultiCheckout.tsx +0 -31
  201. package/src/pages/MultiOrdersDetails.tsx +0 -27
  202. package/src/pages/MyOrders.tsx +0 -40
  203. package/src/pages/NetworkError.tsx +0 -24
  204. package/src/pages/NotFound.tsx +0 -22
  205. package/src/pages/OrderDetails.tsx +0 -25
  206. package/src/pages/ProductDetails.tsx +0 -55
  207. package/src/pages/Profile.tsx +0 -36
  208. package/src/pages/ReviewDriver.tsx +0 -30
  209. package/src/pages/ReviewOrder.tsx +0 -32
  210. package/src/pages/ReviewProducts.tsx +0 -30
  211. package/src/pages/Sessions.tsx +0 -22
  212. package/src/pages/Signup.tsx +0 -53
  213. package/src/pages/SpinnerLoader.tsx +0 -10
  214. 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,10 +330,8 @@ 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
- {!offer?.type && (
319
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
320
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
321
- </TouchableOpacity>
333
+ {!!offer?.id && (
334
+ <OfferAlert offerId={offer?.id} />
322
335
  )}
323
336
  </OSRow>
324
337
  <OText size={12} lineHeight={18}>
@@ -327,10 +340,10 @@ const CartUI = (props: any) => {
327
340
  </OSTable>
328
341
  ))
329
342
  }
330
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
343
+ {orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
331
344
  <OSTable>
332
345
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
333
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
346
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
334
347
  </OSTable>
335
348
  )}
336
349
  {
@@ -344,9 +357,9 @@ const CartUI = (props: any) => {
344
357
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
345
358
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
346
359
  </TouchableOpacity>
347
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
348
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
349
- </TouchableOpacity>
360
+ {!!offer?.id && (
361
+ <OfferAlert offerId={offer?.id} />
362
+ )}
350
363
  </OSRow>
351
364
  <OText size={12} lineHeight={18}>
352
365
  - {parsePrice(offer?.summary?.discount)}
@@ -354,12 +367,6 @@ const CartUI = (props: any) => {
354
367
  </OSTable>
355
368
  ))
356
369
  }
357
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
358
- <OSTable>
359
- <OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
360
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
361
- </OSTable>
362
- )}
363
370
  {cart?.driver_tip > 0 && !hideDriverTip && (
364
371
  <OSTable>
365
372
  <OText size={12} lineHeight={18}>
@@ -382,12 +389,13 @@ const CartUI = (props: any) => {
382
389
  <OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
383
390
  </OSTable>
384
391
  ))}
385
- {isCouponEnabled && !isCartPending && (
392
+ {isCouponEnabled && !isCartPending && !hideCouponInput && (
386
393
  <OSTable>
387
394
  <OSCoupon>
388
395
  <CouponControl
389
396
  businessId={businessId}
390
397
  price={cart.total}
398
+ cart={cart}
391
399
  />
392
400
  </OSCoupon>
393
401
  </OSTable>
@@ -448,7 +456,7 @@ const CartUI = (props: any) => {
448
456
  </TouchableOpacity>
449
457
  </OSTable>
450
458
  )}
451
- {cart?.status !== 2 && !hideCartComments && (
459
+ {cart?.status !== 2 && (
452
460
  <OSTable>
453
461
  <View style={{ width: '100%', marginTop: 20 }}>
454
462
  <OText size={16} lineHeight={18}>{t('COMMENTS', 'Comments')}</OText>
@@ -549,14 +557,6 @@ const CartUI = (props: any) => {
549
557
  setOpenPlaceModal={setOpenPlaceModal}
550
558
  />
551
559
  </OModal>
552
- <OAlert
553
- open={confirm.open}
554
- title={confirm.title}
555
- content={confirm.content}
556
- onAccept={confirm.handleOnAccept}
557
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
558
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
559
- />
560
560
  </CContainer>
561
561
  )
562
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
- const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
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
+ `