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.
- package/package.json +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/config.json +0 -2
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +5 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/NewOrderNotification/index.tsx +61 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +54 -50
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +51 -58
- package/themes/original/src/components/Cart/index.tsx +19 -15
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +42 -27
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +389 -156
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +35 -28
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +76 -61
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +1 -1
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +62 -5
- package/themes/original/src/utils/index.tsx +28 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Platform, StyleSheet,
|
|
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
|
-
|
|
145
|
-
|
|
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
|
-
<
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
|
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
|
-
|
|
145
|
-
{
|
|
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
|
-
|
|
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('
|
|
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
|
-
|
|
209
|
-
|
|
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
|
-
|
|
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',
|
|
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
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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.
|
|
41
|
-
borderRadius:
|
|
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={
|
|
135
|
-
{t('
|
|
134
|
+
<OText size={30} style={{ textAlign: 'left' }}>
|
|
135
|
+
{t('VERIFY_PHONE', 'Verify Phone')}
|
|
136
136
|
</OText>
|
|
137
137
|
{lastNumbers && (
|
|
138
|
-
<OText size={
|
|
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={
|
|
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('
|
|
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:
|
|
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}
|
|
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
|
}
|