ordering-ui-react-native 0.21.24 → 0.21.26
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
|
@@ -53,7 +53,6 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
53
53
|
let times = 0
|
|
54
54
|
|
|
55
55
|
const handleCloseEvents = () => {
|
|
56
|
-
notificationSound.stop()
|
|
57
56
|
setCurrentEvent(null)
|
|
58
57
|
clearInterval(_timeout)
|
|
59
58
|
}
|
|
@@ -120,7 +119,11 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
120
119
|
}, [])
|
|
121
120
|
|
|
122
121
|
useEffect(() => {
|
|
123
|
-
return () =>
|
|
122
|
+
return () => {
|
|
123
|
+
handleCloseEvents()
|
|
124
|
+
notificationSound.stop()
|
|
125
|
+
notificationSound.release()
|
|
126
|
+
}
|
|
124
127
|
}, [])
|
|
125
128
|
|
|
126
129
|
return (
|
|
@@ -158,12 +158,13 @@ const CheckoutUI = (props: any) => {
|
|
|
158
158
|
const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
|
|
159
159
|
const [isOpen, setIsOpen] = useState(false)
|
|
160
160
|
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
161
|
-
const [openModal, setOpenModal] = useState({ login: false, signup: false })
|
|
161
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
162
162
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
163
163
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
164
164
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
165
165
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
166
166
|
const cardsMethods = ['credomatic']
|
|
167
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
167
168
|
const placeSpotTypes = [3, 4, 5]
|
|
168
169
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
|
|
169
170
|
const isGiftCardCart = !cart?.business_id
|
|
@@ -237,7 +238,8 @@ const CheckoutUI = (props: any) => {
|
|
|
237
238
|
user,
|
|
238
239
|
token: user?.session?.access_token
|
|
239
240
|
})
|
|
240
|
-
|
|
241
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
242
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
const handleSuccessLogin = (user: any) => {
|
|
@@ -245,6 +247,11 @@ const CheckoutUI = (props: any) => {
|
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
|
|
250
|
+
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
251
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
|
|
248
255
|
if (!userErrors.length && (!requiredFields?.length || allowedGuest) || forcePlace) {
|
|
249
256
|
vibrateApp()
|
|
250
257
|
handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment)
|
|
@@ -927,7 +934,7 @@ const CheckoutUI = (props: any) => {
|
|
|
927
934
|
</OModal>
|
|
928
935
|
<OModal
|
|
929
936
|
open={openModal.signup}
|
|
930
|
-
onClose={() => setOpenModal({ ...openModal, signup: false })}
|
|
937
|
+
onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
|
|
931
938
|
>
|
|
932
939
|
<ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
|
|
933
940
|
<SignupForm
|