ordering-ui-react-native 0.22.60 → 0.22.62
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
CHANGED
|
@@ -11,6 +11,8 @@ import { BusinessMenuList } from '../BusinessMenuList'
|
|
|
11
11
|
import Spinner from 'react-native-loading-spinner-overlay'
|
|
12
12
|
import { BusinessPreorderParams } from '../../types'
|
|
13
13
|
import moment from 'moment'
|
|
14
|
+
import { setLocalMoment } from '../../utils';
|
|
15
|
+
|
|
14
16
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
15
17
|
import {
|
|
16
18
|
PreOrderContainer,
|
|
@@ -311,6 +313,10 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
311
313
|
}
|
|
312
314
|
}, [dateSelected])
|
|
313
315
|
|
|
316
|
+
useEffect(() => {
|
|
317
|
+
setLocalMoment(moment, t)
|
|
318
|
+
}, [])
|
|
319
|
+
|
|
314
320
|
useFocusEffect(
|
|
315
321
|
React.useCallback(() => {
|
|
316
322
|
handleAsap && handleAsap()
|
|
@@ -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'
|
|
@@ -180,7 +180,11 @@ const CheckoutUI = (props: any) => {
|
|
|
180
180
|
const containerRef = useRef<any>()
|
|
181
181
|
const cardsMethods = ['credomatic']
|
|
182
182
|
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
183
|
-
const notFields = ['coupon', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
183
|
+
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
|
|
184
|
+
|
|
185
|
+
const guestCheckoutDriveTip = checkoutFieldsState?.fields?.find(field => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip')
|
|
186
|
+
const guestCheckoutComment = useMemo(() => checkoutFieldsState?.fields?.find(field => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [checkoutFieldsState, options])
|
|
187
|
+
|
|
184
188
|
const placeSpotTypes = [3, 4, 5]
|
|
185
189
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
186
190
|
const businessConfigs = businessDetails?.business?.configs ?? []
|
|
@@ -205,7 +209,9 @@ const CheckoutUI = (props: any) => {
|
|
|
205
209
|
return acc = acc
|
|
206
210
|
}, cart?.subtotal)
|
|
207
211
|
|
|
208
|
-
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
212
|
+
const validateCommentsCartField = (!user?.guest_id ? (validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required) : (guestCheckoutComment?.enabled && guestCheckoutComment?.required_with_guest)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
213
|
+
const validateDriverTipField = options.type === 1 && (!user?.guest_id ? (validationFields?.fields?.checkout?.driver_tip?.enabled && validationFields?.fields?.checkout?.driver_tip?.required) : (guestCheckoutDriveTip?.enabled && guestCheckoutDriveTip?.required_with_guest)) && (Number(cart?.driver_tip) <= 0)
|
|
214
|
+
|
|
209
215
|
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
|
|
210
216
|
validationFields?.fields?.card?.zipcode?.required &&
|
|
211
217
|
paymethodSelected?.data?.card &&
|
|
@@ -220,8 +226,9 @@ const CheckoutUI = (props: any) => {
|
|
|
220
226
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
221
227
|
(Number(cart?.driver_tip) <= 0)) ||
|
|
222
228
|
(validateCommentsCartField) ||
|
|
223
|
-
(
|
|
224
|
-
|
|
229
|
+
(validateDriverTipField && !isGiftCardCart) ||
|
|
230
|
+
(validateZipcodeCard) ||
|
|
231
|
+
(methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
225
232
|
|
|
226
233
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
227
234
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -997,7 +1004,15 @@ const CheckoutUI = (props: any) => {
|
|
|
997
1004
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
998
1005
|
</OText>
|
|
999
1006
|
)}
|
|
1000
|
-
|
|
1007
|
+
{validateDriverTipField && !isGiftCardCart &&
|
|
1008
|
+
(
|
|
1009
|
+
<OText
|
|
1010
|
+
color={theme.colors.error}
|
|
1011
|
+
size={12}
|
|
1012
|
+
>
|
|
1013
|
+
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
1014
|
+
</OText>
|
|
1015
|
+
)}
|
|
1001
1016
|
{validateCommentsCartField && (
|
|
1002
1017
|
<OText
|
|
1003
1018
|
color={theme.colors.error}
|