ordering-ui-react-native 0.19.0-testing → 0.19.1-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 +6 -5
  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/VerifyPhone/styles.tsx +1 -2
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/utils/index.tsx +2 -2
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +14 -7
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  12. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  13. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  14. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  16. package/themes/business/src/components/Chat/index.tsx +41 -13
  17. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  18. package/themes/business/src/components/DriverSchedule/index.tsx +16 -6
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/MapView/index.tsx +11 -7
  21. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +121 -104
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  27. package/themes/business/src/components/OrderSummary/index.tsx +7 -8
  28. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  29. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +43 -32
  31. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -28
  34. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  36. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/StoresList/index.tsx +5 -3
  41. package/themes/business/src/components/UserProfileForm/index.tsx +9 -8
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  43. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  44. package/themes/business/src/types/index.tsx +9 -0
  45. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  47. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  50. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  51. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  52. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  53. package/themes/original/index.tsx +7 -3
  54. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  55. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  56. package/themes/original/src/components/AddressList/index.tsx +4 -7
  57. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  58. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  59. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  60. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  61. package/themes/original/src/components/BusinessController/index.tsx +9 -6
  62. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  63. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  64. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  65. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  68. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  69. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  70. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  71. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  72. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  73. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  74. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  75. package/themes/original/src/components/BusinessProductsListing/index.tsx +35 -15
  76. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  77. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  78. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  80. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  81. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  82. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  83. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  86. package/themes/original/src/components/Cart/index.tsx +25 -6
  87. package/themes/original/src/components/CartContent/index.tsx +61 -39
  88. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  89. package/themes/original/src/components/Checkout/index.tsx +136 -19
  90. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  91. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  92. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  93. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  94. package/themes/original/src/components/Favorite/index.tsx +4 -9
  95. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  96. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  97. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  98. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  99. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  100. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  101. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  102. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  103. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  104. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  105. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  106. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  107. package/themes/original/src/components/Home/index.tsx +1 -1
  108. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  109. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  110. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  111. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  112. package/themes/original/src/components/Messages/index.tsx +9 -4
  113. package/themes/original/src/components/Messages/styles.tsx +1 -1
  114. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  115. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  116. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  117. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  118. package/themes/original/src/components/MultiCheckout/index.tsx +184 -51
  119. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  120. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  121. package/themes/original/src/components/NavBar/index.tsx +3 -1
  122. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  123. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  124. package/themes/original/src/components/Notifications/index.tsx +4 -8
  125. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  126. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  127. package/themes/original/src/components/OrderDetails/index.tsx +717 -667
  128. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  129. package/themes/original/src/components/OrderProgress/index.tsx +7 -7
  130. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  131. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  132. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  133. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  134. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  135. package/themes/original/src/components/OrdersOption/index.tsx +4 -3
  136. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  137. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  138. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  139. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  140. package/themes/original/src/components/PaymentOptions/index.tsx +41 -32
  141. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  142. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  143. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  144. package/themes/original/src/components/ProductForm/index.tsx +81 -167
  145. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  146. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  147. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  148. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  149. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  150. package/themes/original/src/components/Promotions/index.tsx +4 -4
  151. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  152. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  153. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  154. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  155. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  156. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  157. package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
  158. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  159. package/themes/original/src/components/StripeCardsList/index.tsx +53 -7
  160. package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
  161. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  162. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  163. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  164. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  165. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  166. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  167. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  168. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  169. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  170. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  171. package/themes/original/src/components/Wallets/index.tsx +8 -9
  172. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  173. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  174. package/themes/original/src/components/shared/OInput.tsx +1 -4
  175. package/themes/original/src/components/shared/OModal.tsx +12 -14
  176. package/themes/original/src/layouts/Container.tsx +5 -3
  177. package/themes/original/src/types/index.tsx +10 -2
  178. package/themes/original/src/utils/index.tsx +124 -0
  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
@@ -47,7 +47,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
47
47
  const [, t] = useLanguage()
48
48
  const [{ configs }] = useConfig()
49
49
  const [{ parsePrice }] = useUtils()
50
- const [, { showToast }] = useToast();
50
+ const [, { showToast }] = useToast();
51
51
  const { confirmApplePayPayment } = useApplePay()
52
52
 
53
53
  const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
@@ -88,6 +88,8 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
88
88
  return theme.images.general.stripesb
89
89
  case 'global_apple_pay':
90
90
  return theme.images.general.applePayMark
91
+ case 'global_google_pay':
92
+ return theme.images.general.googlePayMark
91
93
  default:
92
94
  return theme.images.general.creditCard
93
95
  }
@@ -123,7 +125,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
123
125
  const renderPaymethods = ({ item }: any) => {
124
126
  return (
125
127
  <>
126
- {item?.gateway === 'global_apple_pay' ? (
128
+ {methodsPay.includes(item?.gateway) ? (
127
129
  <TouchableOpacity
128
130
  onPress={() => handleChangePaymethod({ ...item, paymethod: { gateway: item.gateway }, paymethod_id: item?.id })}
129
131
  >
@@ -214,6 +216,13 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
214
216
  publicKey={paymethodSelected?.data?.publishable}
215
217
  payType={paymethodSelected?.paymethod?.name}
216
218
  onSelectCard={handlePaymethodDataChange}
219
+ addCardOpen={addCardOpen}
220
+ setAddCardOpen={setAddCardOpen}
221
+ openCarts={openCarts}
222
+ toSave
223
+ handlePaymethodDataChange={handlePaymethodDataChange}
224
+ clientSecret={props.clientSecret}
225
+ onPaymentChange={handlePaymethodDataChange}
217
226
  />
218
227
  </View>
219
228
  )}
@@ -297,7 +306,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
297
306
  </>
298
307
  )}
299
308
 
300
- <OModal
309
+ {/* <OModal
301
310
  entireModal
302
311
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
303
312
  open={addCardOpen.stripe}
@@ -320,7 +329,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
320
329
  onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
321
330
  />
322
331
  </KeyboardAvoidingView>
323
- </OModal>
332
+ </OModal> */}
324
333
  </PMContainer>
325
334
  )
326
335
  }
@@ -10,11 +10,11 @@ import {
10
10
  ToastType,
11
11
  MultiCheckout as MultiCheckoutController
12
12
  } from 'ordering-components/native'
13
- import { View, StyleSheet, Platform } from 'react-native'
13
+ import { View, StyleSheet, Platform, ScrollView } from 'react-native'
14
14
  import { useTheme } from 'styled-components/native';
15
15
  import { Container } from '../../layouts/Container';
16
16
  import NavBar from '../NavBar';
17
- import { OText, OIcon, OModal } from '../shared';
17
+ import { OText, OIcon, OModal, OButton } from '../shared';
18
18
  import { getTypesText } from '../../utils';
19
19
  import { UserDetails } from '../UserDetails'
20
20
  import { AddressDetails } from '../AddressDetails'
@@ -26,6 +26,8 @@ import { DriverTips } from '../DriverTips'
26
26
  import { CouponControl } from '../CouponControl';
27
27
  import { DriverTipsContainer } from '../Cart/styles'
28
28
  import { OSTable, OSCoupon } from '../OrderSummary/styles';
29
+ import { SignupForm } from '../SignupForm'
30
+ import { LoginForm } from '../LoginForm'
29
31
 
30
32
  import {
31
33
  ChContainer,
@@ -64,16 +66,21 @@ const MultiCheckoutUI = (props: any) => {
64
66
  cartGroup,
65
67
  walletState,
66
68
  onNavigationRedirectReplace,
67
- merchantId
69
+ merchantId,
70
+ cartsInvalid
68
71
  } = props
69
72
 
70
73
  const theme = useTheme();
71
74
  const styles = StyleSheet.create({
72
75
  pagePadding: {
73
- paddingLeft: 40,
74
- paddingRight: 40
76
+ paddingLeft: 20,
77
+ paddingRight: 20
75
78
  },
76
- wrapperNavbar: { paddingHorizontal: 40 }
79
+ wrapperNavbar: { paddingHorizontal: 20 },
80
+ detailWrapper: {
81
+ paddingHorizontal: 20,
82
+ width: '100%'
83
+ },
77
84
  })
78
85
 
79
86
  const [, { showToast }] = useToast();
@@ -82,14 +89,14 @@ const MultiCheckoutUI = (props: any) => {
82
89
  const [{ parsePrice, parseDate }] = useUtils();
83
90
  const [{ options, carts, loading }, { confirmCart }] = useOrder();
84
91
  const [validationFields] = useValidationFields();
85
- const [{ user }] = useSession()
92
+ const [{ user }, { login }] = useSession()
86
93
 
87
94
  const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
88
95
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
89
96
  const isMultiDriverTips = configs?.checkout_multi_business_enabled?.value === '1'
90
97
  const walletCarts = (Object.values(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) || []
91
98
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
92
-
99
+ const cartsToShow = openCarts?.length > 0 ? openCarts : cartsInvalid
93
100
  const walletName: any = {
94
101
  cash: {
95
102
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
@@ -133,12 +140,17 @@ const MultiCheckoutUI = (props: any) => {
133
140
  const [phoneUpdate, setPhoneUpdate] = useState(false);
134
141
  const [userErrors, setUserErrors] = useState<any>([]);
135
142
  const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
143
+ const [allowedGuest, setAllowedGuest] = useState(false)
144
+ const [isOpen, setIsOpen] = useState(false)
145
+ const [requiredFields, setRequiredFields] = useState<any>([])
146
+ const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
147
+ const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
136
148
  const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
137
149
  const methodsPay = ['global_google_pay', 'global_apple_pay']
138
- const isDisablePlaceOrderButton = cartGroup?.loading || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
150
+ const isDisablePlaceOrderButton = cartGroup?.loading || placing || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
139
151
  (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data) ||
140
152
  walletCarts.length > 0
141
- || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
153
+ || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) || openCarts?.length === 0
142
154
 
143
155
  const handleMomentClick = () => {
144
156
  if (isPreOrder) {
@@ -150,11 +162,12 @@ const MultiCheckoutUI = (props: any) => {
150
162
  setUserErrors([])
151
163
  const errors = []
152
164
  const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
165
+ const _requiredFields: any = []
153
166
 
154
167
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
155
168
  if (field?.required && !notFields.includes(field.code)) {
156
169
  if (!user[field?.code]) {
157
- errors.push(t(`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`, `The field ${field?.name} is required`))
170
+ _requiredFields.push(field?.code)
158
171
  }
159
172
  }
160
173
  })
@@ -165,8 +178,9 @@ const MultiCheckoutUI = (props: any) => {
165
178
  validationFields?.fields?.checkout?.cellphone?.required) ||
166
179
  configs?.verification_phone_required?.value === '1')
167
180
  ) {
168
- errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
181
+ _requiredFields.push('cellphone')
169
182
  }
183
+ setRequiredFields(_requiredFields)
170
184
 
171
185
  if (phoneUpdate) {
172
186
  errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
@@ -179,11 +193,20 @@ const MultiCheckoutUI = (props: any) => {
179
193
  setPhoneUpdate(val)
180
194
  }
181
195
 
182
- const handlePlaceOrder = (confirmPayment ?: any) => {
183
- if (!userErrors.length) {
196
+ const handlePlaceOrder = (confirmPayment?: any) => {
197
+ if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
198
+ setOpenModal({ ...openModal, signup: true, isGuest: true })
199
+ return
200
+ }
201
+
202
+ if (!userErrors.length && (!requiredFields?.length || allowedGuest)) {
184
203
  handleGroupPlaceOrder && handleGroupPlaceOrder(confirmPayment)
185
204
  return
186
205
  }
206
+ if (requiredFields?.length) {
207
+ setIsOpen(true)
208
+ return
209
+ }
187
210
  let stringError = ''
188
211
  Object.values(userErrors).map((item: any, i: number) => {
189
212
  stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
@@ -192,6 +215,24 @@ const MultiCheckoutUI = (props: any) => {
192
215
  setIsUserDetailsEdit(true)
193
216
  }
194
217
 
218
+ const handlePlaceOrderAsGuest = () => {
219
+ setIsOpen(false)
220
+ handleGroupPlaceOrder && handleGroupPlaceOrder()
221
+ }
222
+
223
+ const handleSuccessSignup = (user: any) => {
224
+ login({
225
+ user,
226
+ token: user?.session?.access_token
227
+ })
228
+ openModal?.isGuest && handlePlaceOrderAsGuest()
229
+ setOpenModal({ ...openModal, signup: false, isGuest: false })
230
+ }
231
+
232
+ const handleSuccessLogin = (user: any) => {
233
+ if (user) setOpenModal({ ...openModal, login: false })
234
+ }
235
+
195
236
  useEffect(() => {
196
237
  if (validationFields && validationFields?.fields?.checkout) {
197
238
  checkValidationFields()
@@ -199,14 +240,14 @@ const MultiCheckoutUI = (props: any) => {
199
240
  }, [validationFields, user])
200
241
 
201
242
  useEffect(() => {
202
- if (openCarts.length === 1) {
243
+ if (cartsToShow?.length === 1) {
203
244
  onNavigationRedirectReplace('CheckoutPage', {
204
- cartUuid: openCarts[0]?.uuid,
245
+ cartUuid: cartsToShow[0]?.uuid,
205
246
  fromMulti: true
206
247
  })
207
248
  return
208
249
  }
209
- }, [openCarts])
250
+ }, [cartsToShow])
210
251
 
211
252
  useEffect(() => {
212
253
  if (walletState.error) {
@@ -221,14 +262,14 @@ const MultiCheckoutUI = (props: any) => {
221
262
  }, [cartUuid])
222
263
 
223
264
  useEffect(() => {
224
- if(paymethodSelected?.gateway === 'global_google_pay'){
265
+ if (paymethodSelected?.gateway === 'global_google_pay') {
225
266
  setMethodPaySupported({
226
267
  enabled: true,
227
268
  loading: false,
228
269
  message: null
229
270
  })
230
271
  }
231
- }, [paymethodSelected])
272
+ }, [paymethodSelected])
232
273
 
233
274
  return (
234
275
  <>
@@ -284,15 +325,45 @@ const MultiCheckoutUI = (props: any) => {
284
325
 
285
326
  <ChSection>
286
327
  <ChUserDetails>
287
- <UserDetails
288
- isUserDetailsEdit={isUserDetailsEdit}
289
- useValidationFields
290
- useDefualtSessionManager
291
- useSessionUser
292
- isCheckout
293
- phoneUpdate={phoneUpdate}
294
- togglePhoneUpdate={togglePhoneUpdate}
295
- />
328
+ {(user?.guest_id && !allowedGuest) ? (
329
+ <View>
330
+ <OText size={14} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textNormal}>
331
+ {t('CUSTOMER_DETAILS', 'Customer details')}
332
+ </OText>
333
+ <OButton
334
+ text={t('SIGN_UP', 'Sign up')}
335
+ textStyle={{ color: theme.colors.white }}
336
+ style={{ borderRadius: 7.6, marginTop: 20 }}
337
+ onClick={() => setOpenModal({ ...openModal, signup: true })}
338
+ />
339
+ <OButton
340
+ text={t('LOGIN', 'Login')}
341
+ textStyle={{ color: theme.colors.primary }}
342
+ bgColor={theme.colors.white}
343
+ borderColor={theme.colors.primary}
344
+ style={{ borderRadius: 7.6, marginTop: 20 }}
345
+ onClick={() => setOpenModal({ ...openModal, login: true })}
346
+ />
347
+ <OButton
348
+ text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
349
+ textStyle={{ color: theme.colors.black }}
350
+ bgColor={theme.colors.white}
351
+ borderColor={theme.colors.black}
352
+ style={{ borderRadius: 7.6, marginTop: 20 }}
353
+ onClick={() => setAllowedGuest(true)}
354
+ />
355
+ </View>
356
+ ) : (
357
+ <UserDetails
358
+ isUserDetailsEdit={isUserDetailsEdit}
359
+ useValidationFields
360
+ useDefualtSessionManager
361
+ useSessionUser
362
+ isCheckout
363
+ phoneUpdate={phoneUpdate}
364
+ togglePhoneUpdate={togglePhoneUpdate}
365
+ />
366
+ )}
296
367
  </ChUserDetails>
297
368
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
298
369
  </ChSection>
@@ -309,27 +380,27 @@ const MultiCheckoutUI = (props: any) => {
309
380
  </ChAddress>
310
381
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
311
382
  </ChSection>
312
-
313
- <ChSection>
314
- <MultiCartsPaymethodsAndWallets
315
- openCarts={openCarts}
316
- paymethodSelected={paymethodSelected}
317
- walletsPaymethod={cartGroup?.result?.wallets}
318
- handleSelectPaymethod={handleSelectPaymethod}
319
- handleSelectWallet={handleSelectWallet}
320
- handlePaymethodDataChange={handlePaymethodDataChange}
321
- cartUuid={cartUuid}
322
- merchantId={merchantId}
323
- setMethodPaySupported={setMethodPaySupported}
324
- methodPaySupported={methodPaySupported}
325
- placeByMethodPay={placeByMethodPay}
326
- setPlaceByMethodPay={setPlaceByMethodPay}
327
- cartTotal={totalCartsPrice}
328
- handlePlaceOrder={handlePlaceOrder}
329
- />
330
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
331
- </ChSection>
332
-
383
+ {openCarts?.length > 0 && (
384
+ <ChSection>
385
+ <MultiCartsPaymethodsAndWallets
386
+ openCarts={openCarts}
387
+ paymethodSelected={paymethodSelected}
388
+ walletsPaymethod={cartGroup?.result?.wallets}
389
+ handleSelectPaymethod={handleSelectPaymethod}
390
+ handleSelectWallet={handleSelectWallet}
391
+ handlePaymethodDataChange={handlePaymethodDataChange}
392
+ cartUuid={cartUuid}
393
+ merchantId={merchantId}
394
+ setMethodPaySupported={setMethodPaySupported}
395
+ methodPaySupported={methodPaySupported}
396
+ placeByMethodPay={placeByMethodPay}
397
+ setPlaceByMethodPay={setPlaceByMethodPay}
398
+ cartTotal={totalCartsPrice}
399
+ handlePlaceOrder={handlePlaceOrder}
400
+ />
401
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
402
+ </ChSection>
403
+ )}
333
404
  {
334
405
  isMultiDriverTips &&
335
406
  options?.type === 1 &&
@@ -364,6 +435,7 @@ const MultiCheckoutUI = (props: any) => {
364
435
  validationFields?.fields?.checkout?.coupon?.enabled &&
365
436
  openCarts.every((cart: any) => cart.business_id && cart.status !== 2) &&
366
437
  configs?.multi_business_checkout_coupon_input_style?.value === 'group' &&
438
+ openCarts?.length > 0 &&
367
439
  (
368
440
  <ChSection>
369
441
  <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
@@ -390,7 +462,7 @@ const MultiCheckoutUI = (props: any) => {
390
462
  {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
391
463
  </OText>
392
464
  </CartsHeader>
393
- {openCarts.map((cart: any) => (
465
+ {cartsToShow.map((cart: any) => (
394
466
  <React.Fragment key={cart.uuid}>
395
467
  <Cart
396
468
  cart={cart}
@@ -407,7 +479,7 @@ const MultiCheckoutUI = (props: any) => {
407
479
  )}
408
480
  </React.Fragment>
409
481
  ))}
410
- {!cartGroup?.loading && openCarts.length === 0 && (
482
+ {!cartGroup?.loading && openCarts.length === 0 && cartsInvalid?.length === 0 && (
411
483
  <CCNotCarts>
412
484
  <OText size={24} style={{ textAlign: 'center' }}>
413
485
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
@@ -465,6 +537,7 @@ const MultiCheckoutUI = (props: any) => {
465
537
  </OText>
466
538
  </View>
467
539
  )}
540
+
468
541
  <OText size={12} color={theme.colors.mediumGray} mRight={70} style={{ marginTop: 10 }}>
469
542
  {t('MULTI_CHECKOUT_DESCRIPTION', 'You will receive a receipt for each business. The payment is not combined between multiple stores. Each payment is processed by the store')}
470
543
  </OText>
@@ -472,7 +545,67 @@ const MultiCheckoutUI = (props: any) => {
472
545
  )}
473
546
  </ChCarts>
474
547
  </ChSection>
548
+ {cartsToShow?.some((cart: any) => !cart?.valid_products && cart?.status !== 2) && (
549
+ <OText
550
+ color={theme.colors.error}
551
+ size={12}
552
+ >
553
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
554
+ </OText>
555
+ )}
475
556
  </ChContainer>
557
+ <OModal
558
+ open={openModal.signup}
559
+ onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
560
+ >
561
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
562
+ <SignupForm
563
+ handleSuccessSignup={handleSuccessSignup}
564
+ isGuest
565
+ signupButtonText={t('SIGNUP', 'Signup')}
566
+ useSignupByEmail
567
+ useChekoutFileds
568
+ />
569
+ </ScrollView>
570
+ </OModal>
571
+ <OModal
572
+ open={openModal.login}
573
+ onClose={() => setOpenModal({ ...openModal, login: false })}
574
+ >
575
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
576
+ <LoginForm
577
+ handleSuccessLogin={handleSuccessLogin}
578
+ isGuest
579
+ loginButtonText={t('LOGIN', 'Login')}
580
+ loginButtonBackground={theme.colors.primary}
581
+ />
582
+ </ScrollView>
583
+ </OModal>
584
+ <OModal
585
+ open={isOpen}
586
+ onClose={() => setIsOpen(false)}
587
+ >
588
+ <View style={styles.detailWrapper}>
589
+ <UserDetails
590
+ isUserDetailsEdit
591
+ useValidationFields
592
+ useDefualtSessionManager
593
+ useSessionUser
594
+ isCheckout
595
+ isEdit
596
+ phoneUpdate={phoneUpdate}
597
+ togglePhoneUpdate={togglePhoneUpdate}
598
+ requiredFields={requiredFields}
599
+ hideUpdateButton
600
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
601
+ onClose={() => {
602
+ setIsOpen(false)
603
+ handlePlaceOrder()
604
+ }}
605
+ setIsOpen={setIsOpen}
606
+ />
607
+ </View>
608
+ </OModal>
476
609
  </Container>
477
610
 
478
611
  <FloatingButton
@@ -93,7 +93,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
93
93
  }, [])
94
94
 
95
95
  return (
96
- <OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 40 }}>
96
+ <OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 20 }}>
97
97
  <View style={{ flexDirection: 'row' }}>
98
98
  <OButton
99
99
  imgRightSrc={null}
@@ -87,7 +87,7 @@ export const MyOrders = (props: any) => {
87
87
  display: 'flex',
88
88
  flexDirection: 'row',
89
89
  alignItems: 'center',
90
- paddingHorizontal: isChewLayout ? 20 : 40,
90
+ paddingHorizontal: 20,
91
91
  },
92
92
  ...props.titleStyle
93
93
  }}>
@@ -124,7 +124,7 @@ export const MyOrders = (props: any) => {
124
124
  <ScrollView
125
125
  horizontal
126
126
  style={{ ...styles.container, borderBottomWidth: 1 }}
127
- contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : isChewLayout ? 20 : 40 }}
127
+ contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : 20 }}
128
128
  showsHorizontalScrollIndicator={false}
129
129
  scrollEventThrottle={16}
130
130
  >
@@ -148,7 +148,7 @@ export const MyOrders = (props: any) => {
148
148
  )}
149
149
  {selectedOption === 'orders' && (
150
150
  <>
151
- <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
151
+ <View style={{ paddingHorizontal: 20 }}>
152
152
  <OrdersOption
153
153
  {...props}
154
154
  preOrders
@@ -158,7 +158,7 @@ export const MyOrders = (props: any) => {
158
158
  refreshOrders={refreshOrders}
159
159
  />
160
160
  </View>
161
- <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
161
+ <View style={{ paddingHorizontal: 20 }}>
162
162
  <OrdersOption
163
163
  {...props}
164
164
  activeOrders
@@ -168,7 +168,7 @@ export const MyOrders = (props: any) => {
168
168
  refreshOrders={refreshOrders}
169
169
  />
170
170
  </View>
171
- <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
171
+ <View style={{ paddingHorizontal: 20 }}>
172
172
  <OrdersOption
173
173
  {...props}
174
174
  ordersLength={ordersLength}
@@ -1,3 +1,6 @@
1
+
2
+
3
+
1
4
  import * as React from 'react'
2
5
  import styled, { useTheme } from 'styled-components/native'
3
6
  import { OButton, OIcon, OText } from '../shared'
@@ -92,7 +95,6 @@ const NavBar = (props: Props) => {
92
95
  <TitleWrapper style={{ ...{ paddingHorizontal: props.isVertical ? 0 : 10 }, ...props.titleWrapStyle }}>
93
96
  <OText
94
97
  size={20}
95
- lineHeight={36}
96
98
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
97
99
  style={
98
100
  {
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage, useOrderingTheme } from 'ordering-components/native'
2
+ import { useLanguage } from 'ordering-components/native'
3
3
  import { Dimensions } from 'react-native'
4
4
  import RNRestart from 'react-native-restart'
5
5
  import { OText, OIcon, OButton } from '../shared'
@@ -16,8 +16,7 @@ export const NetworkError = (props: NoNetworkParams) => {
16
16
  } = props
17
17
  const theme = useTheme()
18
18
  const [, t] = useLanguage()
19
- const [orderingTheme] = useOrderingTheme()
20
- const urlimage = orderingTheme?.theme?.no_internet?.components?.image
19
+ const urlimage = theme?.no_internet?.components?.image
21
20
  const noNetworkImage = image || theme.images.general.noNetwork
22
21
  const deviceWidth = Dimensions.get('screen').width
23
22
 
@@ -2,10 +2,10 @@ import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
4
  flex: 1;
5
- padding: 20px 40px;
5
+ padding: 20px;
6
6
  `
7
7
  export const ImageContainer = styled.View`
8
8
  flex: 1;
9
9
  align-items: center;
10
10
  justify-content: center;
11
- `
11
+ `
@@ -3,7 +3,6 @@ import {
3
3
  UserFormDetails as NotificationsController,
4
4
  useLanguage,
5
5
  useSession,
6
- useOrderingTheme,
7
6
  useToast,
8
7
  ToastType,
9
8
  } from 'ordering-components/native'
@@ -28,7 +27,6 @@ const NotificationsUI = (props: any) => {
28
27
  const [{ user: userSession }] = useSession()
29
28
  const [, t] = useLanguage();
30
29
  const [, { showToast }] = useToast();
31
- const [orderingTheme] = useOrderingTheme()
32
30
 
33
31
  const user = userData || userSession
34
32
 
@@ -45,8 +43,8 @@ const NotificationsUI = (props: any) => {
45
43
  })
46
44
 
47
45
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
48
- const showCustomerPromotions = !orderingTheme?.theme?.profile?.components?.promotions?.hidden
49
- const showNotifications = !orderingTheme?.theme?.profile?.components?.notification_settings?.hidden
46
+ const showCustomerPromotions = !theme?.profile?.components?.promotions?.hidden
47
+ const showNotifications = !theme?.profile?.components?.notification_settings?.hidden
50
48
 
51
49
  const handleEditNotifications = (key: any, value: any) => {
52
50
  setNotificationsList({
@@ -75,10 +73,8 @@ const NotificationsUI = (props: any) => {
75
73
  titleAlign={'center'}
76
74
  onActionLeft={goToBack}
77
75
  showCall={false}
78
- style={{
79
- paddingHorizontal: 40,
80
- paddingVertical: 0,
81
- }}
76
+ style={{ paddingVertical: 0 }}
77
+ btnStyle={{ paddingLeft: 0 }}
82
78
  />
83
79
  {showCustomerPromotions && showNotifications && (
84
80
  <>
@@ -9,7 +9,6 @@ export const Container = styled.ScrollView`
9
9
  export const NotificationsGroupSwitchWrapper = styled.View`
10
10
  flex-grow: 1;
11
11
  justify-content: space-between;
12
- padding: 0 20px;
13
12
  `
14
13
 
15
14
  export const SwitchWrapper = styled.View`
@@ -33,7 +33,7 @@ export const OrderHistory = (props: any) => {
33
33
  paddingVertical: 16
34
34
  },
35
35
  container: {
36
- paddingHorizontal: 40,
36
+ paddingHorizontal: 20,
37
37
  paddingVertical: 15
38
38
  }
39
39
  });
@@ -107,8 +107,12 @@ export const OrderHistory = (props: any) => {
107
107
  ellipsizeMode='tail'
108
108
  >
109
109
  {t('ORDER_PLACED', 'Order placed')} {' '}
110
- {t('VIA', 'Via')}{' '}
111
- {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
110
+ {!props.hideViaText && (
111
+ <>
112
+ {t('VIA', 'Via')}{' '}
113
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
114
+ </>
115
+ )}
112
116
  </OText>
113
117
  <OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
114
118
  </View>