ordering-ui-react-native 0.14.34 → 0.14.35-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/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 +6 -8
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +28 -13
- 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/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 -35
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +22 -49
- package/themes/original/src/components/BusinessesListing/index.tsx +100 -75
- 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/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/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 +6 -2
- package/themes/original/src/components/ProductForm/index.tsx +67 -77
- package/themes/original/src/components/ProductForm/styles.tsx +9 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +21 -11
- package/themes/original/src/components/SingleProductCard/styles.tsx +4 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
- package/themes/original/src/components/UpsellingProducts/index.tsx +85 -83
- package/themes/original/src/types/index.tsx +6 -0
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ScrollView,
|
|
8
8
|
Platform,
|
|
9
9
|
TouchableOpacity,
|
|
10
|
+
RefreshControl
|
|
10
11
|
} from 'react-native';
|
|
11
12
|
import {
|
|
12
13
|
BusinessList as BusinessesListingController,
|
|
@@ -57,11 +58,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
57
58
|
handleBusinessClick,
|
|
58
59
|
paginationProps,
|
|
59
60
|
handleChangeSearch,
|
|
60
|
-
|
|
61
|
+
businessId
|
|
61
62
|
} = props;
|
|
62
63
|
|
|
63
64
|
const theme = useTheme();
|
|
64
65
|
const isFocused = useIsFocused();
|
|
66
|
+
const [refreshing] = useState(false);
|
|
65
67
|
|
|
66
68
|
const styles = StyleSheet.create({
|
|
67
69
|
container: {
|
|
@@ -142,15 +144,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
142
144
|
};
|
|
143
145
|
|
|
144
146
|
const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
const R = 6371 // km
|
|
148
|
+
const dLat = convertToRadian(lat2 - lat1)
|
|
149
|
+
const dLon = convertToRadian(lon2 - lon1)
|
|
150
|
+
const curLat1 = convertToRadian(lat1)
|
|
151
|
+
const curLat2 = convertToRadian(lat2)
|
|
152
|
+
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(curLat1) * Math.cos(curLat2)
|
|
153
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
|
154
|
+
return R * c
|
|
155
|
+
}
|
|
154
156
|
|
|
155
157
|
useEffect(() => {
|
|
156
158
|
if (businessesList.businesses.length > 0) {
|
|
@@ -162,6 +164,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
162
164
|
setFeaturedBusinesses(ary);
|
|
163
165
|
}
|
|
164
166
|
}, [businessesList.businesses]);
|
|
167
|
+
|
|
165
168
|
// const resetInactivityTimeout = () => {
|
|
166
169
|
// clearTimeout(timerId.current)
|
|
167
170
|
// timerId.current = setInterval(() => {
|
|
@@ -173,21 +176,37 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
173
176
|
// resetInactivityTimeout()
|
|
174
177
|
// }, [])
|
|
175
178
|
|
|
179
|
+
const handleOnRefresh = () => {
|
|
180
|
+
const hasMore = !(
|
|
181
|
+
paginationProps.totalPages === paginationProps.currentPage
|
|
182
|
+
);
|
|
183
|
+
if (!businessesList.loading && hasMore) {
|
|
184
|
+
getBusinesses();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
176
188
|
useEffect(() => {
|
|
177
189
|
Geolocation.getCurrentPosition((pos) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
190
|
+
const crd = pos.coords
|
|
191
|
+
const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
|
|
192
|
+
if (distance > 20) setIsFarAway(true)
|
|
181
193
|
else setIsFarAway(false)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
}, (err) => {
|
|
195
|
+
console.log(`ERROR(${err.code}): ${err.message}`)
|
|
196
|
+
}, {
|
|
197
|
+
enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
|
|
198
|
+
})
|
|
199
|
+
}, [orderState?.options?.address?.location])
|
|
188
200
|
|
|
189
201
|
return (
|
|
190
|
-
<ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
|
|
202
|
+
<ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
|
|
203
|
+
refreshControl={
|
|
204
|
+
<RefreshControl
|
|
205
|
+
refreshing={refreshing}
|
|
206
|
+
onRefresh={() => handleOnRefresh()}
|
|
207
|
+
/>
|
|
208
|
+
}
|
|
209
|
+
>
|
|
191
210
|
<HeaderWrapper
|
|
192
211
|
source={theme.images.backgrounds.business_list_header}
|
|
193
212
|
style={{ paddingTop: top + 20 }}>
|
|
@@ -257,72 +276,78 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
257
276
|
/>
|
|
258
277
|
</WrapMomentOption>
|
|
259
278
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
279
|
+
{!businessId && (
|
|
280
|
+
<SearchBar
|
|
281
|
+
onSearch={handleChangeSearch}
|
|
282
|
+
searchValue={searchValue}
|
|
283
|
+
lazyLoad
|
|
284
|
+
isCancelXButtonShow={!!searchValue}
|
|
285
|
+
borderStyle={styles.borderStyle}
|
|
286
|
+
onCancel={() => handleChangeSearch('')}
|
|
287
|
+
placeholder={t('SEARCH', 'Search')}
|
|
288
|
+
height={26}
|
|
289
|
+
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
|
|
290
|
+
/>
|
|
291
|
+
)}
|
|
273
292
|
|
|
274
293
|
</View>
|
|
275
294
|
</OrderControlContainer>
|
|
276
295
|
</HeaderWrapper>
|
|
277
|
-
{
|
|
278
|
-
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
handleCustomClick={handleBusinessClick}
|
|
297
|
-
orderType={orderState?.options?.type}
|
|
298
|
-
/>
|
|
299
|
-
{bAry.length > 1 && (
|
|
296
|
+
{
|
|
297
|
+
isFocused && (
|
|
298
|
+
<OrderProgressWrapper>
|
|
299
|
+
<OrderProgress
|
|
300
|
+
{...props}
|
|
301
|
+
/>
|
|
302
|
+
</OrderProgressWrapper>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
{
|
|
306
|
+
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
307
|
+
<FeaturedWrapper>
|
|
308
|
+
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
|
|
309
|
+
<ScrollView
|
|
310
|
+
showsHorizontalScrollIndicator={false}
|
|
311
|
+
nestedScrollEnabled
|
|
312
|
+
horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
|
|
313
|
+
{featuredBusiness.map((bAry: any, idx) => (
|
|
314
|
+
<View key={'f-listing_' + idx}>
|
|
300
315
|
<BusinessFeaturedController
|
|
301
|
-
key={bAry[
|
|
302
|
-
business={bAry[
|
|
316
|
+
key={bAry[0].id}
|
|
317
|
+
business={bAry[0]}
|
|
303
318
|
handleCustomClick={handleBusinessClick}
|
|
304
319
|
orderType={orderState?.options?.type}
|
|
305
320
|
/>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
321
|
+
{bAry.length > 1 && (
|
|
322
|
+
<BusinessFeaturedController
|
|
323
|
+
key={bAry[1].id}
|
|
324
|
+
business={bAry[1]}
|
|
325
|
+
handleCustomClick={handleBusinessClick}
|
|
326
|
+
orderType={orderState?.options?.type}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
329
|
+
</View>
|
|
330
|
+
))}
|
|
331
|
+
</ScrollView>
|
|
332
|
+
</FeaturedWrapper>
|
|
333
|
+
)
|
|
334
|
+
}
|
|
312
335
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
336
|
+
{
|
|
337
|
+
!businessId && !props.franchiseId && (
|
|
338
|
+
<HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
|
|
339
|
+
)
|
|
340
|
+
}
|
|
316
341
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
317
342
|
<ListWrapper>
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
343
|
+
{!businessId && (
|
|
344
|
+
<BusinessTypeFilter
|
|
345
|
+
images={props.images}
|
|
346
|
+
businessTypes={props.businessTypes}
|
|
347
|
+
defaultBusinessType={props.defaultBusinessType}
|
|
348
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
349
|
+
/>
|
|
350
|
+
)}
|
|
326
351
|
{!businessesList.loading && businessesList.businesses.length === 0 && (
|
|
327
352
|
<NotFoundSource
|
|
328
353
|
content={t(
|
|
@@ -17,7 +17,6 @@ import { BusinessItemAccordion } from '../BusinessItemAccordion';
|
|
|
17
17
|
import { CouponControl } from '../CouponControl';
|
|
18
18
|
|
|
19
19
|
import { OButton, OInput, OModal, OText } from '../shared';
|
|
20
|
-
import { ProductForm } from '../ProductForm';
|
|
21
20
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
22
21
|
import { verifyDecimals } from '../../utils';
|
|
23
22
|
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
@@ -35,10 +34,9 @@ const CartUI = (props: any) => {
|
|
|
35
34
|
removeProduct,
|
|
36
35
|
handleCartOpen,
|
|
37
36
|
setIsCartsLoading,
|
|
38
|
-
hideUpselling,
|
|
39
37
|
handleChangeComment,
|
|
40
|
-
commentState
|
|
41
|
-
|
|
38
|
+
commentState,
|
|
39
|
+
onNavigationRedirect
|
|
42
40
|
} = props
|
|
43
41
|
|
|
44
42
|
const theme = useTheme();
|
|
@@ -49,8 +47,6 @@ const CartUI = (props: any) => {
|
|
|
49
47
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
50
48
|
const [validationFields] = useValidationFields()
|
|
51
49
|
|
|
52
|
-
const [openProduct, setModalIsOpen] = useState(false)
|
|
53
|
-
const [curProduct, setCurProduct] = useState<any>(null)
|
|
54
50
|
const [openUpselling, setOpenUpselling] = useState(false)
|
|
55
51
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
56
52
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
@@ -71,14 +67,14 @@ const CartUI = (props: any) => {
|
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
const handleEditProduct = (product: any) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
onNavigationRedirect('ProductDetails', {
|
|
71
|
+
businessId,
|
|
72
|
+
isCartProduct: true,
|
|
73
|
+
productCart: product,
|
|
74
|
+
businessSlug: cart?.business?.slug,
|
|
75
|
+
categoryId: product?.category_id,
|
|
76
|
+
productId: product?.id,
|
|
77
|
+
})
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
const handleClearProducts = async () => {
|
|
@@ -329,23 +325,6 @@ const CartUI = (props: any) => {
|
|
|
329
325
|
</CheckoutAction>
|
|
330
326
|
)}
|
|
331
327
|
</BusinessItemAccordion>
|
|
332
|
-
<OModal
|
|
333
|
-
open={openProduct}
|
|
334
|
-
entireModal
|
|
335
|
-
customClose
|
|
336
|
-
onClose={() => setModalIsOpen(false)}
|
|
337
|
-
>
|
|
338
|
-
<ProductForm
|
|
339
|
-
isCartProduct
|
|
340
|
-
productCart={curProduct}
|
|
341
|
-
businessSlug={cart?.business?.slug}
|
|
342
|
-
businessId={businessId}
|
|
343
|
-
categoryId={curProduct?.category_id}
|
|
344
|
-
productId={curProduct?.id}
|
|
345
|
-
onSave={handlerProductAction}
|
|
346
|
-
onClose={() => setModalIsOpen(false)}
|
|
347
|
-
/>
|
|
348
|
-
</OModal>
|
|
349
328
|
|
|
350
329
|
<OModal
|
|
351
330
|
open={openChangeStore && props.isFranchiseApp}
|
|
@@ -510,6 +510,7 @@ const CheckoutUI = (props: any) => {
|
|
|
510
510
|
<WalletPaymentOptionContainer>
|
|
511
511
|
<PaymentOptionWallet
|
|
512
512
|
cart={cart}
|
|
513
|
+
businessId={cart?.business_id}
|
|
513
514
|
/>
|
|
514
515
|
</WalletPaymentOptionContainer>
|
|
515
516
|
)}
|
|
@@ -546,6 +547,7 @@ const CheckoutUI = (props: any) => {
|
|
|
546
547
|
<OrderSummary
|
|
547
548
|
cart={cart}
|
|
548
549
|
isCartPending={cart?.status === 2}
|
|
550
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
549
551
|
/>
|
|
550
552
|
</>
|
|
551
553
|
)}
|
|
@@ -11,7 +11,8 @@ export const FacebookLogin = (props: any) => {
|
|
|
11
11
|
const {
|
|
12
12
|
handleErrors,
|
|
13
13
|
handleLoading,
|
|
14
|
-
handleSuccessFacebookLogin
|
|
14
|
+
handleSuccessFacebookLogin,
|
|
15
|
+
notificationState
|
|
15
16
|
} = props
|
|
16
17
|
|
|
17
18
|
const [, t] = useLanguage()
|
|
@@ -30,7 +31,14 @@ export const FacebookLogin = (props: any) => {
|
|
|
30
31
|
|
|
31
32
|
const handleLoginClick = async (accessToken: string) => {
|
|
32
33
|
try {
|
|
33
|
-
const
|
|
34
|
+
const body: any = {
|
|
35
|
+
access_token: accessToken
|
|
36
|
+
}
|
|
37
|
+
if (notificationState?.notification_token) {
|
|
38
|
+
body.notification_token = notificationState.notification_token
|
|
39
|
+
body.notification_app = notificationState.notification_app
|
|
40
|
+
}
|
|
41
|
+
const response = await ordering.users().authFacebook(body)
|
|
34
42
|
if (!response.content.error) {
|
|
35
43
|
if (handleSuccessFacebookLogin) {
|
|
36
44
|
handleSuccessFacebookLogin(response.content.result)
|
|
@@ -38,9 +46,10 @@ export const FacebookLogin = (props: any) => {
|
|
|
38
46
|
}
|
|
39
47
|
} else {
|
|
40
48
|
handleLoading && handleLoading(false)
|
|
49
|
+
handleErrors && handleErrors(response.content.result)
|
|
41
50
|
logoutWithFacebook()
|
|
42
51
|
}
|
|
43
|
-
} catch (err) {
|
|
52
|
+
} catch (err: any) {
|
|
44
53
|
handleLoading && handleLoading(false)
|
|
45
54
|
handleErrors && handleErrors(err.message)
|
|
46
55
|
}
|
|
@@ -48,7 +57,7 @@ export const FacebookLogin = (props: any) => {
|
|
|
48
57
|
|
|
49
58
|
const loginWithFacebook = () => {
|
|
50
59
|
handleLoading && handleLoading(true)
|
|
51
|
-
LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
|
|
60
|
+
LoginManager && LoginManager.logInWithPermissions(['public_profile', 'email']).then(
|
|
52
61
|
(login: any) => {
|
|
53
62
|
if (login.isCancelled) {
|
|
54
63
|
const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
|
|
@@ -58,6 +67,9 @@ export const FacebookLogin = (props: any) => {
|
|
|
58
67
|
AccessToken.getCurrentAccessToken().then((data: any) => {
|
|
59
68
|
const accessToken = data.accessToken.toString();
|
|
60
69
|
handleLoginClick(accessToken)
|
|
70
|
+
}).catch((err : any) => {
|
|
71
|
+
handleErrors && handleErrors(err.message)
|
|
72
|
+
handleLoading && handleLoading(false)
|
|
61
73
|
});
|
|
62
74
|
}
|
|
63
75
|
},
|
|
@@ -68,7 +80,10 @@ export const FacebookLogin = (props: any) => {
|
|
|
68
80
|
handleLoading && handleLoading(false)
|
|
69
81
|
handleErrors && handleErrors(err)
|
|
70
82
|
},
|
|
71
|
-
)
|
|
83
|
+
).catch((err : any) => {
|
|
84
|
+
handleErrors && handleErrors(err.message)
|
|
85
|
+
handleLoading && handleLoading(false)
|
|
86
|
+
});
|
|
72
87
|
};
|
|
73
88
|
|
|
74
89
|
const onPressButton = auth
|
|
@@ -48,7 +48,7 @@ export const Help = (props: HelpParams) => {
|
|
|
48
48
|
|
|
49
49
|
<LastOrdersContainer>
|
|
50
50
|
<OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
|
|
51
|
-
<LastOrders
|
|
51
|
+
<LastOrders {...props} onRedirect={onRedirect} />
|
|
52
52
|
</LastOrdersContainer>
|
|
53
53
|
</>
|
|
54
54
|
)
|
|
@@ -5,11 +5,11 @@ import { StyleSheet, View } from 'react-native';
|
|
|
5
5
|
import { OButton, OIcon, OText } from '../shared';
|
|
6
6
|
import { LanguageSelector } from '../LanguageSelector';
|
|
7
7
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
8
|
-
import { useWindowDimensions } from 'react-native';
|
|
8
|
+
import { useWindowDimensions, Platform } from 'react-native';
|
|
9
9
|
|
|
10
10
|
export const Home = (props: any) => {
|
|
11
11
|
const { onNavigationRedirect } = props;
|
|
12
|
-
const { width } = useWindowDimensions();
|
|
12
|
+
const { width, height } = useWindowDimensions();
|
|
13
13
|
const [, t] = useLanguage();
|
|
14
14
|
const [orderState] = useOrder();
|
|
15
15
|
|
|
@@ -18,7 +18,9 @@ export const Home = (props: any) => {
|
|
|
18
18
|
return (
|
|
19
19
|
<View style={styles.container}>
|
|
20
20
|
<View>
|
|
21
|
-
<
|
|
21
|
+
<View style={{paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
|
|
22
|
+
<LanguageSelector />
|
|
23
|
+
</View>
|
|
22
24
|
<OIcon
|
|
23
25
|
src={theme.images.logos.logotypeInvert}
|
|
24
26
|
style={{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller } from 'ordering-components/native'
|
|
2
|
+
import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller, useBusiness } from 'ordering-components/native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native'
|
|
5
5
|
import { OText, OModal } from '../shared'
|
|
@@ -214,6 +214,7 @@ const OrderMessageUI = (props: any) => {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
export const OrderListing = (props: OrdersOptionParams) => {
|
|
217
|
+
const [businessState] = useBusiness();
|
|
217
218
|
const OrderListingProps = {
|
|
218
219
|
...props,
|
|
219
220
|
UIComponent: OrdersOptionUI,
|
|
@@ -224,6 +225,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
|
|
|
224
225
|
pageSize: 10,
|
|
225
226
|
controlType: 'infinity'
|
|
226
227
|
},
|
|
228
|
+
businessId: businessState?.business?.id,
|
|
227
229
|
profileMessages: true,
|
|
228
230
|
orderBy: 'last_direct_message_at',
|
|
229
231
|
orderDirection: 'asc'
|
|
@@ -287,6 +289,7 @@ export const MessageListing = (props: MessageListingParams) => {
|
|
|
287
289
|
setSelectedOrderId={setSelectedOrderId}
|
|
288
290
|
setOrderList={setOrderListStatus}
|
|
289
291
|
setOpenMessges={setOpenMessges}
|
|
292
|
+
franchiseId={props.franchiseId}
|
|
290
293
|
/>
|
|
291
294
|
{openMessages && seletedOrder && (
|
|
292
295
|
<OModal
|
|
@@ -304,4 +307,3 @@ export const MessageListing = (props: MessageListingParams) => {
|
|
|
304
307
|
</MessageListingWrapper>
|
|
305
308
|
)
|
|
306
309
|
}
|
|
307
|
-
|
|
@@ -611,7 +611,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
611
611
|
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
612
612
|
{t('DELIVERY_PREFERENCE', 'Delivery Preference')}
|
|
613
613
|
</OText>
|
|
614
|
-
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
614
|
+
<OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
615
|
+
{order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
|
|
616
|
+
</OText>
|
|
615
617
|
</View>
|
|
616
618
|
)}
|
|
617
619
|
{order?.comment && (
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
21
21
|
import { CouponControl } from '../CouponControl';
|
|
22
22
|
import { OInput, OModal, OText } from '../shared';
|
|
23
|
-
import { ProductForm } from '../ProductForm';
|
|
24
23
|
import { verifyDecimals } from '../../utils';
|
|
25
24
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
26
25
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -35,7 +34,8 @@ const OrderSummaryUI = (props: any) => {
|
|
|
35
34
|
isCartPending,
|
|
36
35
|
isFromCheckout,
|
|
37
36
|
commentState,
|
|
38
|
-
handleChangeComment
|
|
37
|
+
handleChangeComment,
|
|
38
|
+
onNavigationRedirect
|
|
39
39
|
} = props;
|
|
40
40
|
|
|
41
41
|
const theme = useTheme()
|
|
@@ -44,8 +44,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
44
44
|
const [orderState] = useOrder();
|
|
45
45
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
46
46
|
const [validationFields] = useValidationFields();
|
|
47
|
-
const [openProduct, setModalIsOpen] = useState(false)
|
|
48
|
-
const [curProduct, setCurProduct] = useState<any>(null)
|
|
49
47
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
|
|
50
48
|
|
|
51
49
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
@@ -55,14 +53,15 @@ const OrderSummaryUI = (props: any) => {
|
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
const handleEditProduct = (product: any) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
onNavigationRedirect('ProductDetails', {
|
|
57
|
+
isCartProduct: true,
|
|
58
|
+
productCart: product,
|
|
59
|
+
businessSlug: cart?.business?.slug,
|
|
60
|
+
businessId: cart?.business_id,
|
|
61
|
+
categoryId: product?.category_id,
|
|
62
|
+
productId: product?.id,
|
|
63
|
+
isFromCheckout: isFromCheckout,
|
|
64
|
+
})
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
const getIncludedTaxes = () => {
|
|
@@ -242,24 +241,6 @@ const OrderSummaryUI = (props: any) => {
|
|
|
242
241
|
)}
|
|
243
242
|
</OSBill>
|
|
244
243
|
)}
|
|
245
|
-
<OModal
|
|
246
|
-
open={openProduct}
|
|
247
|
-
entireModal
|
|
248
|
-
customClose
|
|
249
|
-
onClose={() => setModalIsOpen(false)}
|
|
250
|
-
>
|
|
251
|
-
<ProductForm
|
|
252
|
-
isCartProduct
|
|
253
|
-
productCart={curProduct}
|
|
254
|
-
businessSlug={cart?.business?.slug}
|
|
255
|
-
businessId={cart?.business_id}
|
|
256
|
-
categoryId={curProduct?.category_id}
|
|
257
|
-
productId={curProduct?.id}
|
|
258
|
-
onSave={handlerProductAction}
|
|
259
|
-
onClose={() => setModalIsOpen(false)}
|
|
260
|
-
isFromCheckout={isFromCheckout}
|
|
261
|
-
/>
|
|
262
|
-
</OModal>
|
|
263
244
|
<OModal
|
|
264
245
|
open={openTaxModal.open}
|
|
265
246
|
onClose={() => setOpenTaxModal({ open: false, data: null })}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PaymentOptionWallet as PaymentOptionWalletController,
|
|
8
8
|
useLanguage,
|
|
9
9
|
useUtils,
|
|
10
|
+
useOrder
|
|
10
11
|
} from 'ordering-components/native'
|
|
11
12
|
|
|
12
13
|
import {
|
|
@@ -18,7 +19,7 @@ import { OText } from '../shared'
|
|
|
18
19
|
|
|
19
20
|
const PaymentOptionWalletUI = (props: any) => {
|
|
20
21
|
const {
|
|
21
|
-
|
|
22
|
+
businessId,
|
|
22
23
|
walletsState,
|
|
23
24
|
selectWallet,
|
|
24
25
|
deletetWalletSelected
|
|
@@ -26,8 +27,11 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
26
27
|
|
|
27
28
|
const theme = useTheme()
|
|
28
29
|
const [, t] = useLanguage()
|
|
30
|
+
const [{ carts }] = useOrder()
|
|
29
31
|
const [{ parsePrice }] = useUtils()
|
|
30
32
|
|
|
33
|
+
const cart = carts?.[`businessId:${businessId}`] ?? {}
|
|
34
|
+
|
|
31
35
|
const styles = StyleSheet.create({
|
|
32
36
|
checkBoxStyle: {
|
|
33
37
|
width: 25,
|
|
@@ -68,7 +72,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
68
72
|
if (!walletsState.loading && walletsState.result?.length) {
|
|
69
73
|
setCheckedState(
|
|
70
74
|
walletsState.result?.map((wallet: any) => {
|
|
71
|
-
return !!cart?.
|
|
75
|
+
return !!cart?.payment_events?.find((w: any) => w.wallet_id === wallet.id)
|
|
72
76
|
})
|
|
73
77
|
)
|
|
74
78
|
}
|