ordering-ui-react-native 0.18.37 → 0.18.39
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 +1 -1
- package/src/components/StripeMethodForm/index.tsx +1 -1
- package/themes/original/src/components/AddressForm/index.tsx +7 -4
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +330 -276
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +35 -8
- package/themes/original/src/components/Checkout/index.tsx +6 -5
- package/themes/original/src/components/GoogleMap/index.tsx +11 -2
- package/themes/original/src/components/LoginForm/index.tsx +15 -14
- package/themes/original/src/components/MyOrders/index.tsx +14 -1
- package/themes/original/src/components/NavBar/index.tsx +9 -4
- package/themes/original/src/components/OrdersOption/index.tsx +3 -1
- package/themes/original/src/components/ProductForm/index.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +7 -5
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +2 -2
- package/themes/original/src/components/SignupForm/index.tsx +14 -14
- package/themes/original/src/components/StripeElementsForm/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -5
- package/themes/original/src/components/UserProfile/index.tsx +2 -20
- package/themes/original/src/components/UserProfileForm/index.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +1 -1
- package/themes/original/src/types/index.tsx +2 -2
- package/themes/original/src/utils/index.tsx +11 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, useWindowDimensions, Keyboard } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, useWindowDimensions, Keyboard, Platform } from 'react-native';
|
|
3
3
|
import { useLanguage, useSession, useConfig } from 'ordering-components/native';
|
|
4
4
|
import {
|
|
5
5
|
StripeProvider,
|
|
@@ -45,6 +45,22 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
45
45
|
const { top, bottom } = useSafeAreaInsets();
|
|
46
46
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
47
47
|
|
|
48
|
+
const styles = StyleSheet.create({
|
|
49
|
+
container: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
paddingHorizontal: 40,
|
|
52
|
+
justifyContent: 'space-between',
|
|
53
|
+
paddingBottom: 12
|
|
54
|
+
},
|
|
55
|
+
btnAddStyle: {
|
|
56
|
+
marginTop: 20,
|
|
57
|
+
borderRadius: 7.6,
|
|
58
|
+
shadowOpacity: 0,
|
|
59
|
+
height: 44,
|
|
60
|
+
marginBottom: isKeyboardShow && Platform.OS === 'ios' ? 40 : 0
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
48
64
|
let billingDetails: any = {}
|
|
49
65
|
|
|
50
66
|
if (user?.name || user?.lastname) {
|
|
@@ -249,21 +265,6 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
249
265
|
)
|
|
250
266
|
}
|
|
251
267
|
|
|
252
|
-
const styles = StyleSheet.create({
|
|
253
|
-
container: {
|
|
254
|
-
width: '100%',
|
|
255
|
-
paddingHorizontal: 40,
|
|
256
|
-
justifyContent: 'space-between',
|
|
257
|
-
paddingBottom: 12
|
|
258
|
-
},
|
|
259
|
-
btnAddStyle: {
|
|
260
|
-
marginTop: 20,
|
|
261
|
-
borderRadius: 7.6,
|
|
262
|
-
shadowOpacity: 0,
|
|
263
|
-
height: 44
|
|
264
|
-
},
|
|
265
|
-
})
|
|
266
|
-
|
|
267
268
|
export const StripeElementsForm = (props: any) => {
|
|
268
269
|
const stripeProps = {
|
|
269
270
|
...props,
|
|
@@ -7,11 +7,12 @@ import { SignupForm } from '../SignupForm'
|
|
|
7
7
|
|
|
8
8
|
import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
|
|
9
9
|
|
|
10
|
-
import { OText, OButton, OInput, OModal } from '../shared';
|
|
11
|
-
import
|
|
10
|
+
import { OText, OButton, OInput, OModal, OIcon } from '../shared';
|
|
11
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
12
12
|
|
|
13
13
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
14
14
|
import { sortInputFields } from '../../utils';
|
|
15
|
+
import { ListItem } from '../UserProfile/styles';
|
|
15
16
|
|
|
16
17
|
export const UserFormDetailsUI = (props: any) => {
|
|
17
18
|
const {
|
|
@@ -31,7 +32,9 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
31
32
|
setWillVerifyOtpState,
|
|
32
33
|
handlePlaceOrderAsGuest,
|
|
33
34
|
isCheckout,
|
|
34
|
-
setIsOpen
|
|
35
|
+
setIsOpen,
|
|
36
|
+
handleRemoveAccount,
|
|
37
|
+
isProfile
|
|
35
38
|
} = props;
|
|
36
39
|
|
|
37
40
|
const theme = useTheme();
|
|
@@ -85,8 +88,9 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
85
88
|
cellphone: null,
|
|
86
89
|
},
|
|
87
90
|
});
|
|
88
|
-
const [
|
|
91
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
89
92
|
|
|
93
|
+
const isAdmin = user?.level === 0
|
|
90
94
|
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
91
95
|
|
|
92
96
|
const handleSuccessSignup = (user: any) => {
|
|
@@ -202,6 +206,18 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
202
206
|
handleChangeInput(countryCode, true);
|
|
203
207
|
}
|
|
204
208
|
|
|
209
|
+
const onRemoveAccount = () => {
|
|
210
|
+
setConfirm({
|
|
211
|
+
open: true,
|
|
212
|
+
content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
|
|
213
|
+
title: t('ACCOUNT_ALERT', 'Account alert'),
|
|
214
|
+
handleOnAccept: () => {
|
|
215
|
+
setConfirm({ ...confirm, open: false })
|
|
216
|
+
handleRemoveAccount && handleRemoveAccount(user?.id)
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
|
|
205
221
|
useEffect(() => {
|
|
206
222
|
if (Object.keys(errors).length > 0) {
|
|
207
223
|
const list = Object.values(errors);
|
|
@@ -408,6 +424,12 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
408
424
|
)}
|
|
409
425
|
</UDWrapper>
|
|
410
426
|
)}
|
|
427
|
+
{isProfile && (
|
|
428
|
+
<ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
|
|
429
|
+
<OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
430
|
+
<OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
|
|
431
|
+
</ListItem>
|
|
432
|
+
)}
|
|
411
433
|
{validationFields?.loading && (
|
|
412
434
|
<UDLoader>
|
|
413
435
|
<OText size={12}>{t('LOADING', 'Loading')}</OText>
|
|
@@ -474,7 +496,14 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
474
496
|
/>
|
|
475
497
|
</ScrollView>
|
|
476
498
|
</OModal>
|
|
477
|
-
|
|
499
|
+
<OAlert
|
|
500
|
+
open={confirm.open}
|
|
501
|
+
title={confirm.title}
|
|
502
|
+
content={confirm.content}
|
|
503
|
+
onAccept={confirm.handleOnAccept}
|
|
504
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
505
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
506
|
+
/>
|
|
478
507
|
</>
|
|
479
508
|
);
|
|
480
509
|
};
|
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
} from './styles';
|
|
36
36
|
import { useWindowDimensions } from 'react-native';
|
|
37
37
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
38
|
-
import styled from 'styled-components';
|
|
39
38
|
import ToggleSwitch from 'toggle-switch-react-native';
|
|
40
39
|
|
|
41
40
|
const ProfileListUI = (props: ProfileParams) => {
|
|
@@ -118,8 +117,6 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
118
117
|
const [, { showToast }] = useToast();
|
|
119
118
|
const { errors } = useForm();
|
|
120
119
|
|
|
121
|
-
const isAdmin = user?.level === 0
|
|
122
|
-
|
|
123
120
|
const { height } = useWindowDimensions();
|
|
124
121
|
const { top, bottom } = useSafeAreaInsets();
|
|
125
122
|
|
|
@@ -153,19 +150,8 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
153
150
|
|
|
154
151
|
const detailProps = {
|
|
155
152
|
goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
|
|
156
|
-
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const onRemoveAccount = () => {
|
|
160
|
-
setConfirm({
|
|
161
|
-
open: true,
|
|
162
|
-
content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
|
|
163
|
-
title: t('ACCOUNT_ALERT', 'Account alert'),
|
|
164
|
-
handleOnAccept: () => {
|
|
165
|
-
setConfirm({ ...confirm, open: false })
|
|
166
|
-
handleRemoveAccount && handleRemoveAccount(user?.id)
|
|
167
|
-
}
|
|
168
|
-
})
|
|
153
|
+
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
|
|
154
|
+
handleRemoveAccount
|
|
169
155
|
}
|
|
170
156
|
|
|
171
157
|
useEffect(() => {
|
|
@@ -282,10 +268,6 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
282
268
|
<View style={{ height: 17 }} />
|
|
283
269
|
<LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
|
|
284
270
|
<View style={{ height: 17 }} />
|
|
285
|
-
<ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
|
|
286
|
-
<OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
287
|
-
<OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
|
|
288
|
-
</ListItem>
|
|
289
271
|
</Actions>
|
|
290
272
|
</ListWrap>
|
|
291
273
|
<OAlert
|
|
@@ -293,7 +293,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
293
293
|
<View style={styles.photo}>
|
|
294
294
|
{user?.photo ? (
|
|
295
295
|
<FastImage
|
|
296
|
-
style={{ height:
|
|
296
|
+
style={{ height: 80, width: 80, borderRadius: 8 }}
|
|
297
297
|
source={{
|
|
298
298
|
uri: user?.photo,
|
|
299
299
|
priority: FastImage.priority.normal,
|
|
@@ -316,6 +316,7 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
316
316
|
<Spinner visible={formState?.loading || verifyPhoneState?.loading} />
|
|
317
317
|
<UserFormDetailsUI
|
|
318
318
|
{...props}
|
|
319
|
+
isProfile
|
|
319
320
|
isEdit
|
|
320
321
|
setWillVerifyOtpState={setWillVerifyOtpState}
|
|
321
322
|
/>
|
|
@@ -156,7 +156,7 @@ const WalletsUI = (props: any) => {
|
|
|
156
156
|
size={20}
|
|
157
157
|
style={{
|
|
158
158
|
marginTop: 30,
|
|
159
|
-
marginLeft: (!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout ?
|
|
159
|
+
marginLeft: (!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout ? 40 : 0,
|
|
160
160
|
color: theme.colors.textNormal,
|
|
161
161
|
}}
|
|
162
162
|
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
@@ -373,8 +373,8 @@ export interface OrdersOptionParams {
|
|
|
373
373
|
preOrders?: boolean,
|
|
374
374
|
reorderState?: any,
|
|
375
375
|
handleReorder?: (orderId: number) => {},
|
|
376
|
-
setOrdersLength?: ({ activeOrdersLength, previousOrdersLength }: { activeOrdersLength: number, previousOrdersLength: number }) => void,
|
|
377
|
-
ordersLength: { activeOrdersLength: number, previousOrdersLength: number },
|
|
376
|
+
setOrdersLength?: ({ activeOrdersLength, previousOrdersLength, preordersLength }: { activeOrdersLength: number, previousOrdersLength: number, preordersLength: number }) => void,
|
|
377
|
+
ordersLength: { activeOrdersLength: number, previousOrdersLength: number, preordersLength: number },
|
|
378
378
|
setSelectedOrderId?: any,
|
|
379
379
|
setOpenMessges?: any,
|
|
380
380
|
loadMoreStatus?: boolean,
|
|
@@ -4,6 +4,7 @@ import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
|
4
4
|
import { CODES } from 'ordering-components/native'
|
|
5
5
|
import { ORDER_TYPES } from '../config/constants';
|
|
6
6
|
import { useTheme } from 'styled-components/native';
|
|
7
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
7
8
|
|
|
8
9
|
const [languageState, t] = useLanguage();
|
|
9
10
|
const theme = useTheme()
|
|
@@ -612,3 +613,13 @@ export const lightenDarkenColor = (color: any) => {
|
|
|
612
613
|
return false
|
|
613
614
|
}
|
|
614
615
|
}
|
|
616
|
+
|
|
617
|
+
export const vibrateApp = (impact ?: string) => {
|
|
618
|
+
const options = {
|
|
619
|
+
enableVibrateFallback: true,
|
|
620
|
+
ignoreAndroidSystemSettings: false
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
624
|
+
|
|
625
|
+
}
|