ordering-ui-react-native 0.22.75 → 0.22.76-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/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 +5 -3
- 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/RenderMarker.tsx +146 -0
- package/themes/business/src/components/MapView/index.tsx +68 -142
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
- package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
- package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -42
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
- 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 +207 -144
- 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 +20 -8
- 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 +15 -16
- 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 +26 -4
- package/themes/business/src/utils/index.tsx +26 -2
- 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 +223 -219
- package/themes/original/src/components/AddressForm/index.tsx +56 -17
- package/themes/original/src/components/AppleLogin/index.tsx +3 -4
- package/themes/original/src/components/BusinessController/index.tsx +4 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +102 -90
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
- package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +72 -69
- package/themes/original/src/components/BusinessProductsList/index.tsx +4 -5
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -1
- package/themes/original/src/components/Cart/index.tsx +43 -12
- package/themes/original/src/components/Checkout/index.tsx +126 -98
- package/themes/original/src/components/FloatingButton/index.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +2 -1
- package/themes/original/src/components/GoogleMap/index.tsx +3 -2
- package/themes/original/src/components/Help/functions.tsx +76 -0
- package/themes/original/src/components/Help/index.tsx +74 -29
- package/themes/original/src/components/Help/styles.tsx +4 -1
- package/themes/original/src/components/HelpOptions/index.tsx +53 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +36 -11
- package/themes/original/src/components/LastOrder/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +11 -5
- package/themes/original/src/components/MessageListing/index.tsx +1 -1
- package/themes/original/src/components/Messages/index.tsx +562 -555
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +141 -61
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCheckout/index.tsx +78 -33
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +6 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
- package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
- package/themes/original/src/components/OrderDetails/index.tsx +44 -20
- 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 +32 -11
- package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
- package/themes/original/src/components/OrdersOption/index.tsx +325 -325
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/SignupForm/index.tsx +40 -24
- package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -1
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +7 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
- package/themes/original/src/components/UserVerification/index.tsx +18 -5
- package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +97 -97
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/providers/AlertProvider.tsx +1 -1
- package/themes/original/src/types/index.tsx +700 -695
- package/themes/original/src/utils/index.tsx +50 -34
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
- package/themes/original/src/components/HelpGuide/index.tsx +0 -68
- package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
- package/themes/original/src/components/HelpOrder/index.tsx +0 -71
- package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import PhoneInput from "react-native-phone-number-input";
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
4
4
|
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
6
6
|
import { Wrapper } from './styles'
|
|
7
7
|
|
|
8
8
|
import { PhoneInputParams } from '../../types';
|
|
9
9
|
import { OIcon, OText } from '../shared';
|
|
10
|
+
import { OModal } from '../../../../../src/components/shared'
|
|
10
11
|
import { findExitingCode, transformCountryCode } from '../../utils'
|
|
11
12
|
|
|
12
13
|
export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
@@ -25,7 +26,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
25
26
|
isDisabled,
|
|
26
27
|
isStartValidation,
|
|
27
28
|
changeCountry,
|
|
28
|
-
updateStateWithSubmit
|
|
29
|
+
updateStateWithSubmit,
|
|
30
|
+
defaultCodeFallback
|
|
29
31
|
} = props
|
|
30
32
|
|
|
31
33
|
const theme = useTheme();
|
|
@@ -34,6 +36,13 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
34
36
|
const [{ configs }] = useConfig()
|
|
35
37
|
const phoneInput = useRef<PhoneInput>(null);
|
|
36
38
|
const [userphoneNumber, setUserphoneNumber] = useState('');
|
|
39
|
+
const [countryPhoneSuboptions, setCountryPhoneSuboptions] = useState({
|
|
40
|
+
open: false,
|
|
41
|
+
options: []
|
|
42
|
+
})
|
|
43
|
+
const isDisableNumberValidation = parseInt(configs?.validation_phone_number_lib?.value ?? 1, 10)
|
|
44
|
+
const countriesWithSubOptions = ['PR']
|
|
45
|
+
const codesStartsWithZero: any = ['44']
|
|
37
46
|
|
|
38
47
|
const style = StyleSheet.create({
|
|
39
48
|
input: {
|
|
@@ -62,13 +71,22 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
62
71
|
useEffect(() => {
|
|
63
72
|
if ((defaultValue && userphoneNumber) || !defaultValue) {
|
|
64
73
|
if (userphoneNumber) {
|
|
65
|
-
const
|
|
74
|
+
const validationsForUK = ['01', '02', '07', '0800', '0808', '0845', '0870', '0871']
|
|
75
|
+
|
|
76
|
+
let isPossibly = false
|
|
77
|
+
let numberWithoutCountryCode = ''
|
|
66
78
|
const callingCode = phoneInput.current?.getCallingCode();
|
|
79
|
+
const cellphone = userphoneNumber.slice(0, 0) + userphoneNumber.slice(1, userphoneNumber.length)
|
|
80
|
+
if (codesStartsWithZero.includes(callingCode)) {
|
|
81
|
+
numberWithoutCountryCode = cellphone.replace(callingCode || '', '')
|
|
82
|
+
const result = validationsForUK.some(areaCode => numberWithoutCountryCode?.startsWith(areaCode))
|
|
83
|
+
isPossibly = result && numberWithoutCountryCode?.length >= 10 && numberWithoutCountryCode?.length < 12
|
|
84
|
+
}
|
|
85
|
+
const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
|
|
67
86
|
const formattedNumber = phoneInput.current?.getNumberAfterPossiblyEliminatingZero();
|
|
68
87
|
const regex = /^[0-9]*$/
|
|
69
|
-
const cellphone = userphoneNumber.slice(0, 0) + userphoneNumber.slice(1, userphoneNumber.length)
|
|
70
88
|
const validNumber = regex.test(cellphone)
|
|
71
|
-
if ((!checkValid && formattedNumber?.number) || !validNumber) {
|
|
89
|
+
if (((!checkValid && formattedNumber?.number && !isPossibly) || !validNumber) && !!isDisableNumberValidation) {
|
|
72
90
|
handleData && handleData({
|
|
73
91
|
...data,
|
|
74
92
|
error: t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid')
|
|
@@ -80,8 +98,11 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
80
98
|
error: '',
|
|
81
99
|
phone: {
|
|
82
100
|
country_phone_code: callingCode,
|
|
83
|
-
cellphone: formattedNumber?.number
|
|
101
|
+
cellphone: !isDisableNumberValidation ? cellphone.slice(callingCode?.length) : formattedNumber?.number
|
|
84
102
|
}
|
|
103
|
+
}, {
|
|
104
|
+
countryCallingCode: callingCode,
|
|
105
|
+
number: numberWithoutCountryCode,
|
|
85
106
|
})
|
|
86
107
|
} else {
|
|
87
108
|
handleData && handleData({
|
|
@@ -109,6 +130,37 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
109
130
|
}
|
|
110
131
|
}, [defaultValue])
|
|
111
132
|
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (defaultCodeFallback && countriesWithSubOptions.includes(defaultCode) && phoneInput.current) {
|
|
135
|
+
phoneInput.current?.setState({
|
|
136
|
+
...phoneInput.current.state,
|
|
137
|
+
code: `${defaultCodeFallback}`
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
}, [phoneInput.current])
|
|
141
|
+
|
|
142
|
+
const _changeCountry = (c) => {
|
|
143
|
+
changeCountry?.(c)
|
|
144
|
+
if (c.callingCode?.length > 1) {
|
|
145
|
+
setCountryPhoneSuboptions({
|
|
146
|
+
open: true,
|
|
147
|
+
options: c.callingCode
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const handleSelectCallingCode = (option: any) => {
|
|
153
|
+
setCountryPhoneSuboptions({
|
|
154
|
+
open: false,
|
|
155
|
+
options: []
|
|
156
|
+
})
|
|
157
|
+
handleChangeNumber(`+${option}`)
|
|
158
|
+
phoneInput.current?.setState({
|
|
159
|
+
...phoneInput.current.state,
|
|
160
|
+
code: `${option}`
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
|
|
112
164
|
return (
|
|
113
165
|
<Wrapper onPress={() => forwardRef?.current?.focus?.()}>
|
|
114
166
|
{(isStartValidation && userphoneNumber === '') && (
|
|
@@ -130,7 +182,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
130
182
|
: findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
|
|
131
183
|
onChangeFormattedText={(text: string) => handleChangeNumber(text)}
|
|
132
184
|
withDarkTheme
|
|
133
|
-
onChangeCountry={(country) =>
|
|
185
|
+
onChangeCountry={(country: any) => _changeCountry?.(country)}
|
|
134
186
|
countryPickerProps={{ withAlphaFilter: true }}
|
|
135
187
|
textContainerStyle={{ ...style.input, ...inputStyle ? inputStyle : {} }}
|
|
136
188
|
textInputStyle={textStyle}
|
|
@@ -151,6 +203,39 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
151
203
|
{data.error}
|
|
152
204
|
</OText>
|
|
153
205
|
)}
|
|
206
|
+
<OModal
|
|
207
|
+
open={countryPhoneSuboptions.open}
|
|
208
|
+
onClose={() => setCountryPhoneSuboptions({
|
|
209
|
+
open: false,
|
|
210
|
+
options: []
|
|
211
|
+
})}
|
|
212
|
+
title={t('SELECT_THE_PHONE_CODE', 'Select the phone code')}
|
|
213
|
+
entireModal
|
|
214
|
+
>
|
|
215
|
+
<View
|
|
216
|
+
style={{
|
|
217
|
+
alignItems: 'center'
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
{countryPhoneSuboptions.options.map((option: any) => (
|
|
221
|
+
<Pressable
|
|
222
|
+
style={{
|
|
223
|
+
margin: 10,
|
|
224
|
+
padding: 10,
|
|
225
|
+
borderBottomColor: '#ccc',
|
|
226
|
+
borderBottomWidth: 1,
|
|
227
|
+
width: '100%'
|
|
228
|
+
}}
|
|
229
|
+
key={option}
|
|
230
|
+
onPress={() => handleSelectCallingCode(option)}
|
|
231
|
+
>
|
|
232
|
+
<OText>
|
|
233
|
+
{`+${option}`}
|
|
234
|
+
</OText>
|
|
235
|
+
</Pressable>
|
|
236
|
+
))}
|
|
237
|
+
</View>
|
|
238
|
+
</OModal>
|
|
154
239
|
</Wrapper>
|
|
155
240
|
)
|
|
156
241
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { View, Animated, StyleSheet, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { useUtils, useLanguage, useOrder } from 'ordering-components/native'
|
|
3
|
+
import { useUtils, useLanguage, useOrder, ProductItemAccordion as ProductItemAccordionController } from 'ordering-components/native'
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
6
|
import RNPickerSelect from 'react-native-picker-select'
|
|
@@ -24,7 +24,7 @@ import { OIcon, OText, OAlert, OModal } from '../shared'
|
|
|
24
24
|
|
|
25
25
|
import { ProductItemAccordionParams } from '../../types'
|
|
26
26
|
|
|
27
|
-
export const
|
|
27
|
+
export const ProductItemAccordionUI = (props: ProductItemAccordionParams) => {
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
isDisabledEdit,
|
|
@@ -36,6 +36,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
36
36
|
onDeleteProduct,
|
|
37
37
|
onEditProduct,
|
|
38
38
|
isFromCheckout,
|
|
39
|
+
productInfo
|
|
39
40
|
} = props
|
|
40
41
|
|
|
41
42
|
const theme = useTheme();
|
|
@@ -46,6 +47,14 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
46
47
|
const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
|
|
47
48
|
const hideProductCommentHide = isFromCheckout && theme?.checkout?.components?.cart?.components?.product?.components?.comments?.hidden
|
|
48
49
|
|
|
50
|
+
const styles = StyleSheet.create({
|
|
51
|
+
productImage: {
|
|
52
|
+
borderRadius: 7.6,
|
|
53
|
+
width: 48,
|
|
54
|
+
height: 48
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
49
58
|
const pickerStyle = StyleSheet.create({
|
|
50
59
|
inputAndroid: {
|
|
51
60
|
width: 45,
|
|
@@ -91,24 +100,6 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
91
100
|
const [isServiceOpen, setIsServiceOpen] = useState(false)
|
|
92
101
|
const [productQuantityState, setProductQuantityState] = useState<any>(product.quantity.toString())
|
|
93
102
|
|
|
94
|
-
const productInfo = () => {
|
|
95
|
-
if (isCartProduct) {
|
|
96
|
-
const ingredients = JSON.parse(JSON.stringify(Object.values(product.ingredients ?? {})))
|
|
97
|
-
let options = JSON.parse(JSON.stringify(Object.values(product.options ?? {})))
|
|
98
|
-
|
|
99
|
-
options = options.map((option: any) => {
|
|
100
|
-
option.suboptions = Object.values(option.suboptions ?? {})
|
|
101
|
-
return option
|
|
102
|
-
})
|
|
103
|
-
return {
|
|
104
|
-
...productInfo,
|
|
105
|
-
ingredients,
|
|
106
|
-
options
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return product
|
|
110
|
-
}
|
|
111
|
-
|
|
112
103
|
const handleEditProduct = (curProduct: any) => {
|
|
113
104
|
if (!curProduct?.calendar_event) {
|
|
114
105
|
onEditProduct && onEditProduct(curProduct)
|
|
@@ -154,8 +145,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
154
145
|
isValid={product?.valid ?? true}
|
|
155
146
|
onPress={
|
|
156
147
|
(!product?.valid_menu && isCartProduct) ||
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
!(productInfo.ingredients.length > 0 || productInfo.options.length > 0 || !!product.comment)
|
|
149
|
+
? null : () => setActiveState(!isActive)
|
|
159
150
|
}
|
|
160
151
|
>
|
|
161
152
|
<View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
|
|
@@ -246,7 +237,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
246
237
|
<View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end', maxWidth: 100 }}>
|
|
247
238
|
<View style={{ flexDirection: 'row' }}>
|
|
248
239
|
<OText size={12} lineHeight={18} weight={'400'}>{parsePrice(product.total || product.price)}</OText>
|
|
249
|
-
{(productInfo
|
|
240
|
+
{(productInfo.ingredients.length > 0 || productInfo.options.length > 0 || !!product.comment) && (
|
|
250
241
|
<MaterialCommunityIcon name='chevron-down' size={18} />
|
|
251
242
|
)}
|
|
252
243
|
</View>
|
|
@@ -290,20 +281,20 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
290
281
|
<View style={{ display: isActive ? 'flex' : 'none', paddingStart: isFromCheckout ? 100 : 40, marginTop: isFromCheckout ? -80 : -30 }}>
|
|
291
282
|
<Animated.View>
|
|
292
283
|
<AccordionContent>
|
|
293
|
-
{productInfo
|
|
284
|
+
{productInfo.ingredients.length > 0 && productInfo.ingredients.some((ingredient: any) => !ingredient.selected) && (
|
|
294
285
|
<ProductOptionsList>
|
|
295
286
|
<OText size={10} color={theme.colors.textSecondary}>{t('INGREDIENTS', 'Ingredients')}</OText>
|
|
296
|
-
{productInfo
|
|
287
|
+
{productInfo.ingredients.map((ingredient: any, i) => !ingredient.selected && (
|
|
297
288
|
<OText size={10} color={theme.colors.textThird} key={ingredient.id + i} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
|
|
298
289
|
))}
|
|
299
290
|
</ProductOptionsList>
|
|
300
291
|
)}
|
|
301
|
-
{productInfo
|
|
292
|
+
{productInfo.options.length > 0 && (
|
|
302
293
|
<ProductOptionsList>
|
|
303
|
-
{productInfo
|
|
294
|
+
{productInfo.options.map((option: any) => (
|
|
304
295
|
<ProductOption key={option.id}>
|
|
305
296
|
<OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
|
|
306
|
-
{option.suboptions.map((suboption: any) => (
|
|
297
|
+
{option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => (
|
|
307
298
|
<ProductSubOption key={suboption.id}>
|
|
308
299
|
<OText size={10} color={theme.colors.textThird}>
|
|
309
300
|
{getFormattedSubOptionName({
|
|
@@ -350,13 +341,13 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
350
341
|
)
|
|
351
342
|
}
|
|
352
343
|
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
height: 48
|
|
358
|
-
},
|
|
359
|
-
test: {
|
|
360
|
-
overflow: 'hidden',
|
|
344
|
+
export const ProductItemAccordion = (props: any) => {
|
|
345
|
+
const productItemAccordionProps = {
|
|
346
|
+
...props,
|
|
347
|
+
UIComponent: ProductItemAccordionUI
|
|
361
348
|
}
|
|
362
|
-
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
<ProductItemAccordionController {...productItemAccordionProps} />
|
|
352
|
+
)
|
|
353
|
+
}
|
|
@@ -36,10 +36,16 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
36
36
|
setIsScrollAvailable,
|
|
37
37
|
image,
|
|
38
38
|
enableIntersection,
|
|
39
|
-
|
|
39
|
+
usePizzaValidation,
|
|
40
|
+
pizzaState
|
|
40
41
|
} = props
|
|
41
42
|
|
|
42
|
-
const disableIncrement =
|
|
43
|
+
const disableIncrement =
|
|
44
|
+
option?.with_half_option
|
|
45
|
+
? pizzaState?.[`option:${option?.id}`]?.value === option?.max
|
|
46
|
+
: option?.limit_suboptions_by_max
|
|
47
|
+
? (balance === option?.max || state.quantity === suboption.max)
|
|
48
|
+
: state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
43
49
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
44
50
|
|
|
45
51
|
const theme = useTheme();
|
|
@@ -66,8 +72,9 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
66
72
|
const handleSuboptionClick = () => {
|
|
67
73
|
toggleSelect()
|
|
68
74
|
setIsDirty(true)
|
|
75
|
+
const minMaxValidation = option?.with_half_option ? usePizzaValidation : (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))
|
|
69
76
|
|
|
70
|
-
if (
|
|
77
|
+
if (!state.selected && minMaxValidation) {
|
|
71
78
|
setShowMessage(true)
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -87,13 +94,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
87
94
|
if (!(balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))) {
|
|
88
95
|
setShowMessage(false)
|
|
89
96
|
}
|
|
90
|
-
}, [balance])
|
|
91
|
-
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
if (!suboption?.preselected || !option?.respect_to) return
|
|
94
|
-
const newState = { ...state, selected: suboption?.preselected, quantity: state.selected ? 0 : 1 }
|
|
95
|
-
onChange(newState, suboption, option)
|
|
96
|
-
}, [suboption, option])
|
|
97
|
+
}, [balance, pizzaState?.[`option:${option?.id}`]?.value])
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
100
|
<InView onChange={(inView: boolean) => handleChangeInterSection(inView)} triggerOnce={true}>
|
|
@@ -129,7 +130,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
129
130
|
{suboption?.name}
|
|
130
131
|
</OText>
|
|
131
132
|
</IconControl>
|
|
132
|
-
{option?.allow_suboption_quantity && state?.selected && (
|
|
133
|
+
{!(option?.max === 1 && option?.min === 1) && option?.allow_suboption_quantity && state?.selected && (
|
|
133
134
|
<QuantityControl>
|
|
134
135
|
<>
|
|
135
136
|
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
@@ -142,11 +143,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
142
143
|
<OText size={12}>
|
|
143
144
|
{state.quantity}
|
|
144
145
|
</OText>
|
|
145
|
-
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
146
|
+
<Checkbox disabled={disabled || disableIncrement || usePizzaValidation} onPress={increment}>
|
|
146
147
|
<IconAntDesign
|
|
147
148
|
name='pluscircleo'
|
|
148
149
|
size={iconsSize}
|
|
149
|
-
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
150
|
+
color={disableIncrement || disabled || usePizzaValidation ? theme.colors.disabled : theme.colors.primary}
|
|
150
151
|
/>
|
|
151
152
|
</Checkbox>
|
|
152
153
|
</>
|
|
@@ -164,7 +165,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
164
165
|
style={styles.inverse}
|
|
165
166
|
/>
|
|
166
167
|
</Circle>
|
|
167
|
-
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
168
|
+
<Circle disabled={disabled || (pizzaState?.[`option:${option?.id}`]?.value === option?.max)} onPress={() => changePosition('whole')}>
|
|
168
169
|
<OIcon
|
|
169
170
|
src={theme.images.general.half_f}
|
|
170
171
|
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
@@ -143,7 +143,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
143
143
|
const valid = busyTimes.some(item => {
|
|
144
144
|
return (moment.utc(item?.start).local().valueOf() <= moment(selectedMoment).valueOf() &&
|
|
145
145
|
moment(selectedMoment).valueOf() < moment.utc(item?.end).local().valueOf()) ||
|
|
146
|
-
(moment.utc(item?.start).local().valueOf() < moment(selectedMoment).
|
|
146
|
+
(moment.utc(item?.start).local().valueOf() < moment(selectedMoment).valueOf() &&
|
|
147
147
|
moment(selectedMoment).add(duration, 'minutes').valueOf() < moment.utc(item?.end).local().valueOf())
|
|
148
148
|
})
|
|
149
149
|
return valid
|
|
@@ -259,7 +259,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
useEffect(() => {
|
|
262
|
-
if (selectDate === null || currentProfessional
|
|
262
|
+
if (selectDate === null || !currentProfessional?.schedule) return
|
|
263
263
|
const _times = getTimes(selectDate, currentProfessional)
|
|
264
264
|
setTimeList(_times)
|
|
265
265
|
}, [selectDate, currentProfessional])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity } from 'react-native';
|
|
2
|
+
import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity, Modal } from 'react-native';
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
4
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
5
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
@@ -32,11 +32,9 @@ import {
|
|
|
32
32
|
} from '../LoginForm/styles';
|
|
33
33
|
|
|
34
34
|
import NavBar from '../NavBar';
|
|
35
|
-
import { VerifyPhone } from '../VerifyPhone';
|
|
36
35
|
|
|
37
36
|
import Alert from '../../../../../src/providers/AlertProvider'
|
|
38
37
|
import { OText, OButton, OInput } from '../shared';
|
|
39
|
-
import { OModal } from '../../../../../src/components/shared';
|
|
40
38
|
import { SignupParams } from '../../types';
|
|
41
39
|
import { sortInputFields } from '../../utils';
|
|
42
40
|
import { GoogleLogin } from '../GoogleLogin';
|
|
@@ -85,7 +83,8 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
85
83
|
useSignUpFullDetails,
|
|
86
84
|
useSignUpOtpEmail,
|
|
87
85
|
useSignUpOtpCellphone,
|
|
88
|
-
isGuest
|
|
86
|
+
isGuest,
|
|
87
|
+
setCellphoneStartZero
|
|
89
88
|
} = props;
|
|
90
89
|
|
|
91
90
|
const theme = useTheme();
|
|
@@ -141,6 +140,8 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
141
140
|
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
142
141
|
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
143
142
|
const [tabLayouts, setTabLayouts] = useState<any>({})
|
|
143
|
+
const [isCheckingCode, setCheckingCode] = useState(false)
|
|
144
|
+
const [otpError, setOtpError] = useState(null)
|
|
144
145
|
|
|
145
146
|
const tabsRef = useRef<any>(null)
|
|
146
147
|
const nameRef = useRef<any>(null);
|
|
@@ -153,9 +154,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
153
154
|
const recaptchaRef = useRef<any>({});
|
|
154
155
|
|
|
155
156
|
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
156
|
-
const googleLoginEnabled = configs?.google_login_enabled?.value === '1'
|
|
157
|
-
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1'
|
|
158
|
-
const appleLoginEnabled = Platform.OS === 'ios' &&
|
|
157
|
+
const googleLoginEnabled = configs?.google_login_enabled?.value === '1'
|
|
158
|
+
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1'
|
|
159
|
+
const appleLoginEnabled = Platform.OS === 'ios' && configs?.apple_login_enabled?.value === '1'
|
|
159
160
|
|
|
160
161
|
const closeAlert = () => {
|
|
161
162
|
setAlertState({
|
|
@@ -366,6 +367,19 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
366
367
|
handleReCaptcha && handleReCaptcha({ code: token, version: recaptchaConfig?.version })
|
|
367
368
|
}
|
|
368
369
|
|
|
370
|
+
const handleChangePhoneNumber = (number: any, rawNumber: any) => {
|
|
371
|
+
setPhoneInputData({
|
|
372
|
+
...phoneInputData,
|
|
373
|
+
...number,
|
|
374
|
+
phone: {
|
|
375
|
+
...phoneInputData.phone,
|
|
376
|
+
...number.phone,
|
|
377
|
+
country_code: phoneInputData.phone.country_code
|
|
378
|
+
}
|
|
379
|
+
})
|
|
380
|
+
setCellphoneStartZero && setCellphoneStartZero(rawNumber?.number && rawNumber?.countryCallingCode ? rawNumber?.number : null)
|
|
381
|
+
}
|
|
382
|
+
|
|
369
383
|
useEffect(() => {
|
|
370
384
|
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
371
385
|
if (configs?.security_recaptcha_type?.value === 'v3' &&
|
|
@@ -467,9 +481,16 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
467
481
|
|
|
468
482
|
useEffect(() => {
|
|
469
483
|
if (checkPhoneCodeState?.result?.error) {
|
|
470
|
-
|
|
484
|
+
const titleText = (
|
|
485
|
+
typeof checkPhoneCodeState?.result?.result === 'string'
|
|
486
|
+
? checkPhoneCodeState?.result?.result
|
|
487
|
+
: checkPhoneCodeState?.result?.result[0].toString()
|
|
488
|
+
) || t('ERROR', 'Error')
|
|
489
|
+
setCheckingCode(false)
|
|
490
|
+
setOtpError(titleText)
|
|
491
|
+
checkPhoneCodeState?.generate && setAlertState({
|
|
471
492
|
open: true,
|
|
472
|
-
title:
|
|
493
|
+
title: titleText,
|
|
473
494
|
content: []
|
|
474
495
|
})
|
|
475
496
|
}
|
|
@@ -650,15 +671,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
650
671
|
<View style={{ marginBottom: 25 }}>
|
|
651
672
|
<PhoneInputNumber
|
|
652
673
|
data={phoneInputData}
|
|
653
|
-
handleData={
|
|
654
|
-
...phoneInputData,
|
|
655
|
-
...val,
|
|
656
|
-
phone: {
|
|
657
|
-
...phoneInputData.phone,
|
|
658
|
-
...val.phone,
|
|
659
|
-
country_code: phoneInputData.phone.country_code
|
|
660
|
-
}
|
|
661
|
-
})}
|
|
674
|
+
handleData={handleChangePhoneNumber}
|
|
662
675
|
forwardRef={phoneRef}
|
|
663
676
|
changeCountry={(val: any) => setPhoneInputData({
|
|
664
677
|
...phoneInputData,
|
|
@@ -967,13 +980,16 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
967
980
|
)
|
|
968
981
|
)}
|
|
969
982
|
</FormSide>
|
|
970
|
-
<
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
title={t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
983
|
+
<Modal
|
|
984
|
+
visible={willVerifyOtpState}
|
|
985
|
+
onDismiss={() => setWillVerifyOtpState && setWillVerifyOtpState(false)}
|
|
986
|
+
animationType='slide'
|
|
975
987
|
>
|
|
976
988
|
<Otp
|
|
989
|
+
isCheckingCode={isCheckingCode}
|
|
990
|
+
setCheckingCode={setCheckingCode}
|
|
991
|
+
otpError={otpError}
|
|
992
|
+
setOtpError={setOtpError}
|
|
977
993
|
pinCount={numOtpInputs || 6}
|
|
978
994
|
willVerifyOtpState={willVerifyOtpState || false}
|
|
979
995
|
setWillVerifyOtpState={() => setWillVerifyOtpState && setWillVerifyOtpState(false)}
|
|
@@ -981,7 +997,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
981
997
|
onSubmit={onSubmit}
|
|
982
998
|
setAlertState={setAlertState}
|
|
983
999
|
/>
|
|
984
|
-
</
|
|
1000
|
+
</Modal>
|
|
985
1001
|
<Spinner
|
|
986
1002
|
visible={formState.loading || validationFields.loading || isFBLoading}
|
|
987
1003
|
/>
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
SingleOrderCard as SingleOrderCardController,
|
|
4
4
|
useUtils,
|
|
5
5
|
useOrder,
|
|
6
|
-
useLanguage
|
|
6
|
+
useLanguage,
|
|
7
|
+
useConfig
|
|
7
8
|
} from 'ordering-components/native';
|
|
8
9
|
import FastImage from 'react-native-fast-image'
|
|
9
10
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
@@ -45,6 +46,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
45
46
|
const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
|
|
46
47
|
const [, t] = useLanguage();
|
|
47
48
|
const [{ carts }] = useOrder()
|
|
49
|
+
const [{ configs }] = useConfig()
|
|
48
50
|
const theme = useTheme();
|
|
49
51
|
const isFocused = useIsFocused();
|
|
50
52
|
|
|
@@ -54,6 +56,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
54
56
|
|
|
55
57
|
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12, 15];
|
|
56
58
|
const isGiftCardOrder = !order?.business_id
|
|
59
|
+
const changeIdToExternalId = configs?.change_order_id?.value === '1'
|
|
57
60
|
|
|
58
61
|
const styles = StyleSheet.create({
|
|
59
62
|
container: {
|
|
@@ -284,7 +287,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
284
287
|
) : (
|
|
285
288
|
<Price>
|
|
286
289
|
<OText size={12} lineHeight={18}>
|
|
287
|
-
{parsePrice(order?.total)}
|
|
290
|
+
{parsePrice(order?.summary?.total ?? order?.total)}
|
|
288
291
|
</OText>
|
|
289
292
|
</Price>
|
|
290
293
|
)}
|
|
@@ -333,7 +336,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
333
336
|
lineHeight={15}
|
|
334
337
|
numberOfLines={1}
|
|
335
338
|
>
|
|
336
|
-
{order?.business?.length > 1 ? order?.business?.length : (t('ORDER_NO', 'Order No') + '.')}
|
|
339
|
+
{order?.business?.length > 1 ? order?.business?.length : !(changeIdToExternalId && order?.external_id) && (t('ORDER_NO', 'Order No') + '.')}
|
|
337
340
|
</OText>
|
|
338
341
|
<OText
|
|
339
342
|
size={10}
|
|
@@ -342,7 +345,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
342
345
|
lineHeight={15}
|
|
343
346
|
numberOfLines={1}
|
|
344
347
|
>
|
|
345
|
-
{order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : order.id + ` \u2022 `}
|
|
348
|
+
{order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : ((changeIdToExternalId && order?.external_id) || order.id) + ` \u2022 `}
|
|
346
349
|
</OText>
|
|
347
350
|
</>
|
|
348
351
|
)}
|
|
@@ -367,7 +370,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
367
370
|
size={10}
|
|
368
371
|
lineHeight={15}
|
|
369
372
|
numberOfLines={1}>
|
|
370
|
-
{getOrderStatus(order.status)?.value}
|
|
373
|
+
{getOrderStatus(order.status, t)?.value}
|
|
371
374
|
</OText>
|
|
372
375
|
)}
|
|
373
376
|
</View>
|
|
@@ -54,6 +54,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
54
54
|
: theme?.business_view?.components?.products?.components?.product?.components?.image?.hidden
|
|
55
55
|
const textSize = isChewLayout ? 12 : 10
|
|
56
56
|
const logoPosition = theme?.business_view?.components?.products?.components?.product?.components?.image?.position
|
|
57
|
+
const hideFavoriteIcon = theme?.business_view?.components?.products?.components?.product?.components?.favorite?.hidden
|
|
57
58
|
|
|
58
59
|
const styles = StyleSheet.create({
|
|
59
60
|
container: {
|
|
@@ -198,7 +199,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
198
199
|
style={{ ...styles.line18, flex: 1 }}>
|
|
199
200
|
{product?.name}
|
|
200
201
|
</OText>
|
|
201
|
-
{!isPreviously && (
|
|
202
|
+
{!isPreviously && !hideFavoriteIcon && (
|
|
202
203
|
<LottieAnimation
|
|
203
204
|
type='favorite'
|
|
204
205
|
onClick={handleChangeFavorite}
|
|
@@ -49,15 +49,12 @@ export const RibbonBox = styled.View`
|
|
|
49
49
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
50
50
|
padding: 1px 8px;
|
|
51
51
|
max-width: 60px;
|
|
52
|
-
|
|
53
52
|
${(props: any) => props.bgColor && css`
|
|
54
53
|
background-color: ${props.bgColor};
|
|
55
54
|
`}
|
|
56
|
-
|
|
57
55
|
${(props: any) => props.isRoundRect && css`
|
|
58
56
|
border-radius: 7.6px;
|
|
59
57
|
`}
|
|
60
|
-
|
|
61
58
|
${(props: any) => props.isCapsule && css`
|
|
62
59
|
border-radius: 50px;
|
|
63
60
|
`}
|
|
@@ -32,7 +32,8 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
32
32
|
gateway,
|
|
33
33
|
paySelected,
|
|
34
34
|
newCardAdded,
|
|
35
|
-
addNewCardAsDefault
|
|
35
|
+
addNewCardAsDefault,
|
|
36
|
+
setUserHasCards
|
|
36
37
|
} = props;
|
|
37
38
|
|
|
38
39
|
const theme = useTheme();
|
|
@@ -62,6 +63,11 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
62
63
|
}
|
|
63
64
|
}, [JSON.stringify(newCardAdded)])
|
|
64
65
|
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const hasCardSelected = cardsList?.cards?.some?.((card : any) => card?.id === paySelected?.data?.id)
|
|
68
|
+
setUserHasCards && setUserHasCards(cardsList?.cards?.length > 0 && hasCardSelected)
|
|
69
|
+
}, [cardsList?.cards?.length, paySelected])
|
|
70
|
+
|
|
65
71
|
return (
|
|
66
72
|
<>
|
|
67
73
|
{token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (
|
|
@@ -35,7 +35,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
35
35
|
setPlaceByMethodPay,
|
|
36
36
|
cartTotal,
|
|
37
37
|
publicKeyAddCard,
|
|
38
|
-
|
|
38
|
+
urlscheme,
|
|
39
39
|
androidAppId,
|
|
40
40
|
businessNames,
|
|
41
41
|
setNewCardAdded
|
|
@@ -218,7 +218,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
218
218
|
<StripeProvider
|
|
219
219
|
publishableKey={isToSave}
|
|
220
220
|
merchantIdentifier={merchantId}
|
|
221
|
-
|
|
221
|
+
urlscheme={`${urlscheme}://checkout/${cart?.uuid}`}
|
|
222
222
|
>
|
|
223
223
|
{methodsPay?.includes(paymethod) ? (
|
|
224
224
|
<StripeMethodForm
|