ordering-ui-react-native 0.15.11 → 0.15.13-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/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +3 -2
- 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 +9 -9
- 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/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 +28 -2
- package/themes/original/src/components/AppleLogin/index.tsx +119 -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/BusinessesListing/index.tsx +40 -53
- package/themes/original/src/components/Cart/index.tsx +41 -10
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +23 -27
- 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/ForgotPasswordForm/index.tsx +8 -12
- 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 +156 -70
- package/themes/original/src/components/LoginForm/styles.tsx +6 -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 +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- 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/Promotions/index.tsx +233 -0
- package/themes/original/src/components/Promotions/styles.tsx +58 -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/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +39 -18
- 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 +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +29 -17
- package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
- 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 +58 -4
- 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 +70 -23
- 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,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { View, StyleSheet, useWindowDimensions, Keyboard } from 'react-native';
|
|
3
|
-
import { useLanguage, useSession
|
|
3
|
+
import { useLanguage, useSession } from 'ordering-components/native';
|
|
4
4
|
import {
|
|
5
5
|
StripeProvider,
|
|
6
6
|
CardField,
|
|
@@ -13,7 +13,6 @@ import { ErrorMessage } from './styles';
|
|
|
13
13
|
import { StripeElementsForm as StripeFormController } from './naked';
|
|
14
14
|
import { OButton, OText } from '../shared';
|
|
15
15
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
16
|
-
import { StripeMethodForm } from '../../../../../src/components/StripeMethodForm';
|
|
17
16
|
|
|
18
17
|
const StripeElementsFormUI = (props: any) => {
|
|
19
18
|
const {
|
|
@@ -23,17 +22,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
23
22
|
businessId,
|
|
24
23
|
requirements,
|
|
25
24
|
stripeTokenHandler,
|
|
26
|
-
methodsPay,
|
|
27
|
-
paymethod,
|
|
28
|
-
onCancel,
|
|
29
|
-
cart,
|
|
30
25
|
} = props;
|
|
31
26
|
|
|
32
27
|
const theme = useTheme();
|
|
33
28
|
|
|
34
29
|
const [, t] = useLanguage();
|
|
35
30
|
const [{ user }] = useSession();
|
|
36
|
-
const [{ configs }] = useConfig();
|
|
37
31
|
const [card, setCard] = useState<any>(null);
|
|
38
32
|
const [isCompleted, setIsCompleted] = useState(false);
|
|
39
33
|
const [errors, setErrors] = useState('')
|
|
@@ -43,30 +37,30 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
43
37
|
const { top, bottom } = useSafeAreaInsets();
|
|
44
38
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
let billingDetails: any = {}
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
if (user?.name || user?.lastname) {
|
|
43
|
+
if (user?.name) {
|
|
44
|
+
billingDetails.name = user?.name
|
|
45
|
+
}
|
|
46
|
+
if (user?.lastname) {
|
|
47
|
+
billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
|
|
48
|
+
}
|
|
49
|
+
}
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
if (user?.email) {
|
|
52
|
+
billingDetails.email = user?.email
|
|
53
|
+
}
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
if (user?.address) {
|
|
56
|
+
billingDetails.addressLine1 = user?.address
|
|
57
|
+
}
|
|
64
58
|
|
|
65
59
|
const createPayMethod = async () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
const params: any = { type: 'Card' }
|
|
61
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
62
|
+
params.billingDetails = billingDetails
|
|
63
|
+
}
|
|
70
64
|
try {
|
|
71
65
|
setCreatePmLoading(true)
|
|
72
66
|
const { paymentMethod } = await createPaymentMethod(params);
|
|
@@ -99,10 +93,10 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
99
93
|
createPayMethod();
|
|
100
94
|
return
|
|
101
95
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
const params: any = { type: 'Card' }
|
|
97
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
98
|
+
params.billingDetails = billingDetails
|
|
99
|
+
}
|
|
106
100
|
try {
|
|
107
101
|
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
108
102
|
|
|
@@ -158,35 +152,27 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
158
152
|
<View style={{ ...styles.container, height: height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
|
|
159
153
|
{publicKey ? (
|
|
160
154
|
<View style={{ flex: 1 }}>
|
|
161
|
-
<StripeProvider
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
width: '100%',
|
|
183
|
-
height: 50,
|
|
184
|
-
marginVertical: 30,
|
|
185
|
-
zIndex: 9999,
|
|
186
|
-
}}
|
|
187
|
-
onCardChange={(cardDetails: any) => setCard(cardDetails)}
|
|
188
|
-
/>
|
|
189
|
-
)}
|
|
155
|
+
<StripeProvider publishableKey={publicKey}>
|
|
156
|
+
<CardField
|
|
157
|
+
postalCodeEnabled={false}
|
|
158
|
+
cardStyle={{
|
|
159
|
+
backgroundColor: '#FFFFFF',
|
|
160
|
+
textColor: '#000000',
|
|
161
|
+
fontSize: 17,
|
|
162
|
+
styles: {
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
}}
|
|
166
|
+
style={{
|
|
167
|
+
width: '100%',
|
|
168
|
+
height: 50,
|
|
169
|
+
marginVertical: 50,
|
|
170
|
+
borderWidth: 1,
|
|
171
|
+
borderColor: theme.colors.border,
|
|
172
|
+
borderRadius: 7.6,
|
|
173
|
+
}}
|
|
174
|
+
onCardChange={(cardDetails: any) => setCard(cardDetails)}
|
|
175
|
+
/>
|
|
190
176
|
</StripeProvider>
|
|
191
177
|
{!!errors && (
|
|
192
178
|
<ErrorMessage>
|
|
@@ -211,19 +197,16 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
211
197
|
</OText>
|
|
212
198
|
</ErrorMessage>
|
|
213
199
|
)}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
|
|
225
|
-
/>
|
|
226
|
-
)}
|
|
200
|
+
<OButton
|
|
201
|
+
text={t('SAVE_CARD', 'Save card')}
|
|
202
|
+
bgColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
203
|
+
borderColor={isCompleted ? theme.colors.primary : theme.colors.backgroundGray}
|
|
204
|
+
style={styles.btnAddStyle}
|
|
205
|
+
textStyle={{ color: 'white', fontSize: 14 }}
|
|
206
|
+
imgRightSrc={null}
|
|
207
|
+
onClick={isCompleted ? () => handleSaveCard() : () => { }}
|
|
208
|
+
isLoading={confirmSetupLoading || values.loadingAdd || createPmLoading}
|
|
209
|
+
/>
|
|
227
210
|
</View>
|
|
228
211
|
)
|
|
229
212
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useLanguage } from 'ordering-components/native'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
3
|
import { SingleProductCard } from '../SingleProductCard'
|
|
4
4
|
import { TaxInformationContainer, ProductContainer } from './styles'
|
|
5
5
|
import { OText } from '../shared'
|
|
@@ -9,12 +9,13 @@ interface taxInformationParams {
|
|
|
9
9
|
name: string,
|
|
10
10
|
description?: string,
|
|
11
11
|
rate: string | number,
|
|
12
|
-
type: number,
|
|
12
|
+
type: string | number,
|
|
13
13
|
fixed?: number,
|
|
14
14
|
percentage?: number,
|
|
15
15
|
id: number,
|
|
16
|
-
discounts?: any
|
|
17
|
-
|
|
16
|
+
discounts?: any,
|
|
17
|
+
rate_type?: number
|
|
18
|
+
},
|
|
18
19
|
products: Array<any>,
|
|
19
20
|
type: string
|
|
20
21
|
}
|
|
@@ -27,8 +28,13 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
27
28
|
} = props
|
|
28
29
|
|
|
29
30
|
const [, t] = useLanguage()
|
|
31
|
+
const [{ parsePrice }] = useUtils()
|
|
30
32
|
|
|
31
33
|
const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
|
|
34
|
+
const offersHideArray = ['offer_target_2', 'offer_target_3']
|
|
35
|
+
const hideProductsSectionOffers = offersHideArray.includes(type)
|
|
36
|
+
const dataHideArray : Array<string | number> = ['platform', 'business']
|
|
37
|
+
const hideProductsSectionData = dataHideArray.includes(data.type)
|
|
32
38
|
|
|
33
39
|
const getFilterValidation = (product: any) => {
|
|
34
40
|
return (
|
|
@@ -52,8 +58,12 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
52
58
|
|
|
53
59
|
return (
|
|
54
60
|
<TaxInformationContainer>
|
|
61
|
+
<OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
62
|
+
{`${data?.name ||
|
|
63
|
+
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${data?.rate_type !== 2 ? `(${typeof data?.rate === 'number' ? `${data?.rate}%` : `${parsePrice(data?.fixed ?? 0)} + ${data?.percentage}%`})` : ''} `}
|
|
64
|
+
</OText>
|
|
55
65
|
{!!data?.description ? (
|
|
56
|
-
<OText size={
|
|
66
|
+
<OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
57
67
|
{t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && !type?.includes('offer') && includedOnPriceString}
|
|
58
68
|
</OText>
|
|
59
69
|
) : (
|
|
@@ -61,7 +71,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
61
71
|
{t('WITHOUT_DESCRIPTION', 'Without description')}
|
|
62
72
|
</OText>
|
|
63
73
|
)}
|
|
64
|
-
{!
|
|
74
|
+
{!hideProductsSectionOffers && !hideProductsSectionData && (
|
|
65
75
|
<>
|
|
66
76
|
<OText>{t('OTHER_PRODUCTS_WITH_THIS', 'Other products with this')} {getTypeString()}:</OText>
|
|
67
77
|
<ProductContainer>
|
|
@@ -157,6 +157,12 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
157
157
|
</TopActions>
|
|
158
158
|
</TopBar>
|
|
159
159
|
<ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
160
|
+
{productsList.length > 0 &&
|
|
161
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
162
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
163
|
+
<UpsellingLayout />
|
|
164
|
+
</View>
|
|
165
|
+
}
|
|
160
166
|
<View style={{ paddingHorizontal: 40 }}>
|
|
161
167
|
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
162
168
|
<OrderSummary
|
|
@@ -165,12 +171,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
165
171
|
onNavigationRedirect={onNavigationRedirect}
|
|
166
172
|
/>
|
|
167
173
|
</View>
|
|
168
|
-
{productsList.length > 0 &&
|
|
169
|
-
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
170
|
-
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
171
|
-
<UpsellingLayout />
|
|
172
|
-
</View>
|
|
173
|
-
}
|
|
174
174
|
</ScrollView>
|
|
175
175
|
<View
|
|
176
176
|
style={{
|
|
@@ -3,17 +3,14 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
3
3
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
4
|
|
|
5
5
|
import { UDContainer, UDHeader, UDForm, UDInfo, EditBtn } from './styles';
|
|
6
|
+
|
|
6
7
|
import {
|
|
7
8
|
UserFormDetails as UserFormController,
|
|
8
9
|
useLanguage,
|
|
9
10
|
useSession,
|
|
10
|
-
ToastType,
|
|
11
|
-
useToast
|
|
12
11
|
} from 'ordering-components/native';
|
|
13
12
|
import { useTheme } from 'styled-components/native';
|
|
14
|
-
import { OIcon, OText
|
|
15
|
-
import { VerifyPhone } from '../VerifyPhone';
|
|
16
|
-
import Spinner from 'react-native-loading-spinner-overlay';
|
|
13
|
+
import { OIcon, OText } from '../shared';
|
|
17
14
|
|
|
18
15
|
import { UserFormDetailsUI } from '../UserFormDetails';
|
|
19
16
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
@@ -29,33 +26,15 @@ const UserDetailsUI = (props: any) => {
|
|
|
29
26
|
isUserDetailsEdit,
|
|
30
27
|
phoneUpdate,
|
|
31
28
|
togglePhoneUpdate,
|
|
32
|
-
isCheckout
|
|
33
|
-
checkPhoneCodeState,
|
|
34
|
-
handleSendVerifyCode,
|
|
35
|
-
handleCheckPhoneCode,
|
|
36
|
-
verifyPhoneState,
|
|
37
|
-
isVerifiedPhone,
|
|
38
|
-
setCheckPhoneCodeState
|
|
29
|
+
isCheckout
|
|
39
30
|
} = props
|
|
40
31
|
|
|
41
32
|
const theme = useTheme();
|
|
42
33
|
|
|
43
34
|
const [, t] = useLanguage()
|
|
44
35
|
const [{ user }] = useSession()
|
|
45
|
-
const [, { showToast }] = useToast();
|
|
46
|
-
|
|
47
36
|
const userData = props.userData || (!formState.result.error && formState.result?.result) || user
|
|
48
37
|
|
|
49
|
-
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
50
|
-
const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
|
|
51
|
-
const [phoneInputData, setPhoneInputData] = useState({
|
|
52
|
-
error: '',
|
|
53
|
-
phone: {
|
|
54
|
-
country_phone_code: null,
|
|
55
|
-
cellphone: null,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
38
|
|
|
60
39
|
useEffect(() => {
|
|
61
40
|
if (isUserDetailsEdit) {
|
|
@@ -76,54 +55,6 @@ const UserDetailsUI = (props: any) => {
|
|
|
76
55
|
}
|
|
77
56
|
}, [user?.country_phone_code])
|
|
78
57
|
|
|
79
|
-
const handleVerifyCodeClick = () => {
|
|
80
|
-
if (formState?.changes?.cellphone && formState?.changes?.country_phone_code) {
|
|
81
|
-
const { cellphone, country_phone_code: countryPhoneCode } = formState?.changes
|
|
82
|
-
|
|
83
|
-
setPhoneInputData({
|
|
84
|
-
error: '',
|
|
85
|
-
phone: {
|
|
86
|
-
country_phone_code: countryPhoneCode,
|
|
87
|
-
cellphone: cellphone,
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
handleSendVerifyCode({
|
|
91
|
-
cellphone: cellphone,
|
|
92
|
-
country_phone_code: countryPhoneCode
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
if (willVerifyOtpState) handleVerifyCodeClick()
|
|
99
|
-
}, [willVerifyOtpState])
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (verifyPhoneState && !verifyPhoneState?.loading) {
|
|
103
|
-
if (verifyPhoneState.result?.error) {
|
|
104
|
-
const message = typeof verifyPhoneState?.result?.result === 'string'
|
|
105
|
-
? verifyPhoneState?.result?.result
|
|
106
|
-
: verifyPhoneState?.result?.result[0]
|
|
107
|
-
verifyPhoneState.result?.result && showToast(
|
|
108
|
-
ToastType.Error,
|
|
109
|
-
message
|
|
110
|
-
)
|
|
111
|
-
setWillVerifyOtpState(false)
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const okResult = verifyPhoneState.result?.result === 'OK'
|
|
116
|
-
if (okResult) {
|
|
117
|
-
!isModalVisible && setIsModalVisible(true)
|
|
118
|
-
setWillVerifyOtpState(false)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, [verifyPhoneState])
|
|
122
|
-
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
if (isVerifiedPhone) setIsModalVisible(false)
|
|
125
|
-
}, [isVerifiedPhone])
|
|
126
|
-
|
|
127
58
|
return (
|
|
128
59
|
<>
|
|
129
60
|
{(validationFields.loading || formState.loading) && (
|
|
@@ -186,32 +117,10 @@ const UserDetailsUI = (props: any) => {
|
|
|
186
117
|
)}
|
|
187
118
|
</UDInfo>
|
|
188
119
|
) : (
|
|
189
|
-
<UserFormDetailsUI
|
|
190
|
-
{...props}
|
|
191
|
-
phoneUpdate={phoneUpdate}
|
|
192
|
-
togglePhoneUpdate={togglePhoneUpdate}
|
|
193
|
-
isCheckout={isCheckout}
|
|
194
|
-
setWillVerifyOtpState={setWillVerifyOtpState}
|
|
195
|
-
/>
|
|
120
|
+
<UserFormDetailsUI {...props} phoneUpdate={phoneUpdate} togglePhoneUpdate={togglePhoneUpdate} isCheckout={isCheckout} />
|
|
196
121
|
)}
|
|
197
122
|
</UDContainer>
|
|
198
123
|
)}
|
|
199
|
-
<OModal
|
|
200
|
-
open={isModalVisible}
|
|
201
|
-
onClose={() => setIsModalVisible(false)}
|
|
202
|
-
entireModal
|
|
203
|
-
>
|
|
204
|
-
<VerifyPhone
|
|
205
|
-
phone={phoneInputData.phone}
|
|
206
|
-
verifyPhoneState={verifyPhoneState}
|
|
207
|
-
checkPhoneCodeState={checkPhoneCodeState}
|
|
208
|
-
handleCheckPhoneCode={handleCheckPhoneCode}
|
|
209
|
-
setCheckPhoneCodeState={setCheckPhoneCodeState}
|
|
210
|
-
handleVerifyCodeClick={handleVerifyCodeClick}
|
|
211
|
-
onClose={() => setIsModalVisible(false)}
|
|
212
|
-
/>
|
|
213
|
-
</OModal>
|
|
214
|
-
<Spinner visible={verifyPhoneState?.loading} />
|
|
215
124
|
</>
|
|
216
125
|
)
|
|
217
126
|
}
|
|
@@ -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 = {
|
|
@@ -216,13 +211,6 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
216
211
|
}
|
|
217
212
|
}
|
|
218
213
|
}, [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
214
|
return (
|
|
227
215
|
<>
|
|
228
216
|
<UDForm>
|
|
@@ -16,6 +16,9 @@ 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'
|
|
19
22
|
|
|
20
23
|
import {
|
|
21
24
|
OIcon,
|
|
@@ -100,7 +103,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
100
103
|
const { top, bottom } = useSafeAreaInsets();
|
|
101
104
|
|
|
102
105
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
103
|
-
|
|
106
|
+
const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
|
|
104
107
|
const onRedirect = (route: string, params?: any) => {
|
|
105
108
|
navigation.navigate(route, params)
|
|
106
109
|
}
|
|
@@ -135,24 +138,23 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
return (
|
|
138
|
-
<View style={{ flex: 1, height: height - top - bottom - 62 }}>
|
|
139
|
-
<OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
|
|
141
|
+
<View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
|
|
142
|
+
{/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
|
|
140
143
|
{t('PROFILE', 'Profile')}
|
|
141
|
-
</OText>
|
|
144
|
+
</OText> */}
|
|
142
145
|
<CenterView style={styles.pagePadding}>
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
{user?.photo && (
|
|
147
|
+
<View style={styles.photo}>
|
|
148
|
+
<FastImage
|
|
149
|
+
style={{ height: 60, width: 60, borderRadius: 8 }}
|
|
150
|
+
source={{
|
|
151
|
+
uri: user?.photo,
|
|
152
|
+
priority: FastImage.priority.normal,
|
|
153
|
+
}}
|
|
154
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
151
155
|
/>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)}
|
|
155
|
-
</View>
|
|
156
|
+
</View>
|
|
157
|
+
)}
|
|
156
158
|
<View style={{ flexBasis: '70%' }}>
|
|
157
159
|
<OText size={20} lineHeight={30} weight={Platform.OS === 'ios' ? '500' : 'bold'} color={theme.colors.textNormal}>{user?.name} {user?.lastname}</OText>
|
|
158
160
|
<TouchableOpacity onPress={() => navigation.navigate('ProfileForm', { ...detailProps })}>
|
|
@@ -166,7 +168,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
166
168
|
<Actions>
|
|
167
169
|
<ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
168
170
|
<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('
|
|
171
|
+
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SAVED_PLACES', 'My saved places')}</OText>
|
|
170
172
|
</ListItem>
|
|
171
173
|
<ListItem onPress={() => onRedirect('Messages', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
172
174
|
<MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
@@ -178,10 +180,20 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
178
180
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
|
|
179
181
|
</ListItem>
|
|
180
182
|
)}
|
|
183
|
+
{IsPromotionsEnabled && (
|
|
184
|
+
<ListItem onPress={() => onRedirect('Promotions', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
185
|
+
<MaterialIcons name='local-offer' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
186
|
+
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('PROMOTIONS', 'Promotions')}</OText>
|
|
187
|
+
</ListItem>
|
|
188
|
+
)}
|
|
181
189
|
<ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
|
|
182
190
|
<OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
183
191
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
|
|
184
192
|
</ListItem>
|
|
193
|
+
<ListItem onPress={() => navigation.navigate('Sessions')} activeOpacity={0.7}>
|
|
194
|
+
<Ionicons name='md-list-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
195
|
+
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SESSIONS', 'Sessions')}</OText>
|
|
196
|
+
</ListItem>
|
|
185
197
|
</Actions>
|
|
186
198
|
|
|
187
199
|
<Actions>
|
|
@@ -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 {
|
|
@@ -288,12 +289,13 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
288
289
|
<CenterView style={styles.pagePadding}>
|
|
289
290
|
<View style={styles.photo}>
|
|
290
291
|
{user?.photo ? (
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
<FastImage
|
|
293
|
+
style={{ height: 60, width: 80, borderRadius: 8 }}
|
|
294
|
+
source={{
|
|
295
|
+
uri: user?.photo,
|
|
296
|
+
priority: FastImage.priority.normal,
|
|
297
|
+
}}
|
|
298
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
297
299
|
/>
|
|
298
300
|
) : (
|
|
299
301
|
<Ionicons name='person-outline' size={50} />
|
|
@@ -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`
|