ordering-ui-react-native 0.15.21 → 0.15.22-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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/StripeElementsForm/index.tsx +27 -48
- 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/config.json +0 -2
- 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 +3 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- 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/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +53 -49
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/types/index.tsx +2 -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/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- 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/CategoriesMenu/index.tsx +6 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- 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 +136 -41
- 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/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/components/shared/OCard.tsx +112 -78
- 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 +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- 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 +48 -57
- package/themes/original/src/components/Cart/index.tsx +18 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +42 -27
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- 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/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -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 +34 -27
- 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 +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +40 -33
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- 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/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- 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 -72
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- 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/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +75 -8
- 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/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +46 -4
- package/themes/original/src/utils/index.tsx +12 -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 -168
|
@@ -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';
|
|
@@ -24,10 +24,15 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
24
24
|
const [orientationState] = useDeviceOrientation();
|
|
25
25
|
|
|
26
26
|
const onSubmit = (values: any) => {
|
|
27
|
-
_setStoreData('customer_name', {
|
|
27
|
+
_setStoreData('customer_name', {customerName: values.name});
|
|
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,
|
|
@@ -52,30 +57,26 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
52
57
|
|
|
53
58
|
const goToBack = () => navigation?.goBack();
|
|
54
59
|
|
|
55
|
-
const submitButton
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}}
|
|
70
|
-
/>
|
|
71
|
-
</View>
|
|
72
|
-
);
|
|
60
|
+
const submitButton = (<OButton
|
|
61
|
+
text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
|
|
62
|
+
onClick={handleSubmit(onSubmit)}
|
|
63
|
+
textStyle={{color: theme.colors.primaryContrast, fontSize: 20}}
|
|
64
|
+
parentStyle={{
|
|
65
|
+
height: orientationState?.orientation === PORTRAIT
|
|
66
|
+
? 50 : 100
|
|
67
|
+
}}
|
|
68
|
+
style={{
|
|
69
|
+
width: orientationState?.orientation === PORTRAIT
|
|
70
|
+
? orientationState?.dimensions.width - 40
|
|
71
|
+
: orientationState?.dimensions.width * 0.5,
|
|
72
|
+
}}
|
|
73
|
+
/>);
|
|
73
74
|
|
|
74
|
-
const skipButton
|
|
75
|
-
<View style={{
|
|
75
|
+
const skipButton = (
|
|
76
|
+
<View style={{flex:1, left: orientationState?.dimensions.width * 0.2,}}>
|
|
76
77
|
<OButton
|
|
77
78
|
text={t('SKIP', 'Skip')}
|
|
78
|
-
onClick={
|
|
79
|
+
onClick={onSkip}
|
|
79
80
|
textStyle={{ color: theme.colors.primary, fontSize: 20 }}
|
|
80
81
|
parentStyle={{
|
|
81
82
|
height: orientationState?.orientation === PORTRAIT
|
|
@@ -84,7 +85,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
84
85
|
style={{
|
|
85
86
|
backgroundColor: theme.colors.white,
|
|
86
87
|
width: orientationState?.orientation === PORTRAIT
|
|
87
|
-
? orientationState?.dimensions.width
|
|
88
|
+
? orientationState?.dimensions.width - 40
|
|
88
89
|
: orientationState?.dimensions.width * 0.1,
|
|
89
90
|
}}
|
|
90
91
|
/>
|
|
@@ -93,78 +94,78 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
93
94
|
|
|
94
95
|
return (
|
|
95
96
|
<>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
<Container>
|
|
98
|
+
<NavBar
|
|
99
|
+
title={t('YOUR_NAME', 'Your name')}
|
|
100
|
+
onActionLeft={goToBack}
|
|
101
|
+
btnStyle={{paddingLeft: 0}}
|
|
102
|
+
/>
|
|
103
|
+
<View style={{
|
|
104
|
+
marginVertical: orientationState?.dimensions?.height * 0.08,
|
|
105
|
+
paddingLeft: orientationState?.dimensions?.width * 0.25
|
|
106
|
+
}}>
|
|
107
|
+
<OText
|
|
108
|
+
size={orientationState?.dimensions?.width * 0.05}
|
|
109
|
+
style={{bottom: 20}}
|
|
110
|
+
>
|
|
111
|
+
{t('WHATS_YOUR_NAME', "What's your name?")}
|
|
112
|
+
{/* <OText
|
|
112
113
|
size={orientationState?.dimensions?.width * 0.05}
|
|
113
114
|
weight={'700'}
|
|
114
115
|
>
|
|
115
116
|
{`${t('ORDER_BE_FOR', 'order be for?')}`}
|
|
116
117
|
</OText> */}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
118
|
+
</OText>
|
|
119
|
+
<Controller
|
|
120
|
+
control={control}
|
|
121
|
+
render={({ onChange, value }: any) => (
|
|
122
|
+
<OInput
|
|
123
|
+
placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
|
|
124
|
+
style={{
|
|
125
|
+
...styles.inputStyle,
|
|
126
|
+
width: orientationState?.orientation === PORTRAIT
|
|
127
|
+
? orientationState?.dimensions.width - 40
|
|
128
|
+
: orientationState?.dimensions.width * 0.5,
|
|
129
|
+
}}
|
|
130
|
+
value={value}
|
|
131
|
+
autoCapitalize="words"
|
|
132
|
+
autoCorrect={false}
|
|
133
|
+
onChange={(val: any) => onChange(val)}
|
|
134
|
+
onSubmitEditing={handleSubmit(onSubmit)}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
name="name"
|
|
138
|
+
rules={{
|
|
139
|
+
required: t(
|
|
140
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
141
|
+
'The field Customer Name is required',
|
|
142
|
+
).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
|
|
143
|
+
pattern: {
|
|
144
|
+
value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
|
|
145
|
+
message: t(
|
|
146
|
+
'INVALID_ERROR',
|
|
147
|
+
'Invalid name',
|
|
148
|
+
).replace('_attribute_', t('NAME', 'Name')),
|
|
149
|
+
}
|
|
128
150
|
}}
|
|
129
|
-
|
|
130
|
-
autoCapitalize="words"
|
|
131
|
-
autoCorrect={false}
|
|
132
|
-
onChange={(val: any) => onChange(val)}
|
|
133
|
-
onSubmitEditing={handleSubmit(onSubmit)}
|
|
151
|
+
defaultValue=""
|
|
134
152
|
/>
|
|
135
|
-
)}
|
|
136
|
-
name="name"
|
|
137
|
-
rules={{
|
|
138
|
-
required: t(
|
|
139
|
-
'VALIDATION_ERROR_REQUIRED',
|
|
140
|
-
'The field Customer Name is required',
|
|
141
|
-
).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
|
|
142
|
-
pattern: {
|
|
143
|
-
value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
|
|
144
|
-
message: t(
|
|
145
|
-
'INVALID_ERROR',
|
|
146
|
-
'Invalid name',
|
|
147
|
-
).replace('_attribute_', t('NAME', 'Name')),
|
|
148
|
-
}
|
|
149
|
-
}}
|
|
150
|
-
defaultValue=""
|
|
151
|
-
/>
|
|
152
153
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
154
|
+
{orientationState?.orientation === LANDSCAPE && submitButton}
|
|
155
|
+
{orientationState?.orientation === LANDSCAPE && skipButton}
|
|
156
|
+
{(orientationState?.orientation === PORTRAIT) && (
|
|
157
|
+
<OSActions>
|
|
158
|
+
{submitButton}
|
|
159
|
+
</OSActions>
|
|
160
|
+
)}
|
|
161
|
+
{(orientationState?.orientation === PORTRAIT) && (
|
|
162
|
+
<OSActions>
|
|
163
|
+
{skipButton}
|
|
164
|
+
</OSActions>
|
|
165
|
+
)}
|
|
166
|
+
</View>
|
|
167
|
+
</Container>
|
|
168
|
+
</>
|
|
168
169
|
);
|
|
169
170
|
};
|
|
170
171
|
|
|
@@ -32,17 +32,17 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<ScrollView
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
>
|
|
35
|
+
// <ScrollView
|
|
36
|
+
// scrollEnabled={false}
|
|
37
|
+
// refreshControl={
|
|
38
|
+
// <RefreshControl
|
|
39
|
+
// refreshing={showLogoutPopup ? false : refreshing}
|
|
40
|
+
// onRefresh={() => setShowLogoutPopup(true)}
|
|
41
|
+
// />
|
|
42
|
+
// }
|
|
43
|
+
// >
|
|
44
44
|
<Pressable onPress={goBusiness}>
|
|
45
|
-
<
|
|
45
|
+
<View style={{ height: orientationState?.dimensions?.height }}>
|
|
46
46
|
{orientationState.orientation === PORTRAIT ? (
|
|
47
47
|
<View
|
|
48
48
|
style={{
|
|
@@ -132,15 +132,15 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
132
132
|
open={showLogoutPopup}
|
|
133
133
|
onClose={() => setShowLogoutPopup(false)}
|
|
134
134
|
/>
|
|
135
|
-
</
|
|
135
|
+
</View>
|
|
136
136
|
</Pressable>
|
|
137
|
-
</ScrollView>
|
|
137
|
+
// </ScrollView>
|
|
138
138
|
);
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
const styles = StyleSheet.create({
|
|
142
142
|
buttonLandStyle: {
|
|
143
|
-
|
|
143
|
+
minWidth: 130,
|
|
144
144
|
marginBottom: 16
|
|
145
145
|
}
|
|
146
146
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { TouchableOpacity, View, StyleSheet } from 'react-native'
|
|
3
|
-
import { LanguageSelector as LanguageSelectorController } from 'ordering-components/native'
|
|
2
|
+
import { TouchableOpacity, View, StyleSheet, ActivityIndicator } from 'react-native'
|
|
3
|
+
import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
|
|
4
4
|
import CountryPicker, { Flag } from 'react-native-country-picker-modal'
|
|
5
5
|
|
|
6
6
|
import { Container, LanguageItem } from './styles'
|
|
@@ -40,6 +40,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
40
40
|
(a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
+
const [orderState] = useOrder()
|
|
43
44
|
const [isCountryModalVisible, setCountryModalVisible] = useState(false);
|
|
44
45
|
|
|
45
46
|
const countryCodes = _languages?.map((item:any) => item.countryCode);
|
|
@@ -48,7 +49,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<>
|
|
51
|
-
{ languagesState.loading ?
|
|
52
|
+
{ languagesState.loading ?
|
|
52
53
|
(<Container>
|
|
53
54
|
<Placeholder style={{ width: 130, paddingTop: 10 }} Animation={Fade}>
|
|
54
55
|
<PlaceholderLine height={15}/>
|
|
@@ -66,8 +67,8 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
66
67
|
closeButtonStyle={styles.closeIcon}
|
|
67
68
|
renderFlagButton={() => (
|
|
68
69
|
<TouchableOpacity
|
|
69
|
-
onPress={() => setCountryModalVisible(true)}
|
|
70
|
-
disabled={
|
|
70
|
+
onPress={() => orderState.loading ? {} : setCountryModalVisible(true)}
|
|
71
|
+
// disabled={orderState.loading}
|
|
71
72
|
>
|
|
72
73
|
<LanguageItem>
|
|
73
74
|
<Flag
|
|
@@ -76,7 +77,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
76
77
|
countryCode={currentLanguageData?.countryCode}
|
|
77
78
|
/>
|
|
78
79
|
<OText color={theme.colors.primary}>{currentLanguageData?.label}</OText>
|
|
79
|
-
|
|
80
|
+
{orderState.loading ? (
|
|
81
|
+
<ActivityIndicator size="small" color={theme.colors.primary} style={{ marginLeft: 5 }} />
|
|
82
|
+
) : (
|
|
83
|
+
<MatarialIcon name='keyboard-arrow-down' size={24}/>
|
|
84
|
+
)}
|
|
80
85
|
</LanguageItem>
|
|
81
86
|
</TouchableOpacity>
|
|
82
87
|
)}
|
|
@@ -87,11 +92,10 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
87
92
|
renderItem: ({item} : any) => (
|
|
88
93
|
<TouchableOpacity
|
|
89
94
|
onPress={() => {
|
|
90
|
-
/* @ts-ignore */
|
|
91
95
|
handleChangeLanguage(item.value);
|
|
92
96
|
setCountryModalVisible(false);
|
|
93
97
|
}}
|
|
94
|
-
disabled={
|
|
98
|
+
disabled={orderState.loading}
|
|
95
99
|
>
|
|
96
100
|
<LanguageItem>
|
|
97
101
|
<View style={styles.flagsContainer} />
|
|
@@ -5,6 +5,7 @@ import { ImageStyle, TextStyle, View, Platform } from 'react-native'
|
|
|
5
5
|
import { OrderTypeSelector } from '../OrderTypeSelector'
|
|
6
6
|
import { useConfig, useLanguage } from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native'
|
|
8
|
+
|
|
8
9
|
const Wrapper = styled.View`
|
|
9
10
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
10
11
|
padding: 10px 0px 20px 0px;
|
|
@@ -64,28 +65,27 @@ const NavBar = (props: Props) => {
|
|
|
64
65
|
|
|
65
66
|
return (
|
|
66
67
|
<Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
|
|
67
|
-
{(props?.onActionLeft) && (
|
|
68
|
+
{(props?.onActionLeft || props?.leftImg) && (
|
|
68
69
|
<OButton
|
|
69
|
-
imgLeftSrc={props.leftImg}
|
|
70
|
+
imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
|
|
70
71
|
imgRightSrc={null}
|
|
71
72
|
style={{ ...btnBackArrow, ...props.btnStyle }}
|
|
72
73
|
onClick={props.onActionLeft}
|
|
73
|
-
imgLeftStyle={props.imgLeftStyle}
|
|
74
|
-
{...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
|
|
74
|
+
imgLeftStyle= {props.imgLeftStyle}
|
|
75
75
|
/>)
|
|
76
76
|
}
|
|
77
77
|
<TitleTopWrapper>
|
|
78
78
|
{props.withIcon
|
|
79
79
|
? (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
<OIcon
|
|
81
|
+
url={props.icon}
|
|
82
|
+
style={{
|
|
83
|
+
borderColor: theme.colors.lightGray,
|
|
84
|
+
borderRadius: 20,
|
|
85
|
+
}}
|
|
86
|
+
width={60}
|
|
87
|
+
height={60}
|
|
88
|
+
/>
|
|
89
89
|
)
|
|
90
90
|
: null
|
|
91
91
|
}
|
|
@@ -125,7 +125,7 @@ const NavBar = (props: Props) => {
|
|
|
125
125
|
</View>
|
|
126
126
|
)}
|
|
127
127
|
|
|
128
|
-
{props.rightComponent}
|
|
128
|
+
{ props.rightComponent }
|
|
129
129
|
</Wrapper>
|
|
130
130
|
)
|
|
131
131
|
}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
Table,
|
|
24
24
|
OrderBill,
|
|
25
25
|
Total,
|
|
26
|
+
OSRow,
|
|
26
27
|
} from './styles'
|
|
27
28
|
import { OrderDetailsParams, Product } from '../../types'
|
|
28
29
|
import { Container } from '../../layouts/Container';
|
|
@@ -178,6 +179,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
178
179
|
setIsLoading(false)
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
const getIncludedTaxes = () => {
|
|
183
|
+
if (order?.taxes?.length === 0) {
|
|
184
|
+
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
185
|
+
} else {
|
|
186
|
+
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
187
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
188
|
+
}, 0)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const getIncludedTaxesDiscounts = () => {
|
|
193
|
+
return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
194
|
+
}
|
|
195
|
+
|
|
181
196
|
useEffect(() => {
|
|
182
197
|
const backAction = () => {
|
|
183
198
|
Alert.alert(`${t('HOLD_ON', 'Hold on')}!`, `${t('ARE_YOU_SURE_YOU_WANT_TO_GO_BACK', 'Are you sure you want to go back')}?`, [
|
|
@@ -209,16 +224,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
209
224
|
const getCustomerName = async () => {
|
|
210
225
|
try {
|
|
211
226
|
const { customerName: name } = await _retrieveStoreData('customer_name')
|
|
212
|
-
|
|
227
|
+
setCustomerName(name)
|
|
213
228
|
} catch (e) {
|
|
214
229
|
if (e) {
|
|
215
|
-
setCustomerName(
|
|
230
|
+
setCustomerName(null)
|
|
216
231
|
}
|
|
217
232
|
}
|
|
218
233
|
}
|
|
219
234
|
getCustomerName()
|
|
220
|
-
const redirectHome = setTimeout(() =>{
|
|
221
|
-
_setStoreData('customer_name', {customerName: ''});
|
|
235
|
+
const redirectHome = setTimeout(() => {
|
|
236
|
+
_setStoreData('customer_name', { customerName: '' });
|
|
222
237
|
navigation.reset({
|
|
223
238
|
routes: [{ name: 'Intro' }],
|
|
224
239
|
});
|
|
@@ -345,7 +360,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
345
360
|
<OButton
|
|
346
361
|
text={`${t('YOU_ARE_DONE', 'You are done! Click to close')}!`}
|
|
347
362
|
onClick={() => {
|
|
348
|
-
_setStoreData('customer_name', {customerName: ''});
|
|
363
|
+
_setStoreData('customer_name', { customerName: '' });
|
|
349
364
|
navigation.reset({
|
|
350
365
|
routes: [{ name: 'Intro' }],
|
|
351
366
|
});
|
|
@@ -419,46 +434,135 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
419
434
|
<Table>
|
|
420
435
|
<OText>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
421
436
|
<OText>
|
|
422
|
-
{parsePrice(
|
|
423
|
-
? (order?.summary?.subtotal + order?.summary?.tax) ?? 0
|
|
424
|
-
: order?.summary?.subtotal ?? 0
|
|
425
|
-
)}
|
|
437
|
+
{parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
|
|
426
438
|
</OText>
|
|
427
439
|
</Table>
|
|
428
|
-
{order?.summary?.discount > 0 && (
|
|
440
|
+
{(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
|
|
429
441
|
<Table>
|
|
430
442
|
{order?.offer_type === 1 ? (
|
|
431
443
|
<OText>
|
|
432
444
|
{t('DISCOUNT', 'Discount')}
|
|
433
|
-
<OText>{`(${verifyDecimals(
|
|
445
|
+
<OText>{`(${verifyDecimals(
|
|
446
|
+
order?.offer_rate,
|
|
447
|
+
parsePrice,
|
|
448
|
+
)}%)`}</OText>
|
|
434
449
|
</OText>
|
|
435
450
|
) : (
|
|
436
451
|
<OText>{t('DISCOUNT', 'Discount')}</OText>
|
|
437
452
|
)}
|
|
438
|
-
<OText
|
|
453
|
+
<OText>
|
|
454
|
+
- {parsePrice(order?.summary?.discount || order?.discount)}
|
|
455
|
+
</OText>
|
|
439
456
|
</Table>
|
|
440
457
|
)}
|
|
458
|
+
{
|
|
459
|
+
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
|
|
460
|
+
<Table key={offer.id}>
|
|
461
|
+
<OSRow>
|
|
462
|
+
<OText>
|
|
463
|
+
{offer.name}
|
|
464
|
+
{offer.rate_type === 1 && (
|
|
465
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
466
|
+
)}
|
|
467
|
+
</OText>
|
|
468
|
+
</OSRow>
|
|
469
|
+
<OText>- {parsePrice(offer?.summary?.discount)}</OText>
|
|
470
|
+
</Table>
|
|
471
|
+
))
|
|
472
|
+
}
|
|
441
473
|
{order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
|
|
442
474
|
<Table>
|
|
443
475
|
<OText>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
<OText>
|
|
450
|
-
{t('TAX', 'Tax')}
|
|
451
|
-
{`(${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%)`}
|
|
452
|
-
</OText>
|
|
453
|
-
<OText>{parsePrice(order?.summary?.tax)}</OText>
|
|
476
|
+
{order?.tax_type === 1 ? (
|
|
477
|
+
<OText>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
|
|
478
|
+
) : (
|
|
479
|
+
<OText>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
|
|
480
|
+
)}
|
|
454
481
|
</Table>
|
|
455
482
|
)}
|
|
483
|
+
{
|
|
484
|
+
order?.taxes?.length === 0 && order?.tax_type === 2 && (
|
|
485
|
+
<Table>
|
|
486
|
+
<OText>
|
|
487
|
+
{t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
|
|
488
|
+
</OText>
|
|
489
|
+
<OText>{parsePrice(order?.summary?.tax || 0)}</OText>
|
|
490
|
+
</Table>
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
{
|
|
494
|
+
order?.fees?.length === 0 && (
|
|
495
|
+
<Table>
|
|
496
|
+
<OText>
|
|
497
|
+
{t('SERVICE_FEE', 'Service fee')}
|
|
498
|
+
{`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
|
|
499
|
+
</OText>
|
|
500
|
+
<OText>{parsePrice(order?.summary?.service_fee || 0)}</OText>
|
|
501
|
+
</Table>
|
|
502
|
+
)
|
|
503
|
+
}
|
|
504
|
+
{
|
|
505
|
+
order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
506
|
+
<Table key={tax.id}>
|
|
507
|
+
<OSRow>
|
|
508
|
+
<OText>
|
|
509
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
510
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
511
|
+
</OText>
|
|
512
|
+
</OSRow>
|
|
513
|
+
<OText>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
514
|
+
</Table>
|
|
515
|
+
))
|
|
516
|
+
}
|
|
517
|
+
{
|
|
518
|
+
order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
|
|
519
|
+
<Table key={fee.id}>
|
|
520
|
+
<OSRow>
|
|
521
|
+
<OText>
|
|
522
|
+
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
523
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
524
|
+
</OText>
|
|
525
|
+
</OSRow>
|
|
526
|
+
<OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
|
|
527
|
+
</Table>
|
|
528
|
+
))
|
|
529
|
+
}
|
|
530
|
+
{
|
|
531
|
+
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
|
|
532
|
+
<Table key={offer.id}>
|
|
533
|
+
<OSRow>
|
|
534
|
+
<OText>
|
|
535
|
+
{offer.name}
|
|
536
|
+
{offer.rate_type === 1 && (
|
|
537
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
538
|
+
)}
|
|
539
|
+
</OText>
|
|
540
|
+
</OSRow>
|
|
541
|
+
<OText>- {parsePrice(offer?.summary?.discount)}</OText>
|
|
542
|
+
</Table>
|
|
543
|
+
))
|
|
544
|
+
}
|
|
456
545
|
{order?.summary?.delivery_price > 0 && (
|
|
457
546
|
<Table>
|
|
458
547
|
<OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
459
548
|
<OText>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
460
549
|
</Table>
|
|
461
550
|
)}
|
|
551
|
+
{
|
|
552
|
+
order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
553
|
+
<Table key={offer.id}>
|
|
554
|
+
<OSRow>
|
|
555
|
+
<OText>
|
|
556
|
+
{offer.name}
|
|
557
|
+
{offer.rate_type === 1 && (
|
|
558
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
559
|
+
)}
|
|
560
|
+
</OText>
|
|
561
|
+
</OSRow>
|
|
562
|
+
<OText>- {parsePrice(offer?.summary?.discount)}</OText>
|
|
563
|
+
</Table>
|
|
564
|
+
))
|
|
565
|
+
}
|
|
462
566
|
{order?.summary?.driver_tip > 0 && (
|
|
463
567
|
<Table>
|
|
464
568
|
<OText>
|
|
@@ -470,23 +574,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
470
574
|
`(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
|
|
471
575
|
)}
|
|
472
576
|
</OText>
|
|
473
|
-
<OText>{parsePrice(order?.summary?.driver_tip ??
|
|
474
|
-
</Table>
|
|
475
|
-
)}
|
|
476
|
-
{order?.summary?.service_fee > 0 && (
|
|
477
|
-
<Table>
|
|
478
|
-
<OText>
|
|
479
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
480
|
-
{`(${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)`}
|
|
481
|
-
</OText>
|
|
482
|
-
<OText>{parsePrice(order?.summary?.service_fee)}</OText>
|
|
577
|
+
<OText>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
|
|
483
578
|
</Table>
|
|
484
579
|
)}
|
|
485
580
|
<Total>
|
|
486
581
|
<Table>
|
|
487
582
|
<OText style={styles.textBold}>{t('TOTAL', 'Total')}</OText>
|
|
488
583
|
<OText style={styles.textBold} color={theme.colors.primary}>
|
|
489
|
-
{parsePrice(order?.summary?.total ??
|
|
584
|
+
{parsePrice(order?.summary?.total ?? order?.total)}
|
|
490
585
|
</OText>
|
|
491
586
|
</Table>
|
|
492
587
|
</Total>
|
|
@@ -508,14 +603,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
508
603
|
<OIconButton
|
|
509
604
|
bgColor="transparent"
|
|
510
605
|
borderColor="transparent"
|
|
511
|
-
RenderIcon={() =>
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
606
|
+
RenderIcon={() =>
|
|
607
|
+
<EvilIcons
|
|
608
|
+
name={'close'}
|
|
609
|
+
size={40}
|
|
610
|
+
color={theme.colors.primary}
|
|
611
|
+
/>
|
|
517
612
|
}
|
|
518
|
-
style={{ flex:1, justifyContent: 'flex-end', left: 30 }}
|
|
613
|
+
style={{ flex: 1, justifyContent: 'flex-end', left: 30 }}
|
|
519
614
|
onClick={() => {
|
|
520
615
|
navigation.reset({
|
|
521
616
|
routes: [{ name: 'Intro' }],
|
|
@@ -553,7 +648,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
553
648
|
size={orientationState?.dimensions?.width * 0.048}
|
|
554
649
|
weight="700"
|
|
555
650
|
>
|
|
556
|
-
{
|
|
651
|
+
{t('HUNGRY', 'hungry')}{!!customerName && `, ${customerName}`}
|
|
557
652
|
</OText>
|
|
558
653
|
</OText>
|
|
559
654
|
|