ordering-ui-react-native 0.22.1 → 0.22.2-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 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +4 -2
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/types/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +49 -27
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +36 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +40 -27
- package/themes/business/src/components/OrderDetails/Business.tsx +54 -37
- package/themes/business/src/components/OrderDetails/Delivery.tsx +138 -55
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -43
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +62 -24
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +149 -68
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +210 -65
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +217 -156
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +39 -16
- package/themes/business/src/components/PreviousOrders/index.tsx +76 -66
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +226 -76
- package/themes/business/src/components/PrinterSettings/styles.tsx +20 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +16 -17
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +14 -5
- package/themes/business/src/utils/index.tsx +25 -1
- 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/Checkout/index.tsx +6 -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/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +11 -0
- package/themes/original/src/components/AddressForm/index.tsx +32 -17
- package/themes/original/src/components/AddressList/index.tsx +8 -7
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
- package/themes/original/src/components/BusinessController/index.tsx +5 -5
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +44 -32
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
- package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +38 -14
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +110 -58
- package/themes/original/src/components/CitiesControl/index.tsx +0 -3
- package/themes/original/src/components/CouponControl/index.tsx +1 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -3
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
- package/themes/original/src/components/GoogleMap/index.tsx +39 -18
- package/themes/original/src/components/Help/index.tsx +2 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -11
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +4 -7
- package/themes/original/src/components/MessageListing/index.tsx +2 -1
- package/themes/original/src/components/Messages/index.tsx +29 -17
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +79 -56
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
- package/themes/original/src/components/MyOrders/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +7 -4
- package/themes/original/src/components/NetworkError/index.tsx +0 -5
- package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +13 -10
- package/themes/original/src/components/OrderDetails/index.tsx +44 -21
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +5 -4
- package/themes/original/src/components/OrderSummary/index.tsx +29 -10
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +3 -6
- package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +10 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
- package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
- package/themes/original/src/components/ProductForm/index.tsx +107 -102
- package/themes/original/src/components/ProductItemAccordion/index.tsx +51 -44
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
- package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
- package/themes/original/src/components/Promotions/index.tsx +6 -9
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +52 -54
- package/themes/original/src/components/Sessions/index.tsx +3 -3
- package/themes/original/src/components/SignupForm/index.tsx +86 -78
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +76 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
- package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +159 -133
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserVerification/index.tsx +14 -4
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
- package/themes/original/src/components/shared/OAlert.tsx +2 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -4
- package/themes/original/src/components/shared/OInput.tsx +4 -8
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +30 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -26,9 +26,9 @@ import { BusinessTypeFilterParams } from '../../types';
|
|
|
26
26
|
const windowWidth = Dimensions.get('window').width;
|
|
27
27
|
|
|
28
28
|
export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
29
|
-
const {
|
|
30
|
-
typesState,
|
|
31
|
-
currentTypeSelected,
|
|
29
|
+
const {
|
|
30
|
+
typesState,
|
|
31
|
+
currentTypeSelected,
|
|
32
32
|
handleChangeBusinessType,
|
|
33
33
|
setBusinessTypes,
|
|
34
34
|
isAppoint
|
|
@@ -38,13 +38,13 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
38
38
|
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
|
|
41
|
-
const defaultImage = (name
|
|
41
|
+
const defaultImage = (name: string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
|
|
42
42
|
|
|
43
43
|
useEffect(() => {
|
|
44
|
-
if(typesState?.types?.length > 0){
|
|
45
|
-
|
|
44
|
+
if (typesState?.types?.length > 0) {
|
|
45
|
+
setBusinessTypes && setBusinessTypes(typesState?.types)
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
}, [typesState])
|
|
48
48
|
|
|
49
49
|
const handleChangeServiceType = (serviceId: any) => {
|
|
50
50
|
if (serviceId === currentTypeSelected) {
|
|
@@ -119,10 +119,11 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
119
119
|
<OButton
|
|
120
120
|
key={i}
|
|
121
121
|
bgColor={(currentTypeSelected === businessType?.id) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
122
|
+
borderColor={(currentTypeSelected === businessType?.id) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
122
123
|
onClick={() => handleChangeServiceType(businessType?.id)}
|
|
123
124
|
text={`${businessType?.name} ${(currentTypeSelected === businessType?.id) ? ' X' : ''}`}
|
|
124
125
|
style={styles.businessType}
|
|
125
|
-
textStyle={{ fontSize: 10, color: (currentTypeSelected === businessType?.id) ? theme.colors.
|
|
126
|
+
textStyle={{ fontSize: 10, color: (currentTypeSelected === businessType?.id) ? theme.colors.white : theme.colors.textNormal }}
|
|
126
127
|
/>
|
|
127
128
|
))}
|
|
128
129
|
</ServiceWrapper>
|
|
@@ -392,10 +392,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
392
392
|
<OButton
|
|
393
393
|
key={i}
|
|
394
394
|
bgColor={(priceLevelSelected === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
395
|
+
borderColor={(priceLevelSelected === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
395
396
|
onClick={() => handleChangePriceLevel(price?.level)}
|
|
396
397
|
text={`${price.content} ${(priceLevelSelected === price?.level) ? ' X' : ''}`}
|
|
397
398
|
style={styles.priceLevel}
|
|
398
|
-
textStyle={{ fontSize: 10, color: (priceLevelSelected === price?.level) ? theme.colors.backgroundLight : theme.colors.
|
|
399
|
+
textStyle={{ fontSize: 10, color: (priceLevelSelected === price?.level) ? theme.colors.backgroundLight : theme.colors.black }}
|
|
399
400
|
/>
|
|
400
401
|
))}
|
|
401
402
|
</ScrollView>
|
|
@@ -168,7 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
168
168
|
setFeaturedBusinesses(ary);
|
|
169
169
|
}
|
|
170
170
|
resetInactivityTimeout()
|
|
171
|
-
}, [businessesList.loading])
|
|
171
|
+
}, [businessesList.loading, businessesList?.businesses])
|
|
172
172
|
|
|
173
173
|
const handleOnRefresh = () => {
|
|
174
174
|
if (!businessesList.loading) {
|
|
@@ -60,7 +60,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
|
|
|
60
60
|
|
|
61
61
|
export const HeaderWrapper = styled.ImageBackground`
|
|
62
62
|
width: 100%;
|
|
63
|
-
height:
|
|
63
|
+
height: 270px;
|
|
64
64
|
padding: 20px;
|
|
65
65
|
background-color: transparent;
|
|
66
66
|
`;
|
|
@@ -19,7 +19,7 @@ import { CouponControl } from '../CouponControl';
|
|
|
19
19
|
import { OButton, OInput, OModal, OText } from '../shared';
|
|
20
20
|
import { UpsellingProducts } from '../UpsellingProducts';
|
|
21
21
|
import { verifyDecimals } from '../../utils';
|
|
22
|
-
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
|
|
22
|
+
import { ActivityIndicator, TouchableOpacity, View, Vibration } from 'react-native';
|
|
23
23
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
24
24
|
import { TaxInformation } from '../TaxInformation';
|
|
25
25
|
import { CartStoresListing } from '../CartStoresListing';
|
|
@@ -114,6 +114,7 @@ const CartUI = (props: any) => {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
const handleUpsellingPage = (individualCart: any) => {
|
|
117
|
+
Vibration.vibrate(100)
|
|
117
118
|
const isProductCartParam = !!individualCart?.products?.length
|
|
118
119
|
setOpenUpselling(false)
|
|
119
120
|
setCanOpenUpselling(false)
|
|
@@ -128,8 +129,9 @@ const CartUI = (props: any) => {
|
|
|
128
129
|
cartUuid: cart?.uuid,
|
|
129
130
|
businessLogo: cart?.business?.logo,
|
|
130
131
|
businessName: cart?.business?.name,
|
|
131
|
-
cartTotal: cart?.total
|
|
132
|
-
|
|
132
|
+
cartTotal: cart?.total,
|
|
133
|
+
fromProductsList: isFromUpselling
|
|
134
|
+
})
|
|
133
135
|
} else {
|
|
134
136
|
const groupKeys: any = {}
|
|
135
137
|
cartsAvailable.forEach((_cart: any) => {
|
|
@@ -145,28 +147,30 @@ const CartUI = (props: any) => {
|
|
|
145
147
|
onNavigationRedirect('CheckoutNavigator', {
|
|
146
148
|
screen: 'MultiCheckout',
|
|
147
149
|
checkCarts: true
|
|
148
|
-
}
|
|
150
|
+
})
|
|
149
151
|
} else {
|
|
150
152
|
onNavigationRedirect('CheckoutNavigator', {
|
|
151
153
|
screen: 'MultiCheckout',
|
|
152
154
|
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
153
|
-
}
|
|
155
|
+
})
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
const getIncludedTaxes = () => {
|
|
160
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
159
161
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
160
|
-
return cart
|
|
162
|
+
return cart?.business.tax_type === 1 ? cart?.tax : 0
|
|
161
163
|
} else {
|
|
162
164
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
163
|
-
return taxIncluded +
|
|
165
|
+
return taxIncluded +
|
|
166
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
167
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
164
168
|
}, 0)
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
|
|
168
172
|
const getIncludedTaxesDiscounts = () => {
|
|
169
|
-
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
173
|
+
return cart?.taxes?.filter((tax: any) => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -197,6 +201,7 @@ const CartUI = (props: any) => {
|
|
|
197
201
|
}, cart?.subtotal)
|
|
198
202
|
|
|
199
203
|
const handleClickCheckout = () => {
|
|
204
|
+
Vibration.vibrate(100)
|
|
200
205
|
if (cart?.business_id) {
|
|
201
206
|
setOpenUpselling(true)
|
|
202
207
|
} else {
|
|
@@ -243,7 +248,10 @@ const CartUI = (props: any) => {
|
|
|
243
248
|
handleClearProducts={handleClearProducts}
|
|
244
249
|
handleCartOpen={handleCartOpen}
|
|
245
250
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
246
|
-
handleChangeStore={() =>
|
|
251
|
+
handleChangeStore={() => {
|
|
252
|
+
Vibration.vibrate(100)
|
|
253
|
+
setOpenChangeStore(true)
|
|
254
|
+
}}
|
|
247
255
|
handleClickCheckout={() => handleClickCheckout()}
|
|
248
256
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
249
257
|
isMultiCheckout={isMultiCheckout}
|
|
@@ -324,7 +332,7 @@ const CartUI = (props: any) => {
|
|
|
324
332
|
</OSTable>
|
|
325
333
|
)}
|
|
326
334
|
{
|
|
327
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
335
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
328
336
|
<OSTable key={`${tax.id}_${i}`}>
|
|
329
337
|
<OSRow>
|
|
330
338
|
<OText size={12} lineHeight={18} numberOfLines={1} >
|
|
@@ -379,9 +387,25 @@ const CartUI = (props: any) => {
|
|
|
379
387
|
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
380
388
|
<OSTable>
|
|
381
389
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
382
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
390
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
383
391
|
</OSTable>
|
|
384
392
|
)}
|
|
393
|
+
{
|
|
394
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
395
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
396
|
+
<OSRow>
|
|
397
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
398
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
399
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
400
|
+
</OText>
|
|
401
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
402
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
403
|
+
</TouchableOpacity>
|
|
404
|
+
</OSRow>
|
|
405
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
406
|
+
</OSTable>
|
|
407
|
+
))
|
|
408
|
+
}
|
|
385
409
|
{
|
|
386
410
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
387
411
|
<OSTable key={`${offer.id}_${i}`}>
|
|
@@ -557,10 +581,10 @@ const CartUI = (props: any) => {
|
|
|
557
581
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
558
582
|
)}
|
|
559
583
|
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
584
|
+
borderColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
560
585
|
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
561
|
-
borderColor={theme.colors.primary}
|
|
562
586
|
imgRightSrc={null}
|
|
563
|
-
textStyle={{
|
|
587
|
+
textStyle={{ textAlign: 'center', flex: 1 }}
|
|
564
588
|
onClick={() => handleClickCheckout()}
|
|
565
589
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
566
590
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Vibration, View } from 'react-native';
|
|
3
3
|
import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
|
|
@@ -39,6 +39,7 @@ export const CartContent = (props: any) => {
|
|
|
39
39
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
40
40
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
41
41
|
const handleCheckoutRedirect = () => {
|
|
42
|
+
Vibration.vibrate(100)
|
|
42
43
|
if (cartsAvailable.length === 1) {
|
|
43
44
|
onNavigationRedirect('CheckoutNavigator', {
|
|
44
45
|
screen: 'CheckoutPage',
|
|
@@ -173,11 +174,8 @@ export const CartContent = (props: any) => {
|
|
|
173
174
|
<CheckoutAction style={{ marginTop: 0 }}>
|
|
174
175
|
<OButton
|
|
175
176
|
text={t('CHECKOUT', 'Checkout')}
|
|
176
|
-
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
177
177
|
isDisabled={!cartsAvailable.length}
|
|
178
|
-
borderColor={theme.colors.primary}
|
|
179
178
|
imgRightSrc={null}
|
|
180
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
181
179
|
onClick={() => handleCheckoutRedirect()}
|
|
182
180
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
183
181
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
@@ -7,7 +7,7 @@ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
|
7
7
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
8
|
import { useIsFocused } from '@react-navigation/native';
|
|
9
9
|
|
|
10
|
-
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
10
|
+
import ReactNativeHapticFeedback, { HapticFeedbackTypes } from "react-native-haptic-feedback";
|
|
11
11
|
import {
|
|
12
12
|
Checkout as CheckoutController,
|
|
13
13
|
useOrder,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
useApi,
|
|
16
16
|
useLanguage,
|
|
17
17
|
useUtils,
|
|
18
|
-
useValidationFields,
|
|
19
18
|
useConfig,
|
|
20
19
|
useToast,
|
|
21
20
|
ToastType,
|
|
@@ -103,7 +102,8 @@ const CheckoutUI = (props: any) => {
|
|
|
103
102
|
setPlaceSpotNumber,
|
|
104
103
|
maxDate,
|
|
105
104
|
androidAppId,
|
|
106
|
-
urlscheme
|
|
105
|
+
urlscheme,
|
|
106
|
+
checkoutFieldsState
|
|
107
107
|
} = props
|
|
108
108
|
|
|
109
109
|
const theme = useTheme();
|
|
@@ -145,12 +145,11 @@ const CheckoutUI = (props: any) => {
|
|
|
145
145
|
|
|
146
146
|
const [, { showToast }] = useToast();
|
|
147
147
|
const [, t] = useLanguage();
|
|
148
|
-
const [{ user, token }, { login }] = useSession();
|
|
148
|
+
const [{ user, token, loading: userLoading }, { login }] = useSession();
|
|
149
149
|
const [ordering] = useApi()
|
|
150
150
|
const [{ configs }] = useConfig();
|
|
151
151
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
152
152
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
153
|
-
const [validationFields] = useValidationFields();
|
|
154
153
|
const [events] = useEvent()
|
|
155
154
|
const [orientationState] = useDeviceOrientation();
|
|
156
155
|
const [isReadMore, setIsReadMore] = useState(false)
|
|
@@ -167,6 +166,7 @@ const CheckoutUI = (props: any) => {
|
|
|
167
166
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
168
167
|
const [isOpen, setIsOpen] = useState(false)
|
|
169
168
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
169
|
+
const [orderTypeValidationFields, setOrderTypeValidationFields] = useState<any>([])
|
|
170
170
|
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
171
171
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
172
172
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
@@ -178,6 +178,14 @@ const CheckoutUI = (props: any) => {
|
|
|
178
178
|
const containerRef = useRef<any>()
|
|
179
179
|
const cardsMethods = ['credomatic']
|
|
180
180
|
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
181
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
182
|
+
|
|
183
|
+
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field: any) => field.order_type_id === options?.type), [checkoutFieldsState, options])
|
|
184
|
+
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip'), [JSON.stringify(checkoutFields), options])
|
|
185
|
+
const guestCheckoutComment = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [JSON.stringify(checkoutFields), options])
|
|
186
|
+
const guestCheckoutCoupon = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'coupon'), [JSON.stringify(checkoutFields), options])
|
|
187
|
+
const guestCheckoutZipcode = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'zipcode'), [JSON.stringify(checkoutFields), options])
|
|
188
|
+
|
|
181
189
|
const placeSpotTypes = [3, 4, 5]
|
|
182
190
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
183
191
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
@@ -202,27 +210,28 @@ const CheckoutUI = (props: any) => {
|
|
|
202
210
|
return acc = acc
|
|
203
211
|
}, cart?.subtotal)
|
|
204
212
|
|
|
205
|
-
const validateCommentsCartField =
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
!paymethodSelected?.data?.card?.zipcode &&
|
|
210
|
-
paymethodSelected?.gateway === 'stripe'
|
|
213
|
+
const validateCommentsCartField = (guestCheckoutComment?.enabled && (user?.guest_id ? guestCheckoutComment?.required_with_guest : guestCheckoutComment?.required)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
214
|
+
const validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
|
|
215
|
+
const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some((offer: any) => offer?.type === 2)
|
|
216
|
+
const validateZipcodeCard = (guestCheckoutZipcode?.enabled && (user?.guest_id ? guestCheckoutZipcode?.required_with_guest : guestCheckoutZipcode?.required)) && paymethodSelected?.gateway === 'stripe' && paymethodSelected?.data?.card && !paymethodSelected?.data?.card?.zipcode
|
|
211
217
|
|
|
212
218
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
213
219
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
214
220
|
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
215
|
-
(options.type === 1 && !isGiftCardCart &&
|
|
216
|
-
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
217
|
-
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
218
|
-
(Number(cart?.driver_tip) <= 0)) ||
|
|
219
221
|
(validateCommentsCartField) ||
|
|
220
|
-
(
|
|
221
|
-
|
|
222
|
+
(validateDriverTipField && !isGiftCardCart) ||
|
|
223
|
+
(validateZipcodeCard) ||
|
|
224
|
+
(methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) ||
|
|
225
|
+
validateCommentsCartField ||
|
|
226
|
+
validateDriverTipField ||
|
|
227
|
+
validateCouponField ||
|
|
228
|
+
validateZipcodeCard
|
|
229
|
+
|
|
222
230
|
|
|
223
231
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
224
232
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
225
233
|
: configs?.driver_tip_options?.value || []
|
|
234
|
+
const driverTipsField = !cartState.loading && cart && cart?.business_id && options.type === 1 && cart?.status !== 2 && (guestCheckoutDriveTip?.enabled) && driverTipsOptions.length > 0
|
|
226
235
|
|
|
227
236
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
228
237
|
|
|
@@ -243,7 +252,7 @@ const CheckoutUI = (props: any) => {
|
|
|
243
252
|
}
|
|
244
253
|
}
|
|
245
254
|
|
|
246
|
-
const vibrateApp = (impact?:
|
|
255
|
+
const vibrateApp = (impact?: HapticFeedbackTypes) => {
|
|
247
256
|
const options = {
|
|
248
257
|
enableVibrateFallback: true,
|
|
249
258
|
ignoreAndroidSystemSettings: false
|
|
@@ -270,7 +279,7 @@ const CheckoutUI = (props: any) => {
|
|
|
270
279
|
return
|
|
271
280
|
}
|
|
272
281
|
|
|
273
|
-
if (!userErrors.length && (!requiredFields?.length
|
|
282
|
+
if (!userErrors.length && (!requiredFields?.length) || forcePlace) {
|
|
274
283
|
vibrateApp()
|
|
275
284
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
|
|
276
285
|
return
|
|
@@ -309,35 +318,65 @@ const CheckoutUI = (props: any) => {
|
|
|
309
318
|
|
|
310
319
|
const checkValidationFields = () => {
|
|
311
320
|
setUserErrors([])
|
|
312
|
-
const errors = []
|
|
313
|
-
const
|
|
314
|
-
const _requiredFields:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
321
|
+
const errors: Array<string> = []
|
|
322
|
+
const userSelected = user
|
|
323
|
+
const _requiredFields: Array<string> = []
|
|
324
|
+
Object.values(checkoutFieldsState?.fields).map((field: any) => {
|
|
325
|
+
if (options?.type === field?.order_type_id &&
|
|
326
|
+
field?.enabled &&
|
|
327
|
+
field?.required &&
|
|
328
|
+
!notFields.includes(field?.validation_field?.code)
|
|
329
|
+
) {
|
|
330
|
+
if (userSelected && !userSelected[field?.validation_field?.code]) {
|
|
331
|
+
_requiredFields.push(field?.validation_field?.code)
|
|
320
332
|
}
|
|
321
333
|
}
|
|
322
334
|
})
|
|
323
|
-
|
|
335
|
+
const mobilePhoneField: any = Object.values(checkoutFieldsState?.fields)?.find((field: any) => field?.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
324
336
|
if (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
337
|
+
userSelected &&
|
|
338
|
+
!userSelected?.cellphone &&
|
|
339
|
+
((mobilePhoneField?.enabled &&
|
|
340
|
+
mobilePhoneField?.required) ||
|
|
328
341
|
configs?.verification_phone_required?.value === '1')
|
|
329
342
|
) {
|
|
330
343
|
_requiredFields.push('cellphone')
|
|
331
344
|
}
|
|
332
345
|
setRequiredFields(_requiredFields)
|
|
333
346
|
|
|
334
|
-
if (phoneUpdate) {
|
|
335
|
-
errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
|
|
336
|
-
}
|
|
337
|
-
|
|
338
347
|
setUserErrors(errors)
|
|
339
348
|
}
|
|
340
349
|
|
|
350
|
+
const checkGuestValidationFields = () => {
|
|
351
|
+
const userSelected = user
|
|
352
|
+
const _requiredFields = checkoutFieldsState?.fields
|
|
353
|
+
.filter((field : any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
|
|
354
|
+
!notFields.includes(field?.validation_field?.code) &&
|
|
355
|
+
field?.validation_field?.code !== 'email' &&
|
|
356
|
+
userSelected && !userSelected[field?.validation_field?.code])
|
|
357
|
+
const requiredFieldsCode = _requiredFields.map((item : any) => item?.validation_field?.code)
|
|
358
|
+
const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
359
|
+
const guestCheckoutEmail = checkoutFieldsState?.fields?.find((field : any) => field.order_type_id === options?.type && field?.validation_field?.code === 'email')
|
|
360
|
+
if (
|
|
361
|
+
userSelected &&
|
|
362
|
+
!userSelected?.guest_cellphone &&
|
|
363
|
+
((guestCheckoutCellPhone?.enabled &&
|
|
364
|
+
guestCheckoutCellPhone?.required_with_guest) ||
|
|
365
|
+
configs?.verification_phone_required?.value === '1')
|
|
366
|
+
) {
|
|
367
|
+
requiredFieldsCode.push('cellphone')
|
|
368
|
+
}
|
|
369
|
+
if (
|
|
370
|
+
userSelected &&
|
|
371
|
+
!userSelected?.guest_email &&
|
|
372
|
+
guestCheckoutEmail?.enabled &&
|
|
373
|
+
guestCheckoutEmail?.required_with_guest
|
|
374
|
+
) {
|
|
375
|
+
requiredFieldsCode.push('email')
|
|
376
|
+
}
|
|
377
|
+
setRequiredFields(requiredFieldsCode)
|
|
378
|
+
}
|
|
379
|
+
|
|
341
380
|
const togglePhoneUpdate = (val: boolean) => {
|
|
342
381
|
setPhoneUpdate(val)
|
|
343
382
|
}
|
|
@@ -346,11 +385,20 @@ const CheckoutUI = (props: any) => {
|
|
|
346
385
|
setShowTitle(contentOffset.y > 30)
|
|
347
386
|
}
|
|
348
387
|
|
|
388
|
+
const handleRedirect = () => {
|
|
389
|
+
props.fromProductsList
|
|
390
|
+
? navigation?.goBack()
|
|
391
|
+
: onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)
|
|
392
|
+
}
|
|
393
|
+
|
|
349
394
|
useEffect(() => {
|
|
350
|
-
if (
|
|
395
|
+
if (checkoutFieldsState?.loading || userLoading) return
|
|
396
|
+
if (user?.guest_id) {
|
|
397
|
+
checkGuestValidationFields()
|
|
398
|
+
} else {
|
|
351
399
|
checkValidationFields()
|
|
352
400
|
}
|
|
353
|
-
}, [
|
|
401
|
+
}, [checkoutFieldsState, user, options?.type])
|
|
354
402
|
|
|
355
403
|
useEffect(() => {
|
|
356
404
|
if (errors) {
|
|
@@ -456,7 +504,7 @@ const CheckoutUI = (props: any) => {
|
|
|
456
504
|
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
457
505
|
<View style={styles.wrapperNavbar}>
|
|
458
506
|
<TopHeader>
|
|
459
|
-
<TopActions onPress={() =>
|
|
507
|
+
<TopActions onPress={() => handleRedirect()}>
|
|
460
508
|
<IconAntDesign
|
|
461
509
|
name='arrowleft'
|
|
462
510
|
size={26}
|
|
@@ -482,7 +530,7 @@ const CheckoutUI = (props: any) => {
|
|
|
482
530
|
hideArrowLeft
|
|
483
531
|
title={t('CHECKOUT', 'Checkout')}
|
|
484
532
|
titleAlign={'center'}
|
|
485
|
-
onActionLeft={() =>
|
|
533
|
+
onActionLeft={() => handleRedirect()}
|
|
486
534
|
showCall={false}
|
|
487
535
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
488
536
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
@@ -619,15 +667,11 @@ const CheckoutUI = (props: any) => {
|
|
|
619
667
|
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
620
668
|
<OButton
|
|
621
669
|
text={t('SIGN_UP', 'Sign up')}
|
|
622
|
-
textStyle={{ color: theme.colors.white }}
|
|
623
670
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
624
671
|
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
625
672
|
/>
|
|
626
673
|
<OButton
|
|
627
674
|
text={t('LOGIN', 'Login')}
|
|
628
|
-
textStyle={{ color: theme.colors.primary }}
|
|
629
|
-
bgColor={theme.colors.white}
|
|
630
|
-
borderColor={theme.colors.primary}
|
|
631
675
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
632
676
|
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
633
677
|
/>
|
|
@@ -652,6 +696,9 @@ const CheckoutUI = (props: any) => {
|
|
|
652
696
|
isCheckout
|
|
653
697
|
phoneUpdate={phoneUpdate}
|
|
654
698
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
699
|
+
isOrderTypeValidationField
|
|
700
|
+
requiredFields={requiredFields}
|
|
701
|
+
checkoutFields={checkoutFields}
|
|
655
702
|
/>
|
|
656
703
|
)
|
|
657
704
|
)}
|
|
@@ -749,6 +796,7 @@ const CheckoutUI = (props: any) => {
|
|
|
749
796
|
</Placeholder>
|
|
750
797
|
) : (
|
|
751
798
|
<AddressDetails
|
|
799
|
+
cart={cart}
|
|
752
800
|
navigation={navigation}
|
|
753
801
|
location={options?.address?.location}
|
|
754
802
|
businessLogo={businessDetails?.business?.logo}
|
|
@@ -764,14 +812,7 @@ const CheckoutUI = (props: any) => {
|
|
|
764
812
|
</ChSection>
|
|
765
813
|
)}
|
|
766
814
|
|
|
767
|
-
{
|
|
768
|
-
cart &&
|
|
769
|
-
cart?.valid &&
|
|
770
|
-
options.type === 1 &&
|
|
771
|
-
cart?.status !== 2 &&
|
|
772
|
-
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
773
|
-
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
774
|
-
cart?.business_id &&
|
|
815
|
+
{driverTipsField &&
|
|
775
816
|
(
|
|
776
817
|
<ChSection>
|
|
777
818
|
<ChDriverTips>
|
|
@@ -916,6 +957,8 @@ const CheckoutUI = (props: any) => {
|
|
|
916
957
|
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
917
958
|
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
918
959
|
}
|
|
960
|
+
hideCommentsByValidationCheckout={!guestCheckoutComment?.enabled}
|
|
961
|
+
hideCouponByValidationCheckout={!guestCheckoutCoupon?.enabled}
|
|
919
962
|
/>
|
|
920
963
|
</>
|
|
921
964
|
)}
|
|
@@ -962,10 +1005,8 @@ const CheckoutUI = (props: any) => {
|
|
|
962
1005
|
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
963
1006
|
</OText>
|
|
964
1007
|
)}
|
|
965
|
-
{
|
|
966
|
-
|
|
967
|
-
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
968
|
-
(Number(cart?.driver_tip) <= 0) && (
|
|
1008
|
+
{validateDriverTipField && !isGiftCardCart &&
|
|
1009
|
+
(
|
|
969
1010
|
<OText
|
|
970
1011
|
color={theme.colors.error}
|
|
971
1012
|
size={12}
|
|
@@ -973,7 +1014,6 @@ const CheckoutUI = (props: any) => {
|
|
|
973
1014
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
974
1015
|
</OText>
|
|
975
1016
|
)}
|
|
976
|
-
|
|
977
1017
|
{validateCommentsCartField && (
|
|
978
1018
|
<OText
|
|
979
1019
|
color={theme.colors.error}
|
|
@@ -991,6 +1031,15 @@ const CheckoutUI = (props: any) => {
|
|
|
991
1031
|
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
992
1032
|
</OText>
|
|
993
1033
|
)}
|
|
1034
|
+
{validateCouponField &&
|
|
1035
|
+
(
|
|
1036
|
+
<OText
|
|
1037
|
+
color={theme.colors.error}
|
|
1038
|
+
size={12}
|
|
1039
|
+
>
|
|
1040
|
+
{t('WARNING_INVALID_COUPON_FIELD', 'Coupon is required.')}
|
|
1041
|
+
</OText>
|
|
1042
|
+
)}
|
|
994
1043
|
</ChErrors>
|
|
995
1044
|
</View>
|
|
996
1045
|
)}
|
|
@@ -1008,20 +1057,23 @@ const CheckoutUI = (props: any) => {
|
|
|
1008
1057
|
<OModal
|
|
1009
1058
|
open={isOpen}
|
|
1010
1059
|
onClose={() => setIsOpen(false)}
|
|
1060
|
+
showToastInsideModal
|
|
1011
1061
|
>
|
|
1012
1062
|
<View style={styles.detailWrapper}>
|
|
1013
1063
|
<UserDetails
|
|
1014
1064
|
isUserDetailsEdit
|
|
1015
1065
|
cartStatus={cart?.status}
|
|
1016
1066
|
businessId={cart?.business_id}
|
|
1017
|
-
useValidationFields
|
|
1018
1067
|
useDefualtSessionManager
|
|
1019
1068
|
useSessionUser
|
|
1020
1069
|
isCheckout
|
|
1021
1070
|
isEdit
|
|
1022
1071
|
phoneUpdate={phoneUpdate}
|
|
1023
1072
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
1073
|
+
isOrderTypeValidationField
|
|
1024
1074
|
requiredFields={requiredFields}
|
|
1075
|
+
checkoutFields={checkoutFields}
|
|
1076
|
+
isCheckoutPlace
|
|
1025
1077
|
hideUpdateButton
|
|
1026
1078
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
1027
1079
|
onClose={() => {
|
|
@@ -69,10 +69,7 @@ export const CitiesControl = (props: any) => {
|
|
|
69
69
|
</View>
|
|
70
70
|
<OButton
|
|
71
71
|
text={t('CONTINUE', 'Continue')}
|
|
72
|
-
bgColor={theme.colors.primary}
|
|
73
|
-
borderColor={theme.colors.primary}
|
|
74
72
|
style={styles.btnStyle}
|
|
75
|
-
textStyle={{ color: 'white' }}
|
|
76
73
|
onClick={() => handleClick()}
|
|
77
74
|
/>
|
|
78
75
|
</Container>
|
|
@@ -102,9 +102,7 @@ const CouponControlUI = (props: any) => {
|
|
|
102
102
|
/>
|
|
103
103
|
<OButton
|
|
104
104
|
onClick={() => onButtonApplyClick()}
|
|
105
|
-
|
|
106
|
-
borderColor={theme.colors.primary}
|
|
107
|
-
textStyle={{ color: 'white', fontSize: 12 }}
|
|
105
|
+
textStyle={{ fontSize: 12 }}
|
|
108
106
|
imgRightSrc={null}
|
|
109
107
|
text={t('APPLY', 'Apply')}
|
|
110
108
|
isDisabled={!couponInput}
|
|
@@ -125,9 +125,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
125
125
|
/>
|
|
126
126
|
<OButton
|
|
127
127
|
text={t('APPLY_TIP', 'Apply Tip')}
|
|
128
|
-
|
|
129
|
-
borderColor={theme.colors.primary}
|
|
130
|
-
textStyle={{ color: 'white', fontSize: 14 }}
|
|
128
|
+
textStyle={{ fontSize: 14 }}
|
|
131
129
|
imgRightSrc={null}
|
|
132
130
|
style={{ borderRadius: 5, height: 44 }}
|
|
133
131
|
isDisabled={parseFloat(value || '0') < 0 || parseFloat(value || '0') === driverTip || value === ''}
|