ordering-ui-react-native 0.22.52 → 0.22.53-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 -7
- package/src/DeliveryApp.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/providers/AlertProvider.tsx +3 -1
- 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 +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +44 -33
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
- package/themes/business/src/components/LoginForm/index.tsx +123 -98
- package/themes/business/src/components/LogoutButton/index.tsx +13 -4
- package/themes/business/src/components/MapView/index.tsx +22 -17
- package/themes/business/src/components/NewOrderNotification/index.tsx +25 -14
- package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
- package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +155 -45
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +271 -176
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +345 -231
- package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- 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 +48 -10
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +22 -7
- package/themes/business/src/utils/index.tsx +28 -3
- 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 +9 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -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/PaymentOptions/index.tsx +121 -57
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +9 -1
- package/themes/original/src/components/AddressForm/index.tsx +19 -19
- package/themes/original/src/components/AddressList/index.tsx +0 -13
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +4 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +14 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +46 -30
- 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 +10 -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/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -15
- package/themes/original/src/components/CartContent/index.tsx +2 -4
- package/themes/original/src/components/Checkout/index.tsx +109 -88
- 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 -10
- package/themes/original/src/components/FavoriteList/index.tsx +0 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -12
- 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 +0 -5
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -5
- package/themes/original/src/components/HelpGuide/index.tsx +0 -5
- package/themes/original/src/components/HelpOrder/index.tsx +0 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +35 -19
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
- package/themes/original/src/components/LoginForm/index.tsx +12 -14
- package/themes/original/src/components/MessageListing/index.tsx +1 -6
- package/themes/original/src/components/Messages/index.tsx +20 -13
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +73 -59
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +1 -0
- 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 -7
- package/themes/original/src/components/NavBar/index.tsx +7 -6
- 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/Notifications/index.tsx +0 -5
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
- 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 +4 -3
- package/themes/original/src/components/OrderSummary/index.tsx +32 -11
- package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -11
- 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 +462 -461
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
- package/themes/original/src/components/PreviousOrders/index.tsx +1 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +7 -12
- package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
- 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 +2 -7
- package/themes/original/src/components/ReviewDriver/index.tsx +1 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +2 -7
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -6
- package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/index.tsx +53 -55
- package/themes/original/src/components/Sessions/index.tsx +3 -8
- package/themes/original/src/components/SignupForm/index.tsx +44 -37
- package/themes/original/src/components/SingleOrderCard/index.tsx +7 -5
- 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 +16 -3
- package/themes/original/src/components/StripeElementsForm/index.tsx +6 -4
- package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -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 +8 -5
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +113 -73
- package/themes/original/src/components/UserProfile/index.tsx +9 -1
- package/themes/original/src/components/UserProfileForm/index.tsx +0 -5
- package/themes/original/src/components/UserVerification/index.tsx +18 -5
- package/themes/original/src/components/Wallets/index.tsx +1 -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 +12 -4
- package/themes/original/src/utils/index.tsx +29 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -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,
|
|
@@ -146,12 +145,11 @@ const CheckoutUI = (props: any) => {
|
|
|
146
145
|
|
|
147
146
|
const [, { showToast }] = useToast();
|
|
148
147
|
const [, t] = useLanguage();
|
|
149
|
-
const [{ user, token }, { login }] = useSession();
|
|
148
|
+
const [{ user, token, loading: userLoading }, { login }] = useSession();
|
|
150
149
|
const [ordering] = useApi()
|
|
151
150
|
const [{ configs }] = useConfig();
|
|
152
151
|
const [{ parsePrice, parseDate }] = useUtils();
|
|
153
152
|
const [{ options, carts, loading }, { confirmCart }] = useOrder();
|
|
154
|
-
const [validationFields] = useValidationFields();
|
|
155
153
|
const [events] = useEvent()
|
|
156
154
|
const [orientationState] = useDeviceOrientation();
|
|
157
155
|
const [isReadMore, setIsReadMore] = useState(false)
|
|
@@ -168,6 +166,7 @@ const CheckoutUI = (props: any) => {
|
|
|
168
166
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
169
167
|
const [isOpen, setIsOpen] = useState(false)
|
|
170
168
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
169
|
+
const [orderTypeValidationFields, setOrderTypeValidationFields] = useState<any>([])
|
|
171
170
|
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
172
171
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
173
172
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
@@ -176,10 +175,20 @@ const CheckoutUI = (props: any) => {
|
|
|
176
175
|
const [showTitle, setShowTitle] = useState(false)
|
|
177
176
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
178
177
|
const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
|
|
178
|
+
const [userHasCards, setUserHasCards] = useState(false)
|
|
179
179
|
const containerRef = useRef<any>()
|
|
180
180
|
const cardsMethods = ['credomatic']
|
|
181
|
-
const stripePaymethods: any = ['stripe', '
|
|
181
|
+
const stripePaymethods: any = ['stripe', 'stripe_connect', 'stripe_redirect']
|
|
182
|
+
const cardsPaymethods: any = ['stripe', 'stripe_connect']
|
|
183
|
+
|
|
182
184
|
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
185
|
+
|
|
186
|
+
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field: any) => field.order_type_id === options?.type), [checkoutFieldsState, options])
|
|
187
|
+
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip'), [JSON.stringify(checkoutFields), options])
|
|
188
|
+
const guestCheckoutComment = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [JSON.stringify(checkoutFields), options])
|
|
189
|
+
const guestCheckoutCoupon = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'coupon'), [JSON.stringify(checkoutFields), options])
|
|
190
|
+
const guestCheckoutZipcode = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'zipcode'), [JSON.stringify(checkoutFields), options])
|
|
191
|
+
|
|
183
192
|
const placeSpotTypes = [3, 4, 5]
|
|
184
193
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
185
194
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
@@ -197,6 +206,7 @@ const CheckoutUI = (props: any) => {
|
|
|
197
206
|
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
|
|
198
207
|
const methodsPay = ['google_pay', 'apple_pay']
|
|
199
208
|
|
|
209
|
+
const commentDelayTime = 1500
|
|
200
210
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
201
211
|
const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
|
|
202
212
|
if (item?.type === 1)
|
|
@@ -204,27 +214,28 @@ const CheckoutUI = (props: any) => {
|
|
|
204
214
|
return acc = acc
|
|
205
215
|
}, cart?.subtotal)
|
|
206
216
|
|
|
207
|
-
const validateCommentsCartField =
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
!paymethodSelected?.data?.card?.zipcode &&
|
|
212
|
-
paymethodSelected?.gateway === 'stripe'
|
|
217
|
+
const validateCommentsCartField = (guestCheckoutComment?.enabled && (user?.guest_id ? guestCheckoutComment?.required_with_guest : guestCheckoutComment?.required)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
218
|
+
const validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
|
|
219
|
+
const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some((offer: any) => offer?.type === 2)
|
|
220
|
+
const validateZipcodeCard = (guestCheckoutZipcode?.enabled && (user?.guest_id ? guestCheckoutZipcode?.required_with_guest : guestCheckoutZipcode?.required)) && paymethodSelected?.gateway === 'stripe' && paymethodSelected?.data?.card && !paymethodSelected?.data?.card?.zipcode
|
|
213
221
|
|
|
214
222
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
215
223
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
216
224
|
(cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
|
|
217
|
-
(options.type === 1 && !isGiftCardCart &&
|
|
218
|
-
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
219
|
-
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
220
|
-
(Number(cart?.driver_tip) <= 0)) ||
|
|
221
225
|
(validateCommentsCartField) ||
|
|
222
|
-
(
|
|
223
|
-
|
|
226
|
+
(validateDriverTipField && !isGiftCardCart) ||
|
|
227
|
+
(validateZipcodeCard) ||
|
|
228
|
+
(methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) ||
|
|
229
|
+
validateCommentsCartField ||
|
|
230
|
+
validateDriverTipField ||
|
|
231
|
+
validateCouponField ||
|
|
232
|
+
validateZipcodeCard ||
|
|
233
|
+
(!userHasCards && cardsPaymethods.includes(paymethodSelected?.gateway))
|
|
224
234
|
|
|
225
235
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
226
236
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
227
237
|
: configs?.driver_tip_options?.value || []
|
|
238
|
+
const driverTipsField = !cartState.loading && cart && cart?.business_id && options.type === 1 && cart?.status !== 2 && (guestCheckoutDriveTip?.enabled) && driverTipsOptions.length > 0
|
|
228
239
|
|
|
229
240
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
230
241
|
|
|
@@ -245,7 +256,7 @@ const CheckoutUI = (props: any) => {
|
|
|
245
256
|
}
|
|
246
257
|
}
|
|
247
258
|
|
|
248
|
-
const vibrateApp = (impact?:
|
|
259
|
+
const vibrateApp = (impact?: HapticFeedbackTypes) => {
|
|
249
260
|
const options = {
|
|
250
261
|
enableVibrateFallback: true,
|
|
251
262
|
ignoreAndroidSystemSettings: false
|
|
@@ -253,12 +264,11 @@ const CheckoutUI = (props: any) => {
|
|
|
253
264
|
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
254
265
|
}
|
|
255
266
|
|
|
256
|
-
const handleSuccessSignup = (user: any) => {
|
|
257
|
-
login({
|
|
267
|
+
const handleSuccessSignup = async (user: any) => {
|
|
268
|
+
await login({
|
|
258
269
|
user,
|
|
259
270
|
token: user?.session?.access_token
|
|
260
271
|
})
|
|
261
|
-
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
262
272
|
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
263
273
|
}
|
|
264
274
|
|
|
@@ -311,53 +321,63 @@ const CheckoutUI = (props: any) => {
|
|
|
311
321
|
|
|
312
322
|
const checkValidationFields = () => {
|
|
313
323
|
setUserErrors([])
|
|
314
|
-
const errors = []
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
Object.values(
|
|
318
|
-
if (
|
|
319
|
-
|
|
320
|
-
|
|
324
|
+
const errors: Array<string> = []
|
|
325
|
+
const userSelected = user
|
|
326
|
+
const _requiredFields: Array<string> = []
|
|
327
|
+
Object.values(checkoutFieldsState?.fields).map((field: any) => {
|
|
328
|
+
if (options?.type === field?.order_type_id &&
|
|
329
|
+
field?.enabled &&
|
|
330
|
+
field?.required &&
|
|
331
|
+
!notFields.includes(field?.validation_field?.code)
|
|
332
|
+
) {
|
|
333
|
+
if (userSelected && !userSelected[field?.validation_field?.code]) {
|
|
334
|
+
_requiredFields.push(field?.validation_field?.code)
|
|
321
335
|
}
|
|
322
336
|
}
|
|
323
337
|
})
|
|
324
|
-
|
|
338
|
+
const mobilePhoneField: any = Object.values(checkoutFieldsState?.fields)?.find((field: any) => field?.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
325
339
|
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
340
|
+
userSelected &&
|
|
341
|
+
!userSelected?.cellphone &&
|
|
342
|
+
((mobilePhoneField?.enabled &&
|
|
343
|
+
mobilePhoneField?.required) ||
|
|
329
344
|
configs?.verification_phone_required?.value === '1')
|
|
330
345
|
) {
|
|
331
346
|
_requiredFields.push('cellphone')
|
|
332
347
|
}
|
|
333
348
|
setRequiredFields(_requiredFields)
|
|
334
349
|
|
|
335
|
-
if (phoneUpdate) {
|
|
336
|
-
errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
|
|
337
|
-
}
|
|
338
|
-
|
|
339
350
|
setUserErrors(errors)
|
|
340
351
|
}
|
|
341
352
|
|
|
342
353
|
const checkGuestValidationFields = () => {
|
|
343
354
|
const userSelected = user
|
|
344
355
|
const _requiredFields = checkoutFieldsState?.fields
|
|
345
|
-
.filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.
|
|
356
|
+
.filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
|
|
346
357
|
!notFields.includes(field?.validation_field?.code) &&
|
|
358
|
+
field?.validation_field?.code !== 'email' &&
|
|
347
359
|
userSelected && !userSelected[field?.validation_field?.code])
|
|
348
|
-
|
|
360
|
+
const requiredFieldsCode = _requiredFields.map((item: any) => item?.validation_field?.code)
|
|
349
361
|
const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
|
|
350
|
-
|
|
362
|
+
const guestCheckoutEmail = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'email')
|
|
351
363
|
if (
|
|
352
364
|
userSelected &&
|
|
353
|
-
!userSelected?.
|
|
365
|
+
!userSelected?.guest_cellphone &&
|
|
354
366
|
((guestCheckoutCellPhone?.enabled &&
|
|
355
|
-
guestCheckoutCellPhone?.
|
|
367
|
+
guestCheckoutCellPhone?.required_with_guest) ||
|
|
356
368
|
configs?.verification_phone_required?.value === '1')
|
|
357
369
|
) {
|
|
358
|
-
|
|
370
|
+
requiredFieldsCode.push('cellphone')
|
|
359
371
|
}
|
|
360
|
-
|
|
372
|
+
if (
|
|
373
|
+
userSelected &&
|
|
374
|
+
!userSelected?.guest_email &&
|
|
375
|
+
guestCheckoutEmail?.enabled &&
|
|
376
|
+
guestCheckoutEmail?.required_with_guest
|
|
377
|
+
) {
|
|
378
|
+
requiredFieldsCode.push('email')
|
|
379
|
+
}
|
|
380
|
+
setRequiredFields(requiredFieldsCode)
|
|
361
381
|
}
|
|
362
382
|
|
|
363
383
|
const togglePhoneUpdate = (val: boolean) => {
|
|
@@ -368,16 +388,20 @@ const CheckoutUI = (props: any) => {
|
|
|
368
388
|
setShowTitle(contentOffset.y > 30)
|
|
369
389
|
}
|
|
370
390
|
|
|
391
|
+
const handleRedirect = () => {
|
|
392
|
+
props.fromProductsList
|
|
393
|
+
? navigation?.goBack()
|
|
394
|
+
: onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)
|
|
395
|
+
}
|
|
396
|
+
|
|
371
397
|
useEffect(() => {
|
|
372
|
-
if (
|
|
398
|
+
if (checkoutFieldsState?.loading || userLoading) return
|
|
399
|
+
if (user?.guest_id) {
|
|
400
|
+
checkGuestValidationFields()
|
|
401
|
+
} else {
|
|
373
402
|
checkValidationFields()
|
|
374
403
|
}
|
|
375
|
-
}, [
|
|
376
|
-
|
|
377
|
-
useEffect(() => {
|
|
378
|
-
if (checkoutFieldsState?.loading || !user?.guest_id) return
|
|
379
|
-
checkGuestValidationFields()
|
|
380
|
-
}, [user, checkoutFieldsState])
|
|
404
|
+
}, [checkoutFieldsState, user, options?.type])
|
|
381
405
|
|
|
382
406
|
useEffect(() => {
|
|
383
407
|
if (errors) {
|
|
@@ -387,12 +411,14 @@ const CheckoutUI = (props: any) => {
|
|
|
387
411
|
}, [errors])
|
|
388
412
|
|
|
389
413
|
useEffect(() => {
|
|
390
|
-
if (cart?.products?.length === 0)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
414
|
+
if (cart?.products?.length === 0 || !userLoading) return
|
|
415
|
+
if (cart?.business_id !== null) {
|
|
416
|
+
onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
|
|
417
|
+
return
|
|
418
|
+
}
|
|
419
|
+
if (isGiftCardCart) {
|
|
420
|
+
onNavigationRedirect('Wallets')
|
|
421
|
+
return
|
|
396
422
|
}
|
|
397
423
|
}, [cart?.products?.length])
|
|
398
424
|
|
|
@@ -454,15 +480,6 @@ const CheckoutUI = (props: any) => {
|
|
|
454
480
|
}
|
|
455
481
|
}, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
|
|
456
482
|
|
|
457
|
-
useEffect(() => {
|
|
458
|
-
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
459
|
-
containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
|
|
460
|
-
})
|
|
461
|
-
return () => {
|
|
462
|
-
keyboardDidShowListener.remove()
|
|
463
|
-
}
|
|
464
|
-
}, [])
|
|
465
|
-
|
|
466
483
|
useEffect(() => {
|
|
467
484
|
const onBackFunction = () => {
|
|
468
485
|
if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
|
|
@@ -483,7 +500,7 @@ const CheckoutUI = (props: any) => {
|
|
|
483
500
|
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
484
501
|
<View style={styles.wrapperNavbar}>
|
|
485
502
|
<TopHeader>
|
|
486
|
-
<TopActions onPress={() =>
|
|
503
|
+
<TopActions onPress={() => handleRedirect()}>
|
|
487
504
|
<IconAntDesign
|
|
488
505
|
name='arrowleft'
|
|
489
506
|
size={26}
|
|
@@ -509,7 +526,7 @@ const CheckoutUI = (props: any) => {
|
|
|
509
526
|
hideArrowLeft
|
|
510
527
|
title={t('CHECKOUT', 'Checkout')}
|
|
511
528
|
titleAlign={'center'}
|
|
512
|
-
onActionLeft={() =>
|
|
529
|
+
onActionLeft={() => handleRedirect()}
|
|
513
530
|
showCall={false}
|
|
514
531
|
btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
|
|
515
532
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
@@ -646,17 +663,11 @@ const CheckoutUI = (props: any) => {
|
|
|
646
663
|
<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
|
|
647
664
|
<OButton
|
|
648
665
|
text={t('SIGN_UP', 'Sign up')}
|
|
649
|
-
textStyle={{ color: theme.colors.white }}
|
|
650
|
-
bgColor={theme.colors.primary}
|
|
651
|
-
borderColor={theme.colors.primary}
|
|
652
666
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
653
667
|
onClick={() => setOpenModal({ ...openModal, signup: true })}
|
|
654
668
|
/>
|
|
655
669
|
<OButton
|
|
656
670
|
text={t('LOGIN', 'Login')}
|
|
657
|
-
textStyle={{ color: theme.colors.white }}
|
|
658
|
-
bgColor={theme.colors.primary}
|
|
659
|
-
borderColor={theme.colors.primary}
|
|
660
671
|
style={{ borderRadius: 7.6, marginTop: 20 }}
|
|
661
672
|
onClick={() => setOpenModal({ ...openModal, login: true })}
|
|
662
673
|
/>
|
|
@@ -681,6 +692,9 @@ const CheckoutUI = (props: any) => {
|
|
|
681
692
|
isCheckout
|
|
682
693
|
phoneUpdate={phoneUpdate}
|
|
683
694
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
695
|
+
isOrderTypeValidationField
|
|
696
|
+
requiredFields={requiredFields}
|
|
697
|
+
checkoutFields={checkoutFields}
|
|
684
698
|
/>
|
|
685
699
|
)
|
|
686
700
|
)}
|
|
@@ -778,6 +792,7 @@ const CheckoutUI = (props: any) => {
|
|
|
778
792
|
</Placeholder>
|
|
779
793
|
) : (
|
|
780
794
|
<AddressDetails
|
|
795
|
+
cart={cart}
|
|
781
796
|
navigation={navigation}
|
|
782
797
|
location={options?.address?.location}
|
|
783
798
|
businessLogo={businessDetails?.business?.logo}
|
|
@@ -793,14 +808,7 @@ const CheckoutUI = (props: any) => {
|
|
|
793
808
|
</ChSection>
|
|
794
809
|
)}
|
|
795
810
|
|
|
796
|
-
{
|
|
797
|
-
cart &&
|
|
798
|
-
cart?.valid &&
|
|
799
|
-
options.type === 1 &&
|
|
800
|
-
cart?.status !== 2 &&
|
|
801
|
-
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
802
|
-
driverTipsOptions && driverTipsOptions?.length > 0 &&
|
|
803
|
-
cart?.business_id &&
|
|
811
|
+
{driverTipsField &&
|
|
804
812
|
(
|
|
805
813
|
<ChSection>
|
|
806
814
|
<ChDriverTips>
|
|
@@ -860,6 +868,7 @@ const CheckoutUI = (props: any) => {
|
|
|
860
868
|
openUserModal={setIsOpen}
|
|
861
869
|
paymethodClicked={paymethodClicked}
|
|
862
870
|
setPaymethodClicked={setPaymethodClicked}
|
|
871
|
+
setUserHasCards={setUserHasCards}
|
|
863
872
|
/>
|
|
864
873
|
</ChPaymethods>
|
|
865
874
|
</ChSection>
|
|
@@ -938,6 +947,7 @@ const CheckoutUI = (props: any) => {
|
|
|
938
947
|
cart={cart}
|
|
939
948
|
isCartPending={cart?.status === 2}
|
|
940
949
|
onNavigationRedirect={onNavigationRedirect}
|
|
950
|
+
commentDelayTime={commentDelayTime}
|
|
941
951
|
placeSpotTypes={placeSpotTypes}
|
|
942
952
|
businessConfigs={businessConfigs}
|
|
943
953
|
maxDate={maxDate}
|
|
@@ -945,6 +955,8 @@ const CheckoutUI = (props: any) => {
|
|
|
945
955
|
creditPointPlanOnBusiness?.accumulation_rate ??
|
|
946
956
|
(!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
|
|
947
957
|
}
|
|
958
|
+
hideCommentsByValidationCheckout={!guestCheckoutComment?.enabled}
|
|
959
|
+
hideCouponByValidationCheckout={!guestCheckoutCoupon?.enabled}
|
|
948
960
|
/>
|
|
949
961
|
</>
|
|
950
962
|
)}
|
|
@@ -991,10 +1003,8 @@ const CheckoutUI = (props: any) => {
|
|
|
991
1003
|
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
992
1004
|
</OText>
|
|
993
1005
|
)}
|
|
994
|
-
{
|
|
995
|
-
|
|
996
|
-
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
997
|
-
(Number(cart?.driver_tip) <= 0) && (
|
|
1006
|
+
{validateDriverTipField && !isGiftCardCart &&
|
|
1007
|
+
(
|
|
998
1008
|
<OText
|
|
999
1009
|
color={theme.colors.error}
|
|
1000
1010
|
size={12}
|
|
@@ -1002,7 +1012,6 @@ const CheckoutUI = (props: any) => {
|
|
|
1002
1012
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
1003
1013
|
</OText>
|
|
1004
1014
|
)}
|
|
1005
|
-
|
|
1006
1015
|
{validateCommentsCartField && (
|
|
1007
1016
|
<OText
|
|
1008
1017
|
color={theme.colors.error}
|
|
@@ -1020,6 +1029,15 @@ const CheckoutUI = (props: any) => {
|
|
|
1020
1029
|
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
1021
1030
|
</OText>
|
|
1022
1031
|
)}
|
|
1032
|
+
{validateCouponField &&
|
|
1033
|
+
(
|
|
1034
|
+
<OText
|
|
1035
|
+
color={theme.colors.error}
|
|
1036
|
+
size={12}
|
|
1037
|
+
>
|
|
1038
|
+
{t('WARNING_INVALID_COUPON_FIELD', 'Coupon is required.')}
|
|
1039
|
+
</OText>
|
|
1040
|
+
)}
|
|
1023
1041
|
</ChErrors>
|
|
1024
1042
|
</View>
|
|
1025
1043
|
)}
|
|
@@ -1037,20 +1055,23 @@ const CheckoutUI = (props: any) => {
|
|
|
1037
1055
|
<OModal
|
|
1038
1056
|
open={isOpen}
|
|
1039
1057
|
onClose={() => setIsOpen(false)}
|
|
1058
|
+
showToastInsideModal
|
|
1040
1059
|
>
|
|
1041
1060
|
<View style={styles.detailWrapper}>
|
|
1042
1061
|
<UserDetails
|
|
1043
1062
|
isUserDetailsEdit
|
|
1044
1063
|
cartStatus={cart?.status}
|
|
1045
1064
|
businessId={cart?.business_id}
|
|
1046
|
-
useValidationFields
|
|
1047
1065
|
useDefualtSessionManager
|
|
1048
1066
|
useSessionUser
|
|
1049
1067
|
isCheckout
|
|
1050
1068
|
isEdit
|
|
1051
1069
|
phoneUpdate={phoneUpdate}
|
|
1052
1070
|
togglePhoneUpdate={togglePhoneUpdate}
|
|
1071
|
+
isOrderTypeValidationField
|
|
1053
1072
|
requiredFields={requiredFields}
|
|
1073
|
+
checkoutFields={checkoutFields}
|
|
1074
|
+
isCheckoutPlace
|
|
1054
1075
|
hideUpdateButton
|
|
1055
1076
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
1056
1077
|
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 === ''}
|
|
@@ -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()
|
|
@@ -44,11 +43,6 @@ export const Favorite = (props: any) => {
|
|
|
44
43
|
paddingTop={Platform.OS === 'ios' ? 20 : 10}
|
|
45
44
|
style={{ paddingVertical: 0 }}
|
|
46
45
|
btnStyle={{ paddingLeft: 0 }}
|
|
47
|
-
buttonProps={{
|
|
48
|
-
bgColor: theme.colors.white,
|
|
49
|
-
borderColor: theme.colors.white,
|
|
50
|
-
textStyle: { color: theme.colors.btnFont }
|
|
51
|
-
}}
|
|
52
46
|
/>
|
|
53
47
|
<TabContainer>
|
|
54
48
|
{tabList.map((menu, i) => (
|
|
@@ -77,7 +71,6 @@ export const Favorite = (props: any) => {
|
|
|
77
71
|
originalURL='business'
|
|
78
72
|
location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
|
|
79
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']}
|
|
80
|
-
franchiseId={franchiseId}
|
|
81
74
|
/>
|
|
82
75
|
)}
|
|
83
76
|
{tabSelected === 'products' && (
|
|
@@ -86,7 +79,6 @@ export const Favorite = (props: any) => {
|
|
|
86
79
|
originalURL='products'
|
|
87
80
|
onNavigationRedirect={onRedirect}
|
|
88
81
|
isProduct
|
|
89
|
-
franchiseId={franchiseId}
|
|
90
82
|
/>
|
|
91
83
|
)}
|
|
92
84
|
{tabSelected === 'orders' && (
|
|
@@ -95,7 +87,6 @@ export const Favorite = (props: any) => {
|
|
|
95
87
|
favoriteURL='favorite_orders'
|
|
96
88
|
originalURL='orders'
|
|
97
89
|
isOrder
|
|
98
|
-
franchiseId={franchiseId}
|
|
99
90
|
/>
|
|
100
91
|
)}
|
|
101
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
|
}
|
|
@@ -125,11 +125,6 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
125
125
|
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
126
126
|
titleStyle={{ width: '100%', marginLeft: 0, paddingLeft: 0 }}
|
|
127
127
|
titleWrapStyle={{ paddingHorizontal: 0, paddingStart: 0, flex: 1 }}
|
|
128
|
-
buttonProps={{
|
|
129
|
-
bgColor: theme.colors.white,
|
|
130
|
-
borderColor: theme.colors.white,
|
|
131
|
-
textStyle: { color: theme.colors.btnFont }
|
|
132
|
-
}}
|
|
133
128
|
/>
|
|
134
129
|
<FormSide>
|
|
135
130
|
<OText
|
|
@@ -213,9 +208,7 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
213
208
|
|
|
214
209
|
<OButton
|
|
215
210
|
text={emailSent && !formState.result?.error ? t('LINK_SEND_FORGOT_PASSWORD', 'Link Sent') : t('FRONT_RECOVER_PASSWORD', 'Recover Password')}
|
|
216
|
-
|
|
217
|
-
bgColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
|
|
218
|
-
borderColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
|
|
211
|
+
isDisabled={formState.loading || emailSent && !formState.result?.error}
|
|
219
212
|
isLoading={formState.loading}
|
|
220
213
|
imgRightSrc={null}
|
|
221
214
|
onClick={emailSent && !formState.result?.error ? () => { } : handleSubmit(onSubmit)}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Container
|
|
13
13
|
} from './styles'
|
|
14
14
|
|
|
15
|
-
export const GiftCardUI =
|
|
15
|
+
export const GiftCardUI = React.memo((props: any) => {
|
|
16
16
|
const {
|
|
17
17
|
navigation
|
|
18
18
|
} = props
|
|
@@ -57,9 +57,7 @@ export const GiftCardUI = React.memo((props: any) => {
|
|
|
57
57
|
<OButton
|
|
58
58
|
onClick={() => setOpenModal('purchase')}
|
|
59
59
|
text={t('PURCHASE', 'Purchase')}
|
|
60
|
-
|
|
61
|
-
borderColor={theme.colors.primary}
|
|
62
|
-
textStyle={{ color: 'white', fontSize: 13 }}
|
|
60
|
+
textStyle={{ fontSize: 13 }}
|
|
63
61
|
imgRightSrc={null}
|
|
64
62
|
style={{ ...style.btnStyle, marginRight: 14 }}
|
|
65
63
|
/>
|
|
@@ -76,26 +74,26 @@ export const GiftCardUI = React.memo((props: any) => {
|
|
|
76
74
|
</View>
|
|
77
75
|
|
|
78
76
|
<OModal
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
open={openModal === 'purchase'}
|
|
78
|
+
onClose={() => setOpenModal(null)}
|
|
79
|
+
entireModal
|
|
82
80
|
customClose
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
>
|
|
82
|
+
<PurchaseGiftCard
|
|
85
83
|
handleCustomGoToCheckout={handleCustomGoToCheckout}
|
|
86
84
|
onClose={() => setOpenModal(null)}
|
|
87
85
|
/>
|
|
88
|
-
|
|
86
|
+
</OModal>
|
|
89
87
|
<OModal
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
open={openModal === 'redeem'}
|
|
89
|
+
onClose={() => setOpenModal(null)}
|
|
90
|
+
entireModal
|
|
93
91
|
customClose
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
>
|
|
93
|
+
<RedeemGiftCard
|
|
96
94
|
onClose={() => setOpenModal(null)}
|
|
97
95
|
/>
|
|
98
|
-
|
|
96
|
+
</OModal>
|
|
99
97
|
</Container>
|
|
100
98
|
)
|
|
101
|
-
})
|
|
99
|
+
})
|
|
@@ -58,12 +58,10 @@ const PurchaseGiftCardUI = (props: any) => {
|
|
|
58
58
|
borderWidth: 0,
|
|
59
59
|
width: 26,
|
|
60
60
|
height: 26,
|
|
61
|
-
backgroundColor: '#FFF',
|
|
62
|
-
borderColor: '#FFF',
|
|
63
|
-
shadowColor: '#FFF',
|
|
64
61
|
paddingLeft: 0,
|
|
65
62
|
paddingRight: 0,
|
|
66
63
|
}}
|
|
64
|
+
useArrow
|
|
67
65
|
onClick={onClose}
|
|
68
66
|
icon={AntDesignIcon}
|
|
69
67
|
iconProps={{
|
|
@@ -113,9 +111,7 @@ const PurchaseGiftCardUI = (props: any) => {
|
|
|
113
111
|
<OButton
|
|
114
112
|
onClick={() => handleAccept()}
|
|
115
113
|
text={t('ACCEPT', 'Accept')}
|
|
116
|
-
|
|
117
|
-
borderColor={theme.colors.primary}
|
|
118
|
-
textStyle={{ color: 'white', fontSize: 13 }}
|
|
114
|
+
textStyle={{ fontSize: 13 }}
|
|
119
115
|
imgRightSrc={null}
|
|
120
116
|
style={style.btnStyle}
|
|
121
117
|
isDisabled={!selectedProduct}
|
|
@@ -130,4 +126,4 @@ export const PurchaseGiftCard = (props: any) => {
|
|
|
130
126
|
UIComponent: PurchaseGiftCardUI
|
|
131
127
|
}
|
|
132
128
|
return <PurchaseGiftCardController {...purchaseGiftCardProps} />
|
|
133
|
-
}
|
|
129
|
+
}
|