ordering-ui-react-native 0.15.24 → 0.15.26-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 (160) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +12 -2
  5. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +0 -1
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/OrderDetails/index.tsx +2 -2
  10. package/src/components/PaymentOptions/index.tsx +9 -16
  11. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  12. package/src/components/SingleProductCard/index.tsx +16 -4
  13. package/src/components/StripeElementsForm/index.tsx +27 -48
  14. package/src/components/UserProfileForm/index.tsx +63 -6
  15. package/src/components/UserProfileForm/styles.tsx +8 -0
  16. package/src/components/VerifyPhone/styles.tsx +1 -2
  17. package/src/components/shared/OModal.tsx +1 -1
  18. package/src/config.json +0 -2
  19. package/src/hooks/useCountdownTimer.tsx +26 -0
  20. package/src/navigators/HomeNavigator.tsx +6 -0
  21. package/src/pages/BusinessProductsList.tsx +1 -0
  22. package/src/pages/BusinessesListing.tsx +1 -1
  23. package/src/pages/Checkout.tsx +1 -1
  24. package/src/pages/Sessions.tsx +22 -0
  25. package/src/types/index.tsx +5 -11
  26. package/src/utils/index.tsx +68 -1
  27. package/themes/business/index.tsx +2 -0
  28. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  29. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  30. package/themes/business/src/components/Chat/index.tsx +38 -86
  31. package/themes/business/src/components/Home/index.tsx +128 -55
  32. package/themes/business/src/components/Home/styles.tsx +8 -1
  33. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  34. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  35. package/themes/business/src/components/NewOrderNotification/index.tsx +61 -98
  36. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  37. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  38. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
  39. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  40. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  41. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  42. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  43. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  44. package/themes/business/src/components/OrdersOption/index.tsx +54 -50
  45. package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
  46. package/themes/business/src/components/shared/OModal.tsx +1 -1
  47. package/themes/business/src/types/index.tsx +5 -1
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  52. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  53. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  54. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  55. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  56. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  57. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  58. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  62. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  63. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  65. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  66. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  67. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  68. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  69. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  70. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  71. package/themes/kiosk/src/types/index.d.ts +2 -0
  72. package/themes/original/index.tsx +178 -1
  73. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  74. package/themes/original/src/components/AddressList/index.tsx +56 -18
  75. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  77. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  78. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  79. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  80. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  81. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  82. package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
  83. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  84. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  86. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  91. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  92. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  93. package/themes/original/src/components/BusinessesListing/index.tsx +51 -58
  94. package/themes/original/src/components/Cart/index.tsx +19 -15
  95. package/themes/original/src/components/CartContent/index.tsx +2 -2
  96. package/themes/original/src/components/Checkout/index.tsx +42 -27
  97. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  98. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  99. package/themes/original/src/components/Help/index.tsx +21 -4
  100. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  101. package/themes/original/src/components/Home/index.tsx +1 -1
  102. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  103. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  104. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  105. package/themes/original/src/components/LoginForm/index.tsx +389 -156
  106. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  107. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  108. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  109. package/themes/original/src/components/Messages/index.tsx +34 -25
  110. package/themes/original/src/components/Messages/styles.tsx +1 -3
  111. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  112. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  113. package/themes/original/src/components/OrderDetails/index.tsx +35 -28
  114. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  115. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  116. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  117. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  118. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  119. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  120. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  121. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  122. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  123. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  124. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  125. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  126. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  127. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  128. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  129. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  130. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  131. package/themes/original/src/components/Promotions/index.tsx +250 -0
  132. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  133. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  134. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  135. package/themes/original/src/components/Sessions/index.tsx +160 -0
  136. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  137. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  138. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  139. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  140. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  141. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  142. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  143. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  144. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  145. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  146. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  147. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  148. package/themes/original/src/components/Wallets/index.tsx +76 -9
  149. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  150. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  151. package/themes/original/src/components/shared/OModal.tsx +1 -1
  152. package/themes/original/src/components/shared/index.tsx +2 -0
  153. package/themes/original/src/config/constants.tsx +6 -6
  154. package/themes/original/src/types/index.tsx +62 -5
  155. package/themes/original/src/utils/index.tsx +28 -2
  156. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  157. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  158. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  159. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  160. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -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';
@@ -25,8 +25,6 @@ export const UserFormDetailsUI = (props: any) => {
25
25
  handleButtonUpdateClick,
26
26
  phoneUpdate,
27
27
  hideUpdateButton,
28
- setWillVerifyOtpState,
29
- isVerifiedPhone,
30
28
  handleChangePromotions
31
29
  } = props;
32
30
 
@@ -141,8 +139,8 @@ export const UserFormDetailsUI = (props: any) => {
141
139
  if (
142
140
  formState.changes?.cellphone === null &&
143
141
  ((validationFields?.fields?.checkout?.cellphone?.enabled &&
144
- validationFields?.fields?.checkout?.cellphone?.required) ||
145
- configs?.verification_phone_required?.value === '1')
142
+ validationFields?.fields?.checkout?.cellphone?.required) ||
143
+ configs?.verification_phone_required?.value === '1')
146
144
  ) {
147
145
  showToast(
148
146
  ToastType.Error,
@@ -153,9 +151,6 @@ export const UserFormDetailsUI = (props: any) => {
153
151
  );
154
152
  return;
155
153
  }
156
- if (formState?.changes?.cellphone && !isVerifiedPhone) {
157
- showToast(ToastType.Error, t('VERIFY_ERROR_PHONE_NUMBER', 'The Phone Number field is not verified'))
158
- }
159
154
  let changes = null;
160
155
  if (user?.cellphone && !userPhoneNumber) {
161
156
  changes = {
@@ -182,6 +177,16 @@ export const UserFormDetailsUI = (props: any) => {
182
177
  handleChangeInput(phoneNumber, true);
183
178
  };
184
179
 
180
+ const changeCountry = (country: any) => {
181
+ let countryCode = {
182
+ country_code: {
183
+ name: 'country_code',
184
+ value: country.cca2
185
+ }
186
+ }
187
+ handleChangeInput(countryCode, true);
188
+ }
189
+
185
190
  useEffect(() => {
186
191
  if (Object.keys(errors).length > 0) {
187
192
  const list = Object.values(errors);
@@ -216,13 +221,6 @@ export const UserFormDetailsUI = (props: any) => {
216
221
  }
217
222
  }
218
223
  }, [user, isEdit]);
219
-
220
- useEffect(() => {
221
- if (!phoneInputData.error && phoneInputData?.phone?.country_phone_code && phoneInputData?.phone?.cellphone) {
222
- setWillVerifyOtpState(true)
223
- }
224
- }, [phoneInputData])
225
-
226
224
  return (
227
225
  <>
228
226
  <UDForm>
@@ -315,6 +313,7 @@ export const UserFormDetailsUI = (props: any) => {
315
313
  <PhoneInputNumber
316
314
  data={phoneInputData}
317
315
  handleData={(val: any) => handleChangePhoneNumber(val)}
316
+ changeCountry={(val: any) => changeCountry(val)}
318
317
  defaultValue={phoneUpdate ? '' : user?.cellphone}
319
318
  defaultCode={user?.country_phone_code || null}
320
319
  boxStyle={styles.phoneSelect}
@@ -368,16 +367,18 @@ export const UserFormDetailsUI = (props: any) => {
368
367
  rules={getInputRules({ name: 'password', code: 'password' })}
369
368
  defaultValue=''
370
369
  />
371
- <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}>
372
- <Controller
373
- control={control}
374
- render={({ onChange, value }: any) => (
370
+ <Controller
371
+ control={control}
372
+ render={({ onChange, value }: any) => (
373
+ <TouchableOpacity
374
+ style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
375
+ onPress={() => {
376
+ onChange(!value)
377
+ handleChangePromotions(!value)
378
+ }}
379
+ >
375
380
  <CheckBox
376
381
  value={value}
377
- onValueChange={newValue => {
378
- onChange(newValue)
379
- handleChangePromotions(newValue)
380
- }}
381
382
  boxType={'square'}
382
383
  tintColors={{
383
384
  true: theme.colors.primary,
@@ -388,14 +389,14 @@ export const UserFormDetailsUI = (props: any) => {
388
389
  onTintColor={theme.colors.primary}
389
390
  style={Platform.OS === 'ios' && styles.checkBoxStyle}
390
391
  />
391
- )}
392
- name='promotions'
393
- defaultValue={formState?.result?.result
394
- ? !!formState?.result?.result?.settings?.notification?.newsletter
395
- : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
396
- />
397
- <OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
398
- </View>
392
+ <OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
393
+ </TouchableOpacity>
394
+ )}
395
+ name='promotions'
396
+ defaultValue={formState?.result?.result
397
+ ? !!formState?.result?.result?.settings?.notification?.newsletter
398
+ : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
399
+ />
399
400
  </UDWrapper>
400
401
  )}
401
402
  {validationFields?.loading && (
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import {
3
3
  UserFormDetails as UserProfileController,
4
4
  useSession,
@@ -16,7 +16,10 @@ import { LogoutButton } from '../LogoutButton'
16
16
  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
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
20
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
19
21
  import FastImage from 'react-native-fast-image'
22
+ import { OAlert } from '../../../../../src/components/shared'
20
23
 
21
24
  import {
22
25
  OIcon,
@@ -34,7 +37,9 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
34
37
  const ProfileListUI = (props: ProfileParams) => {
35
38
  const {
36
39
  navigation,
37
- formState
40
+ formState,
41
+ handleRemoveAccount,
42
+ removeAccountState
38
43
  } = props;
39
44
 
40
45
  const theme = useTheme();
@@ -91,17 +96,21 @@ const ProfileListUI = (props: ProfileParams) => {
91
96
  });
92
97
 
93
98
 
94
- const [{ user }] = useSession();
99
+ const [{ user }, { logout }] = useSession();
95
100
  const [, t] = useLanguage();
96
101
  const [{ configs }] = useConfig();
97
102
  const [, { showToast }] = useToast();
98
103
  const { errors } = useForm();
99
104
 
105
+ const isAdmin = user?.level === 0
106
+
100
107
  const { height } = useWindowDimensions();
101
108
  const { top, bottom } = useSafeAreaInsets();
102
109
 
103
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
110
+ const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
104
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')
113
+ const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
105
114
  const onRedirect = (route: string, params?: any) => {
106
115
  navigation.navigate(route, params)
107
116
  }
@@ -135,14 +144,32 @@ const ProfileListUI = (props: ProfileParams) => {
135
144
  onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
136
145
  }
137
146
 
147
+ const onRemoveAccount = () => {
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
+ })
157
+ }
158
+
159
+ useEffect(() => {
160
+ if (removeAccountState?.result === 'OK') {
161
+ logout()
162
+ }
163
+ }, [removeAccountState])
164
+
138
165
  return (
139
- <View style={{ flex: 1, height: height - top - bottom - 62 }}>
140
- <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
166
+ <View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
167
+ {/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
141
168
  {t('PROFILE', 'Profile')}
142
- </OText>
169
+ </OText> */}
143
170
  <CenterView style={styles.pagePadding}>
144
- <View style={styles.photo}>
145
- {user?.photo ? (
171
+ {user?.photo && (
172
+ <View style={styles.photo}>
146
173
  <FastImage
147
174
  style={{ height: 60, width: 60, borderRadius: 8 }}
148
175
  source={{
@@ -151,10 +178,8 @@ const ProfileListUI = (props: ProfileParams) => {
151
178
  }}
152
179
  resizeMode={FastImage.resizeMode.cover}
153
180
  />
154
- ) : (
155
- <Ionicons name='person-outline' size={50} style={{ marginRight: 10 }} />
156
- )}
157
- </View>
181
+ </View>
182
+ )}
158
183
  <View style={{ flexBasis: '70%' }}>
159
184
  <OText size={20} lineHeight={30} weight={Platform.OS === 'ios' ? '500' : 'bold'} color={theme.colors.textNormal}>{user?.name} {user?.lastname}</OText>
160
185
  <TouchableOpacity onPress={() => navigation.navigate('ProfileForm', { ...detailProps })}>
@@ -168,7 +193,7 @@ const ProfileListUI = (props: ProfileParams) => {
168
193
  <Actions>
169
194
  <ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
170
195
  <OIcon src={theme.images.general.pin} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
171
- <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_SAVED_PLACES', 'My saved places')}</OText>
196
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SAVED_PLACES', 'My saved places')}</OText>
172
197
  </ListItem>
173
198
  <ListItem onPress={() => onRedirect('Messages', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
174
199
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
@@ -180,18 +205,41 @@ const ProfileListUI = (props: ProfileParams) => {
180
205
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
181
206
  </ListItem>
182
207
  )}
208
+ {IsPromotionsEnabled && (
209
+ <ListItem onPress={() => onRedirect('Promotions', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
210
+ <MaterialIcons name='local-offer' style={styles.messageIconStyle} color={theme.colors.textNormal} />
211
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('PROMOTIONS', 'Promotions')}</OText>
212
+ </ListItem>
213
+ )}
183
214
  <ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
184
215
  <OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
185
216
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
186
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>
187
222
  </Actions>
188
223
 
189
224
  <Actions>
190
225
  <LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
191
226
  <View style={{ height: 17 }} />
192
227
  <LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
228
+ <View style={{ height: 17 }} />
229
+ <ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
230
+ <OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
231
+ <OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
232
+ </ListItem>
193
233
  </Actions>
194
234
  </ListWrap>
235
+ <OAlert
236
+ open={confirm.open}
237
+ title={confirm.title}
238
+ content={confirm.content}
239
+ onAccept={confirm.handleOnAccept}
240
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
241
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
242
+ />
195
243
  </View>
196
244
  );
197
245
  };
@@ -56,7 +56,8 @@ const ProfileUI = (props: ProfileParams) => {
56
56
  },
57
57
  pagePadding: {
58
58
  paddingLeft: 40,
59
- paddingRight: 40
59
+ paddingRight: 40,
60
+ justifyContent: 'center',
60
61
  },
61
62
  navBarStyle: {
62
63
  paddingLeft: 40,
@@ -205,8 +206,8 @@ const ProfileUI = (props: ProfileParams) => {
205
206
  },
206
207
  });
207
208
  handleSendVerifyCode({
208
- cellphone: cellphone,
209
- country_phone_code: countryPhoneCode
209
+ cellphone: cellphone,
210
+ country_phone_code: countryPhoneCode
210
211
  })
211
212
  }
212
213
  }
@@ -277,15 +278,16 @@ const ProfileUI = (props: ProfileParams) => {
277
278
 
278
279
  return (
279
280
  <>
281
+ <NavBar
282
+ title={t('ACCOUNT', 'Account')}
283
+ titleAlign={'center'}
284
+ onActionLeft={() => navigation.goBack()}
285
+ showCall={false}
286
+ style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 30 , marginTop: Platform.OS === 'ios' ? 50 : 40 }}
287
+ />
280
288
  <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
281
289
  <Container noPadding>
282
- <NavBar
283
- onActionLeft={() => navigation.goBack()}
284
- btnStyle={{ paddingStart: 0 }}
285
- title={t('ACCOUNT', 'Account')}
286
- isVertical
287
- style={styles.navBarStyle}
288
- />
290
+
289
291
  <CenterView style={styles.pagePadding}>
290
292
  <View style={styles.photo}>
291
293
  {user?.photo ? (
@@ -305,7 +307,7 @@ const ProfileUI = (props: ProfileParams) => {
305
307
  icon={theme.images.general.camera}
306
308
  borderColor={theme.colors.clear}
307
309
  iconStyle={{ width: 20, height: 20 }}
308
- style={{ maxWidth: 40, position: 'absolute', bottom: -2, alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
310
+ style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
309
311
  onClick={() => handleImagePicker()}
310
312
  />
311
313
  </CenterView>
@@ -326,13 +328,13 @@ const ProfileUI = (props: ProfileParams) => {
326
328
  entireModal
327
329
  >
328
330
  <VerifyPhone
329
- phone={phoneInputData.phone}
330
- verifyPhoneState={verifyPhoneState}
331
- checkPhoneCodeState={checkPhoneCodeState}
332
- handleCheckPhoneCode={handleCheckPhoneCode}
333
- setCheckPhoneCodeState={setCheckPhoneCodeState}
334
- handleVerifyCodeClick={handleVerifyCodeClick}
335
- onClose={() => setIsModalVisible(false)}
331
+ phone={phoneInputData.phone}
332
+ verifyPhoneState={verifyPhoneState}
333
+ checkPhoneCodeState={checkPhoneCodeState}
334
+ handleCheckPhoneCode={handleCheckPhoneCode}
335
+ setCheckPhoneCodeState={setCheckPhoneCodeState}
336
+ handleVerifyCodeClick={handleVerifyCodeClick}
337
+ onClose={() => setIsModalVisible(false)}
336
338
  />
337
339
  </OModal>
338
340
  </>
@@ -37,8 +37,8 @@ export const VerifyPhone = (props: any) => {
37
37
  height: 75,
38
38
  marginBottom: 25,
39
39
  borderWidth: 1,
40
- borderColor: theme.colors.inputBorderColor,
41
- borderRadius: 8,
40
+ borderColor: theme.colors.disabled,
41
+ borderRadius: 20,
42
42
  textAlign: 'center',
43
43
  fontSize: 40
44
44
  }
@@ -131,11 +131,11 @@ export const VerifyPhone = (props: any) => {
131
131
 
132
132
  return (
133
133
  <Container>
134
- <OText size={26} style={{ textAlign: 'left', fontWeight: '600', marginTop: 10, marginBottom: 30 }}>
135
- {t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
134
+ <OText size={30} style={{ textAlign: 'left' }}>
135
+ {t('VERIFY_PHONE', 'Verify Phone')}
136
136
  </OText>
137
137
  {lastNumbers && (
138
- <OText size={16} color={theme.colors.disabled}>
138
+ <OText size={20} color={theme.colors.disabled}>
139
139
  {`${t('MESSAGE_ENTER_VERIFY_CODE', 'Please, enter the verification code we sent to your mobile ending with')} **${lastNumbers}`}
140
140
  </OText>
141
141
  )}
@@ -174,7 +174,7 @@ export const VerifyPhone = (props: any) => {
174
174
  ).result?.result)?.map((e: any, i: number) => (
175
175
  <OText
176
176
  key={i}
177
- size={16}
177
+ size={20}
178
178
  color={theme.colors.error}
179
179
  >
180
180
  {`* ${t(getTraduction(e))}`}
@@ -183,9 +183,12 @@ export const VerifyPhone = (props: any) => {
183
183
  </ErrorSection>
184
184
  )}
185
185
  <ResendSection>
186
+ <OText size={16} style={{ marginRight: 5 }}>
187
+ {t('ARE_YOU_NOT_SEEING_THE_CODE', 'Are you not seeing the code?')}
188
+ </OText>
186
189
  <Pressable onPress={() => handleSendCodeAgain()}>
187
190
  <OText size={16} color={theme.colors.primary}>
188
- {t('RESEND_CODE', 'Resend code')}
191
+ {t('SEND_AGAIN', 'Send Again')}
189
192
  </OText>
190
193
  </Pressable>
191
194
  </ResendSection>
@@ -19,12 +19,13 @@ export const CountDownContainer = styled.View`
19
19
  export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
+ justify-content: center;
22
23
  margin-bottom: 30px;
23
24
  `
24
25
 
25
26
  export const WrappCountdown = styled.View`
26
27
  padding-top: 20px;
27
- padding-bottom: 50px;
28
+ padding-bottom: 20px;
28
29
  `
29
30
 
30
31
  export const InputsSection = styled.View`
@@ -1,7 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Pressable, View } from 'react-native';
2
+ import { Pressable, StyleSheet, View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+ import FastImage from 'react-native-fast-image'
5
6
  import {
6
7
  WalletList,
7
8
  useLanguage,
@@ -15,7 +16,10 @@ import {
15
16
  TransactionsWrapper,
16
17
  OTabs,
17
18
  OTab,
18
- SectionContent
19
+ SectionContent,
20
+ LoyaltyContent,
21
+ LoyaltyWrapp,
22
+ LoyaltyImg
19
23
  } from './styles'
20
24
 
21
25
  import NavBar from '../NavBar'
@@ -27,10 +31,14 @@ const WalletsUI = (props: any) => {
27
31
  const {
28
32
  navigation,
29
33
  walletList,
34
+ userLoyaltyLevel,
30
35
  transactionsList,
31
36
  setWalletSelected,
32
37
  isWalletCashEnabled,
33
- isWalletPointsEnabled
38
+ isWalletPointsEnabled,
39
+ getWallets,
40
+ refreshWallets,
41
+ setRefreshWallets
34
42
  } = props
35
43
 
36
44
  const [, t] = useLanguage()
@@ -38,12 +46,27 @@ const WalletsUI = (props: any) => {
38
46
  const [{ parsePrice }] = useUtils()
39
47
  const [{ configs }] = useConfig()
40
48
 
49
+ const styles = StyleSheet.create({
50
+ logoStyle: {
51
+ width: 120,
52
+ height: 120,
53
+ borderRadius: 8,
54
+ borderWidth: 1,
55
+ borderColor: theme.colors.border,
56
+ flexDirection: 'column',
57
+ justifyContent: 'center',
58
+ alignItems: 'center',
59
+ }
60
+ });
61
+
41
62
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
42
63
 
43
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
64
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
44
65
 
45
66
  const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
46
67
 
68
+ const loyaltyLevel = Object.keys(userLoyaltyLevel.loyaltyLevel ?? {}).length > 0 && userLoyaltyLevel.loyaltyLevel
69
+
47
70
  const walletName: any = {
48
71
  cash: {
49
72
  name: t('CASH_WALLET', 'Cash Wallet'),
@@ -74,6 +97,13 @@ const WalletsUI = (props: any) => {
74
97
  }
75
98
  }, [configs])
76
99
 
100
+ useEffect(() => {
101
+ if(refreshWallets){
102
+ getWallets()
103
+ setRefreshWallets && setRefreshWallets(false)
104
+ }
105
+ }, [refreshWallets])
106
+
77
107
  return (
78
108
  <Container>
79
109
  <NavBar
@@ -86,18 +116,22 @@ const WalletsUI = (props: any) => {
86
116
  />
87
117
 
88
118
  {!walletList.loading &&
119
+ !userLoyaltyLevel.loading &&
89
120
  !walletList.error &&
90
121
  walletList.wallets?.length > 0 &&
91
122
  (
92
123
  <>
93
- <OTabs>
124
+ <OTabs
125
+ horizontal
126
+ showsHorizontalScrollIndicator={false}
127
+ >
94
128
  {walletList.wallets?.map((wallet: any) => walletName[wallet.type]?.isActive && (
95
129
  <Pressable
96
130
  key={wallet.id}
97
131
  onPress={() => handleChangeTab(wallet)}
98
132
  >
99
- <OTab>
100
- <OText size={18} color={tabSelected === wallet.type ? theme.colors.primary : theme.colors.disabled}>
133
+ <OTab isSelected={tabSelected === wallet.type}>
134
+ <OText size={18}>
101
135
  {walletName[wallet.type]?.name}
102
136
  </OText>
103
137
  </OTab>
@@ -106,6 +140,39 @@ const WalletsUI = (props: any) => {
106
140
  </OTabs>
107
141
 
108
142
  <SectionContent>
143
+ {!!loyaltyLevel && tabSelected === 'credit_point' && (
144
+ <LoyaltyContent>
145
+ <LoyaltyWrapp>
146
+ <OText size={20}>
147
+ {`${t('LOYALTY_LEVEL_TITLE', 'Your level is')}:`}
148
+ </OText>
149
+ {loyaltyLevel.image ? (
150
+ <FastImage
151
+ style={styles.logoStyle}
152
+ source={{
153
+ uri: loyaltyLevel.image,
154
+ priority: FastImage.priority.high,
155
+ cache:FastImage.cacheControl.web
156
+ }}
157
+ resizeMode={FastImage.resizeMode.contain}
158
+ />
159
+ ) : (
160
+ <LoyaltyImg
161
+ source={theme.images.dummies.loyaltyLevel}
162
+ resizeMode='contain'
163
+ />
164
+ )}
165
+ <OText
166
+ size={22}
167
+ weight='bold'
168
+ style={{ textTransform: 'uppercase' }}
169
+ color={theme.colors.primary}
170
+ >
171
+ {loyaltyLevel.name}
172
+ </OText>
173
+ </LoyaltyWrapp>
174
+ </LoyaltyContent>
175
+ )}
109
176
  <BalanceElement>
110
177
  <OText size={20} style={{fontWeight: '600'}}>
111
178
  {currentWalletSelected?.type === 'cash'
@@ -172,7 +239,7 @@ const WalletsUI = (props: any) => {
172
239
  </>
173
240
  )}
174
241
 
175
- {walletList?.loading && (
242
+ {(walletList?.loading || userLoyaltyLevel.loading) && (
176
243
  <>
177
244
  <View>
178
245
  <Placeholder Animation={Fade}>
@@ -196,7 +263,7 @@ const WalletsUI = (props: any) => {
196
263
  </>
197
264
  )}
198
265
 
199
- {!walletList?.loading && (walletList?.error || !walletList?.wallets?.length) && (
266
+ {!walletList?.loading && !userLoyaltyLevel.loading && (walletList?.error || !walletList?.wallets?.length) && (
200
267
  <NotFoundSource
201
268
  content={walletList?.error
202
269
  ? t('ERROR_NOT_FOUND_WALLETS', 'Sorry, an error has occurred')
@@ -41,3 +41,24 @@ export const OTabs = styled.View`
41
41
  export const OTab = styled.View`
42
42
  padding-horizontal: 10px;
43
43
  `;
44
+
45
+ export const LoyaltyContent = styled.View`
46
+ width: 100%;
47
+ margin-bottom: 20px;
48
+ `
49
+
50
+ export const LoyaltyWrapp = styled.View`
51
+ flex-direction: column;
52
+ justify-content: center;
53
+ align-items: center;
54
+ `
55
+
56
+ export const LoyaltyImg = styled.ImageBackground`
57
+ position: relative;
58
+ height: 150px;
59
+ width: 100%;
60
+ display: flex;
61
+ flex-direction: column;
62
+ justify-content: center;
63
+ align-items: center;
64
+ `
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Platform } from 'react-native';
3
+ import OText from './OText';
4
+
5
+ const HeaderTitle = (props: any) => {
6
+ const { text, style } = props
7
+ return (
8
+ <OText
9
+ size={24}
10
+ style={style ?? {
11
+ marginTop: Platform.OS === 'android' ? 50 : 30,
12
+ paddingHorizontal: 40,
13
+ textTransform: 'capitalize'
14
+ }}
15
+ >
16
+ {text}
17
+ </OText>
18
+ )
19
+ }
20
+
21
+ export default HeaderTitle
@@ -91,7 +91,7 @@ const OModal = (props: Props): React.ReactElement => {
91
91
  animationType="slide"
92
92
  transparent={isTransparent}
93
93
  visible={open}
94
- onRequestClose={() => onClose()}
94
+ onRequestClose={() => onClose && onClose()}
95
95
  style={{ height: '100%', flex: 1, position: 'absolute', ...style, zIndex: 9999 }}
96
96
  >
97
97
  {isAvoidKeyBoardView ? (
@@ -11,6 +11,7 @@ import OKeyButton from './OKeyButton'
11
11
  import OModal from './OModal'
12
12
  import OAlert from './OAlert'
13
13
  import OBottomPopup from './OBottomPopup'
14
+ import HeaderTitle from './HeaderTitle'
14
15
 
15
16
  export {
16
17
  OText,
@@ -26,4 +27,5 @@ export {
26
27
  OAlert,
27
28
  OModal,
28
29
  OBottomPopup,
30
+ HeaderTitle
29
31
  }