ordering-ui-react-native 0.15.33 → 0.15.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/themes/kiosk/src/components/Intro/index.tsx +12 -12
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/original/src/components/BusinessController/index.tsx +4 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +15 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +23 -21
- package/themes/original/src/components/OrderDetails/index.tsx +10 -2
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
package/package.json
CHANGED
|
@@ -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,9 +132,9 @@ 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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React,{ useState, useEffect } from 'react'
|
|
2
2
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
3
|
-
import { StyleSheet, View, Platform } from 'react-native'
|
|
3
|
+
import { StyleSheet, View, Platform, ImageBackground } from 'react-native'
|
|
4
4
|
import {
|
|
5
5
|
UpsellingPage as UpsellingPageController,
|
|
6
6
|
useUtils,
|
|
@@ -20,6 +20,7 @@ import { Container } from '../../layouts/Container';
|
|
|
20
20
|
import GridContainer from '../../layouts/GridContainer';
|
|
21
21
|
import { PORTRAIT, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
|
|
22
22
|
import { useTheme } from 'styled-components/native';
|
|
23
|
+
import FastImage from 'react-native-fast-image';
|
|
23
24
|
|
|
24
25
|
const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
25
26
|
const {
|
|
@@ -114,7 +115,24 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
114
115
|
{
|
|
115
116
|
!upsellingProducts.error ? upsellingProducts.products.map((product: any) => (
|
|
116
117
|
<Item key={product.id}>
|
|
117
|
-
|
|
118
|
+
{product?.images ? (
|
|
119
|
+
<FastImage
|
|
120
|
+
style={styles.imageStyle}
|
|
121
|
+
source={{
|
|
122
|
+
uri: product?.images,
|
|
123
|
+
priority: FastImage.priority.normal,
|
|
124
|
+
// cache:FastImage.cacheControl.web
|
|
125
|
+
}}
|
|
126
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
127
|
+
/>
|
|
128
|
+
) : (
|
|
129
|
+
<ImageBackground
|
|
130
|
+
style={styles.imageStyle}
|
|
131
|
+
source={theme.images.dummies.product}
|
|
132
|
+
imageStyle={{ borderRadius: 10 }}
|
|
133
|
+
resizeMode='cover'
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
118
136
|
<Details>
|
|
119
137
|
<OText
|
|
120
138
|
weight="500"
|
|
@@ -125,24 +143,22 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
125
143
|
{product.name}
|
|
126
144
|
</OText>
|
|
127
145
|
|
|
128
|
-
|
|
129
|
-
<OText
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</OText>
|
|
146
|
+
<OText>
|
|
147
|
+
<OText
|
|
148
|
+
color={theme.colors.primary}
|
|
149
|
+
weight="500"
|
|
150
|
+
>
|
|
151
|
+
{parsePrice(product.price)}
|
|
152
|
+
</OText>
|
|
136
153
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
</OText>
|
|
154
|
+
<OText
|
|
155
|
+
color={theme.colors.mediumGray}
|
|
156
|
+
size={12}
|
|
157
|
+
style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
|
|
158
|
+
>
|
|
159
|
+
{product?.offer_price ? ` ${parsePrice(product?.offer_price)} ` : ''}
|
|
144
160
|
</OText>
|
|
145
|
-
|
|
161
|
+
</OText>
|
|
146
162
|
</Details>
|
|
147
163
|
|
|
148
164
|
<OButton
|
|
@@ -200,24 +216,22 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
200
216
|
{product.name}
|
|
201
217
|
</OText>
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
<OText
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
</OText>
|
|
219
|
+
<OText>
|
|
220
|
+
<OText
|
|
221
|
+
color={theme.colors.primary}
|
|
222
|
+
weight="500"
|
|
223
|
+
>
|
|
224
|
+
{parsePrice(product.price)}
|
|
225
|
+
</OText>
|
|
211
226
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</OText>
|
|
227
|
+
<OText
|
|
228
|
+
color={theme.colors.mediumGray}
|
|
229
|
+
size={12}
|
|
230
|
+
style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
|
|
231
|
+
>
|
|
232
|
+
{product?.offer_price ? parsePrice(product?.offer_price) : ''}
|
|
219
233
|
</OText>
|
|
220
|
-
|
|
234
|
+
</OText>
|
|
221
235
|
</Details>
|
|
222
236
|
<OButton
|
|
223
237
|
text={t('ADD_PRODUCT', 'add product')}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useUtils,
|
|
5
5
|
useOrder,
|
|
6
6
|
useLanguage,
|
|
7
|
+
useConfig
|
|
7
8
|
} from 'ordering-components/native';
|
|
8
9
|
import { OIcon, OText } from '../shared';
|
|
9
10
|
import { StyleSheet, View } from 'react-native';
|
|
@@ -44,6 +45,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
44
45
|
const [orderState] = useOrder();
|
|
45
46
|
const [, t] = useLanguage();
|
|
46
47
|
const theme = useTheme()
|
|
48
|
+
const [{ configs }] = useConfig();
|
|
49
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
47
50
|
|
|
48
51
|
const styles = StyleSheet.create({
|
|
49
52
|
headerStyle: {
|
|
@@ -112,7 +115,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
112
115
|
};
|
|
113
116
|
|
|
114
117
|
const handleBusinessClick = (selectedBusiness: any) => {
|
|
115
|
-
if (business?.open) handleClick && handleClick(selectedBusiness)
|
|
118
|
+
if (business?.open || !isPreOrderSetting) handleClick && handleClick(selectedBusiness)
|
|
116
119
|
else {
|
|
117
120
|
navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
|
|
118
121
|
}
|
|
@@ -17,6 +17,7 @@ import { SearchBar } from '../SearchBar'
|
|
|
17
17
|
import { BusinessProductsCategories } from '../BusinessProductsCategories'
|
|
18
18
|
import { BusinessProductsList } from '../BusinessProductsList'
|
|
19
19
|
import { BusinessProductsListingParams } from '../../types'
|
|
20
|
+
import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
|
|
20
21
|
import {
|
|
21
22
|
TopHeader,
|
|
22
23
|
WrapSearchBar,
|
|
@@ -50,7 +51,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
50
51
|
const theme = useTheme();
|
|
51
52
|
const [, t] = useLanguage()
|
|
52
53
|
const [{ auth }] = useSession()
|
|
53
|
-
const [orderState] = useOrder()
|
|
54
|
+
const [orderState, { clearCart }] = useOrder()
|
|
54
55
|
const [{ parsePrice }] = useUtils()
|
|
55
56
|
const [, { showToast }] = useToast()
|
|
56
57
|
const [{ configs }] = useConfig()
|
|
@@ -163,6 +164,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
163
164
|
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
164
165
|
}
|
|
165
166
|
|
|
167
|
+
const removeCartByReOrder = async () => {
|
|
168
|
+
const removeCardId = await _retrieveStoreData('remove-cartId')
|
|
169
|
+
if (currentCart && removeCardId) {
|
|
170
|
+
clearCart(removeCardId)
|
|
171
|
+
_removeStoreData('remove-cartId')
|
|
172
|
+
showToast(ToastType.Info, t('PRODUCT_REMOVED', 'Products removed from cart'))
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
removeCartByReOrder()
|
|
178
|
+
}, [])
|
|
179
|
+
|
|
166
180
|
return (
|
|
167
181
|
<SafeAreaView
|
|
168
182
|
style={{ flex: 1 }}
|
|
@@ -61,7 +61,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
61
61
|
handleChangeSearch,
|
|
62
62
|
businessId
|
|
63
63
|
} = props;
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
const theme = useTheme();
|
|
66
66
|
const isFocused = useIsFocused();
|
|
67
67
|
const appState = useRef(AppState.currentState)
|
|
@@ -120,7 +120,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
120
120
|
|
|
121
121
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
122
122
|
Number(configs?.max_days_preorder?.value) > 0
|
|
123
|
-
|
|
123
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
124
124
|
const timerId = useRef<any>(false)
|
|
125
125
|
// const panResponder = useRef(
|
|
126
126
|
// PanResponder.create({
|
|
@@ -266,25 +266,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
266
266
|
style={{ marginStart: 8 }}
|
|
267
267
|
/>
|
|
268
268
|
</WrapMomentOption>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
269
|
+
{isPreOrderSetting && (
|
|
270
|
+
<WrapMomentOption
|
|
271
|
+
onPress={() => handleMomentClick()}>
|
|
272
|
+
<OText
|
|
273
|
+
size={12}
|
|
274
|
+
numberOfLines={1}
|
|
275
|
+
ellipsizeMode="tail"
|
|
276
|
+
color={theme.colors.textSecondary}>
|
|
277
|
+
{orderState.options?.momentß
|
|
278
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
279
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
280
|
+
</OText>
|
|
281
|
+
{isPreorderEnabled && (
|
|
282
|
+
<OIcon
|
|
283
|
+
src={theme.images.general.arrow_down}
|
|
284
|
+
width={10}
|
|
285
|
+
style={{ marginStart: 8 }}
|
|
286
|
+
/>
|
|
287
|
+
)}
|
|
288
|
+
</WrapMomentOption>
|
|
289
|
+
)}
|
|
288
290
|
|
|
289
291
|
{!businessId && (
|
|
290
292
|
<SearchBar
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { View, StyleSheet, BackHandler, Platform, Linking } from 'react-native';
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { _setStoreData } from '../../providers/StoreUtil';
|
|
4
5
|
import {
|
|
5
6
|
useLanguage,
|
|
6
7
|
OrderDetails as OrderDetailsConTableoller,
|
|
7
8
|
useUtils,
|
|
9
|
+
useOrder,
|
|
8
10
|
useConfig
|
|
9
11
|
} from 'ordering-components/native';
|
|
10
12
|
import { useTheme } from 'styled-components/native';
|
|
@@ -87,9 +89,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
87
89
|
const [, t] = useLanguage();
|
|
88
90
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
89
91
|
const [{ configs }] = useConfig();
|
|
92
|
+
const [{ carts }] = useOrder()
|
|
93
|
+
|
|
90
94
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
91
95
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
92
|
-
|
|
93
96
|
const { order, businessData } = props.order;
|
|
94
97
|
|
|
95
98
|
const walletName: any = {
|
|
@@ -362,7 +365,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
362
365
|
|
|
363
366
|
useEffect(() => {
|
|
364
367
|
if (reorderState?.error) {
|
|
365
|
-
|
|
368
|
+
const _businessId = 'businessId:' + businessData?.id
|
|
369
|
+
const _uuid = carts[_businessId]?.uuid
|
|
370
|
+
if (_uuid) {
|
|
371
|
+
_setStoreData('remove-cartId', JSON.stringify(_uuid))
|
|
372
|
+
navigation.navigate('Business', { store: businessData?.slug })
|
|
373
|
+
}
|
|
366
374
|
}
|
|
367
375
|
if (!reorderState?.error && reorderState?.result?.uuid) {
|
|
368
376
|
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
@@ -97,27 +97,27 @@ export const OrderTypeSelector = (props: any) => {
|
|
|
97
97
|
{
|
|
98
98
|
value: 1,
|
|
99
99
|
content: t('DELIVERY', 'Delivery'),
|
|
100
|
-
description: t('ORDERTYPE_DESCRIPTION_DELIVERY', '
|
|
100
|
+
description: t('ORDERTYPE_DESCRIPTION_DELIVERY', 'Delivery description')
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
value: 2,
|
|
104
104
|
content: t('PICKUP', 'Pickup'),
|
|
105
|
-
description: t('ORDERTYPE_DESCRIPTION_PICKUP', '
|
|
105
|
+
description: t('ORDERTYPE_DESCRIPTION_PICKUP', 'Pickup description')
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
value: 3,
|
|
109
109
|
content: t('EAT_IN', 'Eat in'),
|
|
110
|
-
description: t('ORDERTYPE_DESCRIPTION_EATIN', '
|
|
110
|
+
description: t('ORDERTYPE_DESCRIPTION_EATIN', 'Eat in description')
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
value: 4,
|
|
114
114
|
content: t('CURBSIDE', 'Curbside'),
|
|
115
|
-
description: t('ORDERTYPE_DESCRIPTION_CURBSIDE', '
|
|
115
|
+
description: t('ORDERTYPE_DESCRIPTION_CURBSIDE', 'Curbside description')
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
value: 5,
|
|
119
119
|
content: t('DRIVE_THRU', 'Drive thru'),
|
|
120
|
-
description: t('ORDERTYPE_DESCRIPTION_DRIVETHRU', '
|
|
120
|
+
description: t('ORDERTYPE_DESCRIPTION_DRIVETHRU', 'Drive Thru description')
|
|
121
121
|
}
|
|
122
122
|
]
|
|
123
123
|
}
|