ordering-ui-react-native 0.15.61 → 0.15.64
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/PaymentOptions/index.tsx +2 -2
- package/src/components/StripeMethodForm/index.tsx +22 -21
- package/themes/original/src/components/AppleLogin/index.tsx +1 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +4 -4
- package/themes/original/src/components/Cart/index.tsx +1 -1
- 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 +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +41 -3
- package/themes/original/src/types/index.tsx +2 -0
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
67
67
|
|
|
68
68
|
const theme = useTheme();
|
|
69
69
|
const [, t] = useLanguage();
|
|
70
|
-
const methodsPay = ['google_pay'
|
|
70
|
+
const methodsPay = ['google_pay']
|
|
71
71
|
const stripeDirectMethods = ['stripe_direct', ...methodsPay]
|
|
72
72
|
|
|
73
73
|
const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
|
|
@@ -156,7 +156,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
156
156
|
)
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const excludeGateway: any = ['stripe_connect', 'stripe_redirect']; //exclude connect & redirect
|
|
159
|
+
const excludeGateway: any = ['stripe_connect', 'stripe_redirect', 'apple_pay']; //exclude connect & redirect & apple pay
|
|
160
160
|
|
|
161
161
|
return (
|
|
162
162
|
<PMContainer>
|
|
@@ -131,7 +131,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
|
|
|
131
131
|
|
|
132
132
|
return (
|
|
133
133
|
<>
|
|
134
|
-
{paymethod === 'google_pay'
|
|
134
|
+
{paymethod === 'google_pay' && (
|
|
135
135
|
<View>
|
|
136
136
|
<OButton
|
|
137
137
|
textStyle={{
|
|
@@ -145,26 +145,27 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
|
|
|
145
145
|
style={{ marginTop: 20 }}
|
|
146
146
|
/>
|
|
147
147
|
</View>
|
|
148
|
-
|
|
149
|
-
<View>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</View>
|
|
148
|
+
// ) : (
|
|
149
|
+
// <View>
|
|
150
|
+
// {isApplePaySupported ? (
|
|
151
|
+
// <>
|
|
152
|
+
// <OText>{t('APPLE_PAY_PAYMENT', 'Apple pay payment')}</OText>
|
|
153
|
+
// <ApplePayButton
|
|
154
|
+
// onPress={pay}
|
|
155
|
+
// type="plain"
|
|
156
|
+
// buttonStyle="black"
|
|
157
|
+
// borderRadius={4}
|
|
158
|
+
// style={{
|
|
159
|
+
// width: '100%',
|
|
160
|
+
// height: 50,
|
|
161
|
+
// }}
|
|
162
|
+
// />
|
|
163
|
+
// </>
|
|
164
|
+
// ) : (
|
|
165
|
+
// <OText>{t('APPLE_PAY_NOT_SUPPORTED', 'Apple pay not supported')}</OText>
|
|
166
|
+
// )}
|
|
167
|
+
// </View>
|
|
168
|
+
// )}
|
|
168
169
|
)}
|
|
169
170
|
<Spinner
|
|
170
171
|
visible={loadingGooglePayment}
|
|
@@ -45,7 +45,7 @@ export const AppleLogin = (props: any) => {
|
|
|
45
45
|
handleLoading && handleLoading(false)
|
|
46
46
|
}
|
|
47
47
|
} else {
|
|
48
|
-
|
|
48
|
+
handleErrors && handleErrors(result)
|
|
49
49
|
handleLoading && handleLoading(false)
|
|
50
50
|
}
|
|
51
51
|
} catch (err: any) {
|
|
@@ -158,9 +158,6 @@ export const AppleLogin = (props: any) => {
|
|
|
158
158
|
|
|
159
159
|
return (
|
|
160
160
|
<Container>
|
|
161
|
-
{credentialStateForUser !== -1 && (
|
|
162
|
-
<Text>{credentialStateForUser}</Text>
|
|
163
|
-
)}
|
|
164
161
|
{canShowButton() &&
|
|
165
162
|
<AppleButton
|
|
166
163
|
onPress={() => Platform.OS == 'android' ? onAndroidButtonPress() : onIOSButtonPress(updateCredentialStateForUser)}
|
|
@@ -4,7 +4,7 @@ import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { OIcon, OText, OModal } from '../shared';
|
|
6
6
|
import { BusinessBasicInformationParams } from '../../types';
|
|
7
|
-
import { convertHoursToMinutes } from '../../utils';
|
|
7
|
+
import { convertHoursToMinutes, shape } from '../../utils';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
9
|
import timezone from 'dayjs/plugin/timezone';
|
|
10
10
|
import isBetween from 'dayjs/plugin/isBetween';
|
|
@@ -165,7 +165,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
165
165
|
: _products
|
|
166
166
|
|
|
167
167
|
const shortCategoryDescription = category?.description?.length > 80 ? `${category?.description?.substring(0, 80)}...` : category?.description
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
return (
|
|
170
170
|
<React.Fragment key={'cat_' + category.id}>
|
|
171
171
|
{products.length > 0 && (
|
|
@@ -224,11 +224,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
224
224
|
/>
|
|
225
225
|
)}
|
|
226
226
|
</OText>
|
|
227
|
-
{category?.subcategories?.length > 0 && (
|
|
228
|
-
<SubcategoriesComponent category={category} />
|
|
229
|
-
)}
|
|
230
227
|
</View>
|
|
231
228
|
)}
|
|
229
|
+
{category?.subcategories?.length > 0 && (
|
|
230
|
+
<SubcategoriesComponent category={category} />
|
|
231
|
+
)}
|
|
232
232
|
<>
|
|
233
233
|
{products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
|
|
234
234
|
<SingleProductCard
|
|
@@ -255,7 +255,7 @@ const CartUI = (props: any) => {
|
|
|
255
255
|
<OSRow>
|
|
256
256
|
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
257
257
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
258
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}
|
|
258
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
259
259
|
</OText>
|
|
260
260
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
261
261
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -4,6 +4,7 @@ import CalendarStrip from 'react-native-calendar-strip'
|
|
|
4
4
|
import {
|
|
5
5
|
useLanguage,
|
|
6
6
|
useConfig,
|
|
7
|
+
useUtils,
|
|
7
8
|
useOrder,
|
|
8
9
|
MomentOption as MomentOptionController,
|
|
9
10
|
} from 'ordering-components/native';
|
|
@@ -132,6 +133,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
132
133
|
|
|
133
134
|
const [, t] = useLanguage();
|
|
134
135
|
const [{ configs }] = useConfig();
|
|
136
|
+
const [{ parseTime }] = useUtils()
|
|
135
137
|
const [orderState] = useOrder();
|
|
136
138
|
const [optionSelected, setOptionSelected] = useState({
|
|
137
139
|
isAsap: false,
|
|
@@ -143,6 +145,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
143
145
|
});
|
|
144
146
|
const { bottom } = useSafeAreaInsets();
|
|
145
147
|
|
|
148
|
+
const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
|
|
149
|
+
|
|
146
150
|
const [selectedTime, setSelectedTime] = useState(null);
|
|
147
151
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
148
152
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
@@ -338,7 +342,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
338
342
|
style={{
|
|
339
343
|
lineHeight: 24
|
|
340
344
|
}}
|
|
341
|
-
>{
|
|
345
|
+
>{is12hours ? (
|
|
346
|
+
time.startTime.includes('12')
|
|
347
|
+
? `${time.startTime}PM`
|
|
348
|
+
: parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
349
|
+
) : time.startTime
|
|
350
|
+
}</OText>
|
|
342
351
|
</TimeItem>
|
|
343
352
|
</TouchableOpacity>
|
|
344
353
|
))}
|
|
@@ -898,7 +898,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
898
898
|
<OSRow>
|
|
899
899
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
900
900
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
901
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}
|
|
901
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
902
902
|
</OText>
|
|
903
903
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
|
|
904
904
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
UserFormDetails as UserProfileController,
|
|
4
4
|
useSession,
|
|
@@ -18,6 +18,7 @@ import MessageCircle from 'react-native-vector-icons/AntDesign'
|
|
|
18
18
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
19
19
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
20
20
|
import FastImage from 'react-native-fast-image'
|
|
21
|
+
import { OAlert } from '../../../../../src/components/shared'
|
|
21
22
|
|
|
22
23
|
import {
|
|
23
24
|
OIcon,
|
|
@@ -35,7 +36,9 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
35
36
|
const ProfileListUI = (props: ProfileParams) => {
|
|
36
37
|
const {
|
|
37
38
|
navigation,
|
|
38
|
-
formState
|
|
39
|
+
formState,
|
|
40
|
+
handleRemoveAccount,
|
|
41
|
+
removeAccountState
|
|
39
42
|
} = props;
|
|
40
43
|
|
|
41
44
|
const theme = useTheme();
|
|
@@ -92,15 +95,19 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
92
95
|
});
|
|
93
96
|
|
|
94
97
|
|
|
95
|
-
const [{ user }] = useSession();
|
|
98
|
+
const [{ user }, { logout }] = useSession();
|
|
96
99
|
const [, t] = useLanguage();
|
|
97
100
|
const [{ configs }] = useConfig();
|
|
98
101
|
const [, { showToast }] = useToast();
|
|
99
102
|
const { errors } = useForm();
|
|
100
103
|
|
|
104
|
+
const isAdmin = user?.level === 0
|
|
105
|
+
|
|
101
106
|
const { height } = useWindowDimensions();
|
|
102
107
|
const { top, bottom } = useSafeAreaInsets();
|
|
103
108
|
|
|
109
|
+
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
110
|
+
|
|
104
111
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
105
112
|
const IsPromotionsEnabled = configs?.advanced_offers_module === '1' || configs?.advanced_offers_module === 'true'
|
|
106
113
|
const onRedirect = (route: string, params?: any) => {
|
|
@@ -136,6 +143,24 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
136
143
|
onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
|
|
137
144
|
}
|
|
138
145
|
|
|
146
|
+
const onRemoveAccount = () => {
|
|
147
|
+
setConfirm({
|
|
148
|
+
open: true,
|
|
149
|
+
content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
|
|
150
|
+
title: t('ACCOUNT_ALERT', 'Account alert'),
|
|
151
|
+
handleOnAccept: () => {
|
|
152
|
+
setConfirm({ ...confirm, open: false })
|
|
153
|
+
handleRemoveAccount && handleRemoveAccount(user?.id)
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (removeAccountState?.result === 'OK') {
|
|
160
|
+
logout()
|
|
161
|
+
}
|
|
162
|
+
}, [removeAccountState])
|
|
163
|
+
|
|
139
164
|
return (
|
|
140
165
|
<View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
|
|
141
166
|
{/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
|
|
@@ -195,8 +220,21 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
195
220
|
<LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
|
|
196
221
|
<View style={{ height: 17 }} />
|
|
197
222
|
<LogoutButton color={theme.colors.textNormal} text={t('LOGOUT', 'Logout')} />
|
|
223
|
+
<View style={{ height: 17 }} />
|
|
224
|
+
<ListItem disabled={isAdmin} onPress={() => onRemoveAccount()} activeOpacity={0.7}>
|
|
225
|
+
<OIcon src={theme.images.general.user} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
226
|
+
<OText size={14} lineHeight={24} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1 }} color={theme.colors.danger5}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
|
|
227
|
+
</ListItem>
|
|
198
228
|
</Actions>
|
|
199
229
|
</ListWrap>
|
|
230
|
+
<OAlert
|
|
231
|
+
open={confirm.open}
|
|
232
|
+
title={confirm.title}
|
|
233
|
+
content={confirm.content}
|
|
234
|
+
onAccept={confirm.handleOnAccept}
|
|
235
|
+
onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
236
|
+
onClose={() => setConfirm({ ...confirm, open: false, title: null })}
|
|
237
|
+
/>
|
|
200
238
|
</View>
|
|
201
239
|
);
|
|
202
240
|
};
|