ordering-ui-react-native 0.15.91 → 0.15.92-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 (236) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +25 -3
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +145 -61
  25. package/src/components/SingleProductCard/index.tsx +16 -4
  26. package/src/components/SingleProductReview/index.tsx +1 -1
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +6 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/theme.json +0 -1
  45. package/src/types/index.tsx +18 -11
  46. package/src/utils/index.tsx +1 -2
  47. package/themes/business/index.tsx +4 -0
  48. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  49. package/themes/business/src/components/Chat/index.tsx +14 -6
  50. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  51. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  52. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  53. package/themes/business/src/components/LoginForm/index.tsx +6 -4
  54. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  55. package/themes/business/src/components/MapView/index.tsx +1 -1
  56. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  57. package/themes/business/src/components/NewOrderNotification/index.tsx +24 -13
  58. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +6 -4
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +26 -18
  61. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  62. package/themes/business/src/components/OrdersOption/index.tsx +67 -20
  63. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  64. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  66. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  67. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  71. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  72. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  73. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  74. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  75. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  76. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  77. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  78. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  79. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  80. package/themes/business/src/components/shared/OModal.tsx +41 -38
  81. package/themes/business/src/types/index.tsx +14 -9
  82. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  83. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  84. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/kiosk/src/components/BusinessMenu/index.tsx +25 -26
  86. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  87. package/themes/kiosk/src/components/Cart/index.tsx +10 -11
  88. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  89. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  90. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  91. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  92. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  93. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  94. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  95. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  96. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  97. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  98. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  99. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  100. package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
  101. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  102. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  103. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  104. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  105. package/themes/kiosk/src/types/index.d.ts +1 -0
  106. package/themes/original/index.tsx +22 -0
  107. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  108. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  109. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  110. package/themes/original/src/components/AddressList/index.tsx +2 -2
  111. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  112. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  113. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  114. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  115. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  116. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  117. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  118. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  119. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  120. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  121. package/themes/original/src/components/BusinessListingSearch/index.tsx +158 -126
  122. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -13
  123. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  124. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  125. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  126. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  127. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  128. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  129. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  130. package/themes/original/src/components/BusinessProductsListing/index.tsx +296 -178
  131. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  132. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  133. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  134. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  135. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  136. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  137. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  138. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  139. package/themes/original/src/components/BusinessesListing/index.tsx +102 -462
  140. package/themes/original/src/components/Cart/index.tsx +82 -37
  141. package/themes/original/src/components/Cart/styles.tsx +4 -0
  142. package/themes/original/src/components/CartContent/index.tsx +22 -16
  143. package/themes/original/src/components/Checkout/index.tsx +141 -93
  144. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  145. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  146. package/themes/original/src/components/Favorite/index.tsx +92 -0
  147. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  148. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  149. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  150. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  151. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  152. package/themes/original/src/components/Help/index.tsx +21 -4
  153. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  154. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  155. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  156. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  157. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  158. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  159. package/themes/original/src/components/LoginForm/index.tsx +50 -11
  160. package/themes/original/src/components/Messages/index.tsx +17 -17
  161. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  162. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  163. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  164. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  165. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  166. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  167. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  168. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  169. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  170. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  171. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  172. package/themes/original/src/components/NavBar/index.tsx +11 -5
  173. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  174. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  175. package/themes/original/src/components/OrderDetails/index.tsx +154 -77
  176. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  177. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  178. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  179. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  180. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  181. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  182. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  183. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  184. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  185. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  186. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  187. package/themes/original/src/components/OrdersOption/index.tsx +138 -46
  188. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  189. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  190. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
  191. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  192. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  193. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  194. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  195. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  196. package/themes/original/src/components/ProductForm/index.tsx +694 -647
  197. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  198. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  199. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  200. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  201. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  202. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  203. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  204. package/themes/original/src/components/Promotions/index.tsx +22 -6
  205. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  206. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  207. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  208. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  209. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  210. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  211. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  212. package/themes/original/src/components/SignupForm/index.tsx +237 -127
  213. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  214. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  215. package/themes/original/src/components/SingleProductCard/index.tsx +204 -95
  216. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  217. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  218. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  219. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  220. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  221. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  222. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  223. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  224. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  225. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  226. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  227. package/themes/original/src/components/Wallets/index.tsx +176 -162
  228. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  229. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  230. package/themes/original/src/components/shared/OButton.tsx +10 -3
  231. package/themes/original/src/components/shared/OInput.tsx +3 -2
  232. package/themes/original/src/components/shared/OModal.tsx +4 -2
  233. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  234. package/themes/original/src/types/index.tsx +198 -47
  235. package/themes/original/src/utils/index.tsx +77 -0
  236. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -8,7 +8,7 @@ import {
8
8
  useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
- import { CContainer, CheckoutAction, Divider } from './styles';
11
+ import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -25,6 +25,7 @@ import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
26
  import { OAlert } from '../../../../../src/components/shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
+ import { DriverTips } from '../DriverTips'
28
29
 
29
30
  const CartUI = (props: any) => {
30
31
  const {
@@ -39,7 +40,8 @@ const CartUI = (props: any) => {
39
40
  handleChangeComment,
40
41
  commentState,
41
42
  onNavigationRedirect,
42
- handleRemoveOfferClick
43
+ handleRemoveOfferClick,
44
+ isMultiCheckout
43
45
  } = props
44
46
 
45
47
  const theme = useTheme();
@@ -59,10 +61,16 @@ const CartUI = (props: any) => {
59
61
 
60
62
  const isCartPending = cart?.status === 2
61
63
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
64
+ const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
65
+ const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
62
66
 
63
67
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
64
68
  const businessId = business?.business_id ?? null
65
- const placeSpotTypes = [3, 4]
69
+ const placeSpotTypes = [4]
70
+
71
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
72
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
73
+ : configs?.driver_tip_options?.value || []
66
74
 
67
75
  const momentFormatted = !orderState?.option?.moment
68
76
  ? t('RIGHT_NOW', 'Right Now')
@@ -96,17 +104,23 @@ const CartUI = (props: any) => {
96
104
  const handleUpsellingPage = () => {
97
105
  setOpenUpselling(false)
98
106
  setCanOpenUpselling(false)
99
- props.onNavigationRedirect('CheckoutNavigator', {
100
- screen: 'CheckoutPage',
101
- cartUuid: cart?.uuid,
102
- businessLogo: cart?.business?.logo,
103
- businessName: cart?.business?.name,
104
- cartTotal: cart?.total
105
- })
107
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
108
+ props.onNavigationRedirect('CheckoutNavigator', {
109
+ screen: 'MultiCheckout'
110
+ })
111
+ } else {
112
+ props.onNavigationRedirect('CheckoutNavigator', {
113
+ screen: 'CheckoutPage',
114
+ cartUuid: cart?.uuid,
115
+ businessLogo: cart?.business?.logo,
116
+ businessName: cart?.business?.name,
117
+ cartTotal: cart?.total
118
+ })
119
+ }
106
120
  }
107
121
 
108
122
  const getIncludedTaxes = () => {
109
- if (cart?.taxes === null) {
123
+ if (cart?.taxes === null || !cart?.taxes) {
110
124
  return cart.business.tax_type === 1 ? cart?.tax : 0
111
125
  } else {
112
126
  return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
@@ -165,6 +179,7 @@ const CartUI = (props: any) => {
165
179
  handleChangeStore={() => setOpenChangeStore(true)}
166
180
  handleClickCheckout={() => setOpenUpselling(true)}
167
181
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
182
+ isMultiCheckout={isMultiCheckout}
168
183
  >
169
184
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
170
185
  <ProductItemAccordion
@@ -346,13 +361,39 @@ const CartUI = (props: any) => {
346
361
  </OSTable>
347
362
  )}
348
363
 
364
+ {isMultiCheckout &&
365
+ cart &&
366
+ cart?.valid &&
367
+ orderState?.options?.type === 1 &&
368
+ cart?.status !== 2 &&
369
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
370
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
371
+ (
372
+ <DriverTipsContainer>
373
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
374
+ {t('DRIVER_TIPS', 'Driver Tips')}
375
+ </OText>
376
+ <DriverTips
377
+ uuid={cart?.uuid}
378
+ businessId={cart?.business_id}
379
+ driverTipsOptions={driverTipsOptions}
380
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
381
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
382
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
383
+ ? cart?.driver_tip
384
+ : cart?.driver_tip_rate}
385
+ useOrderContext
386
+ />
387
+ </DriverTipsContainer>
388
+ )}
389
+
349
390
  <OSTotal>
350
391
  <OSTable style={{ marginTop: 15 }}>
351
392
  <OText size={14} lineHeight={21} weight={'600'}>
352
393
  {t('TOTAL', 'Total')}
353
394
  </OText>
354
395
  <OText size={14} lineHeight={21} weight={'600'}>
355
- {parsePrice(cart?.total >= 0 ? cart?.total : 0)}
396
+ {parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
356
397
  </OText>
357
398
  </OSTable>
358
399
  </OSTotal>
@@ -409,31 +450,35 @@ const CartUI = (props: any) => {
409
450
  )}
410
451
  </OSBill>
411
452
  )}
412
- {cart?.valid_products ? (
413
- <CheckoutAction>
414
- <OButton
415
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
416
- !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
417
- ) : !cart?.valid_address ? (
418
- `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
419
- ) : (
420
- `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
421
- )}
422
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
423
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
424
- borderColor={theme.colors.primary}
425
- imgRightSrc={null}
426
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
427
- onClick={() => setOpenUpselling(true)}
428
- style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
429
- />
430
- </CheckoutAction>
431
- ) : (
432
- <View style={{ alignItems: 'center', width: '100%' }}>
433
- <OText size={12} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 5 }}>
434
- {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
435
- </OText>
436
- </View>
453
+ {!isMultiCheckout && (
454
+ <>
455
+ {cart?.valid_products ? (
456
+ <CheckoutAction>
457
+ <OButton
458
+ text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
459
+ !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
460
+ ) : !cart?.valid_address ? (
461
+ `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
462
+ ) : (
463
+ `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
464
+ )}
465
+ bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
466
+ isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
467
+ borderColor={theme.colors.primary}
468
+ imgRightSrc={null}
469
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
470
+ onClick={() => setOpenUpselling(true)}
471
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
472
+ />
473
+ </CheckoutAction>
474
+ ) : (
475
+ <View style={{ alignItems: 'center', width: '100%' }}>
476
+ <OText size={12} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 5 }}>
477
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
478
+ </OText>
479
+ </View>
480
+ )}
481
+ </>
437
482
  )}
438
483
  </BusinessItemAccordion>
439
484
 
@@ -33,3 +33,7 @@ export const Divider = styled.View`
33
33
  margin-top: 5px;
34
34
  margin-bottom: 10px;
35
35
  `
36
+
37
+ export const DriverTipsContainer = styled.View`
38
+ padding: 5px 0;
39
+ `
@@ -1,17 +1,18 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { useLanguage, useOrder } from 'ordering-components/native';
1
+ import React, { useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import { useLanguage } from 'ordering-components/native';
3
4
  import { useTheme } from 'styled-components/native';
4
5
  import { CCContainer, CCNotCarts, CCList } from './styles';
5
6
 
6
7
  import { Cart } from '../Cart';
7
- import { OIcon, OText } from '../shared';
8
+ import { OButton, OText } from '../shared';
8
9
  import Spinner from 'react-native-loading-spinner-overlay';
9
- import { View } from 'react-native';
10
10
 
11
11
  export const CartContent = (props: any) => {
12
12
  const {
13
13
  carts,
14
- isOrderStateCarts
14
+ isOrderStateCarts,
15
+ onNavigationRedirect
15
16
  } = props
16
17
 
17
18
  const theme = useTheme();
@@ -22,18 +23,15 @@ export const CartContent = (props: any) => {
22
23
  <CCContainer>
23
24
  {isOrderStateCarts && carts?.length > 0 && (
24
25
  <>
25
- {/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
- {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText> */}
28
26
  {carts.map((cart: any, i: number) => (
29
27
  <CCList key={i} style={{ overflow: 'visible' }}>
30
28
  {cart.products.length > 0 && (
31
29
  <>
32
30
  <Cart
33
- singleBusiness={props.singleBusiness}
34
- isFranchiseApp={props.isFranchiseApp}
31
+ singleBusiness={props.singleBusiness}
32
+ isFranchiseApp={props.isFranchiseApp}
35
33
  cart={cart}
36
- cartuuid={cart.uuid}
34
+ cartuuid={cart.uuid}
37
35
  onNavigationRedirect={props.onNavigationRedirect}
38
36
  isCartsLoading={isCartsLoading}
39
37
  setIsCartsLoading={setIsCartsLoading}
@@ -48,14 +46,22 @@ export const CartContent = (props: any) => {
48
46
  )}
49
47
  {(!carts || carts?.length === 0) && (
50
48
  <CCNotCarts>
51
- {/* <OIcon
52
- url={props.icon}
53
- width={200}
54
- height={122}
55
- /> */}
56
49
  <OText size={24} style={{ textAlign: 'center' }}>
57
50
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
58
51
  </OText>
52
+ <OButton
53
+ text={t('START_SHOPPING', 'Start shopping')}
54
+ bgColor={theme.colors.primary}
55
+ borderColor={theme.colors.primary}
56
+ textStyle={{
57
+ color: theme.colors.white,
58
+ fontSize: 14,
59
+ paddingRight: 0
60
+ }}
61
+ style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
62
+ imgRightSrc={null}
63
+ onClick={() => onNavigationRedirect('BusinessList')}
64
+ />
59
65
  </CCNotCarts>
60
66
  )}
61
67
  <Spinner visible={isCartsLoading} />
@@ -24,6 +24,7 @@ import { DriverTips } from '../DriverTips';
24
24
  import { NotFoundSource } from '../NotFoundSource';
25
25
  import { UserDetails } from '../UserDetails';
26
26
  import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
+ import { PlaceSpot } from '../PlaceSpot'
27
28
 
28
29
  import {
29
30
  ChContainer,
@@ -105,15 +106,21 @@ const CheckoutUI = (props: any) => {
105
106
  padding: 20
106
107
  },
107
108
  pagePadding: {
108
- paddingLeft: 40,
109
- paddingRight: 40
109
+ paddingHorizontal: 40
110
110
  },
111
111
  icon: {
112
112
  top: 15,
113
113
  right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
114
114
  position: 'absolute',
115
115
  fontSize: 20
116
- }
116
+ },
117
+ detailWrapper: {
118
+ paddingHorizontal: 40,
119
+ width: '100%'
120
+ },
121
+ wrapperNavbar: Platform.OS === 'ios'
122
+ ? { paddingVertical: 0, paddingHorizontal: 40 }
123
+ : { paddingVertical: 20, paddingHorizontal: 40 }
117
124
  })
118
125
 
119
126
  const [, { showToast }] = useToast();
@@ -133,20 +140,25 @@ const CheckoutUI = (props: any) => {
133
140
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
134
141
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
135
142
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
136
-
137
- const placeSpotTypes = [3, 4]
138
- const businessConfigs = businessDetails?.business?.configs ?? []
139
- const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
140
- const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
141
- const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
143
+ const [isOpen, setIsOpen] = useState(false)
144
+ const [requiredFields, setRequiredFields] = useState<any>([])
145
+
146
+ const placeSpotTypes = [3, 4, 5]
147
+ const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
148
+ const businessConfigs = businessDetails?.business?.configs ?? []
149
+ const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
150
+ const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
151
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
152
+ const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
142
153
 
143
154
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
144
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
145
- cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
146
- (options.type === 1 &&
147
- validationFields?.fields?.checkout?.driver_tip?.enabled &&
148
- validationFields?.fields?.checkout?.driver_tip?.required &&
149
- (Number(cart?.driver_tip) <= 0))
155
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
156
+ placing || errorCash || cart?.subtotal < cart?.minimum ||
157
+ // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
158
+ (options.type === 1 &&
159
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
160
+ validationFields?.fields?.checkout?.driver_tip?.required &&
161
+ (Number(cart?.driver_tip) <= 0))
150
162
 
151
163
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
152
164
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -168,9 +180,13 @@ const CheckoutUI = (props: any) => {
168
180
  }
169
181
  }
170
182
 
171
- const handlePlaceOrder = () => {
172
- if (!userErrors.length) {
173
- handlerClickPlaceOrder && handlerClickPlaceOrder()
183
+ const handlePlaceOrder = (confirmPayment: any) => {
184
+ if (!userErrors.length && !requiredFields?.length) {
185
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
186
+ return
187
+ }
188
+ if (requiredFields?.length) {
189
+ setIsOpen(true)
174
190
  return
175
191
  }
176
192
  let stringError = ''
@@ -200,11 +216,12 @@ const CheckoutUI = (props: any) => {
200
216
  setUserErrors([])
201
217
  const errors = []
202
218
  const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
219
+ const _requiredFields: any = []
203
220
 
204
221
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
205
- if (field?.required && !notFields.includes(field.code)) {
222
+ if (field?.required && !notFields.includes(field.code) && field?.enabled) {
206
223
  if (!user[field?.code]) {
207
- errors.push(t(`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`, `The field ${field?.name} is required`))
224
+ _requiredFields.push(field?.code)
208
225
  }
209
226
  }
210
227
  })
@@ -215,8 +232,9 @@ const CheckoutUI = (props: any) => {
215
232
  validationFields?.fields?.checkout?.cellphone?.required) ||
216
233
  configs?.verification_phone_required?.value === '1')
217
234
  ) {
218
- errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
235
+ _requiredFields.push('cellphone')
219
236
  }
237
+ setRequiredFields(_requiredFields)
220
238
 
221
239
  if (phoneUpdate) {
222
240
  errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
@@ -259,13 +277,18 @@ const CheckoutUI = (props: any) => {
259
277
  return (
260
278
  <>
261
279
  <Container noPadding>
262
- <NavBar
263
- isVertical
264
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
265
- title={t('CHECKOUT', 'Checkout')}
266
- titleStyle={{ marginLeft: 0, marginRight: 0, paddingLeft: 40 }}
267
- btnStyle={{ marginLeft: 40, padding: 40 }}
268
- />
280
+ <View style={styles.wrapperNavbar}>
281
+ <NavBar
282
+ title={t('CHECKOUT', 'Checkout')}
283
+ titleAlign={'center'}
284
+ onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
285
+ showCall={false}
286
+ btnStyle={{ paddingLeft: 0 }}
287
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
288
+ titleWrapStyle={{ paddingHorizontal: 0 }}
289
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
290
+ />
291
+ </View>
269
292
  <ChContainer style={styles.pagePadding}>
270
293
  <ChSection style={{ paddingTop: 0 }}>
271
294
  <ChHeader>
@@ -306,10 +329,10 @@ const CheckoutUI = (props: any) => {
306
329
  !businessDetails?.error &&
307
330
  (
308
331
  <Placeholder Animation={Fade}>
309
- <PlaceholderLine height={20} width={70} />
310
- <PlaceholderLine height={10} width={60} />
311
- <PlaceholderLine height={10} width={60} />
312
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
332
+ <PlaceholderLine height={20} />
333
+ <PlaceholderLine height={12} />
334
+ <PlaceholderLine height={12} />
335
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
313
336
  </Placeholder>
314
337
  )}
315
338
  {
@@ -355,10 +378,10 @@ const CheckoutUI = (props: any) => {
355
378
  <ChUserDetails>
356
379
  {cartState.loading ? (
357
380
  <Placeholder Animation={Fade}>
358
- <PlaceholderLine height={20} width={70} />
359
- <PlaceholderLine height={10} width={60} />
360
- <PlaceholderLine height={10} width={60} />
361
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
381
+ <PlaceholderLine height={20} />
382
+ <PlaceholderLine height={12} />
383
+ <PlaceholderLine height={12} />
384
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
362
385
  </Placeholder>
363
386
  ) : (
364
387
  <UserDetails
@@ -382,8 +405,8 @@ const CheckoutUI = (props: any) => {
382
405
  {cartState.loading || deliveryOptionSelected === undefined ? (
383
406
  <View style={{ height: 110 }}>
384
407
  <Placeholder Animation={Fade}>
385
- <PlaceholderLine height={20} width={70} />
386
- <PlaceholderLine height={40} width={100} />
408
+ <PlaceholderLine height={20} />
409
+ <PlaceholderLine height={40} />
387
410
  </Placeholder>
388
411
  </View>
389
412
  ) : (
@@ -574,6 +597,20 @@ const CheckoutUI = (props: any) => {
574
597
  )}
575
598
 
576
599
 
600
+ {!cartState.loading && placeSpotsEnabled && (
601
+ <>
602
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
603
+ <PlaceSpot
604
+ isCheckout
605
+ isInputMode
606
+ cart={cart}
607
+ spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
608
+ vehicleDefault={cart?.vehicle}
609
+ />
610
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
611
+ </>
612
+ )}
613
+
577
614
  {!cartState.loading && cart && (
578
615
  <ChSection>
579
616
  <ChCart>
@@ -606,23 +643,26 @@ const CheckoutUI = (props: any) => {
606
643
  </OText>
607
644
  </TouchableOpacity>
608
645
  </CartHeader>
609
- <TouchableOpacity
610
- onPress={() => setOpenChangeStore(true)}
611
- style={{ alignSelf: 'flex-start' }}
612
- >
613
- <OText
614
- size={12}
615
- lineHeight={18}
616
- color={theme.colors.textSecondary}
617
- style={{ textDecorationLine: 'underline' }}
646
+ {isBusinessChangeEnabled && (
647
+ <TouchableOpacity
648
+ onPress={() => setOpenChangeStore(true)}
649
+ style={{ alignSelf: 'flex-start' }}
618
650
  >
619
- {t('CHANGE_STORE', 'Change store')}
620
- </OText>
621
- </TouchableOpacity>
651
+ <OText
652
+ size={12}
653
+ lineHeight={18}
654
+ color={theme.colors.textSecondary}
655
+ style={{ textDecorationLine: 'underline' }}
656
+ >
657
+ {t('CHANGE_STORE', 'Change store')}
658
+ </OText>
659
+ </TouchableOpacity>
660
+ )}
622
661
  <OrderSummary
623
662
  cart={cart}
624
663
  isCartPending={cart?.status === 2}
625
664
  onNavigationRedirect={onNavigationRedirect}
665
+ placeSpotTypes={placeSpotTypes}
626
666
  />
627
667
  </>
628
668
  )}
@@ -659,25 +699,17 @@ const CheckoutUI = (props: any) => {
659
699
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
660
700
  </OText>
661
701
  )}
662
- {placeSpotTypes.includes(options?.type) && !cart?.place && (
663
- <OText
664
- color={theme.colors.error}
665
- size={12}
666
- >
667
- {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
668
- </OText>
669
- )}
670
702
  {options.type === 1 &&
671
- validationFields?.fields?.checkout?.driver_tip?.enabled &&
672
- validationFields?.fields?.checkout?.driver_tip?.required &&
673
- (Number(cart?.driver_tip) <= 0) && (
674
- <OText
675
- color={theme.colors.error}
676
- size={12}
677
- >
678
- {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
679
- </OText>
680
- )}
703
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
704
+ validationFields?.fields?.checkout?.driver_tip?.required &&
705
+ (Number(cart?.driver_tip) <= 0) && (
706
+ <OText
707
+ color={theme.colors.error}
708
+ size={12}
709
+ >
710
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
711
+ </OText>
712
+ )}
681
713
  </ChErrors>
682
714
  </View>
683
715
  )}
@@ -692,11 +724,33 @@ const CheckoutUI = (props: any) => {
692
724
  onClose={() => setOpenChangeStore(false)}
693
725
  />
694
726
  </OModal>
727
+ <OModal
728
+ open={isOpen}
729
+ onClose={() => setIsOpen(false)}
730
+ >
731
+ <View style={styles.detailWrapper}>
732
+ <UserDetails
733
+ isUserDetailsEdit
734
+ cartStatus={cart?.status}
735
+ businessId={cart?.business_id}
736
+ useValidationFields
737
+ useDefualtSessionManager
738
+ useSessionUser
739
+ isCheckout
740
+ isEdit
741
+ phoneUpdate={phoneUpdate}
742
+ togglePhoneUpdate={togglePhoneUpdate}
743
+ requiredFields={requiredFields}
744
+ hideUpdateButton
745
+ onClose={() => setIsOpen(false)}
746
+ />
747
+ </View>
748
+ </OModal>
695
749
  </ChContainer>
696
750
  </Container>
697
751
  {!cartState.loading && cart && cart?.status !== 2 && (
698
752
  <FloatingButton
699
- handleClick={() => handlePlaceOrder()}
753
+ handleClick={() => handlePlaceOrder(null)}
700
754
  isSecondaryBtn={isDisabledButtonPlace}
701
755
  disabled={isDisabledButtonPlace}
702
756
  btnText={cart?.subtotal >= cart?.minimum
@@ -710,7 +764,7 @@ const CheckoutUI = (props: any) => {
710
764
  : (`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`)
711
765
  }
712
766
  btnRightValueShow
713
- btnRightValue={parsePrice(cart?.total)}
767
+ btnRightValue={parsePrice(cart?.balance)}
714
768
  iosBottom={30}
715
769
  />
716
770
  )}
@@ -726,19 +780,6 @@ const CheckoutUI = (props: any) => {
726
780
  setShowGateway={setShowGateway}
727
781
  />
728
782
  )}
729
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
730
- <PaymentOptionsWebView
731
- onNavigationRedirect={onNavigationRedirect}
732
- uri={`https://test-square-f50f7.web.app`}
733
- user={user}
734
- token={token}
735
- cart={cart}
736
- currency={currency}
737
- webviewPaymethod={webviewPaymethod}
738
- setShowGateway={setShowGateway}
739
- locationId={'L1NGAY5M6KJRX'}
740
- />
741
- )}
742
783
  </>
743
784
  )
744
785
  }
@@ -764,16 +805,23 @@ export const Checkout = (props: any) => {
764
805
 
765
806
  const getOrder = async (cartId: any) => {
766
807
  try {
767
- setCartState({ ...cartState, loading: true })
768
- const url = `${ordering.root}/carts/${cartId}`
769
- const response = await fetch(url, {
770
- method: 'GET',
771
- headers: {
772
- 'Content-Type': 'application/json',
773
- Authorization: `Bearer ${token}`
774
- }
775
- })
776
- const { result } = await response.json();
808
+ let result: any = {}
809
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
810
+ if (cart) {
811
+ result = { ...cart }
812
+ } else {
813
+ setCartState({ ...cartState, loading: true })
814
+ const url = `${ordering.root}/carts/${cartId}`
815
+ const response = await fetch(url, {
816
+ method: 'GET',
817
+ headers: {
818
+ 'Content-Type': 'application/json',
819
+ Authorization: `Bearer ${token}`
820
+ }
821
+ })
822
+ const content = await response.json();
823
+ result = content.result
824
+ }
777
825
 
778
826
  let publicKey = null
779
827
  try {
@@ -76,7 +76,6 @@ export const ChCart = styled(ChPaymethods)``
76
76
 
77
77
  export const WalletPaymentOptionContainer = styled(ChPaymethods)`
78
78
  padding-bottom: 0;
79
- margin-left: -20px;
80
79
  `
81
80
 
82
81
  export const ChPlaceOrderBtn = styled.View`