ordering-ui-react-native 0.17.94 → 0.17.95-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 (224) hide show
  1. package/package.json +9 -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 +7 -2
  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 +22 -94
  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/OrdersListManager/index.tsx +7 -2
  35. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  36. package/themes/business/src/components/OrdersOption/index.tsx +44 -47
  37. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  38. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  39. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  40. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  41. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  42. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  43. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  46. package/themes/business/src/components/StoresList/index.tsx +3 -4
  47. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  49. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  50. package/themes/business/src/components/shared/OModal.tsx +16 -9
  51. package/themes/business/src/types/index.tsx +24 -10
  52. package/themes/business/src/utils/index.tsx +29 -2
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  57. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +7 -3
  65. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  66. package/themes/original/src/components/AddressForm/index.tsx +35 -17
  67. package/themes/original/src/components/AddressList/index.tsx +5 -8
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  73. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  74. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +21 -23
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +137 -32
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +36 -403
  94. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  95. package/themes/original/src/components/Cart/index.tsx +51 -87
  96. package/themes/original/src/components/CartContent/index.tsx +70 -30
  97. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  98. package/themes/original/src/components/Checkout/index.tsx +265 -32
  99. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  100. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  101. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  102. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  103. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  104. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  105. package/themes/original/src/components/Favorite/index.tsx +1 -5
  106. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  108. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  110. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  113. package/themes/original/src/components/Home/index.tsx +13 -4
  114. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  117. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  118. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  119. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  120. package/themes/original/src/components/Messages/index.tsx +15 -4
  121. package/themes/original/src/components/MomentOption/index.tsx +41 -36
  122. package/themes/original/src/components/MomentOption/styles.tsx +0 -15
  123. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  125. package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  128. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  129. package/themes/original/src/components/NavBar/index.tsx +20 -13
  130. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  131. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  132. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  133. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  134. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  135. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  136. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  137. package/themes/original/src/components/OrderSummary/index.tsx +59 -56
  138. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  139. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  140. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  141. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  142. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  143. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  144. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  145. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  146. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  147. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  148. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  149. package/themes/original/src/components/ProductForm/index.tsx +86 -30
  150. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  151. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  152. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  153. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  154. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  155. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  156. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  157. package/themes/original/src/components/Promotions/index.tsx +2 -2
  158. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  159. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  160. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  161. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  162. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  165. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  167. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  168. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  172. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  173. package/themes/original/src/components/UserFormDetails/index.tsx +113 -10
  174. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  175. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  176. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  177. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  178. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  179. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  180. package/themes/original/src/components/Wallets/index.tsx +51 -61
  181. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  182. package/themes/original/src/components/shared/OButton.tsx +3 -3
  183. package/themes/original/src/components/shared/OInput.tsx +4 -5
  184. package/themes/original/src/components/shared/OModal.tsx +3 -3
  185. package/themes/original/src/config/constants.tsx +0 -10
  186. package/themes/original/src/types/index.tsx +36 -17
  187. package/themes/original/src/utils/index.tsx +185 -13
  188. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  189. package/src/navigators/BottomNavigator.tsx +0 -117
  190. package/src/navigators/CheckoutNavigator.tsx +0 -66
  191. package/src/navigators/HomeNavigator.tsx +0 -202
  192. package/src/navigators/NavigationRef.tsx +0 -7
  193. package/src/navigators/RootNavigator.tsx +0 -269
  194. package/src/pages/Account.tsx +0 -34
  195. package/src/pages/AddressForm.tsx +0 -62
  196. package/src/pages/AddressList.tsx +0 -24
  197. package/src/pages/BusinessProductsList.tsx +0 -81
  198. package/src/pages/BusinessesListing.tsx +0 -43
  199. package/src/pages/CartList.tsx +0 -49
  200. package/src/pages/Checkout.tsx +0 -101
  201. package/src/pages/ForgotPassword.tsx +0 -24
  202. package/src/pages/Help.tsx +0 -23
  203. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  204. package/src/pages/HelpGuide.tsx +0 -23
  205. package/src/pages/HelpOrder.tsx +0 -23
  206. package/src/pages/Home.tsx +0 -36
  207. package/src/pages/IntroductoryTutorial.tsx +0 -170
  208. package/src/pages/Login.tsx +0 -47
  209. package/src/pages/MomentOption.tsx +0 -30
  210. package/src/pages/MultiCheckout.tsx +0 -31
  211. package/src/pages/MultiOrdersDetails.tsx +0 -27
  212. package/src/pages/MyOrders.tsx +0 -40
  213. package/src/pages/NetworkError.tsx +0 -24
  214. package/src/pages/NotFound.tsx +0 -22
  215. package/src/pages/OrderDetails.tsx +0 -25
  216. package/src/pages/ProductDetails.tsx +0 -55
  217. package/src/pages/Profile.tsx +0 -36
  218. package/src/pages/ReviewDriver.tsx +0 -30
  219. package/src/pages/ReviewOrder.tsx +0 -32
  220. package/src/pages/ReviewProducts.tsx +0 -30
  221. package/src/pages/Sessions.tsx +0 -22
  222. package/src/pages/Signup.tsx +0 -53
  223. package/src/pages/SpinnerLoader.tsx +0 -10
  224. package/src/pages/Splash.tsx +0 -21
@@ -34,7 +34,8 @@ const UserDetailsUI = (props: any) => {
34
34
  isCheckout,
35
35
  handleSendVerifyCode,
36
36
  verifyPhoneState,
37
- setFormState
37
+ setFormState,
38
+ setIsOpen
38
39
  } = props
39
40
 
40
41
  const theme = useTheme();
@@ -209,6 +210,7 @@ const UserDetailsUI = (props: any) => {
209
210
  isCheckout={isCheckout}
210
211
  setWillVerifyOtpState={setWillVerifyOtpState}
211
212
  setIsSubmit={setIsSubmit}
213
+ setIsOpen={setIsOpen}
212
214
  />
213
215
  )}
214
216
  </UDContainer>
@@ -1,15 +1,20 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Platform, StyleSheet, TouchableOpacity } from 'react-native';
2
+ import { Platform, StyleSheet, TouchableOpacity, ScrollView } from 'react-native';
3
3
  import { useSession, useLanguage, ToastType, useToast, useConfig } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
+ import { SignupForm } from '../SignupForm'
6
7
 
7
8
  import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
8
9
 
9
- import { OText, OButton, OInput } from '../shared';
10
+ import { OText, OButton, OInput, OModal, OIcon } from '../shared';
11
+ import { OAlert } from '../../../../../src/components/shared'
10
12
 
11
13
  import { PhoneInputNumber } from '../PhoneInputNumber';
12
14
  import { sortInputFields } from '../../utils';
15
+ import { ListItem } from '../UserProfile/styles';
16
+ import moment from 'moment';
17
+ import { DatePickerUI } from '../DatePicker';
13
18
 
14
19
  export const UserFormDetailsUI = (props: any) => {
15
20
  const {
@@ -27,6 +32,11 @@ export const UserFormDetailsUI = (props: any) => {
27
32
  phoneUpdate,
28
33
  hideUpdateButton,
29
34
  setWillVerifyOtpState,
35
+ handlePlaceOrderAsGuest,
36
+ isCheckout,
37
+ setIsOpen,
38
+ handleRemoveAccount,
39
+ isProfile
30
40
  } = props;
31
41
 
32
42
  const theme = useTheme();
@@ -68,10 +78,13 @@ export const UserFormDetailsUI = (props: any) => {
68
78
  const [, { showToast }] = useToast();
69
79
  const { handleSubmit, control, errors, setValue } = useForm();
70
80
 
71
- const [{ user }] = useSession();
81
+ const [{ user }, { login }] = useSession();
72
82
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
73
83
  const [isValid, setIsValid] = useState(false)
74
84
  const [isChanged, setIsChanged] = useState(false)
85
+ const [isModalOpen, setIsModalOpen] = useState(false)
86
+ const [birthdate, setBirthdate] = useState(user?.birthdate ?? null)
87
+ const [showDatePicker, setShowDatePicker] = useState(false)
75
88
  const [phoneInputData, setPhoneInputData] = useState({
76
89
  error: '',
77
90
  phone: {
@@ -79,8 +92,19 @@ export const UserFormDetailsUI = (props: any) => {
79
92
  cellphone: null,
80
93
  },
81
94
  });
95
+ const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
82
96
 
97
+ const isAdmin = user?.level === 0
83
98
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
99
+ const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
100
+
101
+ const handleSuccessSignup = (user: any) => {
102
+ login({
103
+ user,
104
+ token: user?.session?.access_token
105
+ })
106
+ handlePlaceOrderAsGuest && handlePlaceOrderAsGuest()
107
+ }
84
108
 
85
109
  const getInputRules = (field: any) => {
86
110
  const rules: any = {
@@ -187,6 +211,25 @@ export const UserFormDetailsUI = (props: any) => {
187
211
  handleChangeInput(countryCode, true);
188
212
  }
189
213
 
214
+ const _handleChangeDate = (date: any) => {
215
+ setBirthdate(date)
216
+ const _birthdate = moment(date).format('YYYY-MM-DD')
217
+ handleChangeInput({ target: { name: 'birthdate', value: _birthdate } })
218
+ setShowDatePicker(false)
219
+ }
220
+
221
+ const onRemoveAccount = () => {
222
+ setConfirm({
223
+ open: true,
224
+ content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
225
+ title: t('ACCOUNT_ALERT', 'Account alert'),
226
+ handleOnAccept: () => {
227
+ setConfirm({ ...confirm, open: false })
228
+ handleRemoveAccount && handleRemoveAccount(user?.id)
229
+ }
230
+ })
231
+ }
232
+
190
233
  useEffect(() => {
191
234
  if (Object.keys(errors).length > 0) {
192
235
  const list = Object.values(errors);
@@ -206,6 +249,10 @@ export const UserFormDetailsUI = (props: any) => {
206
249
  if (!formState?.loading && formState?.result?.error) {
207
250
  formState.result?.result &&
208
251
  showToast(ToastType.Error, formState.result?.result[0]);
252
+ if (isCheckout) {
253
+ setIsOpen && setIsOpen(false)
254
+ cleanFormState && cleanFormState({ changes: {} })
255
+ }
209
256
  }
210
257
  }, [formState?.loading]);
211
258
 
@@ -233,6 +280,14 @@ export const UserFormDetailsUI = (props: any) => {
233
280
  }
234
281
  }, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
235
282
 
283
+ useEffect(() => {
284
+ if (!validationFields.loading && birthdate) {
285
+ setValue('birthdate', formState?.result?.result
286
+ ? formState?.result?.result?.birthdate
287
+ : formState?.changes?.birthdate ?? (user && user?.birthdate) ?? '')
288
+ }
289
+ }, [validationFields, birthdate])
290
+
236
291
  useEffect(() => {
237
292
  if (!requiredFields || formState?.changes?.length === 0) return
238
293
  const _isValid = requiredFields.every((key: any) => formState?.changes[key])
@@ -324,7 +379,21 @@ export const UserFormDetailsUI = (props: any) => {
324
379
  </React.Fragment>
325
380
  ),
326
381
  )}
327
-
382
+ {showInputBirthday && (
383
+ <WrapperPhone>
384
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
385
+ {t('BIRTHDATE', 'Birthdate')}
386
+ </OText>
387
+ <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
388
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
389
+ {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
390
+ </OText>
391
+ </TouchableOpacity>
392
+ {showDatePicker && (
393
+ <DatePickerUI birthdate={birthdate} handleChangeDate={_handleChangeDate} />
394
+ )}
395
+ </WrapperPhone>
396
+ )}
328
397
  {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
329
398
  <WrapperPhone>
330
399
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
@@ -389,6 +458,12 @@ export const UserFormDetailsUI = (props: any) => {
389
458
  )}
390
459
  </UDWrapper>
391
460
  )}
461
+ {isProfile && (
462
+ <ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
463
+ <OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
464
+ <OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
465
+ </ListItem>
466
+ )}
392
467
  {validationFields?.loading && (
393
468
  <UDLoader>
394
469
  <OText size={12}>{t('LOADING', 'Loading')}</OText>
@@ -407,8 +482,8 @@ export const UserFormDetailsUI = (props: any) => {
407
482
  ? t('UPDATING', 'Updating...')
408
483
  : t('UPDATE', 'Update')
409
484
  }
410
- bgColor={theme.colors.white}
411
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
485
+ bgColor={theme.colors.primary}
486
+ textStyle={{ color: theme.colors.white, fontSize: 14 }}
412
487
  borderColor={theme.colors.primary}
413
488
  isDisabled={formState.loading}
414
489
  imgRightSrc={null}
@@ -423,18 +498,46 @@ export const UserFormDetailsUI = (props: any) => {
423
498
  text={
424
499
  formState.loading
425
500
  ? t('UPDATING', 'Updating...')
426
- : t('CONTINUE', 'Continue')
501
+ : ((isCheckout && !!user?.guest_id)
502
+ ? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
503
+ : t('CONTINUE', 'Continue'))
427
504
  }
428
505
  bgColor={theme.colors.white}
429
506
  textStyle={{ color: theme.colors.primary, fontSize: 14 }}
430
507
  borderColor={theme.colors.primary}
431
- isDisabled={formState.loading || !isValid}
508
+ isDisabled={!user?.guest_id && (formState.loading || !isValid)}
432
509
  imgRightSrc={null}
433
510
  style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
434
- onClick={handleSubmit(onSubmit)}
511
+ onClick={!user?.guest_id ? handleSubmit(onSubmit) : () => setIsModalOpen(true)}
435
512
  />
436
513
  )}
514
+ {isCheckout && !!user?.guest_id && (
515
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={() => handlePlaceOrderAsGuest()}>
516
+ <OText color={theme.colors.primary} style={{ textAlign: 'center' }}>{t('PLACE_ORDER_AS_GUEST', 'Place order as guest')}</OText>
517
+ </TouchableOpacity>
518
+ )}
519
+ <OModal
520
+ open={isModalOpen}
521
+ onClose={() => setIsModalOpen(false)}
522
+ >
523
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
524
+ <SignupForm
525
+ handleSuccessSignup={handleSuccessSignup}
526
+ isGuest
527
+ signupButtonText={t('SIGNUP', 'Signup')}
528
+ useSignupByEmail
529
+ useChekoutFileds
530
+ />
531
+ </ScrollView>
532
+ </OModal>
533
+ <OAlert
534
+ open={confirm.open}
535
+ title={confirm.title}
536
+ content={confirm.content}
537
+ onAccept={confirm.handleOnAccept}
538
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
539
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
540
+ />
437
541
  </>
438
542
  );
439
543
  };
440
-
@@ -20,7 +20,7 @@ export const UDLoader = styled.View`
20
20
  width: 100%;
21
21
  justify-content: center;
22
22
  height: auto;
23
- display: inline-flex;
23
+ display: flex;
24
24
  flex-wrap: wrap;
25
25
  padding: 0;
26
26
  margin-top: 0px;
@@ -35,7 +35,6 @@ import {
35
35
  } from './styles';
36
36
  import { useWindowDimensions } from 'react-native';
37
37
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
38
- import styled from 'styled-components';
39
38
  import ToggleSwitch from 'toggle-switch-react-native';
40
39
 
41
40
  const ProfileListUI = (props: ProfileParams) => {
@@ -60,7 +59,7 @@ const ProfileListUI = (props: ProfileParams) => {
60
59
  const hideSession = theme?.bar_menu?.components?.sessions?.hidden
61
60
  const hidePromotions = theme?.bar_menu?.components?.promotions?.hidden
62
61
  const hideAddressList = theme?.profile?.components?.address_list?.hidden
63
- const showLanguages = !theme?.profile?.components?.languages?.hidden
62
+ const showLanguages = theme?.profile?.components?.languages?.hidden
64
63
  const showNotifications = !theme?.profile?.components?.notification_settings?.hidden
65
64
  const langPickerStyle = StyleSheet.create({
66
65
  inputAndroid: {
@@ -118,8 +117,6 @@ const ProfileListUI = (props: ProfileParams) => {
118
117
  const [, { showToast }] = useToast();
119
118
  const { errors } = useForm();
120
119
 
121
- const isAdmin = user?.level === 0
122
-
123
120
  const { height } = useWindowDimensions();
124
121
  const { top, bottom } = useSafeAreaInsets();
125
122
 
@@ -153,19 +150,8 @@ const ProfileListUI = (props: ProfileParams) => {
153
150
 
154
151
  const detailProps = {
155
152
  goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
156
- onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
157
- }
158
-
159
- const onRemoveAccount = () => {
160
- setConfirm({
161
- open: true,
162
- content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
163
- title: t('ACCOUNT_ALERT', 'Account alert'),
164
- handleOnAccept: () => {
165
- setConfirm({ ...confirm, open: false })
166
- handleRemoveAccount && handleRemoveAccount(user?.id)
167
- }
168
- })
153
+ onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
154
+ handleRemoveAccount
169
155
  }
170
156
 
171
157
  useEffect(() => {
@@ -175,7 +161,7 @@ const ProfileListUI = (props: ProfileParams) => {
175
161
  }, [removeAccountState])
176
162
 
177
163
  return (
178
- <View style={{ flex: 1, height: height - top - bottom, paddingTop: 20 }}>
164
+ <View style={{ flex: 1, height: '100%', paddingTop: 20 }}>
179
165
  <CenterView style={styles.pagePadding}>
180
166
  {user?.photo && !hideProfileImage && (
181
167
  <View style={styles.photo}>
@@ -238,11 +224,11 @@ const ProfileListUI = (props: ProfileParams) => {
238
224
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
239
225
  </ListItem>
240
226
  )}
241
- {!showNotifications && (
227
+ {showNotifications && (
242
228
  <ListItem onPress={() => navigation.navigate('Notifications', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
243
229
  <NotificationBadge style={{ borderRadius: 100 / 2 }} />
244
230
  <Ionicons name='notifications-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
245
- <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('NOTIFICATIONS', 'Notifications')}
231
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MARKETING_NOTIFICATIONS', 'Marketing notifications')}
246
232
  </OText>
247
233
  <NotificationsWrapper>
248
234
  <ToggleSwitch
@@ -275,17 +261,13 @@ const ProfileListUI = (props: ProfileParams) => {
275
261
  )}
276
262
  </Actions>
277
263
 
278
- <Actions>
264
+ <Actions style={{ paddingTop: height * .02 }}>
279
265
  {!showLanguages && (
280
266
  <LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
281
267
  )}
282
268
  <View style={{ height: 17 }} />
283
269
  <LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
284
270
  <View style={{ height: 17 }} />
285
- <ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
286
- <OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
287
- <OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
288
- </ListItem>
289
271
  </Actions>
290
272
  </ListWrap>
291
273
  <OAlert
@@ -288,38 +288,37 @@ const ProfileUI = (props: ProfileParams) => {
288
288
  showCall={false}
289
289
  btnStyle={{ paddingLeft: 0 }}
290
290
  />
291
- <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
292
- <CenterView>
293
- <View style={styles.photo}>
294
- {user?.photo ? (
295
- <FastImage
296
- style={{ height: 60, width: 80, borderRadius: 8 }}
297
- source={{
298
- uri: user?.photo,
299
- priority: FastImage.priority.normal,
300
- }}
301
- resizeMode={FastImage.resizeMode.cover}
302
- />
303
- ) : (
304
- <Ionicons name='person-outline' size={50} />
305
- )}
306
- </View>
307
- <OIconButton
308
- icon={theme.images.general.camera}
309
- borderColor={theme.colors.clear}
310
- iconStyle={{ width: 20, height: 20 }}
311
- style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
312
- onClick={() => handleImagePicker()}
313
- />
314
- </CenterView>
315
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32, zIndex: 10 }} />
316
- <Spinner visible={formState?.loading || verifyPhoneState?.loading} />
317
- <UserFormDetailsUI
318
- {...props}
319
- isEdit
320
- setWillVerifyOtpState={setWillVerifyOtpState}
291
+ <CenterView>
292
+ <View style={styles.photo}>
293
+ {user?.photo ? (
294
+ <FastImage
295
+ style={{ height: 80, width: 80, borderRadius: 8 }}
296
+ source={{
297
+ uri: user?.photo,
298
+ priority: FastImage.priority.normal,
299
+ }}
300
+ resizeMode={FastImage.resizeMode.cover}
301
+ />
302
+ ) : (
303
+ <Ionicons name='person-outline' size={50} />
304
+ )}
305
+ </View>
306
+ <OIconButton
307
+ icon={theme.images.general.camera}
308
+ borderColor={theme.colors.clear}
309
+ iconStyle={{ width: 20, height: 20 }}
310
+ style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
311
+ onClick={() => handleImagePicker()}
321
312
  />
322
- </KeyboardAvoidingView>
313
+ </CenterView>
314
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32, zIndex: 10 }} />
315
+ <Spinner visible={formState?.loading || verifyPhoneState?.loading} />
316
+ <UserFormDetailsUI
317
+ {...props}
318
+ isProfile
319
+ isEdit
320
+ setWillVerifyOtpState={setWillVerifyOtpState}
321
+ />
323
322
  </Container>
324
323
  <OModal
325
324
  open={isModalVisible}
@@ -195,38 +195,39 @@ const UserVerificationUI = (props: any) => {
195
195
  }
196
196
 
197
197
  useEffect(() => {
198
- let _timer = TIME_COUNTDOWN - 1;
199
- let minutes = 0;
200
- let seconds = 0;
201
- const interval = setInterval(() => {
202
- minutes = _timer / 60;
203
- seconds = _timer % 60;
204
-
205
- minutes = minutes < 10 ? 0 + minutes : minutes;
206
- seconds = seconds < 10 ? 0 + seconds : seconds;
207
-
208
- const formatMinutes = parseInt(minutes.toString()) < 10
209
- ? `0${parseInt(minutes.toString())}`
210
- : parseInt(minutes.toString());
211
-
212
- const formatseconds = parseInt(seconds.toString()) < 10
213
- ? `0${parseInt(seconds.toString())}`
214
- : parseInt(seconds.toString());
215
-
216
- setTimer(`${formatMinutes}:${formatseconds}`);
217
-
218
- if (--_timer < 0) {
219
- clearInterval(interval);
220
- }
221
-
222
- if (timer === `${TIME_COUNTDOWN / 60}:00` && isSendCodeAgain) {
223
- setIsSendCodeAgain(false)
224
- clearInterval(interval);
225
- }
226
- }, 1000);
227
-
228
- return () => clearInterval(interval)
229
- }, [isSendCodeAgain])
198
+ if (verificationState.phone) {
199
+ let _timer = TIME_COUNTDOWN - 1;
200
+ let minutes = 0;
201
+ let seconds = 0;
202
+ const interval = setInterval(() => {
203
+ minutes = _timer / 60;
204
+ seconds = _timer % 60;
205
+
206
+ minutes = minutes < 10 ? 0 + minutes : minutes;
207
+ seconds = seconds < 10 ? 0 + seconds : seconds;
208
+
209
+ const formatMinutes = parseInt(minutes.toString()) < 10
210
+ ? `0${parseInt(minutes.toString())}`
211
+ : parseInt(minutes.toString());
212
+
213
+ const formatseconds = parseInt(seconds.toString()) < 10
214
+ ? `0${parseInt(seconds.toString())}`
215
+ : parseInt(seconds.toString());
216
+
217
+ setTimer(`${formatMinutes}:${formatseconds}`);
218
+
219
+ if (--_timer < 0) {
220
+ clearInterval(interval);
221
+ }
222
+
223
+ if (timer === `${TIME_COUNTDOWN / 60}:00` && isSendCodeAgain) {
224
+ setIsSendCodeAgain(false)
225
+ clearInterval(interval);
226
+ }
227
+ }, 1000);
228
+ return () => clearInterval(interval)
229
+ }
230
+ }, [isSendCodeAgain, verificationState.phone])
230
231
 
231
232
  useEffect(() => {
232
233
  if (otpState?.length === CODE_LENGTH) {
@@ -292,7 +293,7 @@ const UserVerificationUI = (props: any) => {
292
293
 
293
294
  useEffect(() => {
294
295
  setupUserPhoneNumber()
295
- }, [user])
296
+ }, [user?.cellphone, user?.country_phone_code])
296
297
 
297
298
  return (
298
299
  <SafeAreaView style={{ flex: 1 }}>
@@ -401,6 +402,7 @@ const UserVerificationUI = (props: any) => {
401
402
  textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
402
403
  noDropIcon
403
404
  isDisabled
405
+ updateStateWithSubmit
404
406
  />
405
407
  </InputWrapper>
406
408
  </>
@@ -460,28 +462,31 @@ const UserVerificationUI = (props: any) => {
460
462
  )}
461
463
 
462
464
  </Container>
463
- <ButtonsActions>
464
- <View style={{ width: '100%' }}>
465
- <OButton
466
- onClick={(verificationState.email || verificationState.phone)
467
- ? () => setVerificationState({ email: false, phone: false })
468
- : () => handleSendOtp(isPhoneVerifyRequired && !isEmailVerifyRequired ? 'phone' : '')
469
- }
470
- text={(verificationState.email || verificationState.phone) ? t('CANCEL', 'Cancel') : t('SEND_CODE', 'Send code')}
471
- bgColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
472
- borderColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
473
- textStyle={{ color: (verificationState.email || verificationState.phone) ? 'black' : 'white' }}
474
- imgRightSrc={null}
475
- isLoading={verifyEmailState?.loadingSendCode || verifyEmailState?.loadingCheckCode || verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
476
- style={(verificationState.email || verificationState.phone) ? style.btnStyle : { borderRadius: 7.6 }}
477
- />
478
- </View>
479
- </ButtonsActions>
465
+ {!!phoneState?.cellphone && (
466
+ <ButtonsActions>
467
+ <View style={{ width: '100%' }}>
468
+ <OButton
469
+ onClick={(verificationState.email || verificationState.phone)
470
+ ? () => setVerificationState({ email: false, phone: false })
471
+ : () => handleSendOtp(isPhoneVerifyRequired && !isEmailVerifyRequired ? 'phone' : '')
472
+ }
473
+ text={(verificationState.email || verificationState.phone) ? t('CANCEL', 'Cancel') : t('SEND_CODE', 'Send code')}
474
+ bgColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
475
+ borderColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
476
+ textStyle={{ color: (verificationState.email || verificationState.phone) ? 'black' : 'white' }}
477
+ imgRightSrc={null}
478
+ isLoading={verifyEmailState?.loadingSendCode || verifyEmailState?.loadingCheckCode || verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
479
+ style={(verificationState.email || verificationState.phone) ? style.btnStyle : { borderRadius: 7.6 }}
480
+ />
481
+ </View>
482
+ </ButtonsActions>
483
+ )}
480
484
  <View style={{ paddingHorizontal: 20, paddingBottom: 80 }}>
481
485
  <UserDetails
482
486
  user={user}
483
487
  isEdit
484
488
  isVerifiedPhone
489
+ dontToggleEditMode
485
490
  />
486
491
  </View>
487
492
  </ScrollView>
@@ -54,7 +54,7 @@ export const WalletTransactionItem = (props: any) => {
54
54
  <OText>{item?.description}</OText>
55
55
  </DescriptionBlock>
56
56
  )}
57
- {!!item?.code && (
57
+ {/* {!!item?.code && (
58
58
  <DescriptionBlock>
59
59
  <OText weight={'bold'}>
60
60
  {t('CODE', 'Code')}
@@ -63,7 +63,7 @@ export const WalletTransactionItem = (props: any) => {
63
63
  </OText>
64
64
  </OText>
65
65
  </DescriptionBlock>
66
- )}
66
+ )} */}
67
67
  </Container>
68
68
  )
69
69
  }
@@ -63,12 +63,12 @@ export const WalletTransactions = (props: any) => {
63
63
  (transactionsList?.error ||
64
64
  !transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.length) &&
65
65
  (
66
- <NotFoundSource
67
- content={transactionsList?.error
66
+ <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>
67
+ {transactionsList?.error
68
68
  ? t('ERROR_NOT_FOUND_TRANSACTIONS', 'Sorry, an error has occurred')
69
69
  : t('NOT_FOUND_TRANSACTIONS', 'No transactions to show at this time.')
70
70
  }
71
- />
71
+ </OText>
72
72
  )}
73
73
  </View>
74
74
  </Container>