ordering-ui-react-native 0.22.32 → 0.22.33-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/Checkout/index.tsx +40 -39
- package/src/components/StripeMethodForm/index.tsx +4 -2
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/types/index.tsx +2 -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 +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -26
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -4
- package/themes/business/src/components/LoginForm/index.tsx +123 -98
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +46 -29
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
- package/themes/business/src/components/OrderDetails/Business.tsx +47 -27
- package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +156 -46
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +45 -18
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +6 -4
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +222 -158
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
- 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 +162 -174
- package/themes/business/src/components/PrinterSettings/styles.tsx +14 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +57 -24
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +18 -5
- package/themes/business/src/utils/index.tsx +28 -3
- 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 +27 -16
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- 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/BusinessItemAccordion/index.tsx +14 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
- 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 +10 -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/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +46 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +127 -77
- 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 -11
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +12 -9
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +27 -19
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +80 -52
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- 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 +16 -11
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -3
- package/themes/original/src/components/OrderSummary/index.tsx +29 -10
- 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 +462 -461
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- 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 +30 -38
- 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 +102 -88
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
- 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 +16 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +10 -4
- package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -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 +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +169 -139
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserVerification/index.tsx +15 -4
- 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 +12 -4
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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();
|
|
@@ -95,23 +96,23 @@ const UserDetailsUI = (props: any) => {
|
|
|
95
96
|
},
|
|
96
97
|
});
|
|
97
98
|
handleSendVerifyCode({
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
cellphone: cellphone,
|
|
100
|
+
country_phone_code: countryPhoneCode
|
|
100
101
|
})
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
const handleSendPhoneCode = (values: any) => {
|
|
105
|
-
|
|
106
|
+
setWillVerifyOtpState(false)
|
|
106
107
|
setIsModalVisible(false)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
setFormState({
|
|
109
|
+
...formState,
|
|
110
|
+
changes: {
|
|
111
|
+
...formState?.changes,
|
|
112
|
+
verification_code: values?.code
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
115
116
|
|
|
116
117
|
useEffect(() => {
|
|
117
118
|
if (willVerifyOtpState) handleVerifyCodeClick()
|
|
@@ -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
|
|
@@ -189,12 +190,12 @@ const UserDetailsUI = (props: any) => {
|
|
|
189
190
|
{userData?.name} {userData?.middle_name} {userData?.lastname} {userData?.second_lastname}
|
|
190
191
|
</OText>
|
|
191
192
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
192
|
-
{userData?.email}
|
|
193
|
+
{userData?.guest_id ? userData?.guest_email : userData?.email}
|
|
193
194
|
</OText>
|
|
194
|
-
{!!(userData?.cellphone || user?.cellphone) && (
|
|
195
|
+
{!!((userData?.cellphone ?? userData?.guest_cellphone) || (user?.cellphone ?? user?.guest_cellphone)) && (
|
|
195
196
|
<>
|
|
196
197
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
197
|
-
{(userData?.country_phone_code) && `+${(userData?.country_phone_code)} `}{(userData?.cellphone)}
|
|
198
|
+
{(userData?.country_phone_code) && `+${(userData?.country_phone_code)} `}{(userData?.guest_id ? user?.guest_cellphone : userData?.cellphone)}
|
|
198
199
|
</OText>
|
|
199
200
|
{!!phoneUpdate && (
|
|
200
201
|
<OText color={theme.colors.error} style={{ textAlign: 'center' }}>{t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number')}</OText>
|
|
@@ -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,12 @@ 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,
|
|
46
|
+
setCellphoneStartZero
|
|
40
47
|
} = props;
|
|
41
48
|
|
|
42
49
|
const theme = useTheme();
|
|
@@ -78,7 +85,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
78
85
|
const [, { showToast }] = useToast();
|
|
79
86
|
const { handleSubmit, control, errors, setValue } = useForm();
|
|
80
87
|
|
|
81
|
-
const [{ user }, { login }] = useSession();
|
|
88
|
+
const [{ user }, { login, logout }] = useSession();
|
|
82
89
|
const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
|
|
83
90
|
const [isValid, setIsValid] = useState(false)
|
|
84
91
|
const [isChanged, setIsChanged] = useState(false)
|
|
@@ -95,8 +102,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
95
102
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
96
103
|
|
|
97
104
|
const isAdmin = user?.level === 0
|
|
98
|
-
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false)
|
|
99
|
-
const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
|
|
105
|
+
const showInputPhoneNumber = isOrderTypeValidationField ? checkoutFields?.find(field => field?.validation_field?.code === 'mobile_phone')?.enabled : (validationFields?.fields?.checkout?.cellphone?.enabled ?? false)
|
|
106
|
+
const showInputBirthday = isOrderTypeValidationField ? checkoutFields?.find(field => field?.validation_field?.code === 'birthdate')?.enabled : (validationFields?.fields?.checkout?.birthdate?.enabled ?? false)
|
|
100
107
|
|
|
101
108
|
const handleSuccessSignup = (user: any) => {
|
|
102
109
|
login({
|
|
@@ -127,15 +134,27 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
127
134
|
return rules;
|
|
128
135
|
};
|
|
129
136
|
|
|
137
|
+
const cellphoneValue = () => {
|
|
138
|
+
let cellphone = user?.guest_id ? user?.guest_cellphone : user?.cellphone
|
|
139
|
+
if (cellphone && CONDITIONAL_CODES.includes(user?.country_code)) {
|
|
140
|
+
if (user?.country_code === 'PR') {
|
|
141
|
+
cellphone = user?.cellphone?.slice(3)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return cellphone
|
|
145
|
+
}
|
|
146
|
+
|
|
130
147
|
const setUserCellPhone = (isEdit = false) => {
|
|
131
148
|
if (userPhoneNumber && !userPhoneNumber.includes('null') && !isEdit) {
|
|
132
149
|
setUserPhoneNumber(userPhoneNumber);
|
|
133
150
|
return;
|
|
134
151
|
}
|
|
135
|
-
|
|
152
|
+
const cellphone = user?.guest_id ? user?.guest_cellphone : user?.cellphone
|
|
153
|
+
|
|
154
|
+
if (cellphone) {
|
|
136
155
|
let phone = null;
|
|
137
156
|
if (user?.country_phone_code) {
|
|
138
|
-
phone = `+${user?.country_phone_code} ${
|
|
157
|
+
phone = `+${user?.country_phone_code} ${cellphone}`;
|
|
139
158
|
} else {
|
|
140
159
|
phone = user?.cellphone;
|
|
141
160
|
}
|
|
@@ -144,17 +163,22 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
144
163
|
...phoneInputData,
|
|
145
164
|
phone: {
|
|
146
165
|
country_phone_code: user?.country_phone_code || null,
|
|
147
|
-
cellphone:
|
|
166
|
+
cellphone: cellphoneValue()
|
|
148
167
|
},
|
|
149
168
|
});
|
|
150
169
|
return;
|
|
151
170
|
}
|
|
152
|
-
setUserPhoneNumber(
|
|
171
|
+
setUserPhoneNumber(cellphone || '');
|
|
153
172
|
};
|
|
154
173
|
|
|
155
174
|
const onSubmit = () => {
|
|
175
|
+
let content = ''
|
|
176
|
+
if (requiredFields?.includes?.('birthdate') && !birthdate) {
|
|
177
|
+
content = content + `${t('VALIDATION_ERROR_BIRTHDATE_REQUIRED', 'Birthdate is required')}\n`
|
|
178
|
+
}
|
|
156
179
|
if (phoneInputData.error) {
|
|
157
|
-
|
|
180
|
+
content = content + `${phoneInputData.error}\n`
|
|
181
|
+
showToast(ToastType.Error, content);
|
|
158
182
|
return;
|
|
159
183
|
}
|
|
160
184
|
if (Object.keys(formState.changes).length > 0) {
|
|
@@ -162,17 +186,16 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
162
186
|
formState.changes?.cellphone === null &&
|
|
163
187
|
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
164
188
|
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
165
|
-
configs?.verification_phone_required?.value === '1')
|
|
189
|
+
(configs?.verification_phone_required?.value === '1' && !user?.guest_id))
|
|
166
190
|
) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
t(
|
|
170
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
171
|
-
'The field Phone Number is required.',
|
|
172
|
-
),
|
|
173
|
-
);
|
|
191
|
+
content = content + `${t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone Number is required.',)}\n`
|
|
192
|
+
showToast(ToastType.Error, content);
|
|
174
193
|
return;
|
|
175
194
|
}
|
|
195
|
+
if (content.length > 0) {
|
|
196
|
+
showToast(ToastType.Error, content);
|
|
197
|
+
return
|
|
198
|
+
}
|
|
176
199
|
let changes = null;
|
|
177
200
|
if (user?.cellphone && !userPhoneNumber) {
|
|
178
201
|
changes = {
|
|
@@ -185,7 +208,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
185
208
|
}
|
|
186
209
|
};
|
|
187
210
|
|
|
188
|
-
const handleChangePhoneNumber = (number: any) => {
|
|
211
|
+
const handleChangePhoneNumber = (number: any, rawNumber : any) => {
|
|
189
212
|
setPhoneInputData(number);
|
|
190
213
|
setIsChanged(true)
|
|
191
214
|
let phoneNumber = {
|
|
@@ -198,6 +221,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
198
221
|
value: number.phone.cellphone,
|
|
199
222
|
},
|
|
200
223
|
};
|
|
224
|
+
setCellphoneStartZero && setCellphoneStartZero(rawNumber?.number && rawNumber?.countryCallingCode ? rawNumber?.number : null)
|
|
201
225
|
handleChangeInput(phoneNumber, true);
|
|
202
226
|
};
|
|
203
227
|
|
|
@@ -223,9 +247,12 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
223
247
|
open: true,
|
|
224
248
|
content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
|
|
225
249
|
title: t('ACCOUNT_ALERT', 'Account alert'),
|
|
226
|
-
handleOnAccept: () => {
|
|
250
|
+
handleOnAccept: async () => {
|
|
227
251
|
setConfirm({ ...confirm, open: false })
|
|
228
|
-
|
|
252
|
+
const response = await handleRemoveAccount?.(user?.id)
|
|
253
|
+
if (response === 'OK'){
|
|
254
|
+
logout()
|
|
255
|
+
}
|
|
229
256
|
}
|
|
230
257
|
})
|
|
231
258
|
}
|
|
@@ -298,127 +325,135 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
298
325
|
<>
|
|
299
326
|
<UDForm>
|
|
300
327
|
{!validationFields?.loading &&
|
|
301
|
-
sortInputFields({ values: validationFields?.fields?.checkout })
|
|
328
|
+
sortInputFields({ values: isOrderTypeValidationField ? checkoutFields : validationFields?.fields?.checkout })
|
|
302
329
|
.length > 0 && (
|
|
303
330
|
<UDWrapper>
|
|
304
331
|
{sortInputFields({
|
|
305
|
-
values: validationFields
|
|
332
|
+
values: isOrderTypeValidationField ? checkoutFields : validationFields?.fields?.checkout,
|
|
306
333
|
}).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
|
|
334
|
+
(item: any) => {
|
|
335
|
+
const field = item?.validation_field || item
|
|
336
|
+
return (
|
|
337
|
+
((isOrderTypeValidationField ? item?.enabled : (showField && showField(field.code))) && ((requiredFields && requiredFields?.includes?.(field.code)) || !requiredFields || !isCheckoutPlace)) && (
|
|
338
|
+
<React.Fragment key={field.id}>
|
|
339
|
+
<Controller
|
|
340
|
+
key={field.id}
|
|
341
|
+
control={control}
|
|
342
|
+
render={() => (
|
|
343
|
+
<>
|
|
344
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
345
|
+
{t(field?.code?.toUpperCase(), field?.name)}
|
|
346
|
+
</OText>
|
|
347
|
+
<OInput
|
|
348
|
+
name={field.code}
|
|
349
|
+
placeholder={t(
|
|
350
|
+
field.code.toUpperCase(),
|
|
351
|
+
field?.name,
|
|
352
|
+
)}
|
|
353
|
+
inputStyle={styles.inputStyle}
|
|
354
|
+
style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
|
|
355
|
+
autoCapitalize={
|
|
356
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
357
|
+
}
|
|
358
|
+
isDisabled={false}
|
|
359
|
+
value={
|
|
360
|
+
formState?.changes[field.code] ??
|
|
361
|
+
(user && user?.guest_id && field.code === 'email' ? user?.guest_email : user?.[field.code]) ??
|
|
362
|
+
''
|
|
363
|
+
}
|
|
364
|
+
onChange={(val: any) => {
|
|
365
|
+
field.code !== 'email'
|
|
366
|
+
? setValue(field.code, val.target.value)
|
|
367
|
+
: setValue(
|
|
368
|
+
field.code,
|
|
369
|
+
val.target.value
|
|
354
370
|
.toLowerCase()
|
|
355
371
|
.replace(
|
|
356
372
|
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
357
373
|
'',
|
|
358
374
|
),
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
375
|
+
);
|
|
376
|
+
field.code !== 'email'
|
|
377
|
+
? handleChangeInput(val)
|
|
378
|
+
: handleChangeInput({
|
|
379
|
+
target: {
|
|
380
|
+
name: 'email',
|
|
381
|
+
value: val.target.value
|
|
382
|
+
.toLowerCase()
|
|
383
|
+
.replace(
|
|
384
|
+
/[&,()%";:ç?<>{}\\[\]\s]/g,
|
|
385
|
+
'',
|
|
386
|
+
),
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
}}
|
|
390
|
+
autoCorrect={field.code === 'email' && false}
|
|
391
|
+
type={
|
|
392
|
+
field.code === 'email'
|
|
393
|
+
? 'email-address'
|
|
394
|
+
: 'default'
|
|
395
|
+
}
|
|
396
|
+
returnKeyType="done"
|
|
397
|
+
autoCompleteType={
|
|
398
|
+
field.code === 'email' ? 'email' : 'off'
|
|
399
|
+
}
|
|
400
|
+
/>
|
|
401
|
+
</>
|
|
402
|
+
)}
|
|
403
|
+
name={field.code}
|
|
404
|
+
rules={getInputRules(field)}
|
|
405
|
+
defaultValue={user && (field.code === 'email' && user?.guest_id ? user?.guest_email : user?.[field.code])}
|
|
406
|
+
/>
|
|
407
|
+
</React.Fragment>
|
|
408
|
+
))
|
|
409
|
+
},
|
|
381
410
|
)}
|
|
382
|
-
{
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
411
|
+
{((!user?.guest_id && showInputBirthday) || (isOrderTypeValidationField || user?.guest_id)) &&
|
|
412
|
+
showInputBirthday &&
|
|
413
|
+
((requiredFields && requiredFields?.includes?.('birthdate')) || !requiredFields || !isCheckoutPlace) &&
|
|
414
|
+
(
|
|
415
|
+
<>
|
|
416
|
+
<WrapperBirthdate>
|
|
417
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
|
|
418
|
+
{t('BIRTHDATE', 'Birthdate')}
|
|
391
419
|
</OText>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
420
|
+
<TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
|
|
421
|
+
<OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6 }}>
|
|
422
|
+
{birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
|
|
423
|
+
</OText>
|
|
424
|
+
</TouchableOpacity>
|
|
425
|
+
</WrapperBirthdate>
|
|
426
|
+
<DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
|
|
427
|
+
</>
|
|
428
|
+
)}
|
|
429
|
+
{((!user?.guest_id && !!showInputPhoneNumber) || (isOrderTypeValidationField || user?.guest_id)) &&
|
|
430
|
+
((requiredFields && requiredFields?.includes?.('cellphone')) || !requiredFields || !isCheckoutPlace) &&
|
|
431
|
+
(
|
|
432
|
+
<WrapperPhone>
|
|
433
|
+
<OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
|
|
434
|
+
<PhoneInputNumber
|
|
435
|
+
data={phoneInputData}
|
|
436
|
+
handleData={handleChangePhoneNumber}
|
|
437
|
+
changeCountry={(val: any) => changeCountry(val)}
|
|
438
|
+
defaultValue={phoneUpdate ? '' : cellphoneValue()}
|
|
439
|
+
defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
|
|
440
|
+
defaultCodeFallback={user?.country_phone_code}
|
|
441
|
+
boxStyle={styles.phoneSelect}
|
|
442
|
+
inputStyle={styles.phoneInputStyle}
|
|
443
|
+
textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
|
|
444
|
+
noDropIcon
|
|
445
|
+
/>
|
|
446
|
+
{phoneUpdate && (
|
|
447
|
+
<OText
|
|
448
|
+
size={10}
|
|
449
|
+
color={theme.colors.error}
|
|
450
|
+
style={{ marginHorizontal: 10, textAlign: 'center' }}>
|
|
451
|
+
{t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
|
|
452
|
+
{cellphoneValue()}
|
|
453
|
+
</OText>
|
|
454
|
+
)}
|
|
455
|
+
</WrapperPhone>
|
|
456
|
+
)}
|
|
422
457
|
{!requiredFields && (
|
|
423
458
|
<Controller
|
|
424
459
|
control={control}
|
|
@@ -482,9 +517,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
482
517
|
? t('UPDATING', 'Updating...')
|
|
483
518
|
: t('UPDATE', 'Update')
|
|
484
519
|
}
|
|
485
|
-
|
|
486
|
-
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
487
|
-
borderColor={theme.colors.primary}
|
|
520
|
+
textStyle={{ fontSize: 14 }}
|
|
488
521
|
isDisabled={formState.loading}
|
|
489
522
|
imgRightSrc={null}
|
|
490
523
|
style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
|
|
@@ -493,7 +526,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
493
526
|
)}
|
|
494
527
|
</>
|
|
495
528
|
)}
|
|
496
|
-
{
|
|
529
|
+
{isCheckoutPlace && (
|
|
497
530
|
<OButton
|
|
498
531
|
text={
|
|
499
532
|
formState.loading
|
|
@@ -502,12 +535,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
502
535
|
? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
|
|
503
536
|
: t('CONTINUE', 'Continue'))
|
|
504
537
|
}
|
|
505
|
-
bgColor={theme.colors.primary}
|
|
506
538
|
textStyle={{
|
|
507
539
|
color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
|
|
508
540
|
fontSize: 14
|
|
509
541
|
}}
|
|
510
|
-
borderColor={theme.colors.primary}
|
|
511
542
|
isDisabled={!user?.guest_id && (formState.loading || !isValid)}
|
|
512
543
|
imgRightSrc={null}
|
|
513
544
|
style={{
|
|
@@ -521,10 +552,10 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
521
552
|
borderColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.white : theme.colors.primary,
|
|
522
553
|
opacity: !user?.guest_id && (formState.loading || !isValid) ? 0.3 : 1,
|
|
523
554
|
}}
|
|
524
|
-
onClick={
|
|
555
|
+
onClick={handleSubmit(onSubmit)}
|
|
525
556
|
/>
|
|
526
557
|
)}
|
|
527
|
-
{isCheckout && !!user?.guest_id && (
|
|
558
|
+
{isCheckout && !!user?.guest_id && !requiredFields && (
|
|
528
559
|
<TouchableOpacity style={{ marginTop: 10 }} onPress={() => handlePlaceOrderAsGuest()}>
|
|
529
560
|
<OText color={theme.colors.primary} style={{ textAlign: 'center' }}>{t('PLACE_ORDER_AS_GUEST', 'Place order as guest')}</OText>
|
|
530
561
|
</TouchableOpacity>
|
|
@@ -554,4 +585,3 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
554
585
|
</>
|
|
555
586
|
);
|
|
556
587
|
};
|
|
557
|
-
|
|
@@ -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}
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
WrapperActions
|
|
38
38
|
} from './styles'
|
|
39
39
|
|
|
40
|
+
const CONDITIONAL_CODES = [1787]
|
|
40
41
|
const TIME_COUNTDOWN = 60 * 10 // 10 minutes
|
|
41
42
|
|
|
42
43
|
const UserDetails = (props: any) => {
|
|
@@ -176,9 +177,18 @@ const UserVerificationUI = (props: any) => {
|
|
|
176
177
|
setTimer(`${TIME_COUNTDOWN / 60}:00`)
|
|
177
178
|
setIsSendCodeAgain(true)
|
|
178
179
|
if (opt === 'phone') {
|
|
180
|
+
let cellphone = phoneState?.cellphone
|
|
181
|
+
let country_phone_code = phoneState?.country_phone_code
|
|
182
|
+
|
|
183
|
+
if (CONDITIONAL_CODES.includes(Number(country_phone_code))) {
|
|
184
|
+
if (Number(country_phone_code) === 1787) {
|
|
185
|
+
cellphone = `787${cellphone}`
|
|
186
|
+
country_phone_code = '1'
|
|
187
|
+
}
|
|
188
|
+
}
|
|
179
189
|
sendVerifyPhoneCode({
|
|
180
|
-
cellphone
|
|
181
|
-
country_phone_code
|
|
190
|
+
cellphone,
|
|
191
|
+
country_phone_code
|
|
182
192
|
})
|
|
183
193
|
return
|
|
184
194
|
}
|
|
@@ -188,8 +198,8 @@ const UserVerificationUI = (props: any) => {
|
|
|
188
198
|
const setupUserPhoneNumber = () => {
|
|
189
199
|
if (!user || !user?.cellphone || !user?.country_phone_code) return
|
|
190
200
|
setPhoneState({
|
|
191
|
-
cellphone: user?.cellphone,
|
|
192
|
-
country_phone_code: user?.country_phone_code,
|
|
201
|
+
cellphone: user?.country_code === "PR" ? user?.cellphone.replace('787', '') : user?.cellphone,
|
|
202
|
+
country_phone_code: user?.country_code === "PR" ? '1787' : user?.country_phone_code,
|
|
193
203
|
formatted: `+${user?.country_phone_code} ${user?.cellphone}`
|
|
194
204
|
})
|
|
195
205
|
}
|
|
@@ -399,6 +409,7 @@ const UserVerificationUI = (props: any) => {
|
|
|
399
409
|
defaultCode={phoneState?.country_phone_code.replace('+', '')}
|
|
400
410
|
boxStyle={style.phoneSelect}
|
|
401
411
|
inputStyle={style.phoneInputStyle}
|
|
412
|
+
defaultCodeFallback={phoneState?.country_phone_code.replace('+', '')}
|
|
402
413
|
textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
|
|
403
414
|
noDropIcon
|
|
404
415
|
isDisabled
|
|
@@ -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
|
}
|