ordering-ui-react-native 0.16.72 → 0.16.73-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 +6 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +19 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/OrderCreating/index.tsx +2 -2
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +298 -345
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/utils/index.tsx +2 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +31 -31
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +332 -140
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +14 -3
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/business/src/components/OrdersOption/index.tsx +63 -73
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +24 -5
- package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +29 -3
- package/themes/business/src/utils/index.tsx +26 -0
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +545 -112
- package/themes/kiosk/src/components/LoginForm/styles.tsx +18 -0
- 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/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +15 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +6 -0
- package/themes/original/src/components/AddressDetails/index.tsx +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +153 -137
- package/themes/original/src/components/AddressList/index.tsx +18 -18
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +47 -22
- package/themes/original/src/components/BusinessController/index.tsx +101 -70
- package/themes/original/src/components/BusinessController/styles.tsx +14 -9
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +105 -156
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +41 -62
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +561 -496
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +83 -92
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +7 -6
- package/themes/original/src/components/Cart/index.tsx +76 -42
- package/themes/original/src/components/CartContent/index.tsx +80 -18
- package/themes/original/src/components/CartContent/styles.tsx +11 -1
- package/themes/original/src/components/Checkout/index.tsx +96 -108
- package/themes/original/src/components/Checkout/styles.tsx +4 -3
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/DriverTips/index.tsx +47 -37
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +70 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +10 -1
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +13 -12
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -20
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +98 -41
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- package/themes/original/src/components/MessageListing/index.tsx +7 -40
- package/themes/original/src/components/Messages/index.tsx +42 -26
- package/themes/original/src/components/MomentOption/index.tsx +17 -11
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
- package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +86 -20
- package/themes/original/src/components/NavBar/index.tsx +7 -6
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +144 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/index.tsx +108 -218
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
- package/themes/original/src/components/OrderProgress/index.tsx +81 -105
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +97 -100
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +22 -8
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +240 -254
- package/themes/original/src/components/ProductForm/styles.tsx +5 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
- package/themes/original/src/components/ProfessionalProfile/index.tsx +20 -9
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +7 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +337 -265
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +134 -89
- package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +133 -91
- package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +5 -3
- package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +177 -164
- package/themes/original/src/components/Wallets/styles.tsx +12 -8
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
- package/themes/original/src/components/shared/OButton.tsx +9 -4
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +37 -6
- package/themes/original/src/utils/index.tsx +317 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, Vibration } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import Picker from 'react-native-country-picker-modal';
|
|
5
5
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
@@ -87,7 +87,8 @@ const CheckoutUI = (props: any) => {
|
|
|
87
87
|
instructionsOptions,
|
|
88
88
|
handleChangeDeliveryOption,
|
|
89
89
|
currency,
|
|
90
|
-
merchantId
|
|
90
|
+
merchantId,
|
|
91
|
+
setPlaceSpotNumber
|
|
91
92
|
} = props
|
|
92
93
|
|
|
93
94
|
const theme = useTheme();
|
|
@@ -106,8 +107,7 @@ const CheckoutUI = (props: any) => {
|
|
|
106
107
|
padding: 20
|
|
107
108
|
},
|
|
108
109
|
pagePadding: {
|
|
109
|
-
|
|
110
|
-
paddingRight: 40
|
|
110
|
+
paddingHorizontal: 40
|
|
111
111
|
},
|
|
112
112
|
icon: {
|
|
113
113
|
top: 15,
|
|
@@ -119,9 +119,11 @@ const CheckoutUI = (props: any) => {
|
|
|
119
119
|
paddingHorizontal: 40,
|
|
120
120
|
width: '100%'
|
|
121
121
|
},
|
|
122
|
-
wrapperNavbar:
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
wrapperNavbar: {
|
|
123
|
+
paddingVertical: 0,
|
|
124
|
+
paddingHorizontal: 40,
|
|
125
|
+
marginVertical: 2
|
|
126
|
+
}
|
|
125
127
|
})
|
|
126
128
|
|
|
127
129
|
const [, { showToast }] = useToast();
|
|
@@ -151,11 +153,16 @@ const CheckoutUI = (props: any) => {
|
|
|
151
153
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
152
154
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
153
155
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
156
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
154
157
|
|
|
155
158
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
159
|
+
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
160
|
+
if (item?.type === 1)
|
|
161
|
+
return acc = acc + item?.summary?.tax
|
|
162
|
+
return acc = acc
|
|
163
|
+
}, cart?.subtotal)
|
|
156
164
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
157
|
-
placing || errorCash ||
|
|
158
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
165
|
+
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
159
166
|
(options.type === 1 &&
|
|
160
167
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
161
168
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -181,8 +188,9 @@ const CheckoutUI = (props: any) => {
|
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
|
|
184
|
-
const handlePlaceOrder = (confirmPayment: any) => {
|
|
185
|
-
if (!userErrors.length && !requiredFields?.length) {
|
|
191
|
+
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
192
|
+
if (!userErrors.length && !requiredFields?.length || forcePlace) {
|
|
193
|
+
Vibration.vibrate()
|
|
186
194
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
187
195
|
return
|
|
188
196
|
}
|
|
@@ -261,10 +269,6 @@ const CheckoutUI = (props: any) => {
|
|
|
261
269
|
}
|
|
262
270
|
}, [errors])
|
|
263
271
|
|
|
264
|
-
// useEffect(() => {
|
|
265
|
-
// handlePaymethodChange(null)
|
|
266
|
-
// }, [cart?.total])
|
|
267
|
-
|
|
268
272
|
useEffect(() => {
|
|
269
273
|
if (cart?.products?.length === 0) {
|
|
270
274
|
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
@@ -275,6 +279,21 @@ const CheckoutUI = (props: any) => {
|
|
|
275
279
|
onFailPaypal()
|
|
276
280
|
}, [showGateway.closedByUser])
|
|
277
281
|
|
|
282
|
+
const HeaderTitle = (props: any) => {
|
|
283
|
+
const { text } = props
|
|
284
|
+
return (
|
|
285
|
+
<OText
|
|
286
|
+
size={16}
|
|
287
|
+
lineHeight={24}
|
|
288
|
+
weight={'500'}
|
|
289
|
+
mBottom={props.mb ?? 10}
|
|
290
|
+
color={theme.colors.textNormal}
|
|
291
|
+
>
|
|
292
|
+
{text}
|
|
293
|
+
</OText>
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
|
|
278
297
|
return (
|
|
279
298
|
<>
|
|
280
299
|
<Container noPadding>
|
|
@@ -284,8 +303,7 @@ const CheckoutUI = (props: any) => {
|
|
|
284
303
|
titleAlign={'center'}
|
|
285
304
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
286
305
|
showCall={false}
|
|
287
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
288
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
306
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
289
307
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
290
308
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
291
309
|
/>
|
|
@@ -293,13 +311,20 @@ const CheckoutUI = (props: any) => {
|
|
|
293
311
|
<ChContainer style={styles.pagePadding}>
|
|
294
312
|
<ChSection style={{ paddingTop: 0 }}>
|
|
295
313
|
<ChHeader>
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
314
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
315
|
+
<OText
|
|
316
|
+
size={12}
|
|
317
|
+
numberOfLines={1}
|
|
318
|
+
ellipsizeMode={'tail'}
|
|
319
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
320
|
+
>
|
|
321
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
322
|
+
</OText>
|
|
299
323
|
<OIcon
|
|
300
324
|
src={theme.images.general.arrow_down}
|
|
301
325
|
width={10}
|
|
302
326
|
style={{ marginStart: 8 }}
|
|
327
|
+
{...(isChewLayout && { color: 'white' })}
|
|
303
328
|
/>
|
|
304
329
|
</CHMomentWrapper>
|
|
305
330
|
<CHMomentWrapper
|
|
@@ -330,10 +355,10 @@ const CheckoutUI = (props: any) => {
|
|
|
330
355
|
!businessDetails?.error &&
|
|
331
356
|
(
|
|
332
357
|
<Placeholder Animation={Fade}>
|
|
333
|
-
<PlaceholderLine height={20}
|
|
334
|
-
<PlaceholderLine height={
|
|
335
|
-
<PlaceholderLine height={
|
|
336
|
-
<PlaceholderLine height={
|
|
358
|
+
<PlaceholderLine height={20} />
|
|
359
|
+
<PlaceholderLine height={12} />
|
|
360
|
+
<PlaceholderLine height={12} />
|
|
361
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
337
362
|
</Placeholder>
|
|
338
363
|
)}
|
|
339
364
|
{
|
|
@@ -342,9 +367,7 @@ const CheckoutUI = (props: any) => {
|
|
|
342
367
|
Object.values(businessDetails?.business).length > 0 &&
|
|
343
368
|
(
|
|
344
369
|
<>
|
|
345
|
-
<
|
|
346
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
347
|
-
</OText>
|
|
370
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
348
371
|
<View>
|
|
349
372
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
350
373
|
{businessDetails?.business?.name}
|
|
@@ -363,9 +386,7 @@ const CheckoutUI = (props: any) => {
|
|
|
363
386
|
)}
|
|
364
387
|
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
365
388
|
<View>
|
|
366
|
-
<
|
|
367
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
368
|
-
</OText>
|
|
389
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
369
390
|
<NotFoundSource
|
|
370
391
|
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
371
392
|
/>
|
|
@@ -379,14 +400,15 @@ const CheckoutUI = (props: any) => {
|
|
|
379
400
|
<ChUserDetails>
|
|
380
401
|
{cartState.loading ? (
|
|
381
402
|
<Placeholder Animation={Fade}>
|
|
382
|
-
<PlaceholderLine height={20}
|
|
383
|
-
<PlaceholderLine height={
|
|
384
|
-
<PlaceholderLine height={
|
|
385
|
-
<PlaceholderLine height={
|
|
403
|
+
<PlaceholderLine height={20} />
|
|
404
|
+
<PlaceholderLine height={12} />
|
|
405
|
+
<PlaceholderLine height={12} />
|
|
406
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
386
407
|
</Placeholder>
|
|
387
408
|
) : (
|
|
388
409
|
<UserDetails
|
|
389
410
|
isUserDetailsEdit={isUserDetailsEdit}
|
|
411
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
390
412
|
cartStatus={cart?.status}
|
|
391
413
|
businessId={cart?.business_id}
|
|
392
414
|
useValidationFields
|
|
@@ -406,13 +428,13 @@ const CheckoutUI = (props: any) => {
|
|
|
406
428
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
407
429
|
<View style={{ height: 110 }}>
|
|
408
430
|
<Placeholder Animation={Fade}>
|
|
409
|
-
<PlaceholderLine height={20}
|
|
410
|
-
<PlaceholderLine height={40}
|
|
431
|
+
<PlaceholderLine height={20} />
|
|
432
|
+
<PlaceholderLine height={40} />
|
|
411
433
|
</Placeholder>
|
|
412
434
|
</View>
|
|
413
435
|
) : (
|
|
414
|
-
|
|
415
|
-
<
|
|
436
|
+
<ChSection>
|
|
437
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
416
438
|
<View
|
|
417
439
|
style={{
|
|
418
440
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -431,7 +453,7 @@ const CheckoutUI = (props: any) => {
|
|
|
431
453
|
<OText
|
|
432
454
|
size={14}
|
|
433
455
|
>
|
|
434
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
456
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
435
457
|
</OText>
|
|
436
458
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
437
459
|
</DeliveryOptionItem>
|
|
@@ -458,7 +480,7 @@ const CheckoutUI = (props: any) => {
|
|
|
458
480
|
/>
|
|
459
481
|
</View>
|
|
460
482
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
461
|
-
|
|
483
|
+
</ChSection>
|
|
462
484
|
)}
|
|
463
485
|
|
|
464
486
|
</DeliveryOptionsContainer>
|
|
@@ -480,29 +502,6 @@ const CheckoutUI = (props: any) => {
|
|
|
480
502
|
</ChSection>
|
|
481
503
|
)}
|
|
482
504
|
|
|
483
|
-
{/* <ChSection>
|
|
484
|
-
<ChTotal>
|
|
485
|
-
{
|
|
486
|
-
(
|
|
487
|
-
<>
|
|
488
|
-
<OIcon
|
|
489
|
-
url={businessLogo || businessDetails?.business?.logo}
|
|
490
|
-
width={80}
|
|
491
|
-
height={80}
|
|
492
|
-
borderRadius={80}
|
|
493
|
-
/>
|
|
494
|
-
<View style={{ marginLeft: 10, width: '85%' }}>
|
|
495
|
-
<OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
|
|
496
|
-
{businessName || businessDetails?.business?.name}
|
|
497
|
-
</OText>
|
|
498
|
-
<OText size={22}>
|
|
499
|
-
{cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
|
|
500
|
-
</OText>
|
|
501
|
-
</View>
|
|
502
|
-
</>
|
|
503
|
-
)}
|
|
504
|
-
</ChTotal>
|
|
505
|
-
</ChSection> */}
|
|
506
505
|
<ChSection>
|
|
507
506
|
<ChAddress>
|
|
508
507
|
{(businessDetails?.loading || cartState.loading) ? (
|
|
@@ -519,6 +518,7 @@ const CheckoutUI = (props: any) => {
|
|
|
519
518
|
uuid={cartUuid}
|
|
520
519
|
apiKey={configs?.google_maps_api_key?.value}
|
|
521
520
|
mapConfigs={mapConfigs}
|
|
521
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
522
522
|
/>
|
|
523
523
|
)}
|
|
524
524
|
</ChAddress>
|
|
@@ -535,19 +535,18 @@ const CheckoutUI = (props: any) => {
|
|
|
535
535
|
(
|
|
536
536
|
<ChSection>
|
|
537
537
|
<ChDriverTips>
|
|
538
|
-
<
|
|
539
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
540
|
-
</OText>
|
|
538
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
541
539
|
<DriverTips
|
|
542
540
|
uuid={cartUuid}
|
|
543
541
|
businessId={cart?.business_id}
|
|
544
|
-
driverTipsOptions={driverTipsOptions}
|
|
545
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
542
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
543
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
546
544
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
547
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
545
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
548
546
|
? cart?.driver_tip
|
|
549
547
|
: cart?.driver_tip_rate}
|
|
550
548
|
useOrderContext
|
|
549
|
+
cart={cart}
|
|
551
550
|
/>
|
|
552
551
|
</ChDriverTips>
|
|
553
552
|
</ChSection>
|
|
@@ -556,9 +555,7 @@ const CheckoutUI = (props: any) => {
|
|
|
556
555
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
557
556
|
<ChSection>
|
|
558
557
|
<ChPaymethods>
|
|
559
|
-
<
|
|
560
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
561
|
-
</OText>
|
|
558
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
562
559
|
{!cartState.loading && cart?.status === 4 && (
|
|
563
560
|
<OText
|
|
564
561
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -606,6 +603,7 @@ const CheckoutUI = (props: any) => {
|
|
|
606
603
|
isInputMode
|
|
607
604
|
cart={cart}
|
|
608
605
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
606
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
609
607
|
vehicleDefault={cart?.vehicle}
|
|
610
608
|
/>
|
|
611
609
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -623,19 +621,12 @@ const CheckoutUI = (props: any) => {
|
|
|
623
621
|
) : (
|
|
624
622
|
<>
|
|
625
623
|
<CartHeader>
|
|
626
|
-
<
|
|
627
|
-
size={16}
|
|
628
|
-
lineHeight={24}
|
|
629
|
-
color={theme.colors.textNormal}
|
|
630
|
-
style={{ fontWeight: '500' }}
|
|
631
|
-
>
|
|
632
|
-
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
633
|
-
</OText>
|
|
624
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
634
625
|
<TouchableOpacity
|
|
635
626
|
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
636
627
|
>
|
|
637
628
|
<OText
|
|
638
|
-
size={
|
|
629
|
+
size={12}
|
|
639
630
|
lineHeight={15}
|
|
640
631
|
color={theme.colors.primary}
|
|
641
632
|
style={{ textDecorationLine: 'underline' }}
|
|
@@ -652,7 +643,7 @@ const CheckoutUI = (props: any) => {
|
|
|
652
643
|
<OText
|
|
653
644
|
size={12}
|
|
654
645
|
lineHeight={18}
|
|
655
|
-
color={theme.colors.
|
|
646
|
+
color={theme.colors.primary}
|
|
656
647
|
style={{ textDecorationLine: 'underline' }}
|
|
657
648
|
>
|
|
658
649
|
{t('CHANGE_STORE', 'Change store')}
|
|
@@ -743,7 +734,10 @@ const CheckoutUI = (props: any) => {
|
|
|
743
734
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
744
735
|
requiredFields={requiredFields}
|
|
745
736
|
hideUpdateButton
|
|
746
|
-
onClose={() =>
|
|
737
|
+
onClose={() => {
|
|
738
|
+
setIsOpen(false)
|
|
739
|
+
handlePlaceOrder(null, true)
|
|
740
|
+
}}
|
|
747
741
|
/>
|
|
748
742
|
</View>
|
|
749
743
|
</OModal>
|
|
@@ -751,10 +745,10 @@ const CheckoutUI = (props: any) => {
|
|
|
751
745
|
</Container>
|
|
752
746
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
753
747
|
<FloatingButton
|
|
754
|
-
handleClick={() => handlePlaceOrder(null)}
|
|
748
|
+
handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
|
|
755
749
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
756
750
|
disabled={isDisabledButtonPlace}
|
|
757
|
-
btnText={
|
|
751
|
+
btnText={subtotalWithTaxes >= cart?.minimum
|
|
758
752
|
? (
|
|
759
753
|
placing
|
|
760
754
|
? t('PLACING', 'Placing')
|
|
@@ -781,19 +775,6 @@ const CheckoutUI = (props: any) => {
|
|
|
781
775
|
setShowGateway={setShowGateway}
|
|
782
776
|
/>
|
|
783
777
|
)}
|
|
784
|
-
{webviewPaymethod?.gateway === 'square' && showGateway.open && (
|
|
785
|
-
<PaymentOptionsWebView
|
|
786
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
787
|
-
uri={`https://test-square-f50f7.web.app`}
|
|
788
|
-
user={user}
|
|
789
|
-
token={token}
|
|
790
|
-
cart={cart}
|
|
791
|
-
currency={currency}
|
|
792
|
-
webviewPaymethod={webviewPaymethod}
|
|
793
|
-
setShowGateway={setShowGateway}
|
|
794
|
-
locationId={'L1NGAY5M6KJRX'}
|
|
795
|
-
/>
|
|
796
|
-
)}
|
|
797
778
|
</>
|
|
798
779
|
)
|
|
799
780
|
}
|
|
@@ -819,16 +800,23 @@ export const Checkout = (props: any) => {
|
|
|
819
800
|
|
|
820
801
|
const getOrder = async (cartId: any) => {
|
|
821
802
|
try {
|
|
822
|
-
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
803
|
+
let result: any = {}
|
|
804
|
+
const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
|
|
805
|
+
if (cart) {
|
|
806
|
+
result = { ...cart }
|
|
807
|
+
} else {
|
|
808
|
+
setCartState({ ...cartState, loading: true })
|
|
809
|
+
const url = `${ordering.root}/carts/${cartId}`
|
|
810
|
+
const response = await fetch(url, {
|
|
811
|
+
method: 'GET',
|
|
812
|
+
headers: {
|
|
813
|
+
'Content-Type': 'application/json',
|
|
814
|
+
Authorization: `Bearer ${token}`
|
|
815
|
+
}
|
|
816
|
+
})
|
|
817
|
+
const content = await response.json();
|
|
818
|
+
result = content.result
|
|
819
|
+
}
|
|
832
820
|
|
|
833
821
|
let publicKey = null
|
|
834
822
|
try {
|
|
@@ -6,7 +6,7 @@ export const ChContainer = styled.View`
|
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
export const ChSection = styled.View`
|
|
9
|
-
padding-top:
|
|
9
|
+
padding-top: 20px;
|
|
10
10
|
`
|
|
11
11
|
|
|
12
12
|
export const ChHeader = styled.View`
|
|
@@ -40,7 +40,9 @@ export const ChMoment = styled(ChAddress)`
|
|
|
40
40
|
`
|
|
41
41
|
|
|
42
42
|
export const CHMomentWrapper = styled.TouchableOpacity`
|
|
43
|
-
background-color: ${(props: any) => props.
|
|
43
|
+
background-color: ${(props: any) => props.isCustomColor
|
|
44
|
+
? props.theme.colors.primary
|
|
45
|
+
: props.theme.colors.backgroundGray100};
|
|
44
46
|
border-radius: 7.6px;
|
|
45
47
|
font-size: 12px;
|
|
46
48
|
max-width: 240px;
|
|
@@ -76,7 +78,6 @@ export const ChCart = styled(ChPaymethods)``
|
|
|
76
78
|
|
|
77
79
|
export const WalletPaymentOptionContainer = styled(ChPaymethods)`
|
|
78
80
|
padding-bottom: 0;
|
|
79
|
-
margin-left: -20px;
|
|
80
81
|
`
|
|
81
82
|
|
|
82
83
|
export const ChPlaceOrderBtn = styled.View`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { StyleSheet, useWindowDimensions, Keyboard, View } from 'react-native';
|
|
3
|
+
import { useLanguage, useOrder } from 'ordering-components/native';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
import { useTheme } from 'styled-components/native';
|
|
6
|
+
|
|
7
|
+
import { OButton, OIcon, OText } from '../shared';
|
|
8
|
+
|
|
9
|
+
import { CityElement, Container } from './styles'
|
|
10
|
+
|
|
11
|
+
export const CitiesControl = (props: any) => {
|
|
12
|
+
const {
|
|
13
|
+
cities,
|
|
14
|
+
onClose,
|
|
15
|
+
handleChangeCity
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const [, t] = useLanguage();
|
|
20
|
+
const [orderState] = useOrder();
|
|
21
|
+
const { height } = useWindowDimensions();
|
|
22
|
+
const { top, bottom } = useSafeAreaInsets();
|
|
23
|
+
|
|
24
|
+
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
25
|
+
const [cityState, setCityState] = useState(orderState?.options?.city_id)
|
|
26
|
+
|
|
27
|
+
const handleClick = () => {
|
|
28
|
+
cityState !== orderState?.options?.city_id && handleChangeCity(cityState)
|
|
29
|
+
onClose && onClose()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const keyboardDidShowListener = Keyboard.addListener(
|
|
34
|
+
'keyboardDidShow',
|
|
35
|
+
() => setIsKeyboardShow(true)
|
|
36
|
+
);
|
|
37
|
+
const keyboardDidHideListener = Keyboard.addListener(
|
|
38
|
+
'keyboardDidHide',
|
|
39
|
+
() => setIsKeyboardShow(false)
|
|
40
|
+
);
|
|
41
|
+
return () => {
|
|
42
|
+
keyboardDidShowListener.remove();
|
|
43
|
+
keyboardDidHideListener.remove();
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
|
|
49
|
+
<View>
|
|
50
|
+
{cities?.map((city: any) => (
|
|
51
|
+
<CityElement
|
|
52
|
+
key={city?.id}
|
|
53
|
+
activeOpacity={1}
|
|
54
|
+
disabled={orderState?.loading}
|
|
55
|
+
onPress={() => setCityState(city?.id === cityState ? null : city?.id)}
|
|
56
|
+
>
|
|
57
|
+
<OIcon
|
|
58
|
+
src={cityState === city?.id
|
|
59
|
+
? theme.images.general.option_checked
|
|
60
|
+
: theme.images.general.option_normal}
|
|
61
|
+
width={16}
|
|
62
|
+
style={{ marginEnd: 24 }}
|
|
63
|
+
/>
|
|
64
|
+
<OText color={theme.colors.black}>
|
|
65
|
+
{city?.name}
|
|
66
|
+
</OText>
|
|
67
|
+
</CityElement>
|
|
68
|
+
))}
|
|
69
|
+
</View>
|
|
70
|
+
<OButton
|
|
71
|
+
text={t('CONTINUE', 'Continue')}
|
|
72
|
+
bgColor={theme.colors.primary}
|
|
73
|
+
borderColor={theme.colors.primary}
|
|
74
|
+
style={styles.btnStyle}
|
|
75
|
+
textStyle={{ color: 'white' }}
|
|
76
|
+
onClick={() => handleClick()}
|
|
77
|
+
/>
|
|
78
|
+
</Container>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const styles = StyleSheet.create({
|
|
83
|
+
btnStyle: {
|
|
84
|
+
marginTop: 20,
|
|
85
|
+
borderRadius: 8,
|
|
86
|
+
shadowOpacity: 0,
|
|
87
|
+
height: 44
|
|
88
|
+
},
|
|
89
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const Container = styled.View`
|
|
4
|
+
width: 100%;
|
|
5
|
+
padding: 0 40px;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
padding-bottom: 12px;
|
|
8
|
+
|
|
9
|
+
${(props: any) => props.height && css`
|
|
10
|
+
height: ${props.height}px;
|
|
11
|
+
`}
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const CityElement = styled.TouchableOpacity`
|
|
15
|
+
padding: 10px;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
`
|