ordering-ui-react-native 0.21.91 → 0.21.92-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 +6 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +14 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +69 -33
- package/themes/business/src/components/OrderDetails/Business.tsx +74 -9
- package/themes/business/src/components/OrderDetails/Delivery.tsx +131 -51
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +62 -24
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +221 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +210 -65
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +251 -159
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +42 -20
- package/themes/business/src/components/PreviousOrders/index.tsx +76 -66
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +1 -1
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +43 -25
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +14 -4
- package/themes/business/src/utils/index.tsx +25 -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/Checkout/index.tsx +6 -0
- 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/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +11 -0
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +43 -15
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +104 -58
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -10
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +29 -17
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +129 -85
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -1
- package/themes/original/src/components/MyOrders/index.tsx +10 -23
- package/themes/original/src/components/NavBar/index.tsx +7 -4
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +13 -10
- package/themes/original/src/components/OrderDetails/index.tsx +42 -19
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +16 -6
- package/themes/original/src/components/OrderSummary/index.tsx +28 -9
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +3 -2
- package/themes/original/src/components/UserFormDetails/index.tsx +154 -130
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -14,7 +14,8 @@ interface taxInformationParams {
|
|
|
14
14
|
percentage?: number,
|
|
15
15
|
id: number,
|
|
16
16
|
discounts?: any,
|
|
17
|
-
rate_type?: number
|
|
17
|
+
rate_type?: number,
|
|
18
|
+
target?: string
|
|
18
19
|
},
|
|
19
20
|
products: Array<any>,
|
|
20
21
|
type: string
|
|
@@ -34,7 +35,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
34
35
|
const offersHideArray = ['offer_target_2', 'offer_target_3']
|
|
35
36
|
const hideProductsSectionOffers = offersHideArray.includes(type)
|
|
36
37
|
const dataHideArray : Array<string | number> = ['platform', 'business']
|
|
37
|
-
const hideProductsSectionData = dataHideArray.includes(data.type)
|
|
38
|
+
const hideProductsSectionData = dataHideArray.includes(data.type) || data?.target === 'delivery_fee'
|
|
38
39
|
|
|
39
40
|
const getFilterValidation = (product: any) => {
|
|
40
41
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { Platform, StyleSheet, View } from 'react-native'
|
|
2
|
+
import { Platform, StyleSheet, View, Vibration } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
5
5
|
useOrder,
|
|
@@ -20,7 +20,7 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
|
20
20
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
21
21
|
import { UpsellingLayout } from './UpsellingLayout';
|
|
22
22
|
|
|
23
|
-
export const UpsellingContent = (props
|
|
23
|
+
export const UpsellingContent = (props: any) => {
|
|
24
24
|
const {
|
|
25
25
|
onGoBack,
|
|
26
26
|
handleUpsellingPage,
|
|
@@ -44,12 +44,10 @@ export const UpsellingContent = (props : any) => {
|
|
|
44
44
|
const commentDelayTime = isChewLayout ? 500 : null
|
|
45
45
|
|
|
46
46
|
const cartList = (carts && Object.values(carts).filter((_cart: any) => _cart?.products?.length > 0 && _cart.uuid !== cart?.uuid)) || []
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
const styles = StyleSheet.create({
|
|
49
49
|
closeUpsellingButton: {
|
|
50
50
|
borderRadius: 7.6,
|
|
51
|
-
borderColor: theme.colors.primary,
|
|
52
|
-
backgroundColor: theme.colors.primary,
|
|
53
51
|
borderWidth: 1,
|
|
54
52
|
alignSelf: 'center',
|
|
55
53
|
height: 44,
|
|
@@ -92,6 +90,11 @@ export const UpsellingContent = (props : any) => {
|
|
|
92
90
|
setShowTitle(contentOffset.y > 30)
|
|
93
91
|
}
|
|
94
92
|
|
|
93
|
+
const handleClickCheckout = () => {
|
|
94
|
+
Vibration.vibrate(100)
|
|
95
|
+
handleUpsellingPage(cart)
|
|
96
|
+
}
|
|
97
|
+
|
|
95
98
|
return (
|
|
96
99
|
<>
|
|
97
100
|
<View style={styles.wrapperNavbar}>
|
|
@@ -160,9 +163,9 @@ export const UpsellingContent = (props : any) => {
|
|
|
160
163
|
<OButton
|
|
161
164
|
imgRightSrc=''
|
|
162
165
|
text={t('CHECKOUT', 'Checkout')}
|
|
166
|
+
textStyle={{ fontSize: 14 }}
|
|
163
167
|
style={{ ...styles.closeUpsellingButton }}
|
|
164
|
-
|
|
165
|
-
onClick={() => handleUpsellingPage(cart)}
|
|
168
|
+
onClick={() => handleClickCheckout()}
|
|
166
169
|
/>
|
|
167
170
|
</View>
|
|
168
171
|
</>
|
|
@@ -25,6 +25,9 @@ export const UpsellingLayout = (props : any) => {
|
|
|
25
25
|
const [{ parsePrice }] = useUtils()
|
|
26
26
|
const [, t] = useLanguage()
|
|
27
27
|
|
|
28
|
+
const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
|
|
29
|
+
|
|
30
|
+
|
|
28
31
|
const styles = StyleSheet.create({
|
|
29
32
|
imageStyle: {
|
|
30
33
|
width: 73,
|
|
@@ -66,9 +69,11 @@ export const UpsellingLayout = (props : any) => {
|
|
|
66
69
|
<OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
|
|
67
70
|
</AddButton>
|
|
68
71
|
</View>
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
+
{(product?.images || !hideProductDummyLogo) && (
|
|
73
|
+
<View>
|
|
74
|
+
<OIcon url={product?.images || theme?.images?.dummies?.product} style={styles.imageStyle} />
|
|
75
|
+
</View>
|
|
76
|
+
)}
|
|
72
77
|
</Item>
|
|
73
78
|
)) : (
|
|
74
79
|
<OText>
|
|
@@ -35,7 +35,8 @@ const UserDetailsUI = (props: any) => {
|
|
|
35
35
|
handleSendVerifyCode,
|
|
36
36
|
verifyPhoneState,
|
|
37
37
|
setFormState,
|
|
38
|
-
setIsOpen
|
|
38
|
+
setIsOpen,
|
|
39
|
+
isCheckoutPlace
|
|
39
40
|
} = props
|
|
40
41
|
|
|
41
42
|
const theme = useTheme();
|
|
@@ -158,7 +159,7 @@ const UserDetailsUI = (props: any) => {
|
|
|
158
159
|
{t('CUSTOMER_DETAILS', 'Customer Details')}
|
|
159
160
|
</OText>
|
|
160
161
|
)}
|
|
161
|
-
{cartStatus !== 2 && !
|
|
162
|
+
{cartStatus !== 2 && !isCheckoutPlace && (
|
|
162
163
|
!isEdit ? (
|
|
163
164
|
<EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>
|
|
164
165
|
<OIcon
|
|
@@ -16,6 +16,8 @@ import { ListItem } from '../UserProfile/styles';
|
|
|
16
16
|
import moment from 'moment';
|
|
17
17
|
import { DatePickerUI } from '../DatePicker';
|
|
18
18
|
|
|
19
|
+
const CONDITIONAL_CODES = ['PR']
|
|
20
|
+
|
|
19
21
|
export const UserFormDetailsUI = (props: any) => {
|
|
20
22
|
const {
|
|
21
23
|
isEdit,
|
|
@@ -36,7 +38,11 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
36
38
|
isCheckout,
|
|
37
39
|
setIsOpen,
|
|
38
40
|
handleRemoveAccount,
|
|
39
|
-
isProfile
|
|
41
|
+
isProfile,
|
|
42
|
+
isGuest,
|
|
43
|
+
isOrderTypeValidationField,
|
|
44
|
+
checkoutFields,
|
|
45
|
+
isCheckoutPlace
|
|
40
46
|
} = props;
|
|
41
47
|
|
|
42
48
|
const theme = useTheme();
|
|
@@ -95,8 +101,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
95
101
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
96
102
|
|
|
97
103
|
const isAdmin = user?.level === 0
|
|
98
|
-
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false)
|
|
99
|
-
const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
|
|
104
|
+
const showInputPhoneNumber = isOrderTypeValidationField ? checkoutFields?.find(field => field?.validation_field?.code === 'mobile_phone')?.enabled : (validationFields?.fields?.checkout?.cellphone?.enabled ?? false)
|
|
105
|
+
const showInputBirthday = isOrderTypeValidationField ? checkoutFields?.find(field => field?.validation_field?.code === 'birthdate')?.enabled : (validationFields?.fields?.checkout?.birthdate?.enabled ?? false)
|
|
100
106
|
|
|
101
107
|
const handleSuccessSignup = (user: any) => {
|
|
102
108
|
login({
|
|
@@ -127,6 +133,16 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
127
133
|
return rules;
|
|
128
134
|
};
|
|
129
135
|
|
|
136
|
+
const cellphoneValue = () => {
|
|
137
|
+
let cellphone = user?.cellphone || null
|
|
138
|
+
if (cellphone && CONDITIONAL_CODES.includes(user?.country_code)) {
|
|
139
|
+
if (user?.country_code === 'PR') {
|
|
140
|
+
cellphone = user?.cellphone?.slice(3)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return cellphone
|
|
144
|
+
}
|
|
145
|
+
|
|
130
146
|
const setUserCellPhone = (isEdit = false) => {
|
|
131
147
|
if (userPhoneNumber && !userPhoneNumber.includes('null') && !isEdit) {
|
|
132
148
|
setUserPhoneNumber(userPhoneNumber);
|
|
@@ -144,7 +160,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
144
160
|
...phoneInputData,
|
|
145
161
|
phone: {
|
|
146
162
|
country_phone_code: user?.country_phone_code || null,
|
|
147
|
-
cellphone:
|
|
163
|
+
cellphone: cellphoneValue()
|
|
148
164
|
},
|
|
149
165
|
});
|
|
150
166
|
return;
|
|
@@ -153,8 +169,13 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
153
169
|
};
|
|
154
170
|
|
|
155
171
|
const onSubmit = () => {
|
|
172
|
+
let content = ''
|
|
173
|
+
if (requiredFields?.includes?.('birthdate') && !birthdate) {
|
|
174
|
+
content = content + `${t('VALIDATION_ERROR_BIRTHDATE_REQUIRED', 'Birthdate is required')}\n`
|
|
175
|
+
}
|
|
156
176
|
if (phoneInputData.error) {
|
|
157
|
-
|
|
177
|
+
content = content + `${phoneInputData.error}\n`
|
|
178
|
+
showToast(ToastType.Error, content);
|
|
158
179
|
return;
|
|
159
180
|
}
|
|
160
181
|
if (Object.keys(formState.changes).length > 0) {
|
|
@@ -164,15 +185,14 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
164
185
|
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
165
186
|
configs?.verification_phone_required?.value === '1')
|
|
166
187
|
) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
t(
|
|
170
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
171
|
-
'The field Phone Number is required.',
|
|
172
|
-
),
|
|
173
|
-
);
|
|
188
|
+
content = content + `${t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone Number is required.',)}\n`
|
|
189
|
+
showToast(ToastType.Error, content);
|
|
174
190
|
return;
|
|
175
191
|
}
|
|
192
|
+
if (content.length > 0) {
|
|
193
|
+
showToast(ToastType.Error, content);
|
|
194
|
+
return
|
|
195
|
+
}
|
|
176
196
|
let changes = null;
|
|
177
197
|
if (user?.cellphone && !userPhoneNumber) {
|
|
178
198
|
changes = {
|
|
@@ -298,125 +318,134 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
298
318
|
<>
|
|
299
319
|
<UDForm>
|
|
300
320
|
{!validationFields?.loading &&
|
|
301
|
-
sortInputFields({ values: validationFields?.fields?.checkout })
|
|
321
|
+
sortInputFields({ values: isOrderTypeValidationField ? checkoutFields : validationFields?.fields?.checkout })
|
|
302
322
|
.length > 0 && (
|
|
303
323
|
<UDWrapper>
|
|
304
324
|
{sortInputFields({
|
|
305
|
-
values: validationFields
|
|
325
|
+
values: isOrderTypeValidationField ? checkoutFields : validationFields?.fields?.checkout,
|
|
306
326
|
}).map(
|
|
307
|
-
(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
<
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
.
|
|
343
|
-
.replace(
|
|
344
|
-
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
345
|
-
'',
|
|
346
|
-
),
|
|
347
|
-
);
|
|
348
|
-
field.code !== 'email'
|
|
349
|
-
? handleChangeInput(val)
|
|
350
|
-
: handleChangeInput({
|
|
351
|
-
target: {
|
|
352
|
-
name: 'email',
|
|
353
|
-
value: val.target.value
|
|
327
|
+
(item: any) => {
|
|
328
|
+
const field = item?.validation_field || item
|
|
329
|
+
return (
|
|
330
|
+
((isOrderTypeValidationField ? item?.enabled : (showField && showField(field.code))) && ((requiredFields && requiredFields?.includes?.(field.code)) || !requiredFields || !isCheckoutPlace)) && (
|
|
331
|
+
<React.Fragment key={field.id}>
|
|
332
|
+
<Controller
|
|
333
|
+
key={field.id}
|
|
334
|
+
control={control}
|
|
335
|
+
render={() => (
|
|
336
|
+
<>
|
|
337
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
338
|
+
{t(field?.code?.toUpperCase(), field?.name)}
|
|
339
|
+
</OText>
|
|
340
|
+
<OInput
|
|
341
|
+
name={field.code}
|
|
342
|
+
placeholder={t(
|
|
343
|
+
field.code.toUpperCase(),
|
|
344
|
+
field?.name,
|
|
345
|
+
)}
|
|
346
|
+
inputStyle={styles.inputStyle}
|
|
347
|
+
style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
|
|
348
|
+
autoCapitalize={
|
|
349
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
350
|
+
}
|
|
351
|
+
isDisabled={false}
|
|
352
|
+
value={
|
|
353
|
+
formState?.changes[field.code] ??
|
|
354
|
+
(user && user[field.code]) ??
|
|
355
|
+
''
|
|
356
|
+
}
|
|
357
|
+
onChange={(val: any) => {
|
|
358
|
+
field.code !== 'email'
|
|
359
|
+
? setValue(field.code, val.target.value)
|
|
360
|
+
: setValue(
|
|
361
|
+
field.code,
|
|
362
|
+
val.target.value
|
|
354
363
|
.toLowerCase()
|
|
355
364
|
.replace(
|
|
356
365
|
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
357
366
|
'',
|
|
358
367
|
),
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
)}
|
|
395
|
-
{!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
|
|
396
|
-
<WrapperPhone>
|
|
397
|
-
<OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
|
|
398
|
-
<PhoneInputNumber
|
|
399
|
-
data={phoneInputData}
|
|
400
|
-
handleData={(val: any) => handleChangePhoneNumber(val)}
|
|
401
|
-
changeCountry={(val: any) => changeCountry(val)}
|
|
402
|
-
defaultValue={phoneUpdate ? '' : user?.cellphone}
|
|
403
|
-
defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
|
|
404
|
-
boxStyle={styles.phoneSelect}
|
|
405
|
-
inputStyle={styles.phoneInputStyle}
|
|
406
|
-
textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
|
|
407
|
-
noDropIcon
|
|
408
|
-
/>
|
|
409
|
-
{phoneUpdate && (
|
|
410
|
-
<OText
|
|
411
|
-
size={10}
|
|
412
|
-
color={theme.colors.error}
|
|
413
|
-
style={{ marginHorizontal: 10, textAlign: 'center' }}>
|
|
414
|
-
{t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
|
|
415
|
-
{user?.cellphone}
|
|
416
|
-
</OText>
|
|
417
|
-
)}
|
|
418
|
-
</WrapperPhone>
|
|
368
|
+
);
|
|
369
|
+
field.code !== 'email'
|
|
370
|
+
? handleChangeInput(val)
|
|
371
|
+
: handleChangeInput({
|
|
372
|
+
target: {
|
|
373
|
+
name: 'email',
|
|
374
|
+
value: val.target.value
|
|
375
|
+
.toLowerCase()
|
|
376
|
+
.replace(
|
|
377
|
+
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
378
|
+
'',
|
|
379
|
+
),
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
}}
|
|
383
|
+
autoCorrect={field.code === 'email' && false}
|
|
384
|
+
type={
|
|
385
|
+
field.code === 'email'
|
|
386
|
+
? 'email-address'
|
|
387
|
+
: 'default'
|
|
388
|
+
}
|
|
389
|
+
returnKeyType="done"
|
|
390
|
+
autoCompleteType={
|
|
391
|
+
field.code === 'email' ? 'email' : 'off'
|
|
392
|
+
}
|
|
393
|
+
/>
|
|
394
|
+
</>
|
|
395
|
+
)}
|
|
396
|
+
name={field.code}
|
|
397
|
+
rules={getInputRules(field)}
|
|
398
|
+
defaultValue={user && user[field.code]}
|
|
399
|
+
/>
|
|
400
|
+
</React.Fragment>
|
|
401
|
+
))
|
|
402
|
+
},
|
|
419
403
|
)}
|
|
404
|
+
{((!user?.guest_id && showInputBirthday) || (isOrderTypeValidationField || user?.guest_id)) &&
|
|
405
|
+
showInputBirthday &&
|
|
406
|
+
((requiredFields && requiredFields?.includes?.('birthdate')) || !requiredFields || !isCheckoutPlace) &&
|
|
407
|
+
(
|
|
408
|
+
<>
|
|
409
|
+
<WrapperBirthdate>
|
|
410
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
411
|
+
{t('BIRTHDATE', 'Birthdate')}
|
|
412
|
+
</OText>
|
|
413
|
+
<TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
|
|
414
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6 }}>
|
|
415
|
+
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
416
|
+
</OText>
|
|
417
|
+
</TouchableOpacity>
|
|
418
|
+
</WrapperBirthdate>
|
|
419
|
+
<DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
|
|
420
|
+
</>
|
|
421
|
+
)}
|
|
422
|
+
{((!user?.guest_id && !!showInputPhoneNumber) || (isOrderTypeValidationField || user?.guest_id)) &&
|
|
423
|
+
((requiredFields && requiredFields?.includes?.('cellphone')) || !requiredFields || !isCheckoutPlace) &&
|
|
424
|
+
(
|
|
425
|
+
<WrapperPhone>
|
|
426
|
+
<OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
|
|
427
|
+
<PhoneInputNumber
|
|
428
|
+
data={phoneInputData}
|
|
429
|
+
handleData={(val: any) => handleChangePhoneNumber(val)}
|
|
430
|
+
changeCountry={(val: any) => changeCountry(val)}
|
|
431
|
+
defaultValue={phoneUpdate ? '' : cellphoneValue()}
|
|
432
|
+
defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
|
|
433
|
+
boxStyle={styles.phoneSelect}
|
|
434
|
+
inputStyle={styles.phoneInputStyle}
|
|
435
|
+
textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
|
|
436
|
+
noDropIcon
|
|
437
|
+
/>
|
|
438
|
+
{phoneUpdate && (
|
|
439
|
+
<OText
|
|
440
|
+
size={10}
|
|
441
|
+
color={theme.colors.error}
|
|
442
|
+
style={{ marginHorizontal: 10, textAlign: 'center' }}>
|
|
443
|
+
{t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
|
|
444
|
+
{cellphoneValue()}
|
|
445
|
+
</OText>
|
|
446
|
+
)}
|
|
447
|
+
</WrapperPhone>
|
|
448
|
+
)}
|
|
420
449
|
{!requiredFields && (
|
|
421
450
|
<Controller
|
|
422
451
|
control={control}
|
|
@@ -480,9 +509,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
480
509
|
? t('UPDATING', 'Updating...')
|
|
481
510
|
: t('UPDATE', 'Update')
|
|
482
511
|
}
|
|
483
|
-
|
|
484
|
-
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
485
|
-
borderColor={theme.colors.primary}
|
|
512
|
+
textStyle={{ fontSize: 14 }}
|
|
486
513
|
isDisabled={formState.loading}
|
|
487
514
|
imgRightSrc={null}
|
|
488
515
|
style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
|
|
@@ -491,7 +518,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
491
518
|
)}
|
|
492
519
|
</>
|
|
493
520
|
)}
|
|
494
|
-
{
|
|
521
|
+
{isCheckoutPlace && (
|
|
495
522
|
<OButton
|
|
496
523
|
text={
|
|
497
524
|
formState.loading
|
|
@@ -500,12 +527,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
500
527
|
? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
|
|
501
528
|
: t('CONTINUE', 'Continue'))
|
|
502
529
|
}
|
|
503
|
-
bgColor={theme.colors.primary}
|
|
504
530
|
textStyle={{
|
|
505
531
|
color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
|
|
506
532
|
fontSize: 14
|
|
507
533
|
}}
|
|
508
|
-
borderColor={theme.colors.primary}
|
|
509
534
|
isDisabled={!user?.guest_id && (formState.loading || !isValid)}
|
|
510
535
|
imgRightSrc={null}
|
|
511
536
|
style={{
|
|
@@ -519,10 +544,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
519
544
|
borderColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.white : theme.colors.primary,
|
|
520
545
|
opacity: !user?.guest_id && (formState.loading || !isValid) ? 0.3 : 1,
|
|
521
546
|
}}
|
|
522
|
-
onClick={
|
|
547
|
+
onClick={handleSubmit(onSubmit)}
|
|
523
548
|
/>
|
|
524
549
|
)}
|
|
525
|
-
{isCheckout && !!user?.guest_id && (
|
|
550
|
+
{isCheckout && !!user?.guest_id && !requiredFields && (
|
|
526
551
|
<TouchableOpacity style={{ marginTop: 10 }} onPress={() => handlePlaceOrderAsGuest()}>
|
|
527
552
|
<OText color={theme.colors.primary} style={{ textAlign: 'center' }}>{t('PLACE_ORDER_AS_GUEST', 'Place order as guest')}</OText>
|
|
528
553
|
</TouchableOpacity>
|
|
@@ -552,4 +577,3 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
552
577
|
</>
|
|
553
578
|
);
|
|
554
579
|
};
|
|
555
|
-
|
|
@@ -44,6 +44,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
44
44
|
handleRemoveAccount,
|
|
45
45
|
removeAccountState,
|
|
46
46
|
handleChangePromotions,
|
|
47
|
+
appVersion
|
|
47
48
|
} = props;
|
|
48
49
|
|
|
49
50
|
const theme = useTheme();
|
|
@@ -151,7 +152,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
151
152
|
const detailProps = {
|
|
152
153
|
goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
|
|
153
154
|
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
|
|
154
|
-
handleRemoveAccount
|
|
155
|
+
handleRemoveAccount,
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
useEffect(() => {
|
|
@@ -271,6 +272,13 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
271
272
|
</Actions>
|
|
272
273
|
</ListWrap>
|
|
273
274
|
<WebsocketStatus />
|
|
275
|
+
{appVersion && (
|
|
276
|
+
<View
|
|
277
|
+
style={{ alignItems: 'center' }}
|
|
278
|
+
>
|
|
279
|
+
<OText>v{appVersion}</OText>
|
|
280
|
+
</View>
|
|
281
|
+
)}
|
|
274
282
|
<OAlert
|
|
275
283
|
open={confirm.open}
|
|
276
284
|
title={confirm.title}
|
|
@@ -141,6 +141,11 @@ const WalletsUI = (props: any) => {
|
|
|
141
141
|
btnStyle={{ paddingLeft: 0 }}
|
|
142
142
|
isVertical={!hideWalletsTheme}
|
|
143
143
|
hideArrowLeft={!hideWalletsTheme}
|
|
144
|
+
buttonProps={{
|
|
145
|
+
bgColor: theme.colors.white,
|
|
146
|
+
borderColor: theme.colors.white,
|
|
147
|
+
textStyle: { color: theme.colors.btnFont }
|
|
148
|
+
}}
|
|
144
149
|
/>
|
|
145
150
|
{isChewLayout && !openHistory && (
|
|
146
151
|
<OButton
|
|
@@ -304,13 +309,11 @@ const WalletsUI = (props: any) => {
|
|
|
304
309
|
borderWidth: 0,
|
|
305
310
|
width: 26,
|
|
306
311
|
height: 26,
|
|
307
|
-
backgroundColor: '#FFF',
|
|
308
|
-
borderColor: '#FFF',
|
|
309
|
-
shadowColor: '#FFF',
|
|
310
312
|
paddingLeft: 0,
|
|
311
313
|
paddingRight: 0,
|
|
312
314
|
marginBottom: 10
|
|
313
315
|
}}
|
|
316
|
+
useArrow
|
|
314
317
|
onClick={() => setOpenHistory(false)}
|
|
315
318
|
icon={AntDesignIcon}
|
|
316
319
|
iconProps={{
|
|
@@ -143,15 +143,12 @@ const SocketStatusUI = (props: any) => {
|
|
|
143
143
|
<OButton
|
|
144
144
|
onClick={() => setOpenModal(false)}
|
|
145
145
|
bgColor={theme.colors.white}
|
|
146
|
-
borderColor={theme.colors.primary}
|
|
147
146
|
textStyle={{ color: theme.colors.primary }}
|
|
148
147
|
style={{ borderRadius: 8, height: 48 }}
|
|
149
148
|
text={t('CLOSE', 'Close')}
|
|
150
149
|
/>
|
|
151
|
-
|
|
150
|
+
<OButton
|
|
152
151
|
onClick={() => RNRestart.Restart()}
|
|
153
|
-
borderColor={theme.colors.primary}
|
|
154
|
-
textStyle={{ color: theme.colors.white }}
|
|
155
152
|
style={{ borderRadius: 8, marginLeft: 16, height: 48 }}
|
|
156
153
|
text={t('UPDATE', 'Update')}
|
|
157
154
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import styled, { css } from 'styled-components/native'
|
|
3
|
-
import { Alert } from 'react-native'
|
|
3
|
+
import { Alert, Vibration } from 'react-native'
|
|
4
4
|
import { useLanguage } from 'ordering-components/native'
|
|
5
5
|
|
|
6
6
|
const Wrapper = styled.TouchableOpacity`
|
|
@@ -41,6 +41,7 @@ const OAlert = (props: Props) => {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const handleClick = () => {
|
|
44
|
+
Vibration.vibrate(100)
|
|
44
45
|
props.onClick && props.onClick()
|
|
45
46
|
createTwoButtonAlert()
|
|
46
47
|
}
|
|
@@ -85,6 +85,7 @@ interface Props {
|
|
|
85
85
|
isDisabledWithSameStyles?: boolean;
|
|
86
86
|
icon?: any;
|
|
87
87
|
iconProps?: any
|
|
88
|
+
useArrow?: boolean;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const OButton = (props: Props): React.ReactElement => {
|
|
@@ -94,8 +95,8 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
94
95
|
if (props.isDisabled) {
|
|
95
96
|
return (
|
|
96
97
|
<View style={props.parentStyle}>
|
|
97
|
-
<StyledButtonDisabled style={props.style}>
|
|
98
|
-
<StyledTextDisabled style={props.textStyle}>
|
|
98
|
+
<StyledButtonDisabled style={{ ...props.style, backgroundColor: theme.colors.disabled }}>
|
|
99
|
+
<StyledTextDisabled style={{ ...props.textStyle, color: theme.colors.backgroundGray200 }}>
|
|
99
100
|
{props.text}
|
|
100
101
|
</StyledTextDisabled>
|
|
101
102
|
</StyledButtonDisabled>
|
|
@@ -119,7 +120,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
119
120
|
style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
|
|
120
121
|
disabled={props.isDisabledWithSameStyles}
|
|
121
122
|
>
|
|
122
|
-
<StyledButton style={
|
|
123
|
+
<StyledButton style={{ ...props.style, backgroundColor: props.useArrow ? theme.colors.white : props.bgColor ?? theme.colors.primary, borderColor: props.useArrow ? theme.colors.white : props.borderColor ?? theme.colors.primary, borderRadius: props.style?.borderRadius }}>
|
|
123
124
|
{props.icon ? (
|
|
124
125
|
<props.icon {...props.iconProps} />
|
|
125
126
|
) : null}
|
|
@@ -127,7 +128,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
127
128
|
<OIcon style={props.imgLeftStyle} src={props.imgLeftSrc} color={theme.colors.textNormal} />
|
|
128
129
|
) : null}
|
|
129
130
|
{props.text ? (
|
|
130
|
-
<StyledText style={props.textStyle}>{props.text}</StyledText>
|
|
131
|
+
<StyledText style={{ ...props.textStyle, color: props.useArrow ? theme.colors.btnFont : props?.textStyle?.color ?? theme.colors.white }}>{props.text}</StyledText>
|
|
131
132
|
) : null}
|
|
132
133
|
{props.imgRightSrc ? (
|
|
133
134
|
<EndImage style={props.imgRightStyle} source={props.imgRightSrc} />
|