ordering-ui-react-native 0.16.77 → 0.16.78-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -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/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/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- 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 +236 -80
- 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/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +82 -47
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- 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 +447 -247
- 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 +36 -3
- package/themes/business/src/utils/index.tsx +53 -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 +476 -153
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- 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 +14 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +8 -0
- package/themes/original/src/components/AddressDetails/index.tsx +10 -8
- package/themes/original/src/components/AddressForm/index.tsx +155 -139
- 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 +125 -79
- 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 +102 -155
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- package/themes/original/src/components/BusinessProductsList/index.tsx +11 -8
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +563 -494
- 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 +116 -81
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
- package/themes/original/src/components/Cart/index.tsx +75 -40
- 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 +101 -106
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- 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 +52 -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 +28 -8
- 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 +23 -14
- 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 +66 -17
- 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 +93 -97
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +86 -92
- package/themes/original/src/components/PageBanner/index.tsx +146 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- 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 -1
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
- 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 +360 -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 +78 -66
- 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 +112 -77
- 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 +4 -1
- 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 +50 -54
- 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 +1 -1
- 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 +42 -7
- package/themes/original/src/utils/index.tsx +322 -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();
|
|
@@ -118,9 +119,11 @@ const CheckoutUI = (props: any) => {
|
|
|
118
119
|
paddingHorizontal: 40,
|
|
119
120
|
width: '100%'
|
|
120
121
|
},
|
|
121
|
-
wrapperNavbar:
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
wrapperNavbar: {
|
|
123
|
+
paddingVertical: 0,
|
|
124
|
+
paddingHorizontal: 40,
|
|
125
|
+
marginVertical: 2
|
|
126
|
+
}
|
|
124
127
|
})
|
|
125
128
|
|
|
126
129
|
const [, { showToast }] = useToast();
|
|
@@ -150,11 +153,16 @@ const CheckoutUI = (props: any) => {
|
|
|
150
153
|
const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
151
154
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
|
|
152
155
|
const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
|
|
156
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
153
157
|
|
|
154
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)
|
|
155
164
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
156
|
-
placing || errorCash ||
|
|
157
|
-
// (placeSpotTypes.includes(options?.type) && !cart?.place) ||
|
|
165
|
+
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
158
166
|
(options.type === 1 &&
|
|
159
167
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
160
168
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
@@ -180,8 +188,9 @@ const CheckoutUI = (props: any) => {
|
|
|
180
188
|
}
|
|
181
189
|
}
|
|
182
190
|
|
|
183
|
-
const handlePlaceOrder = (confirmPayment: any) => {
|
|
184
|
-
if (!userErrors.length && !requiredFields?.length) {
|
|
191
|
+
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
192
|
+
if (!userErrors.length && !requiredFields?.length || forcePlace) {
|
|
193
|
+
Vibration.vibrate()
|
|
185
194
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
186
195
|
return
|
|
187
196
|
}
|
|
@@ -197,6 +206,11 @@ const CheckoutUI = (props: any) => {
|
|
|
197
206
|
setIsUserDetailsEdit(true)
|
|
198
207
|
}
|
|
199
208
|
|
|
209
|
+
const handlePlaceOrderAsGuest = () => {
|
|
210
|
+
setIsOpen(false)
|
|
211
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
212
|
+
}
|
|
213
|
+
|
|
200
214
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
201
215
|
setShowGateway({ closedByUser: false, open: true })
|
|
202
216
|
setWebviewPaymethod(paymethod)
|
|
@@ -260,10 +274,6 @@ const CheckoutUI = (props: any) => {
|
|
|
260
274
|
}
|
|
261
275
|
}, [errors])
|
|
262
276
|
|
|
263
|
-
// useEffect(() => {
|
|
264
|
-
// handlePaymethodChange(null)
|
|
265
|
-
// }, [cart?.total])
|
|
266
|
-
|
|
267
277
|
useEffect(() => {
|
|
268
278
|
if (cart?.products?.length === 0) {
|
|
269
279
|
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
|
|
@@ -274,6 +284,21 @@ const CheckoutUI = (props: any) => {
|
|
|
274
284
|
onFailPaypal()
|
|
275
285
|
}, [showGateway.closedByUser])
|
|
276
286
|
|
|
287
|
+
const HeaderTitle = (props: any) => {
|
|
288
|
+
const { text } = props
|
|
289
|
+
return (
|
|
290
|
+
<OText
|
|
291
|
+
size={16}
|
|
292
|
+
lineHeight={24}
|
|
293
|
+
weight={'500'}
|
|
294
|
+
mBottom={props.mb ?? 10}
|
|
295
|
+
color={theme.colors.textNormal}
|
|
296
|
+
>
|
|
297
|
+
{text}
|
|
298
|
+
</OText>
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
|
|
277
302
|
return (
|
|
278
303
|
<>
|
|
279
304
|
<Container noPadding>
|
|
@@ -283,8 +308,7 @@ const CheckoutUI = (props: any) => {
|
|
|
283
308
|
titleAlign={'center'}
|
|
284
309
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
285
310
|
showCall={false}
|
|
286
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
287
|
-
style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
311
|
+
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
288
312
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
289
313
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
290
314
|
/>
|
|
@@ -292,13 +316,20 @@ const CheckoutUI = (props: any) => {
|
|
|
292
316
|
<ChContainer style={styles.pagePadding}>
|
|
293
317
|
<ChSection style={{ paddingTop: 0 }}>
|
|
294
318
|
<ChHeader>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
319
|
+
<CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
|
|
320
|
+
<OText
|
|
321
|
+
size={12}
|
|
322
|
+
numberOfLines={1}
|
|
323
|
+
ellipsizeMode={'tail'}
|
|
324
|
+
color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
|
|
325
|
+
>
|
|
326
|
+
{t(getTypesText(options?.type || 1), 'Delivery')}
|
|
327
|
+
</OText>
|
|
298
328
|
<OIcon
|
|
299
329
|
src={theme.images.general.arrow_down}
|
|
300
330
|
width={10}
|
|
301
331
|
style={{ marginStart: 8 }}
|
|
332
|
+
{...(isChewLayout && { color: 'white' })}
|
|
302
333
|
/>
|
|
303
334
|
</CHMomentWrapper>
|
|
304
335
|
<CHMomentWrapper
|
|
@@ -329,10 +360,10 @@ const CheckoutUI = (props: any) => {
|
|
|
329
360
|
!businessDetails?.error &&
|
|
330
361
|
(
|
|
331
362
|
<Placeholder Animation={Fade}>
|
|
332
|
-
<PlaceholderLine height={20}
|
|
333
|
-
<PlaceholderLine height={
|
|
334
|
-
<PlaceholderLine height={
|
|
335
|
-
<PlaceholderLine height={
|
|
363
|
+
<PlaceholderLine height={20} />
|
|
364
|
+
<PlaceholderLine height={12} />
|
|
365
|
+
<PlaceholderLine height={12} />
|
|
366
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
336
367
|
</Placeholder>
|
|
337
368
|
)}
|
|
338
369
|
{
|
|
@@ -341,9 +372,7 @@ const CheckoutUI = (props: any) => {
|
|
|
341
372
|
Object.values(businessDetails?.business).length > 0 &&
|
|
342
373
|
(
|
|
343
374
|
<>
|
|
344
|
-
<
|
|
345
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
346
|
-
</OText>
|
|
375
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
347
376
|
<View>
|
|
348
377
|
<OText size={12} lineHeight={18} weight={'400'}>
|
|
349
378
|
{businessDetails?.business?.name}
|
|
@@ -362,9 +391,7 @@ const CheckoutUI = (props: any) => {
|
|
|
362
391
|
)}
|
|
363
392
|
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
364
393
|
<View>
|
|
365
|
-
<
|
|
366
|
-
{t('BUSINESS_DETAILS', 'Business Details')}
|
|
367
|
-
</OText>
|
|
394
|
+
<HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
|
|
368
395
|
<NotFoundSource
|
|
369
396
|
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
370
397
|
/>
|
|
@@ -378,14 +405,15 @@ const CheckoutUI = (props: any) => {
|
|
|
378
405
|
<ChUserDetails>
|
|
379
406
|
{cartState.loading ? (
|
|
380
407
|
<Placeholder Animation={Fade}>
|
|
381
|
-
<PlaceholderLine height={20}
|
|
382
|
-
<PlaceholderLine height={
|
|
383
|
-
<PlaceholderLine height={
|
|
384
|
-
<PlaceholderLine height={
|
|
408
|
+
<PlaceholderLine height={20} />
|
|
409
|
+
<PlaceholderLine height={12} />
|
|
410
|
+
<PlaceholderLine height={12} />
|
|
411
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
385
412
|
</Placeholder>
|
|
386
413
|
) : (
|
|
387
414
|
<UserDetails
|
|
388
415
|
isUserDetailsEdit={isUserDetailsEdit}
|
|
416
|
+
HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
|
|
389
417
|
cartStatus={cart?.status}
|
|
390
418
|
businessId={cart?.business_id}
|
|
391
419
|
useValidationFields
|
|
@@ -405,13 +433,13 @@ const CheckoutUI = (props: any) => {
|
|
|
405
433
|
{cartState.loading || deliveryOptionSelected === undefined ? (
|
|
406
434
|
<View style={{ height: 110 }}>
|
|
407
435
|
<Placeholder Animation={Fade}>
|
|
408
|
-
<PlaceholderLine height={20}
|
|
409
|
-
<PlaceholderLine height={40}
|
|
436
|
+
<PlaceholderLine height={20} />
|
|
437
|
+
<PlaceholderLine height={40} />
|
|
410
438
|
</Placeholder>
|
|
411
439
|
</View>
|
|
412
440
|
) : (
|
|
413
|
-
|
|
414
|
-
<
|
|
441
|
+
<ChSection>
|
|
442
|
+
<HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
|
|
415
443
|
<View
|
|
416
444
|
style={{
|
|
417
445
|
backgroundColor: theme.colors.inputDisabled,
|
|
@@ -430,7 +458,7 @@ const CheckoutUI = (props: any) => {
|
|
|
430
458
|
<OText
|
|
431
459
|
size={14}
|
|
432
460
|
>
|
|
433
|
-
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)
|
|
461
|
+
{deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
|
|
434
462
|
</OText>
|
|
435
463
|
<MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
|
|
436
464
|
</DeliveryOptionItem>
|
|
@@ -457,7 +485,7 @@ const CheckoutUI = (props: any) => {
|
|
|
457
485
|
/>
|
|
458
486
|
</View>
|
|
459
487
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
460
|
-
|
|
488
|
+
</ChSection>
|
|
461
489
|
)}
|
|
462
490
|
|
|
463
491
|
</DeliveryOptionsContainer>
|
|
@@ -479,29 +507,6 @@ const CheckoutUI = (props: any) => {
|
|
|
479
507
|
</ChSection>
|
|
480
508
|
)}
|
|
481
509
|
|
|
482
|
-
{/* <ChSection>
|
|
483
|
-
<ChTotal>
|
|
484
|
-
{
|
|
485
|
-
(
|
|
486
|
-
<>
|
|
487
|
-
<OIcon
|
|
488
|
-
url={businessLogo || businessDetails?.business?.logo}
|
|
489
|
-
width={80}
|
|
490
|
-
height={80}
|
|
491
|
-
borderRadius={80}
|
|
492
|
-
/>
|
|
493
|
-
<View style={{ marginLeft: 10, width: '85%' }}>
|
|
494
|
-
<OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
|
|
495
|
-
{businessName || businessDetails?.business?.name}
|
|
496
|
-
</OText>
|
|
497
|
-
<OText size={22}>
|
|
498
|
-
{cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
|
|
499
|
-
</OText>
|
|
500
|
-
</View>
|
|
501
|
-
</>
|
|
502
|
-
)}
|
|
503
|
-
</ChTotal>
|
|
504
|
-
</ChSection> */}
|
|
505
510
|
<ChSection>
|
|
506
511
|
<ChAddress>
|
|
507
512
|
{(businessDetails?.loading || cartState.loading) ? (
|
|
@@ -518,6 +523,7 @@ const CheckoutUI = (props: any) => {
|
|
|
518
523
|
uuid={cartUuid}
|
|
519
524
|
apiKey={configs?.google_maps_api_key?.value}
|
|
520
525
|
mapConfigs={mapConfigs}
|
|
526
|
+
HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
|
|
521
527
|
/>
|
|
522
528
|
)}
|
|
523
529
|
</ChAddress>
|
|
@@ -534,19 +540,18 @@ const CheckoutUI = (props: any) => {
|
|
|
534
540
|
(
|
|
535
541
|
<ChSection>
|
|
536
542
|
<ChDriverTips>
|
|
537
|
-
<
|
|
538
|
-
{t('DRIVER_TIPS', 'Driver Tips')}
|
|
539
|
-
</OText>
|
|
543
|
+
<HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
|
|
540
544
|
<DriverTips
|
|
541
545
|
uuid={cartUuid}
|
|
542
546
|
businessId={cart?.business_id}
|
|
543
|
-
driverTipsOptions={driverTipsOptions}
|
|
544
|
-
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
547
|
+
driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
|
|
548
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
545
549
|
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
546
|
-
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
550
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
547
551
|
? cart?.driver_tip
|
|
548
552
|
: cart?.driver_tip_rate}
|
|
549
553
|
useOrderContext
|
|
554
|
+
cart={cart}
|
|
550
555
|
/>
|
|
551
556
|
</ChDriverTips>
|
|
552
557
|
</ChSection>
|
|
@@ -555,9 +560,7 @@ const CheckoutUI = (props: any) => {
|
|
|
555
560
|
{!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
|
|
556
561
|
<ChSection>
|
|
557
562
|
<ChPaymethods>
|
|
558
|
-
<
|
|
559
|
-
{t('PAYMENT_METHOD', 'Payment Method')}
|
|
560
|
-
</OText>
|
|
563
|
+
<HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
|
|
561
564
|
{!cartState.loading && cart?.status === 4 && (
|
|
562
565
|
<OText
|
|
563
566
|
style={{ textAlign: 'center', marginTop: 20 }}
|
|
@@ -605,6 +608,7 @@ const CheckoutUI = (props: any) => {
|
|
|
605
608
|
isInputMode
|
|
606
609
|
cart={cart}
|
|
607
610
|
spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
|
|
611
|
+
setPlaceSpotNumber={setPlaceSpotNumber}
|
|
608
612
|
vehicleDefault={cart?.vehicle}
|
|
609
613
|
/>
|
|
610
614
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
@@ -622,19 +626,12 @@ const CheckoutUI = (props: any) => {
|
|
|
622
626
|
) : (
|
|
623
627
|
<>
|
|
624
628
|
<CartHeader>
|
|
625
|
-
<
|
|
626
|
-
size={16}
|
|
627
|
-
lineHeight={24}
|
|
628
|
-
color={theme.colors.textNormal}
|
|
629
|
-
style={{ fontWeight: '500' }}
|
|
630
|
-
>
|
|
631
|
-
{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
|
|
632
|
-
</OText>
|
|
629
|
+
<HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
|
|
633
630
|
<TouchableOpacity
|
|
634
631
|
onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
|
|
635
632
|
>
|
|
636
633
|
<OText
|
|
637
|
-
size={
|
|
634
|
+
size={12}
|
|
638
635
|
lineHeight={15}
|
|
639
636
|
color={theme.colors.primary}
|
|
640
637
|
style={{ textDecorationLine: 'underline' }}
|
|
@@ -651,7 +648,7 @@ const CheckoutUI = (props: any) => {
|
|
|
651
648
|
<OText
|
|
652
649
|
size={12}
|
|
653
650
|
lineHeight={18}
|
|
654
|
-
color={theme.colors.
|
|
651
|
+
color={theme.colors.primary}
|
|
655
652
|
style={{ textDecorationLine: 'underline' }}
|
|
656
653
|
>
|
|
657
654
|
{t('CHANGE_STORE', 'Change store')}
|
|
@@ -742,7 +739,11 @@ const CheckoutUI = (props: any) => {
|
|
|
742
739
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
743
740
|
requiredFields={requiredFields}
|
|
744
741
|
hideUpdateButton
|
|
745
|
-
|
|
742
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
743
|
+
onClose={() => {
|
|
744
|
+
setIsOpen(false)
|
|
745
|
+
handlePlaceOrder(null, true)
|
|
746
|
+
}}
|
|
746
747
|
/>
|
|
747
748
|
</View>
|
|
748
749
|
</OModal>
|
|
@@ -750,10 +751,10 @@ const CheckoutUI = (props: any) => {
|
|
|
750
751
|
</Container>
|
|
751
752
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
752
753
|
<FloatingButton
|
|
753
|
-
handleClick={() => handlePlaceOrder(null)}
|
|
754
|
+
handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
|
|
754
755
|
isSecondaryBtn={isDisabledButtonPlace}
|
|
755
756
|
disabled={isDisabledButtonPlace}
|
|
756
|
-
btnText={
|
|
757
|
+
btnText={subtotalWithTaxes >= cart?.minimum
|
|
757
758
|
? (
|
|
758
759
|
placing
|
|
759
760
|
? t('PLACING', 'Placing')
|
|
@@ -780,19 +781,6 @@ const CheckoutUI = (props: any) => {
|
|
|
780
781
|
setShowGateway={setShowGateway}
|
|
781
782
|
/>
|
|
782
783
|
)}
|
|
783
|
-
{webviewPaymethod?.gateway === 'square' && showGateway.open && (
|
|
784
|
-
<PaymentOptionsWebView
|
|
785
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
786
|
-
uri={`https://test-square-f50f7.web.app`}
|
|
787
|
-
user={user}
|
|
788
|
-
token={token}
|
|
789
|
-
cart={cart}
|
|
790
|
-
currency={currency}
|
|
791
|
-
webviewPaymethod={webviewPaymethod}
|
|
792
|
-
setShowGateway={setShowGateway}
|
|
793
|
-
locationId={'L1NGAY5M6KJRX'}
|
|
794
|
-
/>
|
|
795
|
-
)}
|
|
796
784
|
</>
|
|
797
785
|
)
|
|
798
786
|
}
|
|
@@ -818,16 +806,23 @@ export const Checkout = (props: any) => {
|
|
|
818
806
|
|
|
819
807
|
const getOrder = async (cartId: any) => {
|
|
820
808
|
try {
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
809
|
+
let result: any = {}
|
|
810
|
+
const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
|
|
811
|
+
if (cart) {
|
|
812
|
+
result = { ...cart }
|
|
813
|
+
} else {
|
|
814
|
+
setCartState({ ...cartState, loading: true })
|
|
815
|
+
const url = `${ordering.root}/carts/${cartId}`
|
|
816
|
+
const response = await fetch(url, {
|
|
817
|
+
method: 'GET',
|
|
818
|
+
headers: {
|
|
819
|
+
'Content-Type': 'application/json',
|
|
820
|
+
Authorization: `Bearer ${token}`
|
|
821
|
+
}
|
|
822
|
+
})
|
|
823
|
+
const content = await response.json();
|
|
824
|
+
result = content.result
|
|
825
|
+
}
|
|
831
826
|
|
|
832
827
|
let publicKey = null
|
|
833
828
|
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;
|
|
@@ -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
|
+
`
|