ordering-ui-react-native 0.21.73 → 0.21.74-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/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +6 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +3 -1
- package/themes/business/index.tsx +4 -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/BusinessProductList/index.tsx +2 -1
- package/themes/business/src/components/Chat/index.tsx +3 -1
- package/themes/business/src/components/DriverMap/index.tsx +44 -27
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- 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 +74 -24
- package/themes/business/src/components/OrderDetails/Business.tsx +65 -7
- package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -35
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderSummary/index.tsx +219 -71
- package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
- package/themes/business/src/components/OrdersOption/index.tsx +250 -127
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +28 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +105 -53
- package/themes/business/src/components/WebsocketStatus/index.tsx +4 -4
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/components/shared/OTextarea.tsx +8 -9
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +23 -4
- package/themes/business/src/utils/index.tsx +19 -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 +13 -1
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- 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 +6 -9
- package/themes/original/src/components/BusinessController/index.tsx +12 -7
- 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 +20 -15
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +15 -4
- 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 +39 -12
- package/themes/original/src/components/CartContent/index.tsx +59 -44
- package/themes/original/src/components/Checkout/index.tsx +47 -26
- 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/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- 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/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- 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 +2 -10
- 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 +1 -0
- package/themes/original/src/components/Messages/index.tsx +8 -7
- package/themes/original/src/components/MomentOption/index.tsx +13 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
- package/themes/original/src/components/MultiCheckout/index.tsx +123 -62
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
- package/themes/original/src/components/MyOrders/index.tsx +21 -26
- package/themes/original/src/components/NavBar/index.tsx +4 -2
- 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 +1 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
- package/themes/original/src/components/OrderDetails/index.tsx +28 -12
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +22 -3
- package/themes/original/src/components/OrderSummary/index.tsx +23 -5
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
- package/themes/original/src/components/OrdersOption/index.tsx +2 -4
- 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 +46 -5
- 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 +16 -19
- package/themes/original/src/components/ProductForm/index.tsx +108 -105
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
- 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 +1 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
- 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 -35
- package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
- 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/UserFormDetails/index.tsx +83 -84
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/Wallets/index.tsx +6 -3
- package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- 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/types/index.tsx +5 -1
- package/themes/original/src/utils/index.tsx +12 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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)
|
|
@@ -155,18 +156,20 @@ const CartUI = (props: any) => {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
const getIncludedTaxes = () => {
|
|
159
|
+
const getIncludedTaxes = (isDeliveryFee?: boolean) => {
|
|
159
160
|
if (cart?.taxes === null || !cart?.taxes) {
|
|
160
|
-
return cart
|
|
161
|
+
return cart?.business.tax_type === 1 ? cart?.tax : 0
|
|
161
162
|
} else {
|
|
162
163
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
163
|
-
return taxIncluded +
|
|
164
|
+
return taxIncluded +
|
|
165
|
+
(((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
|
|
166
|
+
(isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
164
167
|
}, 0)
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
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)
|
|
172
|
+
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
173
|
}
|
|
171
174
|
|
|
172
175
|
const OfferAlert = ({ offerId }: any) => {
|
|
@@ -197,10 +200,15 @@ const CartUI = (props: any) => {
|
|
|
197
200
|
}, cart?.subtotal)
|
|
198
201
|
|
|
199
202
|
const handleClickCheckout = () => {
|
|
203
|
+
Vibration.vibrate(100)
|
|
200
204
|
if (cart?.business_id) {
|
|
201
205
|
setOpenUpselling(true)
|
|
202
206
|
} else {
|
|
203
|
-
|
|
207
|
+
onNavigationRedirect('CheckoutNavigator', {
|
|
208
|
+
screen: 'CheckoutPage',
|
|
209
|
+
cartUuid: cart?.uuid,
|
|
210
|
+
cartTotal: cart?.total
|
|
211
|
+
}, true)
|
|
204
212
|
}
|
|
205
213
|
}
|
|
206
214
|
|
|
@@ -219,7 +227,7 @@ const CartUI = (props: any) => {
|
|
|
219
227
|
|
|
220
228
|
return (
|
|
221
229
|
<CContainer>
|
|
222
|
-
{openUpselling && (
|
|
230
|
+
{!!openUpselling && (
|
|
223
231
|
<UpsellingProducts
|
|
224
232
|
handleUpsellingPage={handleUpsellingPage}
|
|
225
233
|
openUpselling={openUpselling}
|
|
@@ -239,7 +247,10 @@ const CartUI = (props: any) => {
|
|
|
239
247
|
handleClearProducts={handleClearProducts}
|
|
240
248
|
handleCartOpen={handleCartOpen}
|
|
241
249
|
onNavigationRedirect={props.onNavigationRedirect}
|
|
242
|
-
handleChangeStore={() =>
|
|
250
|
+
handleChangeStore={() => {
|
|
251
|
+
Vibration.vibrate(100)
|
|
252
|
+
setOpenChangeStore(true)
|
|
253
|
+
}}
|
|
243
254
|
handleClickCheckout={() => handleClickCheckout()}
|
|
244
255
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
245
256
|
isMultiCheckout={isMultiCheckout}
|
|
@@ -320,7 +331,7 @@ const CartUI = (props: any) => {
|
|
|
320
331
|
</OSTable>
|
|
321
332
|
)}
|
|
322
333
|
{
|
|
323
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
334
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any, i: number) => (
|
|
324
335
|
<OSTable key={`${tax.id}_${i}`}>
|
|
325
336
|
<OSRow>
|
|
326
337
|
<OText size={12} lineHeight={18} numberOfLines={1} >
|
|
@@ -375,9 +386,25 @@ const CartUI = (props: any) => {
|
|
|
375
386
|
{orderState?.options?.type === 1 && cart?.delivery_price_with_discount > 0 && !hideDeliveryFee && (
|
|
376
387
|
<OSTable>
|
|
377
388
|
<OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
378
|
-
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
|
|
389
|
+
<OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</OText>
|
|
379
390
|
</OSTable>
|
|
380
391
|
)}
|
|
392
|
+
{
|
|
393
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
|
|
394
|
+
<OSTable key={`${tax.description}_${i}`}>
|
|
395
|
+
<OSRow>
|
|
396
|
+
<OText size={12} lineHeight={18} numberOfLines={1}>
|
|
397
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
398
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
|
|
399
|
+
</OText>
|
|
400
|
+
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
|
|
401
|
+
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
402
|
+
</TouchableOpacity>
|
|
403
|
+
</OSRow>
|
|
404
|
+
<OText size={12} lineHeight={18}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
405
|
+
</OSTable>
|
|
406
|
+
))
|
|
407
|
+
}
|
|
381
408
|
{
|
|
382
409
|
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
383
410
|
<OSTable key={`${offer.id}_${i}`}>
|
|
@@ -553,10 +580,10 @@ const CartUI = (props: any) => {
|
|
|
553
580
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
554
581
|
)}
|
|
555
582
|
bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
583
|
+
borderColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
556
584
|
isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
|
|
557
|
-
borderColor={theme.colors.primary}
|
|
558
585
|
imgRightSrc={null}
|
|
559
|
-
textStyle={{
|
|
586
|
+
textStyle={{ textAlign: 'center', flex: 1 }}
|
|
560
587
|
onClick={() => handleClickCheckout()}
|
|
561
588
|
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
562
589
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
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';
|
|
@@ -13,7 +13,8 @@ export const CartContent = (props: any) => {
|
|
|
13
13
|
const {
|
|
14
14
|
onNavigationRedirect,
|
|
15
15
|
singleBusiness,
|
|
16
|
-
businessSlug
|
|
16
|
+
businessSlug,
|
|
17
|
+
navigation
|
|
17
18
|
} = props
|
|
18
19
|
|
|
19
20
|
const theme = useTheme();
|
|
@@ -22,7 +23,7 @@ export const CartContent = (props: any) => {
|
|
|
22
23
|
const [{ parsePrice }] = useUtils();
|
|
23
24
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
24
25
|
const [cartsOpened, setCartsOpened] = useState([])
|
|
25
|
-
const [{ carts: cartsContext }] = useOrder();
|
|
26
|
+
const [{ carts: cartsContext }, { confirmCart }] = useOrder();
|
|
26
27
|
const cartsList =
|
|
27
28
|
(cartsContext &&
|
|
28
29
|
Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
|
|
@@ -38,6 +39,7 @@ export const CartContent = (props: any) => {
|
|
|
38
39
|
?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
|
|
39
40
|
?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
|
|
40
41
|
const handleCheckoutRedirect = () => {
|
|
42
|
+
Vibration.vibrate(100)
|
|
41
43
|
if (cartsAvailable.length === 1) {
|
|
42
44
|
onNavigationRedirect('CheckoutNavigator', {
|
|
43
45
|
screen: 'CheckoutPage',
|
|
@@ -71,7 +73,7 @@ export const CartContent = (props: any) => {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
const changeActiveState = useCallback((isClosed
|
|
76
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
75
77
|
const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
|
|
76
78
|
if (isActive || !isClosed) {
|
|
77
79
|
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
@@ -83,6 +85,20 @@ export const CartContent = (props: any) => {
|
|
|
83
85
|
}
|
|
84
86
|
}, [cartsOpened])
|
|
85
87
|
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const unsuscribe = navigation.addListener('focus', () => {
|
|
90
|
+
const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
|
|
91
|
+
if (cartsListBlockedByPaypal?.length > 0) {
|
|
92
|
+
cartsListBlockedByPaypal.map(async (cart: any) => {
|
|
93
|
+
await confirmCart(cart?.uuid)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
return () => {
|
|
98
|
+
return unsuscribe()
|
|
99
|
+
}
|
|
100
|
+
}, [carts, navigation])
|
|
101
|
+
|
|
86
102
|
return (
|
|
87
103
|
<CCContainer
|
|
88
104
|
style={{ paddingHorizontal: 20 }}
|
|
@@ -120,53 +136,52 @@ export const CartContent = (props: any) => {
|
|
|
120
136
|
{isMultiCheckout && (
|
|
121
137
|
<>
|
|
122
138
|
{!!cartsAvailable.length && (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
127
|
-
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
128
|
-
</OText>
|
|
129
|
-
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
130
|
-
{parsePrice(totalCartsFee)}
|
|
131
|
-
</OText>
|
|
132
|
-
</View>
|
|
133
|
-
)}
|
|
134
|
-
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
135
|
-
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
139
|
+
<>
|
|
140
|
+
<ChCartsTotal>
|
|
141
|
+
{!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
136
142
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
137
143
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
138
|
-
{t('
|
|
144
|
+
{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
|
|
139
145
|
</OText>
|
|
140
146
|
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
141
|
-
{parsePrice(
|
|
147
|
+
{parsePrice(totalCartsFee)}
|
|
142
148
|
</OText>
|
|
143
149
|
</View>
|
|
144
150
|
)}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
{cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
|
|
152
|
+
configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
|
|
153
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
154
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
155
|
+
{t('DRIVER_TIP', 'Driver tip')}
|
|
156
|
+
</OText>
|
|
157
|
+
<OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
|
|
158
|
+
{parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
|
|
159
|
+
</OText>
|
|
160
|
+
</View>
|
|
161
|
+
)}
|
|
162
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
163
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
|
|
164
|
+
{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
|
|
165
|
+
</OText>
|
|
166
|
+
<OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
|
|
167
|
+
</View>
|
|
168
|
+
<View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
|
|
169
|
+
<OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
|
|
170
|
+
{t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
|
|
171
|
+
</OText>
|
|
172
|
+
</View>
|
|
173
|
+
</ChCartsTotal>
|
|
174
|
+
<CheckoutAction style={{ marginTop: 0 }}>
|
|
175
|
+
<OButton
|
|
176
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
177
|
+
isDisabled={!cartsAvailable.length}
|
|
178
|
+
imgRightSrc={null}
|
|
179
|
+
onClick={() => handleCheckoutRedirect()}
|
|
180
|
+
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
181
|
+
/>
|
|
182
|
+
</CheckoutAction>
|
|
183
|
+
</>
|
|
157
184
|
)}
|
|
158
|
-
<CheckoutAction style={{ marginTop: 0 }}>
|
|
159
|
-
<OButton
|
|
160
|
-
text={t('CHECKOUT', 'Checkout')}
|
|
161
|
-
bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
|
|
162
|
-
isDisabled={!cartsAvailable.length}
|
|
163
|
-
borderColor={theme.colors.primary}
|
|
164
|
-
imgRightSrc={null}
|
|
165
|
-
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
166
|
-
onClick={() => handleCheckoutRedirect()}
|
|
167
|
-
style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
168
|
-
/>
|
|
169
|
-
</CheckoutAction>
|
|
170
185
|
</>
|
|
171
186
|
)}
|
|
172
187
|
</>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard } from 'react-native';
|
|
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'
|
|
5
5
|
import Picker from 'react-native-country-picker-modal';
|
|
6
6
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
|
|
7
7
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
8
9
|
|
|
9
10
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
10
11
|
import {
|
|
@@ -100,10 +101,13 @@ const CheckoutUI = (props: any) => {
|
|
|
100
101
|
currency,
|
|
101
102
|
merchantId,
|
|
102
103
|
setPlaceSpotNumber,
|
|
103
|
-
maxDate
|
|
104
|
+
maxDate,
|
|
105
|
+
androidAppId,
|
|
106
|
+
urlscheme
|
|
104
107
|
} = props
|
|
105
108
|
|
|
106
109
|
const theme = useTheme();
|
|
110
|
+
const isFocused = useIsFocused();
|
|
107
111
|
|
|
108
112
|
const styles = StyleSheet.create({
|
|
109
113
|
btnBackArrow: {
|
|
@@ -159,7 +163,7 @@ const CheckoutUI = (props: any) => {
|
|
|
159
163
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
160
164
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
161
165
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
162
|
-
const [showGateway, setShowGateway] = useState<any>({
|
|
166
|
+
const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
|
|
163
167
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
164
168
|
const [isOpen, setIsOpen] = useState(false)
|
|
165
169
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
@@ -208,7 +212,7 @@ const CheckoutUI = (props: any) => {
|
|
|
208
212
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
209
213
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
210
214
|
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
211
|
-
(options.type === 1 &&
|
|
215
|
+
(options.type === 1 && !isGiftCardCart &&
|
|
212
216
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
213
217
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
214
218
|
(Number(cart?.driver_tip) <= 0)) ||
|
|
@@ -413,6 +417,7 @@ const CheckoutUI = (props: any) => {
|
|
|
413
417
|
}, [])
|
|
414
418
|
|
|
415
419
|
useEffect(() => {
|
|
420
|
+
if (!isFocused) return
|
|
416
421
|
if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
|
|
417
422
|
const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
|
|
418
423
|
if (error) {
|
|
@@ -420,7 +425,7 @@ const CheckoutUI = (props: any) => {
|
|
|
420
425
|
navigation.navigate('BusinessList')
|
|
421
426
|
}
|
|
422
427
|
}
|
|
423
|
-
}, [cartState?.error, cartState?.cart, cartState?.loading])
|
|
428
|
+
}, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
|
|
424
429
|
|
|
425
430
|
useEffect(() => {
|
|
426
431
|
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
@@ -431,11 +436,26 @@ const CheckoutUI = (props: any) => {
|
|
|
431
436
|
}
|
|
432
437
|
}, [])
|
|
433
438
|
|
|
439
|
+
useEffect(() => {
|
|
440
|
+
const onBackFunction = () => {
|
|
441
|
+
if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
|
|
442
|
+
setShowGateway({ open: false, closedByUser: true })
|
|
443
|
+
return true
|
|
444
|
+
} else {
|
|
445
|
+
return false
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
BackHandler.addEventListener('hardwareBackPress', onBackFunction)
|
|
449
|
+
return () => {
|
|
450
|
+
BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
|
|
451
|
+
}
|
|
452
|
+
}, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
|
|
453
|
+
|
|
434
454
|
return (
|
|
435
455
|
<>
|
|
436
|
-
<
|
|
437
|
-
<
|
|
438
|
-
|
|
456
|
+
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
457
|
+
<View style={styles.wrapperNavbar}>
|
|
458
|
+
<TopHeader>
|
|
439
459
|
<TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
|
|
440
460
|
<IconAntDesign
|
|
441
461
|
name='arrowleft'
|
|
@@ -453,10 +473,10 @@ const CheckoutUI = (props: any) => {
|
|
|
453
473
|
{t('CHECKOUT', 'Checkout')}
|
|
454
474
|
</OText>
|
|
455
475
|
)}
|
|
456
|
-
|
|
457
|
-
</
|
|
458
|
-
</
|
|
459
|
-
<Container forwardRef={containerRef} noPadding onScroll={handleScroll}>
|
|
476
|
+
</TopHeader>
|
|
477
|
+
</View>
|
|
478
|
+
</SafeAreaView>
|
|
479
|
+
<Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
|
|
460
480
|
<View style={styles.wrapperNavbar}>
|
|
461
481
|
<NavBar
|
|
462
482
|
hideArrowLeft
|
|
@@ -599,15 +619,11 @@ const CheckoutUI = (props: any) => {
|
|
|
599
619
|
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
600
620
|
<OButton
|
|
601
621
|
text={t('SIGN_UP', 'Sign up')}
|
|
602
|
-
textStyle={{ color: theme.colors.white }}
|
|
603
622
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
604
623
|
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
605
624
|
/>
|
|
606
625
|
<OButton
|
|
607
626
|
text={t('LOGIN', 'Login')}
|
|
608
|
-
textStyle={{ color: theme.colors.primary }}
|
|
609
|
-
bgColor={theme.colors.white}
|
|
610
|
-
borderColor={theme.colors.primary}
|
|
611
627
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
612
628
|
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
613
629
|
/>
|
|
@@ -729,6 +745,7 @@ const CheckoutUI = (props: any) => {
|
|
|
729
745
|
</Placeholder>
|
|
730
746
|
) : (
|
|
731
747
|
<AddressDetails
|
|
748
|
+
cart={cart}
|
|
732
749
|
navigation={navigation}
|
|
733
750
|
location={options?.address?.location}
|
|
734
751
|
businessLogo={businessDetails?.business?.logo}
|
|
@@ -751,7 +768,7 @@ const CheckoutUI = (props: any) => {
|
|
|
751
768
|
cart?.status !== 2 &&
|
|
752
769
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
753
770
|
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
754
|
-
|
|
771
|
+
cart?.business_id &&
|
|
755
772
|
(
|
|
756
773
|
<ChSection>
|
|
757
774
|
<ChDriverTips>
|
|
@@ -799,6 +816,8 @@ const CheckoutUI = (props: any) => {
|
|
|
799
816
|
handlePaymentMethodClickCustom={handlePaymentMethodClick}
|
|
800
817
|
handlePlaceOrder={handlePlaceOrder}
|
|
801
818
|
merchantId={merchantId}
|
|
819
|
+
urlscheme={urlscheme}
|
|
820
|
+
androidAppId={androidAppId}
|
|
802
821
|
setMethodPaySupported={setMethodPaySupported}
|
|
803
822
|
methodPaySupported={methodPaySupported}
|
|
804
823
|
placeByMethodPay={placeByMethodPay}
|
|
@@ -844,7 +863,7 @@ const CheckoutUI = (props: any) => {
|
|
|
844
863
|
{!cartState.loading && cart && (
|
|
845
864
|
<ChSection>
|
|
846
865
|
<ChCart>
|
|
847
|
-
{cartsWithProducts && cart?.products?.length === 0 ? (
|
|
866
|
+
{cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
|
|
848
867
|
<NotFoundSource
|
|
849
868
|
content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
|
|
850
869
|
btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
|
|
@@ -922,13 +941,15 @@ const CheckoutUI = (props: any) => {
|
|
|
922
941
|
</OText>
|
|
923
942
|
)}
|
|
924
943
|
|
|
925
|
-
{!cart?.valid_products && cart?.status !== 2 && (
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
944
|
+
{!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
|
|
945
|
+
<>
|
|
946
|
+
<OText
|
|
947
|
+
color={theme.colors.error}
|
|
948
|
+
size={12}
|
|
949
|
+
>
|
|
950
|
+
{t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
|
|
951
|
+
</OText>
|
|
952
|
+
</>
|
|
932
953
|
)}
|
|
933
954
|
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
934
955
|
<OText
|
|
@@ -938,7 +959,7 @@ const CheckoutUI = (props: any) => {
|
|
|
938
959
|
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
939
960
|
</OText>
|
|
940
961
|
)}
|
|
941
|
-
{options.type === 1 &&
|
|
962
|
+
{options.type === 1 && !isGiftCardCart &&
|
|
942
963
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
943
964
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
944
965
|
(Number(cart?.driver_tip) <= 0) && (
|
|
@@ -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 === ''}
|
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
|
|
15
15
|
export const Favorite = (props: any) => {
|
|
16
16
|
const {
|
|
17
|
-
navigation
|
|
18
|
-
franchiseId
|
|
17
|
+
navigation
|
|
19
18
|
} = props
|
|
20
19
|
const [, t] = useLanguage()
|
|
21
20
|
const theme = useTheme()
|
|
@@ -72,7 +71,6 @@ export const Favorite = (props: any) => {
|
|
|
72
71
|
originalURL='business'
|
|
73
72
|
location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
|
|
74
73
|
propsToFetch={['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']}
|
|
75
|
-
franchiseId={franchiseId}
|
|
76
74
|
/>
|
|
77
75
|
)}
|
|
78
76
|
{tabSelected === 'products' && (
|
|
@@ -81,7 +79,6 @@ export const Favorite = (props: any) => {
|
|
|
81
79
|
originalURL='products'
|
|
82
80
|
onNavigationRedirect={onRedirect}
|
|
83
81
|
isProduct
|
|
84
|
-
franchiseId={franchiseId}
|
|
85
82
|
/>
|
|
86
83
|
)}
|
|
87
84
|
{tabSelected === 'orders' && (
|
|
@@ -90,7 +87,6 @@ export const Favorite = (props: any) => {
|
|
|
90
87
|
favoriteURL='favorite_orders'
|
|
91
88
|
originalURL='orders'
|
|
92
89
|
isOrder
|
|
93
|
-
franchiseId={franchiseId}
|
|
94
90
|
/>
|
|
95
91
|
)}
|
|
96
92
|
</Container>
|
|
@@ -270,7 +270,6 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
270
270
|
onClick={() => getFavoriteList(pagination?.currentPage + 1)}
|
|
271
271
|
text={t('LOAD_MORE_ITEMS', 'Load more items')}
|
|
272
272
|
imgRightSrc={null}
|
|
273
|
-
textStyle={{ color: theme.colors.white }}
|
|
274
273
|
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
275
274
|
/>
|
|
276
275
|
</WrappButton>
|
|
@@ -64,7 +64,7 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
64
64
|
handleReCaptcha(null)
|
|
65
65
|
if (reCaptchaValue) return
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
if (!recaptchaConfig?.siteKey) {
|
|
68
68
|
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
69
69
|
return
|
|
70
70
|
}
|
|
@@ -73,7 +73,7 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
73
73
|
return
|
|
74
74
|
}
|
|
75
75
|
recaptchaRef.current.open()
|
|
76
|
-
|
|
76
|
+
}
|
|
77
77
|
|
|
78
78
|
const onRecaptchaVerify = (token: any) => {
|
|
79
79
|
setRecaptchaVerified(true)
|
|
@@ -92,8 +92,8 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
92
92
|
formState.result?.result && showToast(
|
|
93
93
|
ToastType.Error,
|
|
94
94
|
typeof formState.result?.result === 'string'
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
? formState.result?.result
|
|
96
|
+
: formState.result?.result[0]
|
|
97
97
|
)
|
|
98
98
|
return
|
|
99
99
|
}
|
|
@@ -208,9 +208,7 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
208
208
|
|
|
209
209
|
<OButton
|
|
210
210
|
text={emailSent && !formState.result?.error ? t('LINK_SEND_FORGOT_PASSWORD', 'Link Sent') : t('FRONT_RECOVER_PASSWORD', 'Recover Password')}
|
|
211
|
-
|
|
212
|
-
bgColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
|
|
213
|
-
borderColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
|
|
211
|
+
isDisabled={formState.loading || emailSent && !formState.result?.error}
|
|
214
212
|
isLoading={formState.loading}
|
|
215
213
|
imgRightSrc={null}
|
|
216
214
|
onClick={emailSent && !formState.result?.error ? () => { } : handleSubmit(onSubmit)}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { OText } from '../../shared'
|
|
6
|
+
import { VerticalGiftCardOrdersLayout } from '../VerticalGiftCardOrdersLayout'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Container,
|
|
10
|
+
NoOrdersWrapper
|
|
11
|
+
} from './styles'
|
|
12
|
+
|
|
13
|
+
export const GiftCardOrdersList = (props: any) => {
|
|
14
|
+
const {
|
|
15
|
+
onNavigationRedirect
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const [, t] = useLanguage();
|
|
20
|
+
const [isEmptyPending, setIsEmptyPending] = useState(false);
|
|
21
|
+
const [isEmptySent, setIsEmptySent] = useState(false);
|
|
22
|
+
const [isEmptyRedeemed, setIsEmptyRedeemed] = useState(false);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Container>
|
|
26
|
+
<VerticalGiftCardOrdersLayout
|
|
27
|
+
title={t('PENDING', 'Pending')}
|
|
28
|
+
defaultStatus='pending'
|
|
29
|
+
setIsEmpty={setIsEmptyPending}
|
|
30
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
{!isEmptyPending && (
|
|
34
|
+
<View
|
|
35
|
+
style={{
|
|
36
|
+
height: 8,
|
|
37
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
38
|
+
marginHorizontal: -40,
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
|
|
43
|
+
<VerticalGiftCardOrdersLayout
|
|
44
|
+
title={t('SENT', 'Sent')}
|
|
45
|
+
defaultStatus='sent'
|
|
46
|
+
setIsEmpty={setIsEmptySent}
|
|
47
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
<VerticalGiftCardOrdersLayout
|
|
51
|
+
title={t('REDEEMED', 'Redeemed')}
|
|
52
|
+
defaultStatus='activated'
|
|
53
|
+
setIsEmpty={setIsEmptyRedeemed}
|
|
54
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
{isEmptyPending && isEmptySent && isEmptyRedeemed && (
|
|
58
|
+
<NoOrdersWrapper>
|
|
59
|
+
<OText size={16} color={theme.colors.textNormal}>{t('YOU_DONT_HAVE_CARDS', 'You don\'t have cards')}</OText>
|
|
60
|
+
</NoOrdersWrapper>
|
|
61
|
+
)}
|
|
62
|
+
</Container>
|
|
63
|
+
)
|
|
64
|
+
}
|