ordering-ui-react-native 0.15.14 → 0.15.15-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/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 +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- 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 +1 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- 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/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +150 -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 +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- package/themes/business/src/types/index.tsx +2 -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/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- 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/CategoriesMenu/index.tsx +6 -5
- 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/LanguageSelector/index.tsx +12 -8
- 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/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +179 -0
- 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 +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
- 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 +49 -58
- package/themes/original/src/components/Cart/index.tsx +58 -21
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +24 -28
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- 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/LoginForm/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +50 -45
- 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 +105 -127
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- 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 +35 -2
- 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/PaymentOptionWallet/index.tsx +9 -4
- 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/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +47 -36
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/Promotions/index.tsx +234 -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 +17 -7
- 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 +70 -20
- package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
- 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 +75 -8
- 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/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +78 -25
- package/themes/original/src/utils/index.tsx +12 -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,6 +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'
|
|
21
|
+
import FastImage from 'react-native-fast-image'
|
|
22
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
19
23
|
|
|
20
24
|
import {
|
|
21
25
|
OIcon,
|
|
@@ -33,7 +37,9 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
33
37
|
const ProfileListUI = (props: ProfileParams) => {
|
|
34
38
|
const {
|
|
35
39
|
navigation,
|
|
36
|
-
formState
|
|
40
|
+
formState,
|
|
41
|
+
handleRemoveAccount,
|
|
42
|
+
removeAccountState
|
|
37
43
|
} = props;
|
|
38
44
|
|
|
39
45
|
const theme = useTheme();
|
|
@@ -90,17 +96,21 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
90
96
|
});
|
|
91
97
|
|
|
92
98
|
|
|
93
|
-
const [{ user }] = useSession();
|
|
99
|
+
const [{ user }, { logout }] = useSession();
|
|
94
100
|
const [, t] = useLanguage();
|
|
95
101
|
const [{ configs }] = useConfig();
|
|
96
102
|
const [, { showToast }] = useToast();
|
|
97
103
|
const { errors } = useForm();
|
|
98
104
|
|
|
105
|
+
const isAdmin = user?.level === 0
|
|
106
|
+
|
|
99
107
|
const { height } = useWindowDimensions();
|
|
100
108
|
const { top, bottom } = useSafeAreaInsets();
|
|
101
109
|
|
|
102
|
-
const
|
|
110
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
103
111
|
|
|
112
|
+
const isWalletEnabled = 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
|
|
104
114
|
const onRedirect = (route: string, params?: any) => {
|
|
105
115
|
navigation.navigate(route, params)
|
|
106
116
|
}
|
|
@@ -134,25 +144,42 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
134
144
|
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
|
|
135
145
|
}
|
|
136
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
|
+
|
|
137
165
|
return (
|
|
138
|
-
<View style={{ flex: 1, height: height - top - bottom - 62 }}>
|
|
139
|
-
<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 }}>
|
|
140
168
|
{t('PROFILE', 'Profile')}
|
|
141
|
-
</OText>
|
|
169
|
+
</OText> */}
|
|
142
170
|
<CenterView style={styles.pagePadding}>
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
171
|
+
{user?.photo && (
|
|
172
|
+
<View style={styles.photo}>
|
|
173
|
+
<FastImage
|
|
174
|
+
style={{ height: 60, width: 60, borderRadius: 8 }}
|
|
175
|
+
source={{
|
|
176
|
+
uri: user?.photo,
|
|
177
|
+
priority: FastImage.priority.normal,
|
|
178
|
+
}}
|
|
179
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
151
180
|
/>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)}
|
|
155
|
-
</View>
|
|
181
|
+
</View>
|
|
182
|
+
)}
|
|
156
183
|
<View style={{ flexBasis: '70%' }}>
|
|
157
184
|
<OText size={20} lineHeight={30} weight={Platform.OS === 'ios' ? '500' : 'bold'} color={theme.colors.textNormal}>{user?.name} {user?.lastname}</OText>
|
|
158
185
|
<TouchableOpacity onPress={() => navigation.navigate('ProfileForm', { ...detailProps })}>
|
|
@@ -166,7 +193,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
166
193
|
<Actions>
|
|
167
194
|
<ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
168
195
|
<OIcon src={theme.images.general.pin} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
169
|
-
<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>
|
|
170
197
|
</ListItem>
|
|
171
198
|
<ListItem onPress={() => onRedirect('Messages', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
172
199
|
<MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
@@ -178,18 +205,41 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
178
205
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
|
|
179
206
|
</ListItem>
|
|
180
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
|
+
)}
|
|
181
214
|
<ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
|
|
182
215
|
<OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
183
216
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
|
|
184
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>
|
|
185
222
|
</Actions>
|
|
186
223
|
|
|
187
224
|
<Actions>
|
|
188
225
|
<LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
|
|
189
226
|
<View style={{ height: 17 }} />
|
|
190
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>
|
|
191
233
|
</Actions>
|
|
192
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
|
+
/>
|
|
193
243
|
</View>
|
|
194
244
|
);
|
|
195
245
|
};
|
|
@@ -21,6 +21,7 @@ import NavBar from '../NavBar';
|
|
|
21
21
|
import { Container } from '../../layouts/Container';
|
|
22
22
|
import { VerifyPhone } from '../VerifyPhone'
|
|
23
23
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
24
|
+
import FastImage from 'react-native-fast-image'
|
|
24
25
|
|
|
25
26
|
const ProfileUI = (props: ProfileParams) => {
|
|
26
27
|
const {
|
|
@@ -55,7 +56,8 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
55
56
|
},
|
|
56
57
|
pagePadding: {
|
|
57
58
|
paddingLeft: 40,
|
|
58
|
-
paddingRight: 40
|
|
59
|
+
paddingRight: 40,
|
|
60
|
+
justifyContent: 'center',
|
|
59
61
|
},
|
|
60
62
|
navBarStyle: {
|
|
61
63
|
paddingLeft: 40,
|
|
@@ -204,8 +206,8 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
204
206
|
},
|
|
205
207
|
});
|
|
206
208
|
handleSendVerifyCode({
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
cellphone: cellphone,
|
|
210
|
+
country_phone_code: countryPhoneCode
|
|
209
211
|
})
|
|
210
212
|
}
|
|
211
213
|
}
|
|
@@ -276,24 +278,26 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
276
278
|
|
|
277
279
|
return (
|
|
278
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
|
+
/>
|
|
279
288
|
<KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
|
|
280
289
|
<Container noPadding>
|
|
281
|
-
|
|
282
|
-
onActionLeft={() => navigation.goBack()}
|
|
283
|
-
btnStyle={{ paddingStart: 0 }}
|
|
284
|
-
title={t('ACCOUNT', 'Account')}
|
|
285
|
-
isVertical
|
|
286
|
-
style={styles.navBarStyle}
|
|
287
|
-
/>
|
|
290
|
+
|
|
288
291
|
<CenterView style={styles.pagePadding}>
|
|
289
292
|
<View style={styles.photo}>
|
|
290
293
|
{user?.photo ? (
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
<FastImage
|
|
295
|
+
style={{ height: 60, width: 80, borderRadius: 8 }}
|
|
296
|
+
source={{
|
|
297
|
+
uri: user?.photo,
|
|
298
|
+
priority: FastImage.priority.normal,
|
|
299
|
+
}}
|
|
300
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
297
301
|
/>
|
|
298
302
|
) : (
|
|
299
303
|
<Ionicons name='person-outline' size={50} />
|
|
@@ -303,7 +307,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
303
307
|
icon={theme.images.general.camera}
|
|
304
308
|
borderColor={theme.colors.clear}
|
|
305
309
|
iconStyle={{ width: 20, height: 20 }}
|
|
306
|
-
style={{ maxWidth: 40, position: 'absolute',
|
|
310
|
+
style={{ maxWidth: 40, position: 'absolute', alignSelf: 'center', backgroundColor: '#000', opacity: 0.5 }}
|
|
307
311
|
onClick={() => handleImagePicker()}
|
|
308
312
|
/>
|
|
309
313
|
</CenterView>
|
|
@@ -324,13 +328,13 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
324
328
|
entireModal
|
|
325
329
|
>
|
|
326
330
|
<VerifyPhone
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
phone={phoneInputData.phone}
|
|
332
|
+
verifyPhoneState={verifyPhoneState}
|
|
333
|
+
checkPhoneCodeState={checkPhoneCodeState}
|
|
334
|
+
handleCheckPhoneCode={handleCheckPhoneCode}
|
|
335
|
+
setCheckPhoneCodeState={setCheckPhoneCodeState}
|
|
336
|
+
handleVerifyCodeClick={handleVerifyCodeClick}
|
|
337
|
+
onClose={() => setIsModalVisible(false)}
|
|
334
338
|
/>
|
|
335
339
|
</OModal>
|
|
336
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
64
|
const isWalletEnabled = 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 && (
|
|
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
|
|
@@ -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
|
}
|