ordering-ui-react-native 0.16.11 → 0.16.12-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 (213) hide show
  1. package/package.json +8 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  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 +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessProductsList/index.tsx +7 -7
  10. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +16 -0
  94. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  95. package/themes/original/src/components/AddressList/index.tsx +1 -1
  96. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  97. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  98. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  99. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  100. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  101. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  102. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  103. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  104. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  105. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  106. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  107. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  108. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  109. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  110. package/themes/original/src/components/BusinessProductsList/index.tsx +61 -72
  111. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  112. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
  113. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  114. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  115. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  116. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  117. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  118. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  119. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  121. package/themes/original/src/components/BusinessesListing/index.tsx +100 -484
  122. package/themes/original/src/components/Cart/index.tsx +81 -36
  123. package/themes/original/src/components/Cart/styles.tsx +4 -0
  124. package/themes/original/src/components/CartContent/index.tsx +22 -16
  125. package/themes/original/src/components/Checkout/index.tsx +106 -66
  126. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  127. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  128. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  129. package/themes/original/src/components/Favorite/index.tsx +1 -0
  130. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  131. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  132. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  133. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  134. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  135. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  136. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  137. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  138. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  139. package/themes/original/src/components/Messages/index.tsx +17 -17
  140. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  141. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  142. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  143. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  144. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  145. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  146. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  147. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  148. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  149. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  150. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  151. package/themes/original/src/components/NavBar/index.tsx +11 -5
  152. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  153. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  156. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  157. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  158. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  159. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  160. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  161. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  162. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  163. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  164. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  165. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  167. package/themes/original/src/components/OrdersOption/index.tsx +126 -37
  168. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  169. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  170. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  171. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  172. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  173. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  174. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  175. package/themes/original/src/components/ProductItemAccordion/index.tsx +40 -27
  176. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  177. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  178. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  179. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  180. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  181. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  182. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  183. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  184. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  185. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  186. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  187. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  188. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  189. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  190. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  191. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  192. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  193. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  194. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  195. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  196. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  197. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  198. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  199. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  200. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  201. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  202. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  203. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  204. package/themes/original/src/components/Wallets/index.tsx +174 -162
  205. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  206. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  207. package/themes/original/src/components/shared/OButton.tsx +10 -3
  208. package/themes/original/src/components/shared/OInput.tsx +3 -2
  209. package/themes/original/src/components/shared/OModal.tsx +3 -1
  210. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  211. package/themes/original/src/types/index.tsx +160 -47
  212. package/themes/original/src/utils/index.tsx +77 -0
  213. 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} />
@@ -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',
@@ -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) {
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) {
232
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,7 +333,7 @@ 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
@@ -344,71 +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
- <Controller
383
- control={control}
384
- render={({ onChange, value }: any) => (
385
- <TouchableOpacity
386
- style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
387
- onPress={() => {
388
- onChange(!value)
389
- handleChangePromotions(!value)
390
- }}
391
- >
392
- <CheckBox
393
- value={value}
394
- boxType={'square'}
395
- tintColors={{
396
- true: theme.colors.primary,
397
- false: theme.colors.disabled
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 && (
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)
398
407
  }}
399
- tintColor={theme.colors.disabled}
400
- onCheckColor={theme.colors.primary}
401
- onTintColor={theme.colors.primary}
402
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
403
- />
404
- <OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
405
- </TouchableOpacity>
406
- )}
407
- name='promotions'
408
- defaultValue={formState?.result?.result
409
- ? !!formState?.result?.result?.settings?.notification?.newsletter
410
- : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
411
- />
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
+
412
431
  </UDWrapper>
413
432
  )}
414
433
  {validationFields?.loading && (
@@ -440,7 +459,22 @@ export const UserFormDetailsUI = (props: any) => {
440
459
  )}
441
460
  </>
442
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
+ )}
443
478
  </>
444
479
  );
445
480
  };
446
-
@@ -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
 
@@ -111,6 +111,7 @@ const ProfileListUI = (props: ProfileParams) => {
111
111
 
112
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')
113
113
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
114
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
114
115
  const onRedirect = (route: string, params?: any) => {
115
116
  navigation.navigate(route, params)
116
117
  }
@@ -199,6 +200,12 @@ const ProfileListUI = (props: ProfileParams) => {
199
200
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
200
201
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MESSAGES', 'Messages')}</OText>
201
202
  </ListItem>
203
+ {isChewLayout && (
204
+ <ListItem onPress={() => onRedirect('MyOrders', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
205
+ <FontAwesome name='list-alt' style={styles.messageIconStyle} color={theme.colors.textNormal} />
206
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_ORDERS', 'My Orders')}</OText>
207
+ </ListItem>
208
+ )}
202
209
  {isWalletEnabled && (
203
210
  <ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
204
211
  <Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
@@ -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();
@@ -73,6 +70,7 @@ const ProfileUI = (props: ProfileParams) => {
73
70
  const { handleSubmit, errors, setValue, control } = useForm();
74
71
  const [isModalVisible, setIsModalVisible] = useState(false);
75
72
  const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
73
+ const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
76
74
 
77
75
  const [phoneInputData, setPhoneInputData] = useState({
78
76
  error: '',
@@ -272,9 +270,17 @@ const ProfileUI = (props: ProfileParams) => {
272
270
  }
273
271
  }, [verifyPhoneState])
274
272
 
275
- useEffect(() => {
276
- if (isVerifiedPhone) setIsModalVisible(false)
277
- }, [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
+ }
278
284
 
279
285
  return (
280
286
  <>
@@ -283,7 +289,7 @@ const ProfileUI = (props: ProfileParams) => {
283
289
  titleAlign={'center'}
284
290
  onActionLeft={() => navigation.goBack()}
285
291
  showCall={false}
286
- style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 30 , marginTop: Platform.OS === 'ios' ? 50 : 40 }}
292
+ style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 30 }}
287
293
  />
288
294
  <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
289
295
  <Container noPadding>
@@ -331,8 +337,7 @@ const ProfileUI = (props: ProfileParams) => {
331
337
  phone={phoneInputData.phone}
332
338
  verifyPhoneState={verifyPhoneState}
333
339
  checkPhoneCodeState={checkPhoneCodeState}
334
- handleCheckPhoneCode={handleCheckPhoneCode}
335
- setCheckPhoneCodeState={setCheckPhoneCodeState}
340
+ handleCheckPhoneCode={handleSendPhoneCode}
336
341
  handleVerifyCodeClick={handleVerifyCodeClick}
337
342
  onClose={() => setIsModalVisible(false)}
338
343
  />
@@ -0,0 +1,76 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import { useLanguage } from 'ordering-components/native'
4
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+ import { useTheme } from 'styled-components/native'
6
+ import { OText } from '../shared';
7
+ import { WalletTransactionItem } from '../WalletTransactionItem'
8
+ import { NotFoundSource } from '../NotFoundSource';
9
+
10
+ import {
11
+ Container,
12
+ TransactionsWrapper
13
+ } from './styles'
14
+
15
+ export const WalletTransactions = (props: any) => {
16
+ const {
17
+ transactionsList,
18
+ currentWalletSelected
19
+ } = props
20
+
21
+ const theme = useTheme()
22
+ const [, t] = useLanguage()
23
+
24
+ return (
25
+ <Container>
26
+ <View style={{ width: '100%', paddingHorizontal: 1, paddingBottom: 40 }}>
27
+ {!transactionsList?.loading &&
28
+ !transactionsList?.error &&
29
+ transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.length > 0 &&
30
+ (
31
+ <>
32
+ <OText style={{fontSize: 20, color: theme.colors.textNormal, marginBottom: 30}}>
33
+ {t('TRANSACTIONS_HISTORY', 'Transactions history')}
34
+ </OText>
35
+ <TransactionsWrapper>
36
+ {transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.map((transaction: any, i: number) =>(
37
+ <WalletTransactionItem
38
+ idx={i}
39
+ type={currentWalletSelected?.type}
40
+ key={transaction.id}
41
+ item={transaction}
42
+ withFormatPrice={currentWalletSelected?.type === 'cash'}
43
+ />
44
+ ))}
45
+ </TransactionsWrapper>
46
+ </>
47
+ )}
48
+
49
+ {(transactionsList?.loading || !transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]) && (
50
+ <View>
51
+ {[...Array(4).keys()].map(i => (
52
+ <View style={{ marginBottom: 10 }} key={i}>
53
+ <Placeholder Animation={Fade}>
54
+ <PlaceholderLine width={100} height={100} style={{ marginBottom: 0, borderRadius: 8 }} />
55
+ </Placeholder>
56
+ </View>
57
+ ))}
58
+ </View>
59
+ )}
60
+
61
+ {!transactionsList?.loading &&
62
+ !(transactionsList?.loading && transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]) &&
63
+ (transactionsList?.error ||
64
+ !transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.length) &&
65
+ (
66
+ <NotFoundSource
67
+ content={transactionsList?.error
68
+ ? t('ERROR_NOT_FOUND_TRANSACTIONS', 'Sorry, an error has occurred')
69
+ : t('NOT_FOUND_TRANSACTIONS', 'No transactions to show at this time.')
70
+ }
71
+ />
72
+ )}
73
+ </View>
74
+ </Container>
75
+ )
76
+ }
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ display: flex;
5
+ flex-direction: column;
6
+ `
7
+
8
+ export const TransactionsWrapper = styled.View`
9
+ display: flex;
10
+ flex-direction: column;
11
+ border-left-width: 2px;
12
+ border-left-color: ${(props: any) => props.theme.colors.disabled};
13
+ `