ordering-ui-react-native 0.14.29 → 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 +72 -27
- 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 +125 -83
- 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
|
@@ -4,9 +4,10 @@ import {
|
|
|
4
4
|
UpsellingPage as UpsellingPageController,
|
|
5
5
|
useUtils,
|
|
6
6
|
useLanguage,
|
|
7
|
+
useOrder
|
|
7
8
|
} from 'ordering-components/native'
|
|
8
9
|
import { useTheme } from 'styled-components/native';
|
|
9
|
-
import { OText, OIcon,
|
|
10
|
+
import { OText, OIcon, OBottomPopup, OButton } from '../shared'
|
|
10
11
|
import { UpsellingProductsParams } from '../../types'
|
|
11
12
|
import {
|
|
12
13
|
Container,
|
|
@@ -14,11 +15,9 @@ import {
|
|
|
14
15
|
Item,
|
|
15
16
|
Details,
|
|
16
17
|
AddButton,
|
|
17
|
-
CloseUpselling,
|
|
18
18
|
TopBar,
|
|
19
19
|
TopActions
|
|
20
20
|
} from './styles'
|
|
21
|
-
import { ProductForm } from '../ProductForm';
|
|
22
21
|
import { OrderSummary } from '../OrderSummary';
|
|
23
22
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
24
23
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -28,18 +27,18 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
28
27
|
isCustomMode,
|
|
29
28
|
upsellingProducts,
|
|
30
29
|
business,
|
|
31
|
-
cart,
|
|
32
30
|
handleUpsellingPage,
|
|
33
31
|
handleCloseUpsellingPage,
|
|
34
32
|
openUpselling,
|
|
35
33
|
canOpenUpselling,
|
|
36
34
|
setCanOpenUpselling,
|
|
37
|
-
isFromCart
|
|
35
|
+
isFromCart,
|
|
36
|
+
onNavigationRedirect,
|
|
37
|
+
onGoBack
|
|
38
38
|
} = props
|
|
39
39
|
|
|
40
40
|
const theme = useTheme();
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
const styles = StyleSheet.create({
|
|
44
43
|
imageStyle: {
|
|
45
44
|
width: 73,
|
|
@@ -66,14 +65,25 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
66
65
|
}
|
|
67
66
|
})
|
|
68
67
|
|
|
69
|
-
const [actualProduct, setActualProduct] = useState<any>(null)
|
|
70
68
|
const [modalIsOpen, setModalIsOpen] = useState(false)
|
|
69
|
+
const [{ carts }] = useOrder()
|
|
71
70
|
const [{ parsePrice }] = useUtils()
|
|
72
71
|
const [, t] = useLanguage()
|
|
73
72
|
const { bottom } = useSafeAreaInsets()
|
|
74
73
|
|
|
74
|
+
const cart = carts?.[`businessId:${props.businessId}`] ?? {}
|
|
75
|
+
const cartProducts = cart?.products?.length
|
|
76
|
+
? cart?.products.map((product: any) => product.id)
|
|
77
|
+
: []
|
|
78
|
+
|
|
79
|
+
const productsList = !upsellingProducts.loading && !upsellingProducts.error
|
|
80
|
+
? upsellingProducts?.products?.length
|
|
81
|
+
? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
|
|
82
|
+
: (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
|
|
83
|
+
: []
|
|
84
|
+
|
|
75
85
|
useEffect(() => {
|
|
76
|
-
if (!isCustomMode) {
|
|
86
|
+
if (!isCustomMode && !props.products) {
|
|
77
87
|
if (!upsellingProducts.loading) {
|
|
78
88
|
if (upsellingProducts?.products?.length && !isFromCart) {
|
|
79
89
|
setCanOpenUpselling && setCanOpenUpselling(true)
|
|
@@ -81,25 +91,15 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
81
91
|
handleUpsellingPage && handleUpsellingPage()
|
|
82
92
|
}
|
|
83
93
|
}
|
|
84
|
-
// if ((!upsellingProducts?.products?.length && !upsellingProducts.loading && !canOpenUpselling && openUpselling) ||
|
|
85
|
-
// (!upsellingProducts?.products?.length && !upsellingProducts.loading && openUpselling)) {
|
|
86
|
-
// handleUpsellingPage && handleUpsellingPage()
|
|
87
|
-
// }
|
|
88
94
|
}
|
|
89
95
|
}, [upsellingProducts.loading, upsellingProducts?.products.length])
|
|
90
96
|
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (!cart?.validate && cart?.products?.length == 0) handleCloseUpsellingPage()
|
|
93
|
-
}, [cart])
|
|
94
|
-
|
|
95
97
|
const handleFormProduct = (product: any) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setActualProduct(null)
|
|
102
|
-
setModalIsOpen(false)
|
|
98
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
99
|
+
product: product,
|
|
100
|
+
businessId: product?.api?.businessId,
|
|
101
|
+
businessSlug: business.slug,
|
|
102
|
+
})
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
const UpsellingLayout = () => {
|
|
@@ -114,7 +114,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
114
114
|
!upsellingProducts.loading && (
|
|
115
115
|
<>
|
|
116
116
|
{
|
|
117
|
-
!upsellingProducts.error ?
|
|
117
|
+
!upsellingProducts.error ? productsList.map((product: any) => (
|
|
118
118
|
<Item key={product.id}>
|
|
119
119
|
<View style={{ flexBasis: '57%' }}>
|
|
120
120
|
<Details>
|
|
@@ -125,7 +125,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
125
125
|
<OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
|
|
126
126
|
</AddButton>
|
|
127
127
|
</View>
|
|
128
|
-
<View
|
|
128
|
+
<View>
|
|
129
129
|
<OIcon url={product.images} style={styles.imageStyle} />
|
|
130
130
|
</View>
|
|
131
131
|
</Item>
|
|
@@ -143,75 +143,73 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
143
143
|
)
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
const UpsellingContent = () => {
|
|
147
|
+
return (
|
|
148
|
+
<>
|
|
149
|
+
<TopBar style={{ paddingTop: Platform.OS == 'ios' ? 10 : 30 }}>
|
|
150
|
+
<TopActions onPress={() => onGoBack()}>
|
|
151
|
+
<OIcon src={theme.images.general.arrow_left} width={15} />
|
|
152
|
+
</TopActions>
|
|
153
|
+
<TopActions style={styles.cancelBtn} onPress={() => handleUpsellingPage()}>
|
|
154
|
+
<OText size={12} color={theme.colors.textSecondary}>{t('CANCEL', 'Cancel')}</OText>
|
|
155
|
+
</TopActions>
|
|
156
|
+
</TopBar>
|
|
157
|
+
<ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
158
|
+
{productsList.length > 0 &&
|
|
159
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
160
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
161
|
+
<UpsellingLayout />
|
|
162
|
+
</View>
|
|
163
|
+
}
|
|
164
|
+
<View style={{ paddingHorizontal: 40 }}>
|
|
165
|
+
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
166
|
+
<OrderSummary
|
|
167
|
+
cart={cart}
|
|
168
|
+
isCartPending={cart?.status === 2}
|
|
169
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
170
|
+
/>
|
|
171
|
+
</View>
|
|
172
|
+
</ScrollView>
|
|
173
|
+
<View
|
|
174
|
+
style={{
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
bottom: props.isPage ? 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
<OButton
|
|
180
|
+
imgRightSrc=''
|
|
181
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
182
|
+
style={{...styles.closeUpsellingButton}}
|
|
183
|
+
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
184
|
+
onClick={() => handleUpsellingPage()}
|
|
185
|
+
/>
|
|
186
|
+
</View>
|
|
187
|
+
</>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
|
|
146
191
|
return (
|
|
147
192
|
<>
|
|
148
193
|
{isCustomMode ? (
|
|
149
194
|
<UpsellingLayout />
|
|
150
195
|
) : (
|
|
151
196
|
<>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<OText size={12} color={theme.colors.textSecondary}>{t('CANCEL', 'Cancel')}</OText>
|
|
167
|
-
</TopActions>
|
|
168
|
-
</TopBar>
|
|
169
|
-
<ScrollView style={{ marginBottom: bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
170
|
-
{upsellingProducts?.products?.length > 0 &&
|
|
171
|
-
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
172
|
-
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
173
|
-
<UpsellingLayout />
|
|
174
|
-
</View>
|
|
175
|
-
}
|
|
176
|
-
<View style={{ paddingHorizontal: 40 }}>
|
|
177
|
-
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
178
|
-
<OrderSummary
|
|
179
|
-
cart={cart}
|
|
180
|
-
isCartPending={cart?.status === 2}
|
|
181
|
-
/>
|
|
182
|
-
</View>
|
|
183
|
-
</ScrollView>
|
|
184
|
-
<View style={{alignItems: 'center', bottom: Platform.OS === 'ios' ? bottom + 59 : bottom + 125}}>
|
|
185
|
-
<OButton
|
|
186
|
-
imgRightSrc=''
|
|
187
|
-
text={t('CHECKOUT', 'Checkout')}
|
|
188
|
-
style={{...styles.closeUpsellingButton}}
|
|
189
|
-
textStyle={{ color: theme.colors.white, fontSize: 14 }}
|
|
190
|
-
onClick={() => handleUpsellingPage()}
|
|
191
|
-
/>
|
|
192
|
-
</View>
|
|
193
|
-
</OBottomPopup>
|
|
194
|
-
)}
|
|
195
|
-
</>
|
|
196
|
-
)}
|
|
197
|
+
{props.isPage ? (
|
|
198
|
+
<UpsellingContent />
|
|
199
|
+
) : (
|
|
200
|
+
canOpenUpselling && !modalIsOpen && (
|
|
201
|
+
<OBottomPopup
|
|
202
|
+
title={''}
|
|
203
|
+
open={openUpselling}
|
|
204
|
+
onClose={() => handleUpsellingPage()}
|
|
205
|
+
isStatusBar
|
|
206
|
+
>
|
|
207
|
+
<UpsellingContent />
|
|
208
|
+
</OBottomPopup>
|
|
209
|
+
)
|
|
210
|
+
)}
|
|
197
211
|
</>
|
|
198
212
|
)}
|
|
199
|
-
<OModal
|
|
200
|
-
open={modalIsOpen}
|
|
201
|
-
onClose={() => setModalIsOpen(false)}
|
|
202
|
-
entireModal
|
|
203
|
-
customClose
|
|
204
|
-
>
|
|
205
|
-
{actualProduct && (
|
|
206
|
-
<ProductForm
|
|
207
|
-
product={actualProduct}
|
|
208
|
-
businessId={actualProduct?.api?.businessId}
|
|
209
|
-
businessSlug={business.slug}
|
|
210
|
-
onSave={() => handleSaveProduct()}
|
|
211
|
-
onClose={() => setModalIsOpen(false)}
|
|
212
|
-
/>
|
|
213
|
-
)}
|
|
214
|
-
</OModal>
|
|
215
213
|
</>
|
|
216
214
|
)
|
|
217
215
|
}
|
|
@@ -221,7 +221,7 @@ export interface SingleProductCardParams {
|
|
|
221
221
|
product: any;
|
|
222
222
|
isSoldOut: boolean;
|
|
223
223
|
onProductClick: any;
|
|
224
|
-
|
|
224
|
+
productAddedToCartLength: number
|
|
225
225
|
}
|
|
226
226
|
export interface BusinessInformationParams {
|
|
227
227
|
navigation?: any,
|
|
@@ -253,6 +253,7 @@ export interface NotFoundSourceParams {
|
|
|
253
253
|
}
|
|
254
254
|
export interface OrdersOptionParams {
|
|
255
255
|
orderList?: any,
|
|
256
|
+
franchiseId?: any,
|
|
256
257
|
activeOrders?: boolean,
|
|
257
258
|
pagination?: any,
|
|
258
259
|
titleContent?: string,
|
|
@@ -438,6 +439,10 @@ export interface UpsellingProductsParams {
|
|
|
438
439
|
cart?: any;
|
|
439
440
|
handleCloseUpsellingPage: () => void;
|
|
440
441
|
isFromCart?: boolean;
|
|
442
|
+
isPage?: boolean;
|
|
443
|
+
products?: any;
|
|
444
|
+
onNavigationRedirect?: any;
|
|
445
|
+
onGoBack?: any;
|
|
441
446
|
}
|
|
442
447
|
|
|
443
448
|
export interface GoogleMapsParams {
|
|
@@ -478,4 +483,5 @@ export interface HelpAccountAndPaymentParams {
|
|
|
478
483
|
|
|
479
484
|
export interface MessageListingParams {
|
|
480
485
|
navigation: any;
|
|
486
|
+
franchiseId?: any;
|
|
481
487
|
}
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
WrapperArrowIcon
|
|
30
30
|
|
|
31
31
|
} from './styles'
|
|
32
|
-
import { OButton, OInput, OText } from '../shared'
|
|
32
|
+
import { OButton, OInput, OText, OIcon } from '../shared'
|
|
33
33
|
import { ProductOptionSubOption } from '../ProductOptionSubOption'
|
|
34
34
|
import { NotFoundSource } from '../NotFoundSource'
|
|
35
35
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
@@ -119,10 +119,24 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
119
119
|
backgroundColor: theme.colors.lightGray,
|
|
120
120
|
padding: 2,
|
|
121
121
|
borderRadius: 20
|
|
122
|
+
},
|
|
123
|
+
productTagWrapper: {
|
|
124
|
+
flexDirection: 'row',
|
|
125
|
+
alignItems: 'center'
|
|
126
|
+
},
|
|
127
|
+
productTagImageStyle: {
|
|
128
|
+
width: 32,
|
|
129
|
+
height: 32,
|
|
130
|
+
borderRadius: 8,
|
|
131
|
+
resizeMode: 'cover'
|
|
132
|
+
},
|
|
133
|
+
productTagNameStyle: {
|
|
134
|
+
paddingHorizontal: 6,
|
|
135
|
+
marginRight: 5
|
|
122
136
|
}
|
|
123
137
|
})
|
|
124
138
|
|
|
125
|
-
const [{ parsePrice }] = useUtils()
|
|
139
|
+
const [{ optimizeImage, parsePrice }] = useUtils()
|
|
126
140
|
const [, t] = useLanguage()
|
|
127
141
|
const [orderState] = useOrder()
|
|
128
142
|
const [{ auth }] = useSession()
|
|
@@ -242,6 +256,33 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
242
256
|
<OText color={theme.colors.gray} style={{ textAlign: 'left', marginBottom: 10 }}>{product?.description || productCart?.description}</OText>
|
|
243
257
|
</ProductDescription>
|
|
244
258
|
)}
|
|
259
|
+
<View style={{ marginHorizontal: 30 }}>
|
|
260
|
+
<ScrollView
|
|
261
|
+
horizontal
|
|
262
|
+
showsHorizontalScrollIndicator={false}
|
|
263
|
+
contentContainerStyle={{ paddingBottom: 20 }}
|
|
264
|
+
>
|
|
265
|
+
{product?.tags?.map((tag: any) => (
|
|
266
|
+
<View
|
|
267
|
+
key={tag.id}
|
|
268
|
+
style={styles.productTagWrapper}
|
|
269
|
+
>
|
|
270
|
+
{tag?.image ? (
|
|
271
|
+
<OIcon
|
|
272
|
+
url={optimizeImage(tag?.image, 'h_40,c_limit')}
|
|
273
|
+
style={styles.productTagImageStyle}
|
|
274
|
+
/>
|
|
275
|
+
) : (
|
|
276
|
+
<OIcon
|
|
277
|
+
src={theme.images?.dummies?.product}
|
|
278
|
+
style={styles.productTagImageStyle}
|
|
279
|
+
/>
|
|
280
|
+
)}
|
|
281
|
+
<OText size={14} style={styles.productTagNameStyle}>{tag.name}</OText>
|
|
282
|
+
</View>
|
|
283
|
+
))}
|
|
284
|
+
</ScrollView>
|
|
285
|
+
</View>
|
|
245
286
|
{loading && !product ? (
|
|
246
287
|
<>
|
|
247
288
|
{[...Array(2)].map((item, i) => (
|