ordering-ui-react-native 0.14.30 → 0.14.31-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 +2 -2
- package/src/components/BusinessItemAccordion/index.tsx +2 -2
- package/src/components/BusinessProductsListing/index.tsx +10 -26
- package/src/components/Cart/index.tsx +136 -62
- package/src/components/Cart/styles.tsx +7 -0
- package/src/components/Checkout/index.tsx +10 -6
- package/src/components/LogoutButton/index.tsx +14 -0
- package/src/components/OrderDetails/index.tsx +102 -34
- package/src/components/OrderDetails/styles.tsx +7 -0
- package/src/components/OrderSummary/index.tsx +142 -58
- package/src/components/OrderSummary/styles.tsx +10 -2
- package/src/components/ProductForm/index.tsx +47 -10
- package/src/components/ProductForm/styles.tsx +1 -1
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/src/components/TaxInformation/index.tsx +58 -26
- package/src/components/UpsellingProducts/index.tsx +13 -31
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/ProductDetails.tsx +55 -0
- package/src/types/index.tsx +2 -0
- package/src/types/react-native-color-matrix-image-filters/index.d.ts +1 -0
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/doordash/src/components/ProductForm/index.tsx +41 -2
- package/themes/doordash/src/components/ProductForm/styles.tsx +1 -1
- package/themes/instacart/src/components/ProductForm/index.tsx +40 -1
- package/themes/instacart/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/Cart/index.tsx +14 -21
- package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
- package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
- package/themes/kiosk/src/components/Intro/index.tsx +4 -4
- package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
- package/themes/original/index.tsx +4 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +37 -34
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +16 -47
- package/themes/original/src/components/Cart/index.tsx +10 -31
- package/themes/original/src/components/Checkout/index.tsx +2 -0
- package/themes/original/src/components/Checkout/styles.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +3 -3
- package/themes/original/src/components/DriverTips/styles.tsx +5 -5
- package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
- package/themes/original/src/components/Help/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +5 -3
- package/themes/original/src/components/LoginForm/index.tsx +50 -49
- package/themes/original/src/components/MessageListing/index.tsx +4 -2
- package/themes/original/src/components/OrderDetails/index.tsx +3 -1
- package/themes/original/src/components/OrderSummary/index.tsx +11 -30
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -6
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -0
- package/themes/original/src/components/ProductForm/index.tsx +113 -88
- package/themes/original/src/components/ProductForm/styles.tsx +10 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +22 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +6 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +84 -86
- package/themes/original/src/types/index.tsx +7 -1
- package/themes/uber-eats/src/components/ProductForm/index.tsx +43 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { UpsellingPage as UpsellingPageController } from 'ordering-components/native'
|
|
3
|
+
|
|
4
|
+
const UpsellingRedirectUI = (props: any) => {
|
|
5
|
+
const {
|
|
6
|
+
setOpenUpselling,
|
|
7
|
+
upsellingProducts,
|
|
8
|
+
handleUpsellingPage,
|
|
9
|
+
onRedirect,
|
|
10
|
+
} = props
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!upsellingProducts.loading) {
|
|
14
|
+
if (upsellingProducts?.products?.length) {
|
|
15
|
+
onRedirect &&
|
|
16
|
+
onRedirect('UpsellingPage', props)
|
|
17
|
+
} else {
|
|
18
|
+
handleUpsellingPage && handleUpsellingPage()
|
|
19
|
+
}
|
|
20
|
+
setOpenUpselling(false)
|
|
21
|
+
}
|
|
22
|
+
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
23
|
+
|
|
24
|
+
return (<>{null}</>)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const UpsellingRedirect = (props: any) => {
|
|
28
|
+
const upsellingProps = {
|
|
29
|
+
...props,
|
|
30
|
+
UIComponent: UpsellingRedirectUI
|
|
31
|
+
}
|
|
32
|
+
return (
|
|
33
|
+
<UpsellingPageController {...upsellingProps} />
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet, SafeAreaView
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, SafeAreaView } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import {
|
|
5
5
|
BusinessAndProductList,
|
|
@@ -17,17 +17,13 @@ import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
|
17
17
|
import { BusinessProductsList } from '../BusinessProductsList'
|
|
18
18
|
import { BusinessProductsListingParams } from '../../types'
|
|
19
19
|
import {
|
|
20
|
-
WrapHeader,
|
|
21
20
|
TopHeader,
|
|
22
|
-
AddressInput,
|
|
23
21
|
WrapSearchBar,
|
|
24
22
|
WrapContent,
|
|
25
23
|
BusinessProductsListingContainer
|
|
26
24
|
} from './styles'
|
|
27
25
|
import { FloatingButton } from '../FloatingButton'
|
|
28
|
-
import {
|
|
29
|
-
import { UpsellingProducts } from '../UpsellingProducts'
|
|
30
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
26
|
+
import { UpsellingRedirect } from './UpsellingRedirect'
|
|
31
27
|
import Animated from 'react-native-reanimated'
|
|
32
28
|
|
|
33
29
|
const PIXELS_TO_SCROLL = 1000
|
|
@@ -47,7 +43,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
47
43
|
errorQuantityProducts,
|
|
48
44
|
header,
|
|
49
45
|
logo,
|
|
50
|
-
getNextProducts
|
|
46
|
+
getNextProducts,
|
|
51
47
|
} = props
|
|
52
48
|
|
|
53
49
|
const theme = useTheme();
|
|
@@ -56,7 +52,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
56
52
|
const [orderState] = useOrder()
|
|
57
53
|
const [{ parsePrice }] = useUtils()
|
|
58
54
|
const [, { showToast }] = useToast()
|
|
59
|
-
const { top } = useSafeAreaInsets();
|
|
60
55
|
|
|
61
56
|
const styles = StyleSheet.create({
|
|
62
57
|
mainContainer: {
|
|
@@ -87,7 +82,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
87
82
|
const { business, loading, error } = businessState
|
|
88
83
|
const [openBusinessInformation, setOpenBusinessInformation] = useState(false)
|
|
89
84
|
const [isOpenSearchBar, setIsOpenSearchBar] = useState(false)
|
|
90
|
-
const [curProduct, setCurProduct] = useState(null)
|
|
91
85
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
92
86
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
93
87
|
const scrollViewRef = useRef<any>(null)
|
|
@@ -102,7 +96,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
const onProductClick = (product: any) => {
|
|
105
|
-
|
|
99
|
+
onRedirect('ProductDetails', {
|
|
100
|
+
product: product,
|
|
101
|
+
businessSlug: business.slug,
|
|
102
|
+
businessId: business.id,
|
|
103
|
+
})
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
const handleCancel = () => {
|
|
@@ -110,14 +108,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
110
108
|
handleChangeSearch('')
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
const handleCloseProductModal = () => {
|
|
114
|
-
setCurProduct(null)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const handlerProductAction = () => {
|
|
118
|
-
handleCloseProductModal()
|
|
119
|
-
}
|
|
120
|
-
|
|
121
111
|
const handleUpsellingPage = () => {
|
|
122
112
|
onRedirect('CheckoutNavigator', {
|
|
123
113
|
screen: 'CheckoutPage',
|
|
@@ -166,13 +156,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
166
156
|
setCategoryClicked(false);
|
|
167
157
|
}, []);
|
|
168
158
|
|
|
169
|
-
|
|
170
|
-
useEffect(() => {
|
|
171
|
-
if (!orderState.loading) {
|
|
172
|
-
handleCloseProductModal()
|
|
173
|
-
}
|
|
174
|
-
}, [orderState.loading])
|
|
175
|
-
|
|
176
159
|
return (
|
|
177
160
|
<SafeAreaView
|
|
178
161
|
style={{ flex: 1 }}
|
|
@@ -304,49 +287,35 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
304
287
|
</>
|
|
305
288
|
)}
|
|
306
289
|
</BusinessProductsListingContainer>
|
|
307
|
-
{!loading && auth &&
|
|
290
|
+
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
308
291
|
<FloatingButton
|
|
309
292
|
btnText={
|
|
310
293
|
currentCart?.subtotal >= currentCart?.minimum
|
|
311
|
-
?
|
|
294
|
+
? t('VIEW_ORDER', 'View Order')
|
|
312
295
|
: `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
|
|
313
296
|
}
|
|
314
297
|
isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
|
|
315
|
-
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum &&
|
|
316
|
-
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum &&
|
|
298
|
+
btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
299
|
+
btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
|
|
317
300
|
btnLeftValue={currentCart?.products?.length}
|
|
318
301
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
319
|
-
disabled={
|
|
302
|
+
disabled={currentCart?.subtotal < currentCart?.minimum}
|
|
320
303
|
handleClick={() => setOpenUpselling(true)}
|
|
321
304
|
/>
|
|
322
305
|
)}
|
|
323
|
-
<OModal
|
|
324
|
-
open={!!curProduct}
|
|
325
|
-
onClose={handleCloseProductModal}
|
|
326
|
-
entireModal
|
|
327
|
-
customClose
|
|
328
|
-
isAvoidKeyBoardView
|
|
329
|
-
>
|
|
330
|
-
<ProductForm
|
|
331
|
-
product={curProduct}
|
|
332
|
-
businessSlug={business.slug}
|
|
333
|
-
businessId={business.id}
|
|
334
|
-
onClose={handleCloseProductModal}
|
|
335
|
-
navigation={navigation}
|
|
336
|
-
onSave={handlerProductAction}
|
|
337
|
-
/>
|
|
338
|
-
</OModal>
|
|
339
306
|
{openUpselling && (
|
|
340
|
-
<
|
|
307
|
+
<UpsellingRedirect
|
|
341
308
|
businessId={currentCart?.business_id}
|
|
342
309
|
business={currentCart?.business}
|
|
343
310
|
cartProducts={currentCart?.products}
|
|
344
311
|
cart={currentCart}
|
|
312
|
+
setOpenUpselling={setOpenUpselling}
|
|
345
313
|
handleUpsellingPage={handleUpsellingPage}
|
|
346
314
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
347
315
|
openUpselling={openUpselling}
|
|
348
316
|
canOpenUpselling={canOpenUpselling}
|
|
349
317
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
318
|
+
onRedirect={onRedirect}
|
|
350
319
|
/>
|
|
351
320
|
)}
|
|
352
321
|
</SafeAreaView>
|
|
@@ -17,7 +17,6 @@ import { BusinessItemAccordion } from '../BusinessItemAccordion';
|
|
|
17
17
|
import { CouponControl } from '../CouponControl';
|
|
18
18
|
|
|
19
19
|
import { OButton, OInput, OModal, OText } from '../shared';
|
|
20
|
-
import { ProductForm } from '../ProductForm';
|
|
21
20
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
22
21
|
import { verifyDecimals } from '../../utils';
|
|
23
22
|
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
@@ -35,10 +34,9 @@ const CartUI = (props: any) => {
|
|
|
35
34
|
removeProduct,
|
|
36
35
|
handleCartOpen,
|
|
37
36
|
setIsCartsLoading,
|
|
38
|
-
hideUpselling,
|
|
39
37
|
handleChangeComment,
|
|
40
|
-
commentState
|
|
41
|
-
|
|
38
|
+
commentState,
|
|
39
|
+
onNavigationRedirect
|
|
42
40
|
} = props
|
|
43
41
|
|
|
44
42
|
const theme = useTheme();
|
|
@@ -49,8 +47,6 @@ const CartUI = (props: any) => {
|
|
|
49
47
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
50
48
|
const [validationFields] = useValidationFields()
|
|
51
49
|
|
|
52
|
-
const [openProduct, setModalIsOpen] = useState(false)
|
|
53
|
-
const [curProduct, setCurProduct] = useState<any>(null)
|
|
54
50
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
55
51
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
56
52
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
@@ -71,14 +67,14 @@ const CartUI = (props: any) => {
|
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
const handleEditProduct = (product: any) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
onNavigationRedirect('ProductDetails', {
|
|
71
|
+
businessId,
|
|
72
|
+
isCartProduct: true,
|
|
73
|
+
productCart: product,
|
|
74
|
+
businessSlug: cart?.business?.slug,
|
|
75
|
+
categoryId: product?.category_id,
|
|
76
|
+
productId: product?.id,
|
|
77
|
+
})
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
const handleClearProducts = async () => {
|
|
@@ -329,23 +325,6 @@ const CartUI = (props: any) => {
|
|
|
329
325
|
</CheckoutAction>
|
|
330
326
|
)}
|
|
331
327
|
</BusinessItemAccordion>
|
|
332
|
-
<OModal
|
|
333
|
-
open={openProduct}
|
|
334
|
-
entireModal
|
|
335
|
-
customClose
|
|
336
|
-
onClose={() => setModalIsOpen(false)}
|
|
337
|
-
>
|
|
338
|
-
<ProductForm
|
|
339
|
-
isCartProduct
|
|
340
|
-
productCart={curProduct}
|
|
341
|
-
businessSlug={cart?.business?.slug}
|
|
342
|
-
businessId={businessId}
|
|
343
|
-
categoryId={curProduct?.category_id}
|
|
344
|
-
productId={curProduct?.id}
|
|
345
|
-
onSave={handlerProductAction}
|
|
346
|
-
onClose={() => setModalIsOpen(false)}
|
|
347
|
-
/>
|
|
348
|
-
</OModal>
|
|
349
328
|
|
|
350
329
|
<OModal
|
|
351
330
|
open={openChangeStore && props.isFranchiseApp}
|
|
@@ -510,6 +510,7 @@ const CheckoutUI = (props: any) => {
|
|
|
510
510
|
<WalletPaymentOptionContainer>
|
|
511
511
|
<PaymentOptionWallet
|
|
512
512
|
cart={cart}
|
|
513
|
+
businessId={cart?.business_id}
|
|
513
514
|
/>
|
|
514
515
|
</WalletPaymentOptionContainer>
|
|
515
516
|
)}
|
|
@@ -546,6 +547,7 @@ const CheckoutUI = (props: any) => {
|
|
|
546
547
|
<OrderSummary
|
|
547
548
|
cart={cart}
|
|
548
549
|
isCartPending={cart?.status === 2}
|
|
550
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
549
551
|
/>
|
|
550
552
|
</>
|
|
551
553
|
)}
|
|
@@ -44,7 +44,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
44
44
|
borderWidth: 1,
|
|
45
45
|
borderColor: theme.colors.inputDisabled,
|
|
46
46
|
marginRight: 10,
|
|
47
|
-
height:
|
|
47
|
+
height: 50
|
|
48
48
|
}
|
|
49
49
|
})
|
|
50
50
|
|
|
@@ -63,7 +63,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
63
63
|
return (
|
|
64
64
|
<DTContainer>
|
|
65
65
|
<DTWrapperTips>
|
|
66
|
-
{driverTipsOptions.map((option: any, i: number) => (
|
|
66
|
+
{driverTipsOptions.map((option: any, i: number) => (
|
|
67
67
|
<TouchableOpacity
|
|
68
68
|
key={i}
|
|
69
69
|
onPress={() => handlerChangeOption(option)}
|
|
@@ -72,7 +72,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
72
72
|
style={style.circle}
|
|
73
73
|
isActive={option === optionSelected}
|
|
74
74
|
>
|
|
75
|
-
<OText size={
|
|
75
|
+
<OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
|
|
76
76
|
{`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
|
|
77
77
|
</OText>
|
|
78
78
|
</DTCard>
|
|
@@ -15,7 +15,7 @@ export const DTWrapperTips = styled.View`
|
|
|
15
15
|
width: 100%;
|
|
16
16
|
justify-content: space-evenly;
|
|
17
17
|
align-items: center;
|
|
18
|
-
flex-wrap:
|
|
18
|
+
flex-wrap: wrap;
|
|
19
19
|
`
|
|
20
20
|
|
|
21
21
|
export const DTCard = styled.View`
|
|
@@ -24,10 +24,10 @@ export const DTCard = styled.View`
|
|
|
24
24
|
align-items: center;
|
|
25
25
|
border: 1px solid ${(props: any) => props.isActive ? props.theme.colors.primary : props.theme.colors.border};
|
|
26
26
|
text-transform: capitalize;
|
|
27
|
-
min-height:
|
|
28
|
-
min-width:
|
|
29
|
-
max-width:
|
|
30
|
-
max-height:
|
|
27
|
+
min-height: 55px;
|
|
28
|
+
min-width: 55px;
|
|
29
|
+
max-width: 55px;
|
|
30
|
+
max-height: 55px;
|
|
31
31
|
margin-right: 10px;
|
|
32
32
|
margin-left: 10px;
|
|
33
33
|
margin-top: 10px;
|
|
@@ -11,7 +11,8 @@ export const FacebookLogin = (props: any) => {
|
|
|
11
11
|
const {
|
|
12
12
|
handleErrors,
|
|
13
13
|
handleLoading,
|
|
14
|
-
handleSuccessFacebookLogin
|
|
14
|
+
handleSuccessFacebookLogin,
|
|
15
|
+
notificationState
|
|
15
16
|
} = props
|
|
16
17
|
|
|
17
18
|
const [, t] = useLanguage()
|
|
@@ -30,7 +31,14 @@ export const FacebookLogin = (props: any) => {
|
|
|
30
31
|
|
|
31
32
|
const handleLoginClick = async (accessToken: string) => {
|
|
32
33
|
try {
|
|
33
|
-
const
|
|
34
|
+
const body: any = {
|
|
35
|
+
access_token: accessToken
|
|
36
|
+
}
|
|
37
|
+
if (notificationState?.notification_token) {
|
|
38
|
+
body.notification_token = notificationState.notification_token
|
|
39
|
+
body.notification_app = notificationState.notification_app
|
|
40
|
+
}
|
|
41
|
+
const response = await ordering.users().authFacebook(body)
|
|
34
42
|
if (!response.content.error) {
|
|
35
43
|
if (handleSuccessFacebookLogin) {
|
|
36
44
|
handleSuccessFacebookLogin(response.content.result)
|
|
@@ -38,9 +46,10 @@ export const FacebookLogin = (props: any) => {
|
|
|
38
46
|
}
|
|
39
47
|
} else {
|
|
40
48
|
handleLoading && handleLoading(false)
|
|
49
|
+
handleErrors && handleErrors(response.content.result)
|
|
41
50
|
logoutWithFacebook()
|
|
42
51
|
}
|
|
43
|
-
} catch (err) {
|
|
52
|
+
} catch (err: any) {
|
|
44
53
|
handleLoading && handleLoading(false)
|
|
45
54
|
handleErrors && handleErrors(err.message)
|
|
46
55
|
}
|
|
@@ -48,7 +57,7 @@ export const FacebookLogin = (props: any) => {
|
|
|
48
57
|
|
|
49
58
|
const loginWithFacebook = () => {
|
|
50
59
|
handleLoading && handleLoading(true)
|
|
51
|
-
LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
|
|
60
|
+
LoginManager && LoginManager.logInWithPermissions(['public_profile', 'email']).then(
|
|
52
61
|
(login: any) => {
|
|
53
62
|
if (login.isCancelled) {
|
|
54
63
|
const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
|
|
@@ -58,6 +67,9 @@ export const FacebookLogin = (props: any) => {
|
|
|
58
67
|
AccessToken.getCurrentAccessToken().then((data: any) => {
|
|
59
68
|
const accessToken = data.accessToken.toString();
|
|
60
69
|
handleLoginClick(accessToken)
|
|
70
|
+
}).catch((err : any) => {
|
|
71
|
+
handleErrors && handleErrors(err.message)
|
|
72
|
+
handleLoading && handleLoading(false)
|
|
61
73
|
});
|
|
62
74
|
}
|
|
63
75
|
},
|
|
@@ -68,7 +80,10 @@ export const FacebookLogin = (props: any) => {
|
|
|
68
80
|
handleLoading && handleLoading(false)
|
|
69
81
|
handleErrors && handleErrors(err)
|
|
70
82
|
},
|
|
71
|
-
)
|
|
83
|
+
).catch((err : any) => {
|
|
84
|
+
handleErrors && handleErrors(err.message)
|
|
85
|
+
handleLoading && handleLoading(false)
|
|
86
|
+
});
|
|
72
87
|
};
|
|
73
88
|
|
|
74
89
|
const onPressButton = auth
|
|
@@ -48,7 +48,7 @@ export const Help = (props: HelpParams) => {
|
|
|
48
48
|
|
|
49
49
|
<LastOrdersContainer>
|
|
50
50
|
<OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
|
|
51
|
-
<LastOrders
|
|
51
|
+
<LastOrders {...props} onRedirect={onRedirect} />
|
|
52
52
|
</LastOrdersContainer>
|
|
53
53
|
</>
|
|
54
54
|
)
|
|
@@ -5,11 +5,11 @@ import { StyleSheet, View } from 'react-native';
|
|
|
5
5
|
import { OButton, OIcon, OText } from '../shared';
|
|
6
6
|
import { LanguageSelector } from '../LanguageSelector';
|
|
7
7
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
8
|
-
import { useWindowDimensions } from 'react-native';
|
|
8
|
+
import { useWindowDimensions, Platform } from 'react-native';
|
|
9
9
|
|
|
10
10
|
export const Home = (props: any) => {
|
|
11
11
|
const { onNavigationRedirect } = props;
|
|
12
|
-
const { width } = useWindowDimensions();
|
|
12
|
+
const { width, height } = useWindowDimensions();
|
|
13
13
|
const [, t] = useLanguage();
|
|
14
14
|
const [orderState] = useOrder();
|
|
15
15
|
|
|
@@ -18,7 +18,9 @@ export const Home = (props: any) => {
|
|
|
18
18
|
return (
|
|
19
19
|
<View style={styles.container}>
|
|
20
20
|
<View>
|
|
21
|
-
<
|
|
21
|
+
<View style={{paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
|
|
22
|
+
<LanguageSelector />
|
|
23
|
+
</View>
|
|
22
24
|
<OIcon
|
|
23
25
|
src={theme.images.logos.logotypeInvert}
|
|
24
26
|
style={{
|
|
@@ -436,59 +436,60 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
436
436
|
</>
|
|
437
437
|
)}
|
|
438
438
|
|
|
439
|
-
<View
|
|
440
|
-
style={{
|
|
441
|
-
flexDirection: 'row',
|
|
442
|
-
width: '100%',
|
|
443
|
-
justifyContent: 'space-between',
|
|
444
|
-
alignItems: 'center',
|
|
445
|
-
marginVertical: 15
|
|
446
|
-
}}>
|
|
447
|
-
<View style={loginStyle.line} />
|
|
448
|
-
<OText
|
|
449
|
-
size={14}
|
|
450
|
-
mBottom={10}
|
|
451
|
-
style={{ paddingHorizontal: 19 }}
|
|
452
|
-
color={theme.colors.disabled}>
|
|
453
|
-
{t('OR', 'or')}
|
|
454
|
-
</OText>
|
|
455
|
-
<View style={loginStyle.line} />
|
|
456
|
-
</View>
|
|
457
|
-
|
|
458
439
|
{configs && Object.keys(configs).length > 0 ? (
|
|
459
440
|
(((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
|
|
460
441
|
(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null)) &&
|
|
461
442
|
(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
443
|
+
<>
|
|
444
|
+
<View
|
|
445
|
+
style={{
|
|
446
|
+
flexDirection: 'row',
|
|
447
|
+
width: '100%',
|
|
448
|
+
justifyContent: 'space-between',
|
|
449
|
+
alignItems: 'center',
|
|
450
|
+
marginVertical: 15
|
|
451
|
+
}}>
|
|
452
|
+
<View style={loginStyle.line} />
|
|
453
|
+
<OText
|
|
454
|
+
size={14}
|
|
455
|
+
mBottom={10}
|
|
456
|
+
style={{ paddingHorizontal: 19 }}
|
|
457
|
+
color={theme.colors.disabled}>
|
|
458
|
+
{t('OR', 'or')}
|
|
459
|
+
</OText>
|
|
460
|
+
<View style={loginStyle.line} />
|
|
461
|
+
</View>
|
|
462
|
+
<ButtonsWrapper>
|
|
463
|
+
<SocialButtons>
|
|
464
|
+
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
465
|
+
configs?.facebook_id?.value && (
|
|
466
|
+
<FacebookLogin
|
|
467
|
+
notificationState={notificationState}
|
|
468
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
469
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
470
|
+
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
471
|
+
/>
|
|
472
|
+
)}
|
|
473
|
+
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
|
|
474
|
+
<GoogleLogin
|
|
475
|
+
notificationState={notificationState}
|
|
476
|
+
webClientId={configs?.google_login_client_id?.value}
|
|
477
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
478
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
479
|
+
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
480
|
+
/>
|
|
481
|
+
)}
|
|
482
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
|
|
483
|
+
<AppleLogin
|
|
484
|
+
notificationState={notificationState}
|
|
485
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
486
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
487
|
+
handleSuccessAppleLogin={handleSuccessFacebook}
|
|
488
|
+
/>
|
|
489
|
+
)}
|
|
490
|
+
</SocialButtons>
|
|
491
|
+
</ButtonsWrapper>
|
|
492
|
+
</>
|
|
492
493
|
)
|
|
493
494
|
) : (
|
|
494
495
|
<SkeletonWrapper>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller } from 'ordering-components/native'
|
|
2
|
+
import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller, useBusiness } from 'ordering-components/native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native'
|
|
5
5
|
import { OText, OModal } from '../shared'
|
|
@@ -214,6 +214,7 @@ const OrderMessageUI = (props: any) => {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
export const OrderListing = (props: OrdersOptionParams) => {
|
|
217
|
+
const [businessState] = useBusiness();
|
|
217
218
|
const OrderListingProps = {
|
|
218
219
|
...props,
|
|
219
220
|
UIComponent: OrdersOptionUI,
|
|
@@ -224,6 +225,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
|
|
|
224
225
|
pageSize: 10,
|
|
225
226
|
controlType: 'infinity'
|
|
226
227
|
},
|
|
228
|
+
businessId: businessState?.business?.id,
|
|
227
229
|
profileMessages: true,
|
|
228
230
|
orderBy: 'last_direct_message_at',
|
|
229
231
|
orderDirection: 'asc'
|
|
@@ -287,6 +289,7 @@ export const MessageListing = (props: MessageListingParams) => {
|
|
|
287
289
|
setSelectedOrderId={setSelectedOrderId}
|
|
288
290
|
setOrderList={setOrderListStatus}
|
|
289
291
|
setOpenMessges={setOpenMessges}
|
|
292
|
+
franchiseId={props.franchiseId}
|
|
290
293
|
/>
|
|
291
294
|
{openMessages && seletedOrder && (
|
|
292
295
|
<OModal
|
|
@@ -304,4 +307,3 @@ export const MessageListing = (props: MessageListingParams) => {
|
|
|
304
307
|
</MessageListingWrapper>
|
|
305
308
|
)
|
|
306
309
|
}
|
|
307
|
-
|
|
@@ -611,7 +611,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
611
611
|
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
612
612
|
{t('DELIVERY_PREFERENCE', 'Delivery Preference')}
|
|
613
613
|
</OText>
|
|
614
|
-
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
614
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
615
|
+
{order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
|
|
616
|
+
</OText>
|
|
615
617
|
</View>
|
|
616
618
|
)}
|
|
617
619
|
{order?.comment && (
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
21
21
|
import { CouponControl } from '../CouponControl';
|
|
22
22
|
import { OInput, OModal, OText } from '../shared';
|
|
23
|
-
import { ProductForm } from '../ProductForm';
|
|
24
23
|
import { verifyDecimals } from '../../utils';
|
|
25
24
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
26
25
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -35,7 +34,8 @@ const OrderSummaryUI = (props: any) => {
|
|
|
35
34
|
isCartPending,
|
|
36
35
|
isFromCheckout,
|
|
37
36
|
commentState,
|
|
38
|
-
handleChangeComment
|
|
37
|
+
handleChangeComment,
|
|
38
|
+
onNavigationRedirect
|
|
39
39
|
} = props;
|
|
40
40
|
|
|
41
41
|
const theme = useTheme()
|
|
@@ -44,8 +44,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
44
44
|
const [orderState] = useOrder();
|
|
45
45
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
46
46
|
const [validationFields] = useValidationFields();
|
|
47
|
-
const [openProduct, setModalIsOpen] = useState(false)
|
|
48
|
-
const [curProduct, setCurProduct] = useState<any>(null)
|
|
49
47
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
|
|
50
48
|
|
|
51
49
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
@@ -55,14 +53,15 @@ const OrderSummaryUI = (props: any) => {
|
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
const handleEditProduct = (product: any) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
onNavigationRedirect('ProductDetails', {
|
|
57
|
+
isCartProduct: true,
|
|
58
|
+
productCart: product,
|
|
59
|
+
businessSlug: cart?.business?.slug,
|
|
60
|
+
businessId: cart?.business_id,
|
|
61
|
+
categoryId: product?.category_id,
|
|
62
|
+
productId: product?.id,
|
|
63
|
+
isFromCheckout: isFromCheckout,
|
|
64
|
+
})
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
const getIncludedTaxes = () => {
|
|
@@ -242,24 +241,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
242
241
|
)}
|
|
243
242
|
</OSBill>
|
|
244
243
|
)}
|
|
245
|
-
<OModal
|
|
246
|
-
open={openProduct}
|
|
247
|
-
entireModal
|
|
248
|
-
customClose
|
|
249
|
-
onClose={() => setModalIsOpen(false)}
|
|
250
|
-
>
|
|
251
|
-
<ProductForm
|
|
252
|
-
isCartProduct
|
|
253
|
-
productCart={curProduct}
|
|
254
|
-
businessSlug={cart?.business?.slug}
|
|
255
|
-
businessId={cart?.business_id}
|
|
256
|
-
categoryId={curProduct?.category_id}
|
|
257
|
-
productId={curProduct?.id}
|
|
258
|
-
onSave={handlerProductAction}
|
|
259
|
-
onClose={() => setModalIsOpen(false)}
|
|
260
|
-
isFromCheckout={isFromCheckout}
|
|
261
|
-
/>
|
|
262
|
-
</OModal>
|
|
263
244
|
<OModal
|
|
264
245
|
open={openTaxModal.open}
|
|
265
246
|
onClose={() => setOpenTaxModal({ open: false, data: null })}
|