ordering-ui-react-native 0.15.69 → 0.15.71-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 (220) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +23 -2
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +6 -2
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/PaymentOptions/index.tsx +67 -50
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +145 -61
  24. package/src/components/SingleProductCard/index.tsx +16 -4
  25. package/src/components/SingleProductReview/index.tsx +1 -1
  26. package/src/components/StripeMethodForm/index.tsx +22 -24
  27. package/src/components/UpsellingProducts/index.tsx +1 -1
  28. package/src/components/UserProfileForm/index.tsx +63 -6
  29. package/src/components/UserProfileForm/styles.tsx +8 -0
  30. package/src/components/VerifyPhone/styles.tsx +1 -2
  31. package/src/components/shared/OBottomPopup.tsx +6 -2
  32. package/src/components/shared/OModal.tsx +1 -1
  33. package/src/hooks/useCountdownTimer.tsx +26 -0
  34. package/src/index.tsx +2 -0
  35. package/src/navigators/CheckoutNavigator.tsx +6 -0
  36. package/src/navigators/HomeNavigator.tsx +12 -0
  37. package/src/pages/BusinessesListing.tsx +7 -6
  38. package/src/pages/MultiCheckout.tsx +31 -0
  39. package/src/pages/MultiOrdersDetails.tsx +27 -0
  40. package/src/pages/OrderDetails.tsx +1 -1
  41. package/src/pages/ReviewDriver.tsx +2 -2
  42. package/src/pages/ReviewOrder.tsx +2 -2
  43. package/src/pages/Sessions.tsx +22 -0
  44. package/src/theme.json +0 -1
  45. package/src/types/index.tsx +18 -11
  46. package/src/utils/index.tsx +68 -2
  47. package/themes/business/index.tsx +4 -0
  48. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  49. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  50. package/themes/business/src/components/Chat/index.tsx +51 -91
  51. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  52. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  53. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  54. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  55. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  56. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  57. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  58. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  61. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  62. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  63. package/themes/business/src/components/OrdersOption/index.tsx +16 -4
  64. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  65. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  66. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  67. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  68. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  69. package/themes/business/src/components/shared/OModal.tsx +41 -38
  70. package/themes/business/src/types/index.tsx +14 -7
  71. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  72. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  73. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  74. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  75. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  76. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  77. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  78. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  79. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  80. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  81. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  82. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  83. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  84. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  85. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  86. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  87. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  88. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  89. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  90. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  91. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  92. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  93. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  94. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  95. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  96. package/themes/kiosk/src/types/index.d.ts +1 -0
  97. package/themes/original/index.tsx +24 -0
  98. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  99. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  100. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  101. package/themes/original/src/components/AddressList/index.tsx +30 -18
  102. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  103. package/themes/original/src/components/BusinessBasicInformation/index.tsx +287 -150
  104. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  105. package/themes/original/src/components/BusinessController/index.tsx +201 -96
  106. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  107. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  108. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  109. package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
  110. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  111. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  112. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  113. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  114. package/themes/original/src/components/BusinessProductsList/index.tsx +70 -52
  115. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  116. package/themes/original/src/components/BusinessProductsListing/index.tsx +339 -153
  117. package/themes/original/src/components/BusinessProductsListing/styles.tsx +33 -0
  118. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  119. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  120. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  121. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  122. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  123. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +671 -0
  124. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  125. package/themes/original/src/components/BusinessesListing/index.tsx +103 -458
  126. package/themes/original/src/components/Cart/index.tsx +93 -43
  127. package/themes/original/src/components/Cart/styles.tsx +4 -0
  128. package/themes/original/src/components/Checkout/index.tsx +90 -39
  129. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  130. package/themes/original/src/components/Favorite/index.tsx +92 -0
  131. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  132. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  133. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  134. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  135. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  136. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  137. package/themes/original/src/components/Help/index.tsx +21 -4
  138. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  139. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  140. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  141. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  142. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  143. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  144. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  145. package/themes/original/src/components/Messages/index.tsx +1 -1
  146. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  147. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  149. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  150. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  151. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  152. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  153. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  154. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  155. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  156. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  157. package/themes/original/src/components/NavBar/index.tsx +4 -4
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +148 -63
  160. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderSummary/index.tsx +5 -5
  164. package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
  165. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  166. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  170. package/themes/original/src/components/OrdersOption/index.tsx +137 -38
  171. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  172. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  173. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  174. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  175. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  176. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +718 -679
  179. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  180. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  181. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  182. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  183. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  184. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  185. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  187. package/themes/original/src/components/Promotions/index.tsx +151 -133
  188. package/themes/original/src/components/Promotions/styles.tsx +2 -1
  189. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  190. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  191. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  192. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  193. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  194. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  195. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  196. package/themes/original/src/components/Sessions/index.tsx +160 -0
  197. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  198. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  199. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  200. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  201. package/themes/original/src/components/SingleProductCard/index.tsx +214 -90
  202. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  205. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  206. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  207. package/themes/original/src/components/UserFormDetails/index.tsx +102 -66
  208. package/themes/original/src/components/UserProfile/index.tsx +10 -1
  209. package/themes/original/src/components/UserProfileForm/index.tsx +32 -25
  210. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  211. package/themes/original/src/components/Wallets/index.tsx +25 -12
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  213. package/themes/original/src/components/shared/OButton.tsx +2 -0
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +4 -2
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +203 -35
  218. package/themes/original/src/utils/index.tsx +94 -1
  219. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  220. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -23,6 +23,8 @@ const UserDetailsUI = (props: any) => {
23
23
  isEdit,
24
24
  formState,
25
25
  cleanFormState,
26
+ requiredFields,
27
+ onClose,
26
28
  cartStatus,
27
29
  toggleIsEdit,
28
30
  validationFields,
@@ -30,12 +32,9 @@ const UserDetailsUI = (props: any) => {
30
32
  phoneUpdate,
31
33
  togglePhoneUpdate,
32
34
  isCheckout,
33
- checkPhoneCodeState,
34
35
  handleSendVerifyCode,
35
- handleCheckPhoneCode,
36
36
  verifyPhoneState,
37
- isVerifiedPhone,
38
- setCheckPhoneCodeState
37
+ setFormState
39
38
  } = props
40
39
 
41
40
  const theme = useTheme();
@@ -47,7 +46,9 @@ const UserDetailsUI = (props: any) => {
47
46
  const userData = props.userData || (!formState.result.error && formState.result?.result) || user
48
47
 
49
48
  const [isModalVisible, setIsModalVisible] = useState(false);
49
+ const [isSubmit, setIsSubmit] = useState(false)
50
50
  const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
51
+ const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
51
52
  const [phoneInputData, setPhoneInputData] = useState({
52
53
  error: '',
53
54
  phone: {
@@ -56,7 +57,6 @@ const UserDetailsUI = (props: any) => {
56
57
  },
57
58
  });
58
59
 
59
-
60
60
  useEffect(() => {
61
61
  if (isUserDetailsEdit) {
62
62
  !isEdit && toggleIsEdit()
@@ -68,6 +68,12 @@ const UserDetailsUI = (props: any) => {
68
68
  cleanFormState({ changes: {} })
69
69
  }
70
70
 
71
+ useEffect(() => {
72
+ if (isSubmit && !isEdit && requiredFields) {
73
+ onClose && onClose()
74
+ }
75
+ }, [isSubmit, requiredFields, isEdit])
76
+
71
77
  useEffect(() => {
72
78
  if (user?.cellphone && !user?.country_phone_code) {
73
79
  togglePhoneUpdate(true)
@@ -94,6 +100,18 @@ const UserDetailsUI = (props: any) => {
94
100
  }
95
101
  }
96
102
 
103
+ const handleSendPhoneCode = (values: any) => {
104
+ setWillVerifyOtpState(false)
105
+ setIsModalVisible(false)
106
+ setFormState({
107
+ ...formState,
108
+ changes: {
109
+ ...formState?.changes,
110
+ verification_code: values?.code
111
+ }
112
+ })
113
+ }
114
+
97
115
  useEffect(() => {
98
116
  if (willVerifyOtpState) handleVerifyCodeClick()
99
117
  }, [willVerifyOtpState])
@@ -120,10 +138,6 @@ const UserDetailsUI = (props: any) => {
120
138
  }
121
139
  }, [verifyPhoneState])
122
140
 
123
- useEffect(() => {
124
- if (isVerifiedPhone) setIsModalVisible(false)
125
- }, [isVerifiedPhone])
126
-
127
141
  return (
128
142
  <>
129
143
  {(validationFields.loading || formState.loading) && (
@@ -138,10 +152,10 @@ const UserDetailsUI = (props: any) => {
138
152
  {!(validationFields.loading || formState.loading) && (
139
153
  <UDContainer>
140
154
  <UDHeader>
141
- <OText size={16} lineHeight={24} weight={'500'}>
155
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
142
156
  {t('CUSTOMER_DETAILS', 'Customer Details')}
143
157
  </OText>
144
- {cartStatus !== 2 && (
158
+ {cartStatus !== 2 && !requiredFields && (
145
159
  !isEdit ? (
146
160
  <EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>
147
161
  <OIcon
@@ -192,6 +206,7 @@ const UserDetailsUI = (props: any) => {
192
206
  togglePhoneUpdate={togglePhoneUpdate}
193
207
  isCheckout={isCheckout}
194
208
  setWillVerifyOtpState={setWillVerifyOtpState}
209
+ setIsSubmit={setIsSubmit}
195
210
  />
196
211
  )}
197
212
  </UDContainer>
@@ -202,13 +217,12 @@ const UserDetailsUI = (props: any) => {
202
217
  entireModal
203
218
  >
204
219
  <VerifyPhone
205
- phone={phoneInputData.phone}
206
- verifyPhoneState={verifyPhoneState}
207
- checkPhoneCodeState={checkPhoneCodeState}
208
- handleCheckPhoneCode={handleCheckPhoneCode}
209
- setCheckPhoneCodeState={setCheckPhoneCodeState}
210
- handleVerifyCodeClick={handleVerifyCodeClick}
211
- onClose={() => setIsModalVisible(false)}
220
+ phone={phoneInputData.phone}
221
+ verifyPhoneState={verifyPhoneState}
222
+ checkPhoneCodeState={checkPhoneCodeState}
223
+ handleCheckPhoneCode={handleSendPhoneCode}
224
+ handleVerifyCodeClick={handleVerifyCodeClick}
225
+ onClose={() => setIsModalVisible(false)}
212
226
  />
213
227
  </OModal>
214
228
  <Spinner visible={verifyPhoneState?.loading} />
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Platform, StyleSheet, View } from 'react-native';
2
+ import { Platform, StyleSheet, TouchableOpacity } 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';
@@ -17,6 +17,9 @@ export const UserFormDetailsUI = (props: any) => {
17
17
  isEdit,
18
18
  formState,
19
19
  showField,
20
+ requiredFields,
21
+ onClose,
22
+ setIsSubmit,
20
23
  cleanFormState,
21
24
  onCloseProfile,
22
25
  isRequiredField,
@@ -26,7 +29,6 @@ export const UserFormDetailsUI = (props: any) => {
26
29
  phoneUpdate,
27
30
  hideUpdateButton,
28
31
  setWillVerifyOtpState,
29
- isVerifiedPhone,
30
32
  handleChangePromotions,
31
33
  } = props;
32
34
 
@@ -76,6 +78,8 @@ export const UserFormDetailsUI = (props: any) => {
76
78
 
77
79
  const [{ user }] = useSession();
78
80
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
81
+ const [isValid, setIsValid] = useState(false)
82
+ const [isChanged, setIsChanged] = useState(false)
79
83
  const [phoneInputData, setPhoneInputData] = useState({
80
84
  error: '',
81
85
  phone: {
@@ -153,9 +157,6 @@ export const UserFormDetailsUI = (props: any) => {
153
157
  );
154
158
  return;
155
159
  }
156
- if (formState?.changes?.cellphone && !isVerifiedPhone) {
157
- showToast(ToastType.Error, t('VERIFY_ERROR_PHONE_NUMBER', 'The Phone Number field is not verified'))
158
- }
159
160
  let changes = null;
160
161
  if (user?.cellphone && !userPhoneNumber) {
161
162
  changes = {
@@ -163,12 +164,14 @@ export const UserFormDetailsUI = (props: any) => {
163
164
  cellphone: '',
164
165
  };
165
166
  }
167
+ setIsSubmit && setIsSubmit(true)
166
168
  handleButtonUpdateClick(changes);
167
169
  }
168
170
  };
169
171
 
170
172
  const handleChangePhoneNumber = (number: any) => {
171
173
  setPhoneInputData(number);
174
+ setIsChanged(true)
172
175
  let phoneNumber = {
173
176
  country_phone_code: {
174
177
  name: 'country_phone_code',
@@ -182,7 +185,7 @@ export const UserFormDetailsUI = (props: any) => {
182
185
  handleChangeInput(phoneNumber, true);
183
186
  };
184
187
 
185
- const changeCountry = (country : any) => {
188
+ const changeCountry = (country: any) => {
186
189
  let countryCode = {
187
190
  country_code: {
188
191
  name: 'country_code',
@@ -228,11 +231,22 @@ export const UserFormDetailsUI = (props: any) => {
228
231
  }, [user, isEdit]);
229
232
 
230
233
  useEffect(() => {
231
- if (!phoneInputData.error && phoneInputData?.phone?.country_phone_code && phoneInputData?.phone?.cellphone) {
232
- setWillVerifyOtpState(true)
234
+ if (!phoneInputData.error &&
235
+ phoneInputData?.phone?.country_phone_code &&
236
+ phoneInputData?.phone?.cellphone &&
237
+ configs?.verification_phone_required?.value === '1' &&
238
+ formState?.changes?.cellphone &&
239
+ isChanged) {
240
+ setWillVerifyOtpState?.(true)
233
241
  }
234
- }, [phoneInputData])
242
+ }, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
235
243
 
244
+ useEffect(() => {
245
+ 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
+
236
250
  return (
237
251
  <>
238
252
  <UDForm>
@@ -245,7 +259,7 @@ export const UserFormDetailsUI = (props: any) => {
245
259
  }).map(
246
260
  (field: any) =>
247
261
  showField &&
248
- showField(field.code) && (
262
+ showField(field.code) && ((requiredFields && requiredFields.includes(field.code)) || !requiredFields) && (
249
263
  <React.Fragment key={field.id}>
250
264
  <Controller
251
265
  key={field.id}
@@ -319,13 +333,13 @@ export const UserFormDetailsUI = (props: any) => {
319
333
  ),
320
334
  )}
321
335
 
322
- {!!showInputPhoneNumber && (
336
+ {!!showInputPhoneNumber &&((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
323
337
  <WrapperPhone>
324
338
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
325
339
  <PhoneInputNumber
326
340
  data={phoneInputData}
327
341
  handleData={(val: any) => handleChangePhoneNumber(val)}
328
- changeCountry={(val : any) => changeCountry(val)}
342
+ changeCountry={(val: any) => changeCountry(val)}
329
343
  defaultValue={phoneUpdate ? '' : user?.cellphone}
330
344
  defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
331
345
  boxStyle={styles.phoneSelect}
@@ -344,69 +358,76 @@ export const UserFormDetailsUI = (props: any) => {
344
358
  )}
345
359
  </WrapperPhone>
346
360
  )}
347
- <Controller
348
- control={control}
349
- render={() => (
350
- <>
351
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
352
- {t('PASSWORD', 'Password')}
353
- </OText>
354
- <OInput
355
- name='password'
356
- placeholder={t('FRONT_VISUALS_PASSWORD', 'Password')}
357
- inputStyle={styles.inputStyle}
358
- style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
359
- autoCapitalize='none'
360
- isDisabled={false}
361
- value={
362
- formState?.changes['password'] ??
363
- (user && user['password']) ??
364
- ''
365
- }
366
- onChange={(val: any) => {
367
- setValue('password', val.target.value)
368
- handleChangeInput(val)
369
- }}
370
- autoCorrect
371
- type='default'
372
- returnKeyType="done"
373
- autoCompleteType='off'
374
- isSecured
375
- />
376
- </>
377
- )}
378
- name='password'
379
- rules={getInputRules({ name: 'password', code: 'password' })}
380
- defaultValue=''
381
- />
382
- <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}>
361
+ {!requiredFields && (
362
+ <Controller
363
+ control={control}
364
+ render={() => (
365
+ <>
366
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
367
+ {t('PASSWORD', 'Password')}
368
+ </OText>
369
+ <OInput
370
+ name='password'
371
+ placeholder={t('FRONT_VISUALS_PASSWORD', 'Password')}
372
+ inputStyle={styles.inputStyle}
373
+ style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
374
+ autoCapitalize='none'
375
+ isDisabled={false}
376
+ value={
377
+ formState?.changes['password'] ??
378
+ (user && user['password']) ??
379
+ ''
380
+ }
381
+ onChange={(val: any) => {
382
+ setValue('password', val.target.value)
383
+ handleChangeInput(val)
384
+ }}
385
+ autoCorrect
386
+ type='default'
387
+ returnKeyType="done"
388
+ autoCompleteType='off'
389
+ isSecured
390
+ />
391
+ </>
392
+ )}
393
+ name='password'
394
+ rules={getInputRules({ name: 'password', code: 'password' })}
395
+ defaultValue=''
396
+ />
397
+ )}
398
+ {!requiredFields && (
383
399
  <Controller
384
400
  control={control}
385
401
  render={({ onChange, value }: any) => (
386
- <CheckBox
387
- value={value}
388
- onValueChange={newValue => {
389
- onChange(newValue)
390
- handleChangePromotions(newValue)
402
+ <TouchableOpacity
403
+ style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
404
+ onPress={() => {
405
+ onChange(!value)
406
+ handleChangePromotions(!value)
391
407
  }}
392
- boxType={'square'}
393
- tintColors={{
394
- true: theme.colors.primary,
395
- false: theme.colors.disabled
396
- }}
397
- tintColor={theme.colors.disabled}
398
- onCheckColor={theme.colors.primary}
399
- onTintColor={theme.colors.primary}
400
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
401
- />
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>
402
423
  )}
403
424
  name='promotions'
404
425
  defaultValue={formState?.result?.result
405
426
  ? !!formState?.result?.result?.settings?.notification?.newsletter
406
427
  : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
407
428
  />
408
- <OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
409
- </View>
429
+ )}
430
+
410
431
  </UDWrapper>
411
432
  )}
412
433
  {validationFields?.loading && (
@@ -438,7 +459,22 @@ export const UserFormDetailsUI = (props: any) => {
438
459
  )}
439
460
  </>
440
461
  )}
462
+ {requiredFields && (
463
+ <OButton
464
+ text={
465
+ formState.loading
466
+ ? t('UPDATING', 'Updating...')
467
+ : t('CONTINUE', 'Continue')
468
+ }
469
+ bgColor={theme.colors.white}
470
+ textStyle={{ color: theme.colors.primary, fontSize: 14 }}
471
+ borderColor={theme.colors.primary}
472
+ isDisabled={formState.loading || !isValid}
473
+ imgRightSrc={null}
474
+ style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
475
+ onClick={handleSubmit(onSubmit)}
476
+ />
477
+ )}
441
478
  </>
442
479
  );
443
480
  };
444
-
@@ -17,6 +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
21
  import FastImage from 'react-native-fast-image'
21
22
  import { OAlert } from '../../../../../src/components/shared'
22
23
 
@@ -108,7 +109,7 @@ const ProfileListUI = (props: ProfileParams) => {
108
109
 
109
110
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
110
111
 
111
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
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')
112
113
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
113
114
  const onRedirect = (route: string, params?: any) => {
114
115
  navigation.navigate(route, params)
@@ -214,6 +215,14 @@ const ProfileListUI = (props: ProfileParams) => {
214
215
  <OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
215
216
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
216
217
  </ListItem>
218
+ <ListItem onPress={() => navigation.navigate('Sessions')} activeOpacity={0.7}>
219
+ <Ionicons name='md-list-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
220
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SESSIONS', 'Sessions')}</OText>
221
+ </ListItem>
222
+ <ListItem onPress={() => navigation.navigate('Favorite')} activeOpacity={0.7}>
223
+ <Ionicons name='heart-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
224
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('FAVORITES', 'Favorites')}</OText>
225
+ </ListItem>
217
226
  </Actions>
218
227
 
219
228
  <Actions>
@@ -35,12 +35,9 @@ const ProfileUI = (props: ProfileParams) => {
35
35
  cleanFormState,
36
36
  handleChangeInput,
37
37
  handleButtonUpdateClick,
38
- checkPhoneCodeState,
39
38
  handleSendVerifyCode,
40
- handleCheckPhoneCode,
41
39
  verifyPhoneState,
42
- isVerifiedPhone,
43
- setCheckPhoneCodeState
40
+ setFormState
44
41
  } = props;
45
42
 
46
43
  const theme = useTheme();
@@ -56,7 +53,8 @@ const ProfileUI = (props: ProfileParams) => {
56
53
  },
57
54
  pagePadding: {
58
55
  paddingLeft: 40,
59
- paddingRight: 40
56
+ paddingRight: 40,
57
+ justifyContent: 'center',
60
58
  },
61
59
  navBarStyle: {
62
60
  paddingLeft: 40,
@@ -72,6 +70,7 @@ const ProfileUI = (props: ProfileParams) => {
72
70
  const { handleSubmit, errors, setValue, control } = useForm();
73
71
  const [isModalVisible, setIsModalVisible] = useState(false);
74
72
  const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
73
+ const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
75
74
 
76
75
  const [phoneInputData, setPhoneInputData] = useState({
77
76
  error: '',
@@ -205,8 +204,8 @@ const ProfileUI = (props: ProfileParams) => {
205
204
  },
206
205
  });
207
206
  handleSendVerifyCode({
208
- cellphone: cellphone,
209
- country_phone_code: countryPhoneCode
207
+ cellphone: cellphone,
208
+ country_phone_code: countryPhoneCode
210
209
  })
211
210
  }
212
211
  }
@@ -271,21 +270,30 @@ const ProfileUI = (props: ProfileParams) => {
271
270
  }
272
271
  }, [verifyPhoneState])
273
272
 
274
- useEffect(() => {
275
- if (isVerifiedPhone) setIsModalVisible(false)
276
- }, [isVerifiedPhone])
273
+ const handleSendPhoneCode = (values: any) => {
274
+ setWillVerifyOtpState(false)
275
+ setIsModalVisible(false)
276
+ setFormState({
277
+ ...formState,
278
+ changes: {
279
+ ...formState?.changes,
280
+ verification_code: values?.code
281
+ }
282
+ })
283
+ }
277
284
 
278
285
  return (
279
286
  <>
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
+ />
280
294
  <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
281
295
  <Container noPadding>
282
- <NavBar
283
- onActionLeft={() => navigation.goBack()}
284
- btnStyle={{ paddingStart: 0 }}
285
- title={t('ACCOUNT', 'Account')}
286
- isVertical
287
- style={styles.navBarStyle}
288
- />
296
+
289
297
  <CenterView style={styles.pagePadding}>
290
298
  <View style={styles.photo}>
291
299
  {user?.photo ? (
@@ -305,7 +313,7 @@ const ProfileUI = (props: ProfileParams) => {
305
313
  icon={theme.images.general.camera}
306
314
  borderColor={theme.colors.clear}
307
315
  iconStyle={{ width: 20, height: 20 }}
308
- style={{ maxWidth: 40, position: 'absolute', bottom: -2, alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
316
+ style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
309
317
  onClick={() => handleImagePicker()}
310
318
  />
311
319
  </CenterView>
@@ -326,13 +334,12 @@ const ProfileUI = (props: ProfileParams) => {
326
334
  entireModal
327
335
  >
328
336
  <VerifyPhone
329
- phone={phoneInputData.phone}
330
- verifyPhoneState={verifyPhoneState}
331
- checkPhoneCodeState={checkPhoneCodeState}
332
- handleCheckPhoneCode={handleCheckPhoneCode}
333
- setCheckPhoneCodeState={setCheckPhoneCodeState}
334
- handleVerifyCodeClick={handleVerifyCodeClick}
335
- onClose={() => setIsModalVisible(false)}
337
+ phone={phoneInputData.phone}
338
+ verifyPhoneState={verifyPhoneState}
339
+ checkPhoneCodeState={checkPhoneCodeState}
340
+ handleCheckPhoneCode={handleSendPhoneCode}
341
+ handleVerifyCodeClick={handleVerifyCodeClick}
342
+ onClose={() => setIsModalVisible(false)}
336
343
  />
337
344
  </OModal>
338
345
  </>