ordering-ui-react-native 0.16.35 → 0.16.36-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 (196) hide show
  1. package/package.json +7 -5
  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/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  35. package/themes/business/src/components/Chat/index.tsx +38 -30
  36. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  37. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  38. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  39. package/themes/business/src/components/MapView/index.tsx +12 -1
  40. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  41. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  42. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  43. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  44. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  45. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  46. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  47. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  50. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  54. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  55. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  57. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  58. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  59. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  60. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  61. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  62. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  63. package/themes/business/src/types/index.tsx +15 -9
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +4 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +2 -2
  80. package/themes/original/src/components/AddressForm/index.tsx +151 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +324 -162
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  86. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +80 -128
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +278 -104
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  105. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  106. package/themes/original/src/components/Cart/index.tsx +54 -16
  107. package/themes/original/src/components/Cart/styles.tsx +4 -0
  108. package/themes/original/src/components/CartContent/index.tsx +22 -16
  109. package/themes/original/src/components/Checkout/index.tsx +109 -64
  110. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  111. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  112. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  113. package/themes/original/src/components/Favorite/index.tsx +1 -0
  114. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  118. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  119. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  120. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  121. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  122. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  124. package/themes/original/src/components/LoginForm/index.tsx +107 -50
  125. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  126. package/themes/original/src/components/Messages/index.tsx +17 -17
  127. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  128. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  129. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  130. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  131. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  132. package/themes/original/src/components/NavBar/index.tsx +15 -9
  133. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  134. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  135. package/themes/original/src/components/Notifications/index.tsx +148 -0
  136. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  137. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  139. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  140. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  141. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  142. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  143. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  144. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  145. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  146. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  147. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  148. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  149. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  152. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  153. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  154. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  155. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  156. package/themes/original/src/components/ProductForm/index.tsx +635 -664
  157. package/themes/original/src/components/ProductForm/styles.tsx +9 -8
  158. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  159. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  160. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  161. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  162. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  163. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  164. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  165. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  166. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  167. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  168. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  169. package/themes/original/src/components/SignupForm/index.tsx +362 -210
  170. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  171. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  172. package/themes/original/src/components/SingleProductCard/index.tsx +200 -110
  173. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -10
  174. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  175. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  176. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  177. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  178. package/themes/original/src/components/UserDetails/index.tsx +11 -2
  179. package/themes/original/src/components/UserFormDetails/index.tsx +67 -77
  180. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  181. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  182. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  183. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  184. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  185. package/themes/original/src/components/Wallets/index.tsx +176 -164
  186. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  187. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  188. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  189. package/themes/original/src/components/shared/OButton.tsx +10 -3
  190. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  191. package/themes/original/src/components/shared/OInput.tsx +13 -3
  192. package/themes/original/src/layouts/Container.tsx +13 -9
  193. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  194. package/themes/original/src/types/index.tsx +91 -30
  195. package/themes/original/src/utils/index.tsx +121 -10
  196. 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,
@@ -44,6 +46,7 @@ const UserDetailsUI = (props: any) => {
44
46
  const userData = props.userData || (!formState.result.error && formState.result?.result) || user
45
47
 
46
48
  const [isModalVisible, setIsModalVisible] = useState(false);
49
+ const [isSubmit, setIsSubmit] = useState(false)
47
50
  const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
48
51
  const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
49
52
  const [phoneInputData, setPhoneInputData] = useState({
@@ -54,7 +57,6 @@ const UserDetailsUI = (props: any) => {
54
57
  },
55
58
  });
56
59
 
57
-
58
60
  useEffect(() => {
59
61
  if (isUserDetailsEdit) {
60
62
  !isEdit && toggleIsEdit()
@@ -66,6 +68,12 @@ const UserDetailsUI = (props: any) => {
66
68
  cleanFormState({ changes: {} })
67
69
  }
68
70
 
71
+ useEffect(() => {
72
+ if (isSubmit && !isEdit && requiredFields) {
73
+ onClose && onClose()
74
+ }
75
+ }, [isSubmit, requiredFields, isEdit])
76
+
69
77
  useEffect(() => {
70
78
  if (user?.cellphone && !user?.country_phone_code) {
71
79
  togglePhoneUpdate(true)
@@ -147,7 +155,7 @@ const UserDetailsUI = (props: any) => {
147
155
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
148
156
  {t('CUSTOMER_DETAILS', 'Customer Details')}
149
157
  </OText>
150
- {cartStatus !== 2 && (
158
+ {cartStatus !== 2 && !requiredFields && (
151
159
  !isEdit ? (
152
160
  <EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>
153
161
  <OIcon
@@ -198,6 +206,7 @@ const UserDetailsUI = (props: any) => {
198
206
  togglePhoneUpdate={togglePhoneUpdate}
199
207
  isCheckout={isCheckout}
200
208
  setWillVerifyOtpState={setWillVerifyOtpState}
209
+ setIsSubmit={setIsSubmit}
201
210
  />
202
211
  )}
203
212
  </UDContainer>
@@ -10,13 +10,14 @@ import { OText, OButton, OInput } from '../shared';
10
10
 
11
11
  import { PhoneInputNumber } from '../PhoneInputNumber';
12
12
  import { sortInputFields } from '../../utils';
13
- import CheckBox from '@react-native-community/checkbox';
14
13
 
15
14
  export const UserFormDetailsUI = (props: any) => {
16
15
  const {
17
16
  isEdit,
18
17
  formState,
19
18
  showField,
19
+ requiredFields,
20
+ setIsSubmit,
20
21
  cleanFormState,
21
22
  onCloseProfile,
22
23
  isRequiredField,
@@ -26,12 +27,10 @@ export const UserFormDetailsUI = (props: any) => {
26
27
  phoneUpdate,
27
28
  hideUpdateButton,
28
29
  setWillVerifyOtpState,
29
- handleChangePromotions,
30
30
  } = props;
31
31
 
32
32
  const theme = useTheme();
33
33
 
34
-
35
34
  const styles = StyleSheet.create({
36
35
  btnOutline: {
37
36
  backgroundColor: '#FFF',
@@ -61,10 +60,6 @@ export const UserFormDetailsUI = (props: any) => {
61
60
  paddingStart: 0,
62
61
  paddingBottom: 0,
63
62
  marginBottom: -0,
64
- },
65
- checkBoxStyle: {
66
- width: 25,
67
- height: 25,
68
63
  }
69
64
  });
70
65
 
@@ -75,7 +70,8 @@ export const UserFormDetailsUI = (props: any) => {
75
70
 
76
71
  const [{ user }] = useSession();
77
72
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
78
- const [isChanged, setIsChanged] = useState(false)
73
+ const [isValid, setIsValid] = useState(false)
74
+ const [isChanged, setIsChanged] = useState(false)
79
75
  const [phoneInputData, setPhoneInputData] = useState({
80
76
  error: '',
81
77
  phone: {
@@ -160,6 +156,7 @@ export const UserFormDetailsUI = (props: any) => {
160
156
  cellphone: '',
161
157
  };
162
158
  }
159
+ setIsSubmit && setIsSubmit(true)
163
160
  handleButtonUpdateClick(changes);
164
161
  }
165
162
  };
@@ -235,7 +232,13 @@ export const UserFormDetailsUI = (props: any) => {
235
232
  setWillVerifyOtpState?.(true)
236
233
  }
237
234
  }, [phoneInputData, configs?.verification_phone_required?.value, isChanged])
238
-
235
+
236
+ useEffect(() => {
237
+ if (!requiredFields || formState?.changes?.length === 0) return
238
+ const _isValid = requiredFields.every((key: any) => formState?.changes[key])
239
+ setIsValid(_isValid)
240
+ }, [formState?.changes, requiredFields])
241
+
239
242
  return (
240
243
  <>
241
244
  <UDForm>
@@ -248,7 +251,7 @@ export const UserFormDetailsUI = (props: any) => {
248
251
  }).map(
249
252
  (field: any) =>
250
253
  showField &&
251
- showField(field.code) && (
254
+ showField(field.code) && ((requiredFields && requiredFields.includes(field.code)) || !requiredFields) && (
252
255
  <React.Fragment key={field.id}>
253
256
  <Controller
254
257
  key={field.id}
@@ -322,7 +325,7 @@ export const UserFormDetailsUI = (props: any) => {
322
325
  ),
323
326
  )}
324
327
 
325
- {!!showInputPhoneNumber && (
328
+ {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
326
329
  <WrapperPhone>
327
330
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
328
331
  <PhoneInputNumber
@@ -347,71 +350,43 @@ export const UserFormDetailsUI = (props: any) => {
347
350
  )}
348
351
  </WrapperPhone>
349
352
  )}
350
- <Controller
351
- control={control}
352
- render={() => (
353
- <>
354
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
355
- {t('PASSWORD', 'Password')}
356
- </OText>
357
- <OInput
358
- name='password'
359
- placeholder={t('FRONT_VISUALS_PASSWORD', 'Password')}
360
- inputStyle={styles.inputStyle}
361
- style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
362
- autoCapitalize='none'
363
- isDisabled={false}
364
- value={
365
- formState?.changes['password'] ??
366
- (user && user['password']) ??
367
- ''
368
- }
369
- onChange={(val: any) => {
370
- setValue('password', val.target.value)
371
- handleChangeInput(val)
372
- }}
373
- autoCorrect
374
- type='default'
375
- returnKeyType="done"
376
- autoCompleteType='off'
377
- isSecured
378
- />
379
- </>
380
- )}
381
- name='password'
382
- rules={getInputRules({ name: 'password', code: 'password' })}
383
- defaultValue=''
384
- />
385
- <Controller
386
- control={control}
387
- render={({ onChange, value }: any) => (
388
- <TouchableOpacity
389
- style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
390
- onPress={() => {
391
- onChange(!value)
392
- handleChangePromotions(!value)
393
- }}
394
- >
395
- <CheckBox
396
- value={value}
397
- boxType={'square'}
398
- tintColors={{
399
- true: theme.colors.primary,
400
- false: theme.colors.disabled
401
- }}
402
- tintColor={theme.colors.disabled}
403
- onCheckColor={theme.colors.primary}
404
- onTintColor={theme.colors.primary}
405
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
406
- />
407
- <OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
408
- </TouchableOpacity>
409
- )}
410
- name='promotions'
411
- defaultValue={formState?.result?.result
412
- ? !!formState?.result?.result?.settings?.notification?.newsletter
413
- : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
414
- />
353
+ {!requiredFields && (
354
+ <Controller
355
+ control={control}
356
+ render={() => (
357
+ <>
358
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
359
+ {t('PASSWORD', 'Password')}
360
+ </OText>
361
+ <OInput
362
+ name='password'
363
+ placeholder={t('FRONT_VISUALS_PASSWORD', 'Password')}
364
+ inputStyle={styles.inputStyle}
365
+ style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
366
+ autoCapitalize='none'
367
+ isDisabled={false}
368
+ value={
369
+ formState?.changes['password'] ??
370
+ (user && user['password']) ??
371
+ ''
372
+ }
373
+ onChange={(val: any) => {
374
+ setValue('password', val.target.value)
375
+ handleChangeInput(val)
376
+ }}
377
+ autoCorrect
378
+ type='default'
379
+ returnKeyType="done"
380
+ autoCompleteType='off'
381
+ isSecured
382
+ />
383
+ </>
384
+ )}
385
+ name='password'
386
+ rules={getInputRules({ name: 'password', code: 'password' })}
387
+ defaultValue=''
388
+ />
389
+ )}
415
390
  </UDWrapper>
416
391
  )}
417
392
  {validationFields?.loading && (
@@ -443,7 +418,22 @@ export const UserFormDetailsUI = (props: any) => {
443
418
  )}
444
419
  </>
445
420
  )}
421
+ {requiredFields && (
422
+ <OButton
423
+ text={
424
+ formState.loading
425
+ ? t('UPDATING', 'Updating...')
426
+ : t('CONTINUE', 'Continue')
427
+ }
428
+ bgColor={theme.colors.white}
429
+ textStyle={{ color: theme.colors.primary, fontSize: 14 }}
430
+ borderColor={theme.colors.primary}
431
+ isDisabled={formState.loading || !isValid}
432
+ imgRightSrc={null}
433
+ style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
434
+ onClick={handleSubmit(onSubmit)}
435
+ />
436
+ )}
446
437
  </>
447
438
  );
448
439
  };
449
-
@@ -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,22 +29,26 @@ 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
 
47
-
48
52
  const langPickerStyle = StyleSheet.create({
49
53
  inputAndroid: {
50
54
  color: theme.colors.textNormal,
@@ -108,22 +112,19 @@ const ProfileListUI = (props: ProfileParams) => {
108
112
  const { top, bottom } = useSafeAreaInsets();
109
113
 
110
114
  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')
115
+ 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
116
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
114
117
  const onRedirect = (route: string, params?: any) => {
115
118
  navigation.navigate(route, params)
116
119
  }
117
120
 
118
121
  useEffect(() => {
119
- if (formState.result.result && !formState.loading) {
120
- if (formState.result?.error) {
121
- showToast(ToastType.Error, formState.result.result);
122
- } else {
122
+ if (notificationsGroup.result.result && !notificationsGroup.loading) {
123
+ if (!notificationsGroup.result?.error) {
123
124
  showToast(ToastType.Success, t('UPDATE_SUCCESSFULLY', 'Update successfully'));
124
125
  }
125
126
  }
126
- }, [formState.result])
127
+ }, [notificationsGroup.result])
127
128
 
128
129
  useEffect(() => {
129
130
  if (Object.keys(errors).length > 0) {
@@ -139,21 +140,20 @@ const ProfileListUI = (props: ProfileParams) => {
139
140
  }, [errors]);
140
141
 
141
142
  const detailProps = {
142
-
143
143
  goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
144
144
  onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
145
145
  }
146
146
 
147
147
  const onRemoveAccount = () => {
148
148
  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
- })
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
+ })
157
157
  }
158
158
 
159
159
  useEffect(() => {
@@ -163,7 +163,7 @@ const ProfileListUI = (props: ProfileParams) => {
163
163
  }, [removeAccountState])
164
164
 
165
165
  return (
166
- <View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
166
+ <View style={{ flex: 1, height: height - top - bottom, paddingTop: 20 }}>
167
167
  {/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
168
168
  {t('PROFILE', 'Profile')}
169
169
  </OText> */}
@@ -183,12 +183,12 @@ const ProfileListUI = (props: ProfileParams) => {
183
183
  <View style={{ flexBasis: '70%' }}>
184
184
  <OText size={20} lineHeight={30} weight={Platform.OS === 'ios' ? '500' : 'bold'} color={theme.colors.textNormal}>{user?.name} {user?.lastname}</OText>
185
185
  <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>
186
+ <OText size={12} lineHeight={18} color={theme.colors.primary} style={{ textDecorationLine: 'underline' }}>{t('VIEW_ACCOUNT', 'View account')}</OText>
187
187
  </TouchableOpacity>
188
188
  </View>
189
189
  </CenterView>
190
190
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32 }} />
191
- <Spinner visible={formState?.loading} />
191
+ <Spinner visible={notificationsGroup?.loading} />
192
192
  <ListWrap style={{ ...styles.pagePadding }}>
193
193
  <Actions>
194
194
  <ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
@@ -199,6 +199,10 @@ const ProfileListUI = (props: ProfileParams) => {
199
199
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
200
200
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MESSAGES', 'Messages')}</OText>
201
201
  </ListItem>
202
+ <ListItem onPress={() => onRedirect('MyOrders', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
203
+ <FontAwesome name='list-alt' style={styles.messageIconStyle} color={theme.colors.textNormal} />
204
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_ORDERS', 'My Orders')}</OText>
205
+ </ListItem>
202
206
  {isWalletEnabled && (
203
207
  <ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
204
208
  <Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
@@ -215,6 +219,27 @@ const ProfileListUI = (props: ProfileParams) => {
215
219
  <OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
216
220
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
217
221
  </ListItem>
222
+ <ListItem onPress={() => navigation.navigate('Notifications', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
223
+ <NotificationBadge style={{ borderRadius: 100 / 2 }} />
224
+ <Ionicons name='notifications-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
225
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('NOTIFICATIONS', 'Notifications')}
226
+ </OText>
227
+ <NotificationsWrapper>
228
+ <ToggleSwitch
229
+ isOn={user && (!!user?.settings?.notification?.newsletter ||
230
+ !!user?.settings?.sms?.newsletter ||
231
+ !!user?.settings?.email?.newsletter)}
232
+ onColor={theme.colors.primary}
233
+ size="small"
234
+ disabled={notificationsGroup?.loading}
235
+ offColor={theme.colors.disabled}
236
+ animationSpeed={400}
237
+ onToggle={() => handleChangePromotions(!(user && (!!user?.settings?.notification?.newsletter ||
238
+ !!user?.settings?.sms?.newsletter ||
239
+ !!user?.settings?.email?.newsletter)))}
240
+ />
241
+ </NotificationsWrapper>
242
+ </ListItem>
218
243
  <ListItem onPress={() => navigation.navigate('Sessions')} activeOpacity={0.7}>
219
244
  <Ionicons name='md-list-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
220
245
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SESSIONS', 'Sessions')}</OText>
@@ -237,13 +262,13 @@ const ProfileListUI = (props: ProfileParams) => {
237
262
  </Actions>
238
263
  </ListWrap>
239
264
  <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
- />
265
+ open={confirm.open}
266
+ title={confirm.title}
267
+ content={confirm.content}
268
+ onAccept={confirm.handleOnAccept}
269
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
270
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
271
+ />
247
272
  </View>
248
273
  );
249
274
  };
@@ -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
+ `;
@@ -271,16 +271,16 @@ const ProfileUI = (props: ProfileParams) => {
271
271
  }, [verifyPhoneState])
272
272
 
273
273
  const handleSendPhoneCode = (values: any) => {
274
- setWillVerifyOtpState(false)
274
+ setWillVerifyOtpState(false)
275
275
  setIsModalVisible(false)
276
- setFormState({
277
- ...formState,
278
- changes: {
279
- ...formState?.changes,
280
- verification_code: values?.code
281
- }
282
- })
283
- }
276
+ setFormState({
277
+ ...formState,
278
+ changes: {
279
+ ...formState?.changes,
280
+ verification_code: values?.code
281
+ }
282
+ })
283
+ }
284
284
 
285
285
  return (
286
286
  <>
@@ -289,7 +289,7 @@ const ProfileUI = (props: ProfileParams) => {
289
289
  titleAlign={'center'}
290
290
  onActionLeft={() => navigation.goBack()}
291
291
  showCall={false}
292
- 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 }}
293
293
  />
294
294
  <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
295
295
  <Container noPadding>
@@ -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
+ `