ordering-ui-react-native 0.16.93 → 0.16.94-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +1 -1
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/OrderCreating/index.tsx +1 -21
  9. package/src/components/OrdersOption/index.tsx +54 -56
  10. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  11. package/src/components/SingleProductReview/index.tsx +7 -4
  12. package/src/components/VerifyPhone/styles.tsx +1 -2
  13. package/src/components/shared/OToast.tsx +4 -4
  14. package/src/utils/index.tsx +2 -1
  15. package/themes/business/index.tsx +2 -0
  16. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  17. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  18. package/themes/business/src/components/BusinessController/index.tsx +2 -3
  19. package/themes/business/src/components/Chat/index.tsx +146 -135
  20. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  21. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  22. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  23. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  24. package/themes/business/src/components/LoginForm/index.tsx +239 -80
  25. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  26. package/themes/business/src/components/MapView/index.tsx +18 -7
  27. package/themes/business/src/components/NewOrderNotification/index.tsx +33 -43
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  34. package/themes/business/src/components/OrdersOption/index.tsx +33 -75
  35. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +1 -1
  36. package/themes/business/src/components/PreviousMessages/index.tsx +16 -18
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  38. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  39. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +42 -25
  43. package/themes/business/src/components/StoresList/index.tsx +2 -2
  44. package/themes/business/src/components/shared/OLink.tsx +33 -13
  45. package/themes/business/src/components/shared/OModal.tsx +16 -9
  46. package/themes/business/src/components/shared/OText.tsx +8 -2
  47. package/themes/business/src/types/index.tsx +33 -2
  48. package/themes/business/src/utils/index.tsx +53 -0
  49. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  51. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  55. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  56. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  57. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  58. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  59. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  60. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  61. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  62. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  64. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  65. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  66. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  67. package/themes/kiosk/src/types/index.d.ts +13 -0
  68. package/themes/kiosk/src/utils/index.tsx +15 -0
  69. package/themes/original/index.tsx +8 -0
  70. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  71. package/themes/original/src/components/AddressForm/index.tsx +152 -116
  72. package/themes/original/src/components/AddressList/index.tsx +26 -21
  73. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  74. package/themes/original/src/components/AnalyticsSegment/index.tsx +164 -8
  75. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  77. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  78. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  79. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  80. package/themes/original/src/components/BusinessFeaturedController/index.tsx +4 -2
  81. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  82. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  83. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -5
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  86. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  87. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -490
  89. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  91. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +97 -77
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  94. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  95. package/themes/original/src/components/Cart/index.tsx +93 -43
  96. package/themes/original/src/components/CartContent/index.tsx +77 -15
  97. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  98. package/themes/original/src/components/Checkout/index.tsx +294 -175
  99. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  100. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  101. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  102. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  103. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  104. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  105. package/themes/original/src/components/Favorite/index.tsx +7 -4
  106. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  107. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  108. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  109. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  110. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  111. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  112. package/themes/original/src/components/Help/index.tsx +8 -8
  113. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  114. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  115. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  116. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  117. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  118. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  119. package/themes/original/src/components/Home/index.tsx +13 -4
  120. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  121. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  123. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  124. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  125. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  126. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  127. package/themes/original/src/components/Messages/index.tsx +32 -10
  128. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  129. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  131. package/themes/original/src/components/MultiCheckout/index.tsx +210 -79
  132. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  133. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  134. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  135. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  136. package/themes/original/src/components/NavBar/index.tsx +6 -11
  137. package/themes/original/src/components/NotFoundSource/index.tsx +1 -1
  138. package/themes/original/src/components/Notifications/index.tsx +144 -0
  139. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  140. package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +110 -221
  142. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  143. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  144. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  145. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  146. package/themes/original/src/components/OrderSummary/index.tsx +52 -17
  147. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  150. package/themes/original/src/components/OrdersOption/index.tsx +76 -83
  151. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  152. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  153. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  154. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  155. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  156. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  157. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +247 -269
  160. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  163. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  164. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  167. package/themes/original/src/components/Promotions/index.tsx +234 -220
  168. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  169. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  170. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  171. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  172. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  173. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  174. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  175. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  176. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  177. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  178. package/themes/original/src/components/Sessions/index.tsx +11 -8
  179. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  180. package/themes/original/src/components/SignupForm/index.tsx +79 -66
  181. package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
  182. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  183. package/themes/original/src/components/SingleProductCard/index.tsx +111 -49
  184. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
  185. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  186. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  187. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  188. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  189. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  190. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  191. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  192. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  193. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  194. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  195. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  196. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  197. package/themes/original/src/components/Wallets/index.tsx +20 -19
  198. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  199. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  200. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  201. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  202. package/themes/original/src/components/shared/OButton.tsx +6 -2
  203. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  204. package/themes/original/src/components/shared/OInput.tsx +10 -1
  205. package/themes/original/src/components/shared/OModal.tsx +3 -3
  206. package/themes/original/src/layouts/Container.tsx +13 -9
  207. package/themes/original/src/types/index.tsx +45 -7
  208. package/themes/original/src/utils/index.tsx +359 -58
  209. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,16 +1,17 @@
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 } from '../shared';
11
+ import Alert from '../../providers/AlertProvider'
10
12
 
11
13
  import { PhoneInputNumber } from '../PhoneInputNumber';
12
14
  import { sortInputFields } from '../../utils';
13
- import CheckBox from '@react-native-community/checkbox';
14
15
 
15
16
  export const UserFormDetailsUI = (props: any) => {
16
17
  const {
@@ -18,7 +19,6 @@ export const UserFormDetailsUI = (props: any) => {
18
19
  formState,
19
20
  showField,
20
21
  requiredFields,
21
- onClose,
22
22
  setIsSubmit,
23
23
  cleanFormState,
24
24
  onCloseProfile,
@@ -29,12 +29,13 @@ export const UserFormDetailsUI = (props: any) => {
29
29
  phoneUpdate,
30
30
  hideUpdateButton,
31
31
  setWillVerifyOtpState,
32
- handleChangePromotions,
32
+ handlePlaceOrderAsGuest,
33
+ isCheckout,
34
+ setIsOpen
33
35
  } = props;
34
36
 
35
37
  const theme = useTheme();
36
38
 
37
-
38
39
  const styles = StyleSheet.create({
39
40
  btnOutline: {
40
41
  backgroundColor: '#FFF',
@@ -64,10 +65,6 @@ export const UserFormDetailsUI = (props: any) => {
64
65
  paddingStart: 0,
65
66
  paddingBottom: 0,
66
67
  marginBottom: -0,
67
- },
68
- checkBoxStyle: {
69
- width: 25,
70
- height: 25,
71
68
  }
72
69
  });
73
70
 
@@ -76,10 +73,11 @@ export const UserFormDetailsUI = (props: any) => {
76
73
  const [, { showToast }] = useToast();
77
74
  const { handleSubmit, control, errors, setValue } = useForm();
78
75
 
79
- const [{ user }] = useSession();
76
+ const [{ user }, { login }] = useSession();
80
77
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
81
78
  const [isValid, setIsValid] = useState(false)
82
- const [isChanged, setIsChanged] = useState(false)
79
+ const [isChanged, setIsChanged] = useState(false)
80
+ const [isModalOpen, setIsModalOpen] = useState(false)
83
81
  const [phoneInputData, setPhoneInputData] = useState({
84
82
  error: '',
85
83
  phone: {
@@ -87,9 +85,18 @@ export const UserFormDetailsUI = (props: any) => {
87
85
  cellphone: null,
88
86
  },
89
87
  });
88
+ const [alertState, setAlertState] = useState({ open: false, content: '' })
90
89
 
91
90
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
92
91
 
92
+ const handleSuccessSignup = (user: any) => {
93
+ login({
94
+ user,
95
+ token: user?.session?.access_token
96
+ })
97
+ handlePlaceOrderAsGuest && handlePlaceOrderAsGuest()
98
+ }
99
+
93
100
  const getInputRules = (field: any) => {
94
101
  const rules: any = {
95
102
  required: isRequiredField(field.code)
@@ -214,6 +221,10 @@ export const UserFormDetailsUI = (props: any) => {
214
221
  if (!formState?.loading && formState?.result?.error) {
215
222
  formState.result?.result &&
216
223
  showToast(ToastType.Error, formState.result?.result[0]);
224
+ if (isCheckout) {
225
+ setIsOpen && setIsOpen(false)
226
+ cleanFormState && cleanFormState({ changes: {} })
227
+ }
217
228
  }
218
229
  }, [formState?.loading]);
219
230
 
@@ -243,10 +254,10 @@ export const UserFormDetailsUI = (props: any) => {
243
254
 
244
255
  useEffect(() => {
245
256
  if (!requiredFields || formState?.changes?.length === 0) return
246
- const _isValid = requiredFields.every((key: any) => formState?.changes[key])
247
- setIsValid(_isValid)
248
- }, [formState?.changes, requiredFields])
249
-
257
+ const _isValid = requiredFields.every((key: any) => formState?.changes[key])
258
+ setIsValid(_isValid)
259
+ }, [formState?.changes, requiredFields])
260
+
250
261
  return (
251
262
  <>
252
263
  <UDForm>
@@ -333,7 +344,7 @@ export const UserFormDetailsUI = (props: any) => {
333
344
  ),
334
345
  )}
335
346
 
336
- {!!showInputPhoneNumber &&((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
347
+ {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
337
348
  <WrapperPhone>
338
349
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
339
350
  <PhoneInputNumber
@@ -395,39 +406,6 @@ export const UserFormDetailsUI = (props: any) => {
395
406
  defaultValue=''
396
407
  />
397
408
  )}
398
- {!requiredFields && (
399
- <Controller
400
- control={control}
401
- render={({ onChange, value }: any) => (
402
- <TouchableOpacity
403
- style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
404
- onPress={() => {
405
- onChange(!value)
406
- handleChangePromotions(!value)
407
- }}
408
- >
409
- <CheckBox
410
- value={value}
411
- boxType={'square'}
412
- tintColors={{
413
- true: theme.colors.primary,
414
- false: theme.colors.disabled
415
- }}
416
- tintColor={theme.colors.disabled}
417
- onCheckColor={theme.colors.primary}
418
- onTintColor={theme.colors.primary}
419
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
420
- />
421
- <OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
422
- </TouchableOpacity>
423
- )}
424
- name='promotions'
425
- defaultValue={formState?.result?.result
426
- ? !!formState?.result?.result?.settings?.notification?.newsletter
427
- : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
428
- />
429
- )}
430
-
431
409
  </UDWrapper>
432
410
  )}
433
411
  {validationFields?.loading && (
@@ -464,18 +442,39 @@ export const UserFormDetailsUI = (props: any) => {
464
442
  text={
465
443
  formState.loading
466
444
  ? t('UPDATING', 'Updating...')
467
- : t('CONTINUE', 'Continue')
445
+ : ((isCheckout && !!user?.guest_id)
446
+ ? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
447
+ : t('CONTINUE', 'Continue'))
468
448
  }
469
449
  bgColor={theme.colors.white}
470
450
  textStyle={{ color: theme.colors.primary, fontSize: 14 }}
471
451
  borderColor={theme.colors.primary}
472
- isDisabled={formState.loading || !isValid}
452
+ isDisabled={!user?.guest_id && (formState.loading || !isValid)}
473
453
  imgRightSrc={null}
474
454
  style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
475
- onClick={handleSubmit(onSubmit)}
455
+ onClick={!user?.guest_id ? handleSubmit(onSubmit) : () => setIsModalOpen(true)}
476
456
  />
477
457
  )}
458
+ {isCheckout && !!user?.guest_id && (
459
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={() => handlePlaceOrderAsGuest()}>
460
+ <OText color={theme.colors.primary} style={{ textAlign: 'center' }}>{t('PLACE_ORDER_AS_GUEST', 'Place order as guest')}</OText>
461
+ </TouchableOpacity>
462
+ )}
463
+ <OModal
464
+ open={isModalOpen}
465
+ onClose={() => setIsModalOpen(false)}
466
+ >
467
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
468
+ <SignupForm
469
+ handleSuccessSignup={handleSuccessSignup}
470
+ isGuest
471
+ signupButtonText={t('SIGNUP', 'Signup')}
472
+ useSignupByEmail
473
+ useChekoutFileds
474
+ />
475
+ </ScrollView>
476
+ </OModal>
477
+
478
478
  </>
479
479
  );
480
480
  };
481
-
@@ -17,7 +17,7 @@ import { LanguageSelector } from '../LanguageSelector'
17
17
  import MessageCircle from 'react-native-vector-icons/AntDesign'
18
18
  import Ionicons from 'react-native-vector-icons/Ionicons'
19
19
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
20
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
20
+ import FontAwesome from 'react-native-vector-icons/FontAwesome'
21
21
  import FastImage from 'react-native-fast-image'
22
22
  import { OAlert } from '../../../../../src/components/shared'
23
23
 
@@ -29,21 +29,27 @@ import {
29
29
  CenterView,
30
30
  Actions,
31
31
  ListWrap,
32
- ListItem
32
+ ListItem,
33
+ NotificationsWrapper,
34
+ NotificationBadge
33
35
  } from './styles';
34
36
  import { useWindowDimensions } from 'react-native';
35
37
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
38
+ import styled from 'styled-components';
39
+ import ToggleSwitch from 'toggle-switch-react-native';
36
40
 
37
41
  const ProfileListUI = (props: ProfileParams) => {
38
42
  const {
39
43
  navigation,
40
- formState,
44
+ notificationsGroup,
41
45
  handleRemoveAccount,
42
- removeAccountState
46
+ removeAccountState,
47
+ handleChangePromotions,
43
48
  } = props;
44
49
 
45
50
  const theme = useTheme();
46
51
 
52
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
47
53
 
48
54
  const langPickerStyle = StyleSheet.create({
49
55
  inputAndroid: {
@@ -85,8 +91,7 @@ const ProfileListUI = (props: ProfileParams) => {
85
91
  marginEnd: 14
86
92
  },
87
93
  pagePadding: {
88
- paddingLeft: 40,
89
- paddingRight: 40
94
+ paddingHorizontal: isChewLayout ? 20 : 40
90
95
  },
91
96
  messageIconStyle: {
92
97
  fontSize: 18,
@@ -108,22 +113,19 @@ const ProfileListUI = (props: ProfileParams) => {
108
113
  const { top, bottom } = useSafeAreaInsets();
109
114
 
110
115
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
111
-
112
- const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
116
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
113
117
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
114
118
  const onRedirect = (route: string, params?: any) => {
115
119
  navigation.navigate(route, params)
116
120
  }
117
121
 
118
122
  useEffect(() => {
119
- if (formState.result.result && !formState.loading) {
120
- if (formState.result?.error) {
121
- showToast(ToastType.Error, formState.result.result);
122
- } else {
123
+ if (notificationsGroup.result.result && !notificationsGroup.loading) {
124
+ if (!notificationsGroup.result?.error) {
123
125
  showToast(ToastType.Success, t('UPDATE_SUCCESSFULLY', 'Update successfully'));
124
126
  }
125
127
  }
126
- }, [formState.result])
128
+ }, [notificationsGroup.result])
127
129
 
128
130
  useEffect(() => {
129
131
  if (Object.keys(errors).length > 0) {
@@ -139,21 +141,20 @@ const ProfileListUI = (props: ProfileParams) => {
139
141
  }, [errors]);
140
142
 
141
143
  const detailProps = {
142
-
143
144
  goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
144
145
  onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
145
146
  }
146
147
 
147
148
  const onRemoveAccount = () => {
148
149
  setConfirm({
149
- open: true,
150
- content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
151
- title: t('ACCOUNT_ALERT', 'Account alert'),
152
- handleOnAccept: () => {
153
- setConfirm({ ...confirm, open: false })
154
- handleRemoveAccount && handleRemoveAccount(user?.id)
155
- }
156
- })
150
+ open: true,
151
+ content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
152
+ title: t('ACCOUNT_ALERT', 'Account alert'),
153
+ handleOnAccept: () => {
154
+ setConfirm({ ...confirm, open: false })
155
+ handleRemoveAccount && handleRemoveAccount(user?.id)
156
+ }
157
+ })
157
158
  }
158
159
 
159
160
  useEffect(() => {
@@ -163,10 +164,7 @@ const ProfileListUI = (props: ProfileParams) => {
163
164
  }, [removeAccountState])
164
165
 
165
166
  return (
166
- <View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
167
- {/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
168
- {t('PROFILE', 'Profile')}
169
- </OText> */}
167
+ <View style={{ flex: 1, height: height - top - bottom, paddingTop: 20 }}>
170
168
  <CenterView style={styles.pagePadding}>
171
169
  {user?.photo && (
172
170
  <View style={styles.photo}>
@@ -183,12 +181,12 @@ const ProfileListUI = (props: ProfileParams) => {
183
181
  <View style={{ flexBasis: '70%' }}>
184
182
  <OText size={20} lineHeight={30} weight={Platform.OS === 'ios' ? '500' : 'bold'} color={theme.colors.textNormal}>{user?.name} {user?.lastname}</OText>
185
183
  <TouchableOpacity onPress={() => navigation.navigate('ProfileForm', { ...detailProps })}>
186
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>{t('VIEW_ACCOUNT', 'View account')}</OText>
184
+ <OText size={12} lineHeight={18} color={theme.colors.primary} style={{ textDecorationLine: 'underline' }}>{t('VIEW_ACCOUNT', 'View account')}</OText>
187
185
  </TouchableOpacity>
188
186
  </View>
189
187
  </CenterView>
190
188
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32 }} />
191
- <Spinner visible={formState?.loading} />
189
+ <Spinner visible={notificationsGroup?.loading} />
192
190
  <ListWrap style={{ ...styles.pagePadding }}>
193
191
  <Actions>
194
192
  <ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
@@ -199,6 +197,10 @@ const ProfileListUI = (props: ProfileParams) => {
199
197
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
200
198
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MESSAGES', 'Messages')}</OText>
201
199
  </ListItem>
200
+ <ListItem onPress={() => onRedirect('MyOrders', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
201
+ <FontAwesome name='list-alt' style={styles.messageIconStyle} color={theme.colors.textNormal} />
202
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_ORDERS', 'My Orders')}</OText>
203
+ </ListItem>
202
204
  {isWalletEnabled && (
203
205
  <ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
204
206
  <Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
@@ -215,6 +217,27 @@ const ProfileListUI = (props: ProfileParams) => {
215
217
  <OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
216
218
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
217
219
  </ListItem>
220
+ <ListItem onPress={() => navigation.navigate('Notifications', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
221
+ <NotificationBadge style={{ borderRadius: 100 / 2 }} />
222
+ <Ionicons name='notifications-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
223
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('NOTIFICATIONS', 'Notifications')}
224
+ </OText>
225
+ <NotificationsWrapper>
226
+ <ToggleSwitch
227
+ isOn={user && (!!user?.settings?.notification?.newsletter ||
228
+ !!user?.settings?.sms?.newsletter ||
229
+ !!user?.settings?.email?.newsletter)}
230
+ onColor={theme.colors.primary}
231
+ size="small"
232
+ disabled={notificationsGroup?.loading}
233
+ offColor={theme.colors.disabled}
234
+ animationSpeed={400}
235
+ onToggle={() => handleChangePromotions(!(user && (!!user?.settings?.notification?.newsletter ||
236
+ !!user?.settings?.sms?.newsletter ||
237
+ !!user?.settings?.email?.newsletter)))}
238
+ />
239
+ </NotificationsWrapper>
240
+ </ListItem>
218
241
  <ListItem onPress={() => navigation.navigate('Sessions')} activeOpacity={0.7}>
219
242
  <Ionicons name='md-list-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
220
243
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SESSIONS', 'Sessions')}</OText>
@@ -237,13 +260,13 @@ const ProfileListUI = (props: ProfileParams) => {
237
260
  </Actions>
238
261
  </ListWrap>
239
262
  <OAlert
240
- open={confirm.open}
241
- title={confirm.title}
242
- content={confirm.content}
243
- onAccept={confirm.handleOnAccept}
244
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
245
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
246
- />
263
+ open={confirm.open}
264
+ title={confirm.title}
265
+ content={confirm.content}
266
+ onAccept={confirm.handleOnAccept}
267
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
268
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
269
+ />
247
270
  </View>
248
271
  );
249
272
  };
@@ -1,5 +1,8 @@
1
+ import { useTheme } from 'styled-components';
1
2
  import styled from 'styled-components/native'
2
3
 
4
+ const theme = useTheme();
5
+
3
6
  export const CenterView = styled.View`
4
7
  flex-direction: row;
5
8
  justify-content: flex-start;
@@ -40,3 +43,17 @@ export const ListItem = styled.TouchableOpacity`
40
43
  margin-bottom: 24px;
41
44
  `
42
45
 
46
+ export const NotificationsWrapper = styled.View`
47
+ position: absolute;
48
+ right: 0;
49
+ `
50
+
51
+ export const NotificationBadge = styled.View`
52
+ width: 10px;
53
+ height: 10px;
54
+ z-index: 2000;
55
+ background-color: ${theme.colors.red};
56
+ position: absolute;
57
+ left: -2px;
58
+ top: 3px;
59
+ `;
@@ -16,9 +16,8 @@ import { ProfileParams } from '../../types';
16
16
  import { UserFormDetailsUI } from '../UserFormDetails';
17
17
 
18
18
  import { OIcon, OIconButton, OModal } from '../shared';
19
- import { CenterView } from './styles';
19
+ import { CenterView, Container } from './styles';
20
20
  import NavBar from '../NavBar';
21
- import { Container } from '../../layouts/Container';
22
21
  import { VerifyPhone } from '../VerifyPhone'
23
22
  import Ionicons from 'react-native-vector-icons/Ionicons'
24
23
  import FastImage from 'react-native-fast-image'
@@ -51,11 +50,6 @@ const ProfileUI = (props: ProfileParams) => {
51
50
  shadowOpacity: 0.2,
52
51
  backgroundColor: theme.colors.white,
53
52
  },
54
- pagePadding: {
55
- paddingLeft: 40,
56
- paddingRight: 40,
57
- justifyContent: 'center',
58
- },
59
53
  navBarStyle: {
60
54
  paddingLeft: 40,
61
55
  paddingRight: 40,
@@ -284,17 +278,18 @@ const ProfileUI = (props: ProfileParams) => {
284
278
 
285
279
  return (
286
280
  <>
287
- <NavBar
288
- title={t('ACCOUNT', 'Account')}
289
- titleAlign={'center'}
290
- onActionLeft={() => navigation.goBack()}
291
- showCall={false}
292
- style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 30 }}
293
- />
294
- <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
295
- <Container noPadding>
296
-
297
- <CenterView style={styles.pagePadding}>
281
+ <Container
282
+ pdng={Platform.OS === 'ios' ? '20px' : '10px'}
283
+ >
284
+ <NavBar
285
+ title={t('ACCOUNT', 'Account')}
286
+ titleAlign={'center'}
287
+ onActionLeft={() => navigation.goBack()}
288
+ showCall={false}
289
+ btnStyle={{ paddingLeft: 0 }}
290
+ />
291
+ <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
292
+ <CenterView>
298
293
  <View style={styles.photo}>
299
294
  {user?.photo ? (
300
295
  <FastImage
@@ -317,17 +312,15 @@ const ProfileUI = (props: ProfileParams) => {
317
312
  onClick={() => handleImagePicker()}
318
313
  />
319
314
  </CenterView>
320
- <View style={{ height: 8, marginLeft: -40, marginRight: -40, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32, zIndex: 10 }} />
315
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32, zIndex: 10 }} />
321
316
  <Spinner visible={formState?.loading || verifyPhoneState?.loading} />
322
- <View style={styles.pagePadding}>
323
- <UserFormDetailsUI
324
- {...props}
325
- isEdit
326
- setWillVerifyOtpState={setWillVerifyOtpState}
327
- />
328
- </View>
329
- </Container>
330
- </KeyboardAvoidingView>
317
+ <UserFormDetailsUI
318
+ {...props}
319
+ isEdit
320
+ setWillVerifyOtpState={setWillVerifyOtpState}
321
+ />
322
+ </KeyboardAvoidingView>
323
+ </Container>
331
324
  <OModal
332
325
  open={isModalVisible}
333
326
  onClose={() => setIsModalVisible(false)}
@@ -9,6 +9,13 @@ export const UserData = styled.View`
9
9
  text-align: center;
10
10
  `
11
11
 
12
+ export const Container = styled.ScrollView`
13
+ position: relative;
14
+ flex: 1;
15
+ padding-top: ${(props: any) => props.pdng};
16
+ margin-bottom: 40px;
17
+ `
18
+
12
19
  export const Names = styled.View`
13
20
  flex-direction: row;
14
21
  `
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Pressable, StyleSheet, View, ScrollView } from 'react-native';
2
+ import { Pressable, StyleSheet, View, ScrollView, TouchableOpacity } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import FastImage from 'react-native-fast-image'
@@ -24,7 +24,6 @@ import {
24
24
  WalletTransactionsWrapper
25
25
  } from './styles'
26
26
 
27
- import NavBar from '../NavBar'
28
27
  import { OButton, OIcon, OText, OModal } from '../shared';
29
28
  import { NotFoundSource } from '../NotFoundSource';
30
29
  import { WalletTransactions } from '../WalletTransactions'
@@ -63,7 +62,8 @@ const WalletsUI = (props: any) => {
63
62
 
64
63
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
65
64
  const [openHistory, setOpenHistory] = useState(false)
66
- const isChewLayout = theme?.wallets_view?.components?.layout?.type === 'chew'
65
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
66
+ const hideWalletsTheme = theme?.bar_menu?.components?.wallets?.hidden
67
67
 
68
68
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
69
69
 
@@ -78,7 +78,7 @@ const WalletsUI = (props: any) => {
78
78
  isActive: isWalletCashEnabled
79
79
  },
80
80
  credit_point: {
81
- name: t('CREDITS_POINTS_WALLET', 'Credit Points Wallet'),
81
+ name: t('POINTS_WALLET', 'Points Wallet'),
82
82
  value: 1,
83
83
  isActive: isWalletPointsEnabled
84
84
  }
@@ -112,15 +112,7 @@ const WalletsUI = (props: any) => {
112
112
  <>
113
113
  <Container>
114
114
  <Header>
115
- <NavBar
116
- title={isChewLayout ? '' : t('WALLETS', 'Wallets')}
117
- titleAlign={'center'}
118
- onActionLeft={goToBack}
119
- showCall={false}
120
- paddingTop={10}
121
- btnStyle={{ paddingLeft: 0 }}
122
- style={{ flex: 1 }}
123
- />
115
+ <OText size={24} style={{ marginTop: 30 }}>{t('WALLETS', 'Wallets')}</OText>
124
116
  {isChewLayout && (
125
117
  <OButton
126
118
  text={t('WALLET_HISTORY', 'Wallet history')}
@@ -145,16 +137,25 @@ const WalletsUI = (props: any) => {
145
137
  showsHorizontalScrollIndicator={false}
146
138
  >
147
139
  {walletList.wallets?.map((wallet: any) => walletName[wallet.type]?.isActive && (
148
- <Pressable
140
+ <TouchableOpacity
149
141
  key={wallet.id}
150
142
  onPress={() => handleChangeTab(wallet)}
151
143
  >
152
- <OTab isSelected={tabSelected === wallet.type}>
153
- <OText size={18}>
144
+ <OTab
145
+ isSelected={tabSelected === wallet.type}
146
+ style={{
147
+ borderBottomWidth: 1,
148
+ borderBottomColor:
149
+ tabSelected === wallet.type
150
+ ? theme.colors.textNormal
151
+ : theme.colors.border
152
+ }}
153
+ >
154
+ <OText>
154
155
  {walletName[wallet.type]?.name}
155
156
  </OText>
156
157
  </OTab>
157
- </Pressable>
158
+ </TouchableOpacity>
158
159
  ))}
159
160
  </OTabs>
160
161
 
@@ -165,7 +166,7 @@ const WalletsUI = (props: any) => {
165
166
  <OText size={20}>
166
167
  {`${t('LOYALTY_LEVEL_TITLE', 'Your level is')}:`}
167
168
  </OText>
168
- {loyaltyLevel.image ? (
169
+ {/* {loyaltyLevel.image ? (
169
170
  <FastImage
170
171
  style={styles.logoStyle}
171
172
  source={{
@@ -180,7 +181,7 @@ const WalletsUI = (props: any) => {
180
181
  source={theme.images.dummies.loyaltyLevel}
181
182
  resizeMode='contain'
182
183
  />
183
- )}
184
+ )} */}
184
185
  <OText
185
186
  size={22}
186
187
  weight='bold'
@@ -34,10 +34,12 @@ export const OTabs = styled.View`
34
34
  flex-direction: row;
35
35
  width: 100%;
36
36
  flex-wrap: wrap;
37
+ padding-vertical: 5px;
37
38
  `;
38
39
 
39
40
  export const OTab = styled.View`
40
41
  padding-horizontal: 10px;
42
+ padding-vertical: 10px;
41
43
  `;
42
44
 
43
45
  export const LoyaltyContent = styled.View`
@@ -0,0 +1,47 @@
1
+ import React, { useState } from 'react'
2
+ import { StyleSheet, ViewStyle } from 'react-native'
3
+ import styled from 'styled-components/native'
4
+
5
+ const CardContainerTouchable = styled.TouchableOpacity``
6
+
7
+ interface Props {
8
+ children: React.ReactChildren | Element,
9
+ style?: Array<ViewStyle> | any,
10
+ onClick: any
11
+ }
12
+
13
+ export const CardAnimation = (props: Props) => {
14
+ const {
15
+ children,
16
+ onClick,
17
+ style
18
+ } = props
19
+ const [isPressed, setIsPressed] = useState(false)
20
+ const styles = StyleSheet.create({
21
+ cardAnimation: {
22
+ elevation: isPressed ? 2 : 0,
23
+ shadowColor: '#888',
24
+ shadowOffset: { width: 0, height: 0 },
25
+ shadowRadius: 0,
26
+ shadowOpacity: isPressed ? 0.8 : 0,
27
+ borderRadius: 12,
28
+ }
29
+ })
30
+
31
+ const styleProvided = style || []
32
+ return (
33
+ <CardContainerTouchable
34
+ onPress={onClick}
35
+ activeOpacity={0.8}
36
+ delayPressIn={20}
37
+ onPressIn={() => setIsPressed(true)}
38
+ onPressOut={() => setIsPressed(false)}
39
+ style={[
40
+ ...styleProvided,
41
+ styles.cardAnimation
42
+ ]}
43
+ >
44
+ {children}
45
+ </CardContainerTouchable>
46
+ )
47
+ }