ordering-ui-react-native 0.15.30 → 0.15.32-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 +4 -2
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +4 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -3
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +3 -1
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/config.json +0 -2
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +5 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
- package/themes/business/src/components/OrdersOption/index.tsx +58 -51
- package/themes/business/src/components/PreviousOrders/index.tsx +58 -17
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -1
- 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/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +7 -8
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- 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/OrderDetails/index.tsx +167 -67
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +140 -37
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +108 -14
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +74 -70
- package/themes/original/src/components/Cart/index.tsx +21 -17
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +59 -48
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +394 -155
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- 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 +56 -33
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +55 -58
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +16 -14
- package/themes/original/src/components/ProductForm/index.tsx +76 -61
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SearchBar/index.tsx +4 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +9 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +68 -6
- package/themes/original/src/utils/index.tsx +28 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -174
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View, Platform, PlatformIOSStatic } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import moment from 'moment'
|
|
5
|
-
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
|
+
import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
6
6
|
import { OButton, OIcon, OText } from '../shared';
|
|
7
7
|
import {
|
|
8
8
|
Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
|
|
9
9
|
} from './styles';
|
|
10
10
|
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
11
11
|
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
12
|
+
import DeviceInfo from 'react-native-device-info';
|
|
12
13
|
|
|
13
14
|
const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
|
|
14
15
|
|
|
@@ -26,12 +27,22 @@ export const PreviousOrders = (props: any) => {
|
|
|
26
27
|
} = props;
|
|
27
28
|
const [, t] = useLanguage();
|
|
28
29
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
30
|
+
const [configState] = useConfig()
|
|
29
31
|
const theme = useTheme();
|
|
30
|
-
const [
|
|
32
|
+
const [, setCurrentTime] = useState()
|
|
33
|
+
const [allowColumns, setAllowColumns] = useState({
|
|
34
|
+
timer: true,
|
|
35
|
+
slaBar: true,
|
|
36
|
+
})
|
|
37
|
+
|
|
31
38
|
const [orientationState] = useDeviceOrientation();
|
|
32
39
|
|
|
33
40
|
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
34
41
|
|
|
42
|
+
const platformIOS = Platform as PlatformIOSStatic
|
|
43
|
+
const isIpad = platformIOS.isPad
|
|
44
|
+
const isTablet = DeviceInfo.isTablet();
|
|
45
|
+
|
|
35
46
|
const handlePressOrder = (order: any) => {
|
|
36
47
|
if (order?.locked && isLogisticOrder) return
|
|
37
48
|
handleClickOrder && handleClickOrder(order)
|
|
@@ -46,8 +57,8 @@ export const PreviousOrders = (props: any) => {
|
|
|
46
57
|
const styles = StyleSheet.create({
|
|
47
58
|
cardButton: {
|
|
48
59
|
flex: 1,
|
|
49
|
-
paddingVertical: 20,
|
|
50
|
-
marginBottom: IS_PORTRAIT ?
|
|
60
|
+
paddingVertical: (isIpad || isTablet) ? 20 : 0,
|
|
61
|
+
marginBottom: IS_PORTRAIT ? 25 : 0,
|
|
51
62
|
marginLeft: 3,
|
|
52
63
|
},
|
|
53
64
|
icon: {
|
|
@@ -88,23 +99,42 @@ export const PreviousOrders = (props: any) => {
|
|
|
88
99
|
},
|
|
89
100
|
});
|
|
90
101
|
|
|
91
|
-
const
|
|
102
|
+
const getDelayMinutes = (order: any) => {
|
|
92
103
|
// targetMin = delivery_datetime + eta_time - now()
|
|
104
|
+
const offset = 300
|
|
105
|
+
const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
|
|
93
106
|
const _delivery = order?.delivery_datetime_utc
|
|
107
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
108
|
+
: parseDate(cdtToutc)
|
|
94
109
|
const _eta = order?.eta_time
|
|
95
|
-
const
|
|
96
|
-
|
|
110
|
+
const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
|
|
111
|
+
return Math.ceil(diffTimeAsSeconds / 60)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const displayDelayedTime = (order: any) => {
|
|
115
|
+
let tagetedMin = getDelayMinutes(order)
|
|
116
|
+
// get day, hour and minutes
|
|
117
|
+
const sign = tagetedMin >= 0 ? '' : '- '
|
|
118
|
+
tagetedMin = Math.abs(tagetedMin)
|
|
119
|
+
let day: string | number = Math.floor(tagetedMin / 1440)
|
|
97
120
|
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
98
|
-
let restHours:
|
|
99
|
-
let restMins:
|
|
121
|
+
let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
|
|
122
|
+
let restMins: string | number = restMinOfTargetedMin - 60 * restHours
|
|
123
|
+
// make standard time format
|
|
124
|
+
day = day === 0 ? '' : day + 'day '
|
|
125
|
+
restHours = restHours < 10 ? '0' + restHours : restHours
|
|
126
|
+
restMins = restMins < 10 ? '0' + restMins : restMins
|
|
100
127
|
|
|
101
|
-
|
|
102
|
-
if (restHours < 10) restHours = ('0' + restHours)
|
|
103
|
-
if (restMins < 10) restMins = ('0' + restMins)
|
|
104
|
-
const finalTaget = day + 'day ' + restHours + ':' + restMins
|
|
128
|
+
const finalTaget = sign + day + restHours + ':' + restMins
|
|
105
129
|
return finalTaget
|
|
106
130
|
}
|
|
107
131
|
|
|
132
|
+
const getStatusClassName = (minutes: number) => {
|
|
133
|
+
if (isNaN(Number(minutes))) return 'in_time'
|
|
134
|
+
const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
|
|
135
|
+
return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
|
|
136
|
+
}
|
|
137
|
+
|
|
108
138
|
useEffect(() => {
|
|
109
139
|
const interval = setInterval(() => {
|
|
110
140
|
const date: any = Date.now()
|
|
@@ -114,6 +144,15 @@ export const PreviousOrders = (props: any) => {
|
|
|
114
144
|
return () => clearInterval(interval)
|
|
115
145
|
}, [])
|
|
116
146
|
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
|
|
149
|
+
setAllowColumns({
|
|
150
|
+
...allowColumns,
|
|
151
|
+
timer: slaSettings,
|
|
152
|
+
slaBar: slaSettings
|
|
153
|
+
})
|
|
154
|
+
}, [configState.loading])
|
|
155
|
+
|
|
117
156
|
let hash: any = {};
|
|
118
157
|
|
|
119
158
|
return (
|
|
@@ -139,7 +178,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
139
178
|
activeOpacity={1}
|
|
140
179
|
>
|
|
141
180
|
<Card key={order.id}>
|
|
142
|
-
|
|
181
|
+
{allowColumns?.slaBar && (
|
|
182
|
+
<Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
|
|
183
|
+
)}
|
|
143
184
|
{
|
|
144
185
|
order.business?.logo && (
|
|
145
186
|
<Logo style={styles.logo}>
|
|
@@ -184,10 +225,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
184
225
|
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
185
226
|
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
186
227
|
</OText>
|
|
187
|
-
{(currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && (
|
|
228
|
+
{((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
|
|
188
229
|
<>
|
|
189
230
|
<OText> · </OText>
|
|
190
|
-
<OText style={styles.date} color={order
|
|
231
|
+
<OText style={styles.date} color={getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : ''} >{displayDelayedTime(order)}</OText>
|
|
191
232
|
</>
|
|
192
233
|
)}
|
|
193
234
|
</View>
|
|
@@ -20,6 +20,9 @@ export interface LoginParams {
|
|
|
20
20
|
passwordInputIcon?: any;
|
|
21
21
|
allowedLevels?: any;
|
|
22
22
|
useRootPoint?: any;
|
|
23
|
+
notificationState?: any;
|
|
24
|
+
handleReCaptcha?: any;
|
|
25
|
+
enableReCaptcha?: any;
|
|
23
26
|
}
|
|
24
27
|
export interface ProfileParams {
|
|
25
28
|
navigation?: any;
|
|
@@ -373,6 +376,7 @@ export interface OrderDetailsParams {
|
|
|
373
376
|
handleClickLogisticOrder?: (status: number, orderId: number) => void;
|
|
374
377
|
orderTitle?: any;
|
|
375
378
|
forceUpdate?: number;
|
|
379
|
+
getPermissions?: any
|
|
376
380
|
}
|
|
377
381
|
export interface ProductItemAccordionParams {
|
|
378
382
|
isCartPending?: boolean;
|
|
@@ -578,4 +582,4 @@ export interface ReviewCustomerParams {
|
|
|
578
582
|
|
|
579
583
|
export interface NoNetworkParams {
|
|
580
584
|
image?: any;
|
|
581
|
-
}
|
|
585
|
+
}
|
|
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
197
197
|
{isFarAway && (
|
|
198
198
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
199
199
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
200
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
200
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
|
|
201
201
|
</FarAwayMessage>
|
|
202
202
|
)}
|
|
203
203
|
{!auth && (
|
|
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
410
410
|
textInputProps={{
|
|
411
411
|
returnKeyType: 'next',
|
|
412
412
|
onSubmitEditing: () => inputRef?.current?.focus?.(),
|
|
413
|
-
style: { borderWidth: 0, fontSize: 12 }
|
|
414
|
-
maxLength: 10
|
|
413
|
+
style: { borderWidth: 0, fontSize: 12 }
|
|
415
414
|
}}
|
|
416
415
|
textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
|
|
417
416
|
/>
|
|
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
155
155
|
{isFarAway && (
|
|
156
156
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
157
157
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
158
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
158
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
|
|
159
159
|
</FarAwayMessage>
|
|
160
160
|
)}
|
|
161
161
|
<View style={styles.wrapperOrderOptions}>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useValidationFields,
|
|
11
11
|
} from 'ordering-components/native';
|
|
12
12
|
|
|
13
|
-
import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
|
|
13
|
+
import { CheckoutAction, OrderTypeWrapper, FloatingLayout, OSRow } from './styles';
|
|
14
14
|
|
|
15
15
|
import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
|
|
16
16
|
|
|
@@ -90,6 +90,20 @@ const CartUI = (props: any) => {
|
|
|
90
90
|
|
|
91
91
|
const goToBack = () => navigation.goBack();
|
|
92
92
|
|
|
93
|
+
const getIncludedTaxes = () => {
|
|
94
|
+
if (cart?.taxes === null) {
|
|
95
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
96
|
+
} else {
|
|
97
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
98
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
99
|
+
}, 0)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const getIncludedTaxesDiscounts = () => {
|
|
104
|
+
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
return (
|
|
94
108
|
<>
|
|
95
109
|
<Container>
|
|
@@ -177,13 +191,10 @@ const CartUI = (props: any) => {
|
|
|
177
191
|
<OSTable>
|
|
178
192
|
<OText>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
179
193
|
<OText>
|
|
180
|
-
{cart
|
|
181
|
-
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
182
|
-
: parsePrice(cart?.subtotal || 0)}
|
|
194
|
+
{parsePrice(cart?.subtotal + getIncludedTaxes())}
|
|
183
195
|
</OText>
|
|
184
196
|
</OSTable>
|
|
185
|
-
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
|
|
186
|
-
|
|
197
|
+
{cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && orientationState?.orientation == PORTRAIT && (
|
|
187
198
|
<OSTable
|
|
188
199
|
style={{
|
|
189
200
|
backgroundColor: theme.colors.success,
|
|
@@ -226,44 +237,107 @@ const CartUI = (props: any) => {
|
|
|
226
237
|
</OText>
|
|
227
238
|
</OSTable>
|
|
228
239
|
)}
|
|
229
|
-
{
|
|
240
|
+
{
|
|
241
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
|
|
242
|
+
<OSTable key={offer.id}>
|
|
243
|
+
<OSRow>
|
|
244
|
+
<OText>{offer.name}</OText>
|
|
245
|
+
{offer.rate_type === 1 && (
|
|
246
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
247
|
+
)}
|
|
248
|
+
</OSRow>
|
|
249
|
+
<OText>
|
|
250
|
+
- {parsePrice(offer?.summary?.discount)}
|
|
251
|
+
</OText>
|
|
252
|
+
</OSTable>
|
|
253
|
+
))
|
|
254
|
+
}
|
|
255
|
+
{cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
230
256
|
<OSTable>
|
|
231
|
-
<OText>
|
|
232
|
-
|
|
233
|
-
{
|
|
234
|
-
|
|
235
|
-
|
|
257
|
+
<OText numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
258
|
+
{cart?.business?.tax_type === 1 ? (
|
|
259
|
+
<OText>{parsePrice(cart?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0)}</OText>
|
|
260
|
+
) : (
|
|
261
|
+
<OText>{parsePrice(cart?.subtotal_with_discount ?? 0)}</OText>
|
|
262
|
+
)}
|
|
236
263
|
</OSTable>
|
|
237
264
|
)}
|
|
265
|
+
{
|
|
266
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
267
|
+
<OSTable key={tax.id}>
|
|
268
|
+
<OSRow>
|
|
269
|
+
<OText>
|
|
270
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
271
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
272
|
+
</OText>
|
|
273
|
+
</OSRow>
|
|
274
|
+
<OText>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
275
|
+
</OSTable>
|
|
276
|
+
))
|
|
277
|
+
}
|
|
278
|
+
{
|
|
279
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
280
|
+
<OSTable key={fee?.id}>
|
|
281
|
+
<OSRow>
|
|
282
|
+
<OText>
|
|
283
|
+
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
284
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
285
|
+
</OText>
|
|
286
|
+
</OSRow>
|
|
287
|
+
<OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
|
|
288
|
+
</OSTable>
|
|
289
|
+
))
|
|
290
|
+
}
|
|
291
|
+
{
|
|
292
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
|
|
293
|
+
<OSTable key={offer.id}>
|
|
294
|
+
<OSRow>
|
|
295
|
+
<OText>{offer.name}</OText>
|
|
296
|
+
{offer.rate_type === 1 && (
|
|
297
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
298
|
+
)}
|
|
299
|
+
</OSRow>
|
|
300
|
+
<OText>
|
|
301
|
+
- {parsePrice(offer?.summary?.discount)}
|
|
302
|
+
</OText>
|
|
303
|
+
</OSTable>
|
|
304
|
+
))
|
|
305
|
+
}
|
|
238
306
|
{selectedOrderType === 1 && cart?.delivery_price > 0 && (
|
|
239
307
|
<OSTable>
|
|
240
308
|
<OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
241
309
|
<OText>{parsePrice(cart?.delivery_price)}</OText>
|
|
242
310
|
</OSTable>
|
|
243
311
|
)}
|
|
312
|
+
{
|
|
313
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
314
|
+
<OSTable key={offer.id}>
|
|
315
|
+
<OSRow>
|
|
316
|
+
<OText>{offer.name}</OText>
|
|
317
|
+
{offer.rate_type === 1 && (
|
|
318
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
319
|
+
)}
|
|
320
|
+
</OSRow>
|
|
321
|
+
<OText>
|
|
322
|
+
- {parsePrice(offer?.summary?.discount)}
|
|
323
|
+
</OText>
|
|
324
|
+
</OSTable>
|
|
325
|
+
))
|
|
326
|
+
}
|
|
244
327
|
{cart?.driver_tip > 0 && (
|
|
245
328
|
<OSTable>
|
|
246
329
|
<OText>
|
|
247
330
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
248
331
|
{cart?.driver_tip_rate > 0 &&
|
|
249
332
|
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
250
|
-
|
|
333
|
+
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
251
334
|
(
|
|
252
|
-
`(${
|
|
335
|
+
`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
|
|
253
336
|
)}
|
|
254
337
|
</OText>
|
|
255
338
|
<OText>{parsePrice(cart?.driver_tip)}</OText>
|
|
256
339
|
</OSTable>
|
|
257
340
|
)}
|
|
258
|
-
{cart?.service_fee > 0 && (
|
|
259
|
-
<OSTable>
|
|
260
|
-
<OText>
|
|
261
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
262
|
-
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
263
|
-
</OText>
|
|
264
|
-
<OText>{parsePrice(cart?.service_fee)}</OText>
|
|
265
|
-
</OSTable>
|
|
266
|
-
)}
|
|
267
341
|
{!cart?.discount_type && isCouponEnabled && !isCartPending && orientationState?.orientation == PORTRAIT && (
|
|
268
342
|
<OSTable>
|
|
269
343
|
<OSCoupon>
|
|
@@ -279,7 +353,7 @@ const CartUI = (props: any) => {
|
|
|
279
353
|
{t('TOTAL', 'Total')}
|
|
280
354
|
</OText>
|
|
281
355
|
<OText weight='bold' color={theme.colors.primary}>
|
|
282
|
-
{cart?.total >=
|
|
356
|
+
{parsePrice(cart?.total >= 0 ? cart?.total : 0)}
|
|
283
357
|
</OText>
|
|
284
358
|
</OSTable>
|
|
285
359
|
</OSBill>
|
|
@@ -179,7 +179,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
179
179
|
<ProductForm
|
|
180
180
|
productCart={curProduct}
|
|
181
181
|
businessSlug={cart?.business?.slug}
|
|
182
|
-
businessId={
|
|
182
|
+
businessId={cart?.business_id}
|
|
183
183
|
categoryId={curProduct?.category_id}
|
|
184
184
|
productId={curProduct?.id}
|
|
185
185
|
onSave={handlerProductAction}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useLanguage } from 'ordering-components/native';
|
|
3
|
-
|
|
3
|
+
import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
|
|
4
4
|
import { CCNotCarts } from './styles';
|
|
5
5
|
|
|
6
6
|
import { Cart } from '../Cart';
|
|
@@ -22,6 +22,7 @@ export const CartContent = (props: any) => {
|
|
|
22
22
|
|
|
23
23
|
const [, t] = useLanguage()
|
|
24
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
25
|
+
const [, { hideCartBottomSheet }] = useCartBottomSheet();
|
|
25
26
|
|
|
26
27
|
const cartProps = {
|
|
27
28
|
navigation,
|
|
@@ -33,6 +34,15 @@ export const CartContent = (props: any) => {
|
|
|
33
34
|
resetInactivityTimeout,
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!cart && showNotFound) {
|
|
39
|
+
navigation?.canGoBack()
|
|
40
|
+
? navigation.goBack()
|
|
41
|
+
: props.onNavigationRedirect && props.onNavigationRedirect('Business')
|
|
42
|
+
hideCartBottomSheet()
|
|
43
|
+
}
|
|
44
|
+
}, [cart])
|
|
45
|
+
|
|
36
46
|
const content = (
|
|
37
47
|
<>
|
|
38
48
|
{(isOrderStateCarts && cart) && (
|
|
@@ -46,13 +56,13 @@ export const CartContent = (props: any) => {
|
|
|
46
56
|
}
|
|
47
57
|
</>
|
|
48
58
|
)}
|
|
49
|
-
{(!cart && showNotFound) && (
|
|
59
|
+
{/* {(!cart && showNotFound) && (
|
|
50
60
|
<CCNotCarts>
|
|
51
61
|
<OText size={24} style={{ textAlign: 'center' }}>
|
|
52
62
|
{t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
53
63
|
</OText>
|
|
54
64
|
</CCNotCarts>
|
|
55
|
-
)}
|
|
65
|
+
)} */}
|
|
56
66
|
<Spinner visible={isCartsLoading} />
|
|
57
67
|
</>
|
|
58
68
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, Animated, TouchableOpacity } from 'react-native';
|
|
2
|
+
import { View, Animated, TouchableOpacity, ImageBackground } from 'react-native';
|
|
3
3
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
4
|
+
import FastImage from 'react-native-fast-image'
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
StyledCartItem,
|
|
@@ -70,13 +71,24 @@ const CartItem = (props: CartItemProps) => {
|
|
|
70
71
|
>
|
|
71
72
|
<StyledCartItem>
|
|
72
73
|
<View style={{ flexDirection: 'row' }}>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
{product?.images ? (
|
|
75
|
+
<FastImage
|
|
76
|
+
style={{ height: 60, width: 80, borderRadius: 6 }}
|
|
77
|
+
source={{
|
|
78
|
+
uri: product?.images,
|
|
79
|
+
priority: FastImage.priority.normal,
|
|
80
|
+
// cache:FastImage.cacheControl.web
|
|
81
|
+
}}
|
|
82
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
83
|
+
/>
|
|
84
|
+
) : (
|
|
85
|
+
<ImageBackground
|
|
86
|
+
style={{ height: 60, width: 80, borderRadius: 6 }}
|
|
87
|
+
source={theme.images.dummies.product}
|
|
88
|
+
imageStyle={{ borderRadius: 6 }}
|
|
89
|
+
resizeMode='cover'
|
|
90
|
+
/>
|
|
91
|
+
)}
|
|
80
92
|
|
|
81
93
|
<View style={{ flexDirection: 'column', justifyContent: 'space-evenly', marginHorizontal: 15, marginTop: 10 }}>
|
|
82
94
|
<View>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
|
|
2
|
+
import { _retrieveStoreData } from '../../../../../src/providers/StoreUtil';
|
|
3
3
|
import {
|
|
4
4
|
Checkout as CheckoutController,
|
|
5
5
|
useOrder,
|
|
@@ -35,28 +35,40 @@ const CheckoutUI = (props: any) => {
|
|
|
35
35
|
} = props
|
|
36
36
|
|
|
37
37
|
const [errorCash, setErrorCash] = useState(false);
|
|
38
|
+
const [customerName, setCustomerName] = useState(null);
|
|
39
|
+
|
|
40
|
+
const getCustomerName = async () => {
|
|
41
|
+
const data = await _retrieveStoreData('customer_name');
|
|
42
|
+
setCustomerName(data?.customerName)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
|
|
47
|
+
navigation?.canGoBack() && navigation.goBack()
|
|
48
|
+
} else {
|
|
49
|
+
getCustomerName()
|
|
50
|
+
}
|
|
51
|
+
}, [cart])
|
|
38
52
|
|
|
39
53
|
return (
|
|
40
54
|
<>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/>
|
|
59
|
-
)}
|
|
55
|
+
<PaymentOptions
|
|
56
|
+
navigation={navigation}
|
|
57
|
+
cart={cart}
|
|
58
|
+
errors={errors}
|
|
59
|
+
customerName={customerName}
|
|
60
|
+
onPaymentChange={handlePaymethodChange}
|
|
61
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
62
|
+
paySelected={paymethodSelected}
|
|
63
|
+
handlerClickPlaceOrder={handlerClickPlaceOrder}
|
|
64
|
+
placing={placing}
|
|
65
|
+
errorCash={errorCash}
|
|
66
|
+
isDisabled={cart?.status === 2}
|
|
67
|
+
businessId={businessDetails?.business?.id}
|
|
68
|
+
isLoading={cartState.loading || businessDetails.loading}
|
|
69
|
+
paymethods={businessDetails?.business?.paymethods}
|
|
70
|
+
setErrorCash={setErrorCash}
|
|
71
|
+
/>
|
|
60
72
|
</>
|
|
61
73
|
)
|
|
62
74
|
}
|
|
@@ -107,7 +119,7 @@ export const Checkout = (props: any) => {
|
|
|
107
119
|
loading: false,
|
|
108
120
|
cart: result
|
|
109
121
|
})
|
|
110
|
-
} catch (error) {
|
|
122
|
+
} catch (error: any) {
|
|
111
123
|
showToast(ToastType.Error, error?.toString() || error.message)
|
|
112
124
|
}
|
|
113
125
|
} else {
|
|
@@ -119,7 +131,7 @@ export const Checkout = (props: any) => {
|
|
|
119
131
|
error: cart ? null : result
|
|
120
132
|
})
|
|
121
133
|
}
|
|
122
|
-
} catch (e) {
|
|
134
|
+
} catch (e: any) {
|
|
123
135
|
setCartState({
|
|
124
136
|
...cartState,
|
|
125
137
|
loading: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { useLanguage, ToastType, useToast } from 'ordering-components/native';
|
|
3
|
-
import { _setStoreData } from '../../../../../src/providers/StoreUtil';
|
|
3
|
+
import { _setStoreData, _removeStoreData } from '../../../../../src/providers/StoreUtil';
|
|
4
4
|
|
|
5
5
|
import { OButton, OInput, OText } from '../shared';
|
|
6
6
|
import { useForm, Controller } from 'react-hook-form';
|
|
@@ -28,6 +28,11 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
28
28
|
onProceedToPay()
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
const onSkip = () => {
|
|
32
|
+
_removeStoreData('customer_name')
|
|
33
|
+
onProceedToPay()
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
const styles = StyleSheet.create({
|
|
32
37
|
inputStyle: {
|
|
33
38
|
borderRadius: 4,
|
|
@@ -75,7 +80,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
75
80
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
76
81
|
<OButton
|
|
77
82
|
text={t('SKIP', 'Skip')}
|
|
78
|
-
onClick={
|
|
83
|
+
onClick={onSkip}
|
|
79
84
|
textStyle={{ color: theme.colors.primary, fontSize: 20 }}
|
|
80
85
|
parentStyle={{
|
|
81
86
|
height: orientationState?.orientation === PORTRAIT
|
|
@@ -108,12 +113,6 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
108
113
|
style={{ bottom: 20 }}
|
|
109
114
|
>
|
|
110
115
|
{t('WHATS_YOUR_NAME', "What's your name?")}
|
|
111
|
-
{/* <OText
|
|
112
|
-
size={orientationState?.dimensions?.width * 0.05}
|
|
113
|
-
weight={'700'}
|
|
114
|
-
>
|
|
115
|
-
{`${t('ORDER_BE_FOR', 'order be for?')}`}
|
|
116
|
-
</OText> */}
|
|
117
116
|
</OText>
|
|
118
117
|
<Controller
|
|
119
118
|
control={control}
|