@lookiero/checkout 0.8.15 → 0.8.16
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.
|
@@ -33,7 +33,7 @@ const Checkout = ({ children, customerId, country, useRedirect }) => {
|
|
|
33
33
|
const navigate = useNavigate();
|
|
34
34
|
const basePath = useBasePath();
|
|
35
35
|
const handleOnSubmit = useCallback(() => {
|
|
36
|
-
navigate(`${basePath}/${Routes.CHECKOUT}/${Routes.CHECKOUT_PAYMENT}
|
|
36
|
+
navigate(`${basePath}/${Routes.CHECKOUT}/${Routes.CHECKOUT_PAYMENT}`, { replace: true });
|
|
37
37
|
}, [basePath, navigate]);
|
|
38
38
|
const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
39
39
|
const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
@@ -23,8 +23,8 @@ const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
|
|
|
23
23
|
}, [getAuthToken]);
|
|
24
24
|
const basePath = useBasePath();
|
|
25
25
|
const navigate = useNavigate();
|
|
26
|
-
const handleOnSuccessModalDismiss = useCallback(() => navigate(`${basePath}/${Routes.FEEDBACK}
|
|
27
|
-
const handleOnErrorSubmitCheckout = useCallback(() => navigate(`${basePath}/${Routes.CHECKOUT}
|
|
26
|
+
const handleOnSuccessModalDismiss = useCallback(() => navigate(`${basePath}/${Routes.FEEDBACK}`, { replace: true }), [basePath, navigate]);
|
|
27
|
+
const handleOnErrorSubmitCheckout = useCallback(() => navigate(`${basePath}/${Routes.CHECKOUT}`, { replace: true }), [basePath, navigate]);
|
|
28
28
|
const [submitCheckout, submitCheckoutStatus] = useSubmitCheckout({
|
|
29
29
|
checkoutId: checkout?.id,
|
|
30
30
|
checkoutBookingId: checkout?.checkoutBookingId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React, { useCallback } from "react";
|
|
2
|
+
import React, { useCallback, useEffect } from "react";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
5
5
|
import { usePageView } from "../../../../shared/tracking/infrastructure/usePageView";
|
|
@@ -35,6 +35,10 @@ const Feedback = ({ customerId, country }) => {
|
|
|
35
35
|
country,
|
|
36
36
|
checkoutId: checkout?.id,
|
|
37
37
|
});
|
|
38
|
+
// Give empty feedback when this view is unmounted
|
|
39
|
+
useEffect(() => () => {
|
|
40
|
+
giveCheckoutFeedback({ feedbacks: {} });
|
|
41
|
+
}, [giveCheckoutFeedback]);
|
|
38
42
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
39
43
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) && dependenciesLoadedStatuses.includes(checkoutQuestionsStatus);
|
|
40
44
|
if (!dependenciesLoaded)
|