ordering-ui-react-native 0.15.61 → 0.15.62
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/BusinessProductsList/index.tsx +4 -4
- 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}
|
|
@@ -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
|
|
@@ -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
|
};
|