@lookiero/checkout 0.8.4-beta.2 → 0.8.4
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/dist/domain/checkout/model/checkout.js +1 -0
- package/dist/infrastructure/delivery/http/fetchHttpClient.js +36 -19
- package/dist/infrastructure/delivery/http/httpClient.d.ts +9 -3
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +3 -1
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +11 -4
- package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.d.ts +3 -1
- package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.js +19 -6
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +2 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +20 -4
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts +2 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.js +20 -5
- package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.d.ts +2 -0
- package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.js +20 -5
- package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.d.ts +2 -0
- package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.js +19 -4
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.d.ts +2 -0
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.js +20 -5
- package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.d.ts +2 -0
- package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.js +20 -5
- package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +5 -1
- package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +13 -6
- package/dist/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.js +9 -8
- package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +9 -8
- package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +9 -8
- package/dist/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.js +8 -7
- package/dist/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.js +8 -7
- package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +1 -4
- package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.js +9 -8
- package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.js +9 -8
- package/dist/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +9 -8
- package/dist/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.js +9 -8
- package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +9 -8
- package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +9 -8
- package/dist/infrastructure/ui/Root.js +2 -1
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +8 -1
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +2 -2
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.d.ts +2 -0
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +9 -10
- package/dist/infrastructure/ui/i18n/i18n.d.ts +1 -0
- package/dist/infrastructure/ui/i18n/i18n.js +1 -0
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +3 -1
- package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +3 -0
- package/dist/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +3 -1
- package/dist/infrastructure/ui/views/feedback/Feedback.js +3 -0
- package/dist/infrastructure/ui/views/item/Item.js +6 -1
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +2 -2
- package/dist/shared/logging/Logger.d.ts +7 -0
- package/dist/shared/logging/Logger.js +1 -0
- package/dist/shared/logging/SentryLogger.d.ts +3 -8
- package/dist/shared/logging/SentryLogger.js +27 -33
- package/dist/shared/logging/SentryLoggerHOC.d.ts +15 -0
- package/dist/shared/logging/SentryLoggerHOC.js +24 -0
- package/dist/shared/logging/useLogger.d.ts +12 -0
- package/dist/shared/logging/useLogger.js +10 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +2 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +14 -7
- package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.d.ts +2 -0
- package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.js +9 -2
- package/dist/shared/notifications/infrastructure/ui/views/Notifications.js +3 -1
- package/dist/shared/ui/components/layouts/slider/Slider.js +12 -47
- package/package.json +2 -1
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +0 -2
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +0 -28
- package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
- package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -55
package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { CHECKOUT_STARTED } from "../../../../domain/checkout/model/checkoutStarted";
|
|
3
3
|
import { CHECKOUT_SUBMITTED } from "../../../../domain/checkout/model/checkoutSubmitted";
|
|
4
|
-
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
5
4
|
import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
|
|
6
5
|
import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
7
6
|
import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
|
|
@@ -16,15 +15,13 @@ const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
|
|
|
16
15
|
const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
|
|
17
16
|
const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
|
|
18
17
|
const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
|
|
19
|
-
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
20
18
|
const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
|
|
21
19
|
isCheckoutItemReplaced(event) ||
|
|
22
20
|
isCheckoutItemReturned(event) ||
|
|
23
21
|
isCheckoutStarted(event) ||
|
|
24
22
|
isCheckoutSubmitted(event) ||
|
|
25
23
|
isCheckoutFeedbackGiven(event) ||
|
|
26
|
-
isCheckoutBookingExpired(event)
|
|
27
|
-
isCheckoutBookingBooked(event);
|
|
24
|
+
isCheckoutBookingExpired(event);
|
|
28
25
|
const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
|
|
29
26
|
query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
|
|
30
27
|
contextId: MESSAGING_CONTEXT_ID,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/view-checkout-booking-by-id",
|
|
3
|
+
body: { checkoutBookingId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
9
10
|
export { httpCheckoutBookingByIdView };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/view-checkout-item-by-id",
|
|
3
|
+
body: { checkoutItemId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
9
10
|
export { httpCheckoutItemByIdView };
|
package/dist/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/list-checkout-questions-by-checkout-id",
|
|
3
|
+
body: { checkoutId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
9
10
|
export { httpCheckoutQuestionsByCheckoutIdView };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const httpPaymentFlowPayloadByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
const httpPaymentFlowPayloadByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/view-payment-flow-payload-by-checkout-id",
|
|
3
|
+
body: { checkoutId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
9
10
|
export { httpPaymentFlowPayloadByCheckoutIdView };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/view-pricing-by-checkout-id",
|
|
3
|
+
body: { checkoutId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
9
10
|
export { httpPricingByCheckoutIdView };
|
package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => await httpPost({
|
|
2
|
+
endpoint: "/list-return-questions-by-checkout-item-id",
|
|
3
|
+
body: { checkoutItemId },
|
|
4
|
+
signal,
|
|
5
|
+
result: {
|
|
6
|
+
error: null,
|
|
7
|
+
success: (response) => response.result,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
9
10
|
export { httpReturnQuestionsByCheckoutItemIdView };
|
|
@@ -2,6 +2,7 @@ import React, { useCallback } from "react";
|
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
4
4
|
import { sentryLogger } from "../../shared/logging/SentryLogger";
|
|
5
|
+
import { sentryLoggerHOC } from "../../shared/logging/SentryLoggerHOC";
|
|
5
6
|
import { Routing } from "./routing/Routing";
|
|
6
7
|
const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
|
|
7
8
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
@@ -10,6 +11,6 @@ const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
|
|
|
10
11
|
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
11
12
|
React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, useRoutes: useRoutes, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
|
|
12
13
|
};
|
|
13
|
-
return sentryLogger(sentry)(Root);
|
|
14
|
+
return sentryLoggerHOC({ logger: sentryLogger(sentry) })(Root);
|
|
14
15
|
};
|
|
15
16
|
export { root };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { Logger } from "../../../shared/logging/Logger";
|
|
2
|
+
interface UsePaymentInstrumentEventsFunctionArgs {
|
|
3
|
+
readonly logger: Logger;
|
|
4
|
+
}
|
|
5
|
+
interface UsePaymentInstrumentEventsFunction {
|
|
6
|
+
(args: UsePaymentInstrumentEventsFunctionArgs): void;
|
|
7
|
+
}
|
|
8
|
+
declare const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction;
|
|
2
9
|
export { usePaymentInstrumentEvents };
|
|
@@ -6,10 +6,10 @@ import { I18nMessages } from "../i18n/i18n";
|
|
|
6
6
|
import { useToast } from "./useToast";
|
|
7
7
|
const PAYMENT_ERROR = "ERROR";
|
|
8
8
|
const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
|
|
9
|
-
const usePaymentInstrumentEvents = () => {
|
|
9
|
+
const usePaymentInstrumentEvents = ({ logger }) => {
|
|
10
10
|
const { subscribe, unsubscribe } = useEvent();
|
|
11
11
|
const { showError, showSuccess } = useToast();
|
|
12
|
-
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
|
|
12
|
+
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
13
13
|
const onSuccess = useCallback(({ message }) => showSuccess({ message: message.id }), [showSuccess]);
|
|
14
14
|
const onError = useCallback(({ error }) => {
|
|
15
15
|
if (error.toaster) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PaymentFlowRef } from "@lookiero/payments-front";
|
|
2
2
|
import { RefObject } from "react";
|
|
3
3
|
import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
|
|
4
|
+
import { Logger } from "../../../shared/logging/Logger";
|
|
4
5
|
type Status = "idle" | "loading" | "success" | "error";
|
|
5
6
|
interface SubmitCheckoutFunctionArgs {
|
|
6
7
|
readonly paymentFlowPayload: PaymentFlowPayloadProjection;
|
|
@@ -14,6 +15,7 @@ interface UseSubmitCheckoutFunctionArgs {
|
|
|
14
15
|
readonly checkoutBookingId: string;
|
|
15
16
|
readonly paymentFlowRef: RefObject<PaymentFlowRef>;
|
|
16
17
|
readonly onError: () => void;
|
|
18
|
+
readonly logger: Logger;
|
|
17
19
|
}
|
|
18
20
|
interface UseSubmitCheckoutFunction {
|
|
19
21
|
(args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckoutResult;
|
|
@@ -7,16 +7,18 @@ import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
|
7
7
|
import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/checkout/react/useSubmitCheckout";
|
|
8
8
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
9
9
|
import { I18nMessages } from "../i18n/i18n";
|
|
10
|
-
const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onError }) => {
|
|
11
|
-
const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId });
|
|
12
|
-
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId });
|
|
13
|
-
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
+
const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onError, logger, }) => {
|
|
11
|
+
const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId, logger });
|
|
12
|
+
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId, logger });
|
|
13
|
+
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
14
14
|
const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState("idle");
|
|
15
15
|
const submitCheckout = useCallback(async ({ paymentFlowPayload }) => {
|
|
16
16
|
try {
|
|
17
17
|
await blockCheckoutBooking();
|
|
18
18
|
}
|
|
19
|
-
catch (error) {
|
|
19
|
+
catch (error) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
20
22
|
paymentFlowRef.current?.startLegacyBoxCheckout(
|
|
21
23
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
24
|
// @ts-ignore
|
|
@@ -25,10 +27,7 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
|
|
|
25
27
|
if (final) {
|
|
26
28
|
if (status === ChargeStatus.EXECUTED) {
|
|
27
29
|
setStartLegacyBoxCheckoutStatus("success");
|
|
28
|
-
|
|
29
|
-
await submitCheckoutCommand();
|
|
30
|
-
}
|
|
31
|
-
catch (error) { }
|
|
30
|
+
await submitCheckoutCommand();
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
33
|
createNotification({
|
|
@@ -39,7 +38,7 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
|
-
}, [blockCheckoutBooking, createNotification, submitCheckoutCommand
|
|
41
|
+
}, [paymentFlowRef, blockCheckoutBooking, createNotification, submitCheckoutCommand]);
|
|
43
42
|
const status = useMemo(() => {
|
|
44
43
|
if (blockCheckoutBookingStatus === CommandStatus.LOADING ||
|
|
45
44
|
startLegacyBoxCheckoutStatus === "loading" ||
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const COLOR_I18N_PREFIX = "color.";
|
|
2
2
|
var I18nMessages;
|
|
3
3
|
(function (I18nMessages) {
|
|
4
|
+
I18nMessages["TOAST_GENERIC_ERROR"] = "toast_generic_error";
|
|
4
5
|
I18nMessages["ITEM_SIZE"] = "item.size";
|
|
5
6
|
I18nMessages["ITEM_COLOR"] = "item.color";
|
|
6
7
|
I18nMessages["ITEM_UNIQUE"] = "item.unique";
|
|
@@ -3,17 +3,19 @@ import React, { useEffect, useRef } from "react";
|
|
|
3
3
|
import { generatePath, Navigate, useMatch } from "react-router-native";
|
|
4
4
|
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
6
|
+
import { useLogger } from "../../../shared/logging/useLogger";
|
|
6
7
|
import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
|
|
7
8
|
import { useStartCheckout } from "../../domain/checkout/react/useStartCheckout";
|
|
8
9
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
9
10
|
import { Routes } from "./routes";
|
|
10
11
|
import { useBasePath } from "./useBasePath";
|
|
11
12
|
const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
|
|
13
|
+
const logger = useLogger();
|
|
12
14
|
const basePath = useBasePath();
|
|
13
15
|
const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
|
|
14
16
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
15
17
|
const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
|
|
16
|
-
const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id });
|
|
18
|
+
const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id, logger });
|
|
17
19
|
useEffect(() => {
|
|
18
20
|
if (checkout?.id) {
|
|
19
21
|
startCheckout();
|
|
@@ -2,6 +2,7 @@ import { QueryStatus } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { PaymentFlow } from "@lookiero/payments-front";
|
|
3
3
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useNavigate } from "react-router-native";
|
|
5
|
+
import { useLogger } from "../../../../../../shared/logging/useLogger";
|
|
5
6
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
6
7
|
import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
7
8
|
import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
|
|
@@ -10,6 +11,7 @@ import { useBasePath } from "../../../../routing/useBasePath";
|
|
|
10
11
|
import { CheckoutSuccessModal } from "../checkoutSuccessModal/CheckoutSuccessModal";
|
|
11
12
|
const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
|
|
12
13
|
const paymentFlowRef = useRef(null);
|
|
14
|
+
const logger = useLogger();
|
|
13
15
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
14
16
|
const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
|
|
15
17
|
checkoutId: checkout?.id,
|
|
@@ -28,6 +30,7 @@ const CheckoutPaymentModal = ({ customerId, getAuthToken }) => {
|
|
|
28
30
|
checkoutBookingId: checkout?.checkoutBookingId,
|
|
29
31
|
paymentFlowRef,
|
|
30
32
|
onError: handleOnErrorSubmitCheckout,
|
|
33
|
+
logger,
|
|
31
34
|
});
|
|
32
35
|
useEffect(() => {
|
|
33
36
|
if (paymentFlowPayload) {
|
package/dist/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { PaymentInstrumentSelect, PaymentMethod, Section } from "@lookiero/payments-front";
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
|
+
import { useLogger } from "../../../../../../shared/logging/useLogger";
|
|
3
4
|
import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
|
|
4
5
|
const PaymentInstrument = ({ useRedirect }) => {
|
|
5
6
|
const paymentInstrumentSelectRef = useRef(null);
|
|
6
7
|
const { returnUrl } = useRedirect();
|
|
7
|
-
|
|
8
|
+
const logger = useLogger();
|
|
9
|
+
usePaymentInstrumentEvents({ logger });
|
|
8
10
|
return (React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, hidePaymentMethods: [PaymentMethod.GOOGLE_PAY], section: Section.BOX_CHECKOUT }));
|
|
9
11
|
};
|
|
10
12
|
export { PaymentInstrument };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
|
+
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
4
5
|
import { usePageView } from "../../../../shared/tracking/infrastructure/usePageView";
|
|
5
6
|
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
6
7
|
import { useGiveCheckoutFeedback } from "../../../domain/checkoutFeedback/react/useGiveCheckoutFeedback";
|
|
@@ -14,12 +15,14 @@ import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
|
|
|
14
15
|
import { style } from "./Feedback.style";
|
|
15
16
|
import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
|
|
16
17
|
const Feedback = ({ customerId, country }) => {
|
|
18
|
+
const logger = useLogger();
|
|
17
19
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
18
20
|
const [checkoutQuestions, checkoutQuestionsStatus] = useListCheckoutQuestionsByCheckoutId({
|
|
19
21
|
checkoutId: checkout?.id,
|
|
20
22
|
});
|
|
21
23
|
const [giveCheckoutFeedback, giveCheckoutFeedbackStatus] = useGiveCheckoutFeedback({
|
|
22
24
|
checkoutId: checkout?.id,
|
|
25
|
+
logger,
|
|
23
26
|
});
|
|
24
27
|
const handleOnSubmit = useCallback(async (feedbacks) => {
|
|
25
28
|
try {
|
|
@@ -4,6 +4,7 @@ import { Platform, View } from "react-native";
|
|
|
4
4
|
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
6
|
import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
7
|
+
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
7
8
|
import { usePageView } from "../../../../shared/tracking/infrastructure/usePageView";
|
|
8
9
|
import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
|
|
9
10
|
import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
|
|
@@ -32,6 +33,7 @@ import { SizeChangeModal } from "./components/sizeChangeModal/SizeChangeModal";
|
|
|
32
33
|
import { SizeWithoutStockModal } from "./components/sizeWithoutStockModal/SizeWithoutStockModal";
|
|
33
34
|
const { spaceXL } = theme();
|
|
34
35
|
const Item = ({ customerId, country }) => {
|
|
36
|
+
const logger = useLogger();
|
|
35
37
|
const { id } = useParams();
|
|
36
38
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
37
39
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
@@ -63,12 +65,14 @@ const Item = ({ customerId, country }) => {
|
|
|
63
65
|
setCustomerDecissionMade(checkoutItem.status !== CheckoutItemStatus.INITIAL);
|
|
64
66
|
}, [checkoutItem.status, id]);
|
|
65
67
|
const handleOnBannerPress = useCallback(() => setCustomerDecissionMade(false), []);
|
|
66
|
-
const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id });
|
|
68
|
+
const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id, logger });
|
|
67
69
|
const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
|
|
68
70
|
checkoutItemId: checkoutItem.id,
|
|
71
|
+
logger,
|
|
69
72
|
});
|
|
70
73
|
const [replaceCheckoutItem, replaceCheckoutItemStatus] = useReplaceCheckoutItem({
|
|
71
74
|
checkoutItemId: checkoutItem.id,
|
|
75
|
+
logger,
|
|
72
76
|
});
|
|
73
77
|
const [sizeWithoutStockModalVisible, setSizeWithoutStockModalVisible] = useState(false);
|
|
74
78
|
const handleOnShowSizeWithoutStockModal = useCallback(() => setSizeWithoutStockModalVisible(true), []);
|
|
@@ -87,6 +91,7 @@ const Item = ({ customerId, country }) => {
|
|
|
87
91
|
const [bookCheckoutBooking] = useBookCheckoutBookingForCheckoutItem({
|
|
88
92
|
checkoutItemId: checkoutItem.id,
|
|
89
93
|
checkoutBookingId: checkout?.checkoutBookingId,
|
|
94
|
+
logger,
|
|
90
95
|
});
|
|
91
96
|
useEffect(() => {
|
|
92
97
|
checkout && bookedProductsVariants === null && bookCheckoutBooking();
|
|
@@ -5,7 +5,7 @@ import { Image, Pressable, View } from "react-native";
|
|
|
5
5
|
import Svg, { Line } from "react-native-svg";
|
|
6
6
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
7
|
import { size } from "../../../../../../projection/shared/size";
|
|
8
|
-
import {
|
|
8
|
+
import { ButtonIcon } from "../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
9
9
|
import { Price } from "../../../../components/atoms/price/Price";
|
|
10
10
|
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
11
11
|
import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
|
|
@@ -39,6 +39,6 @@ const ProductVariant = ({ media, brand, name, price, size: sizeProjection, color
|
|
|
39
39
|
status === CheckoutItemStatus.REPLACED && (React.createElement(View, { style: style.sizeChange },
|
|
40
40
|
React.createElement(Text, { level: 3, style: style.sizeChangeText, detail: true }, sizeChangeText)))),
|
|
41
41
|
React.createElement(Price, { price: price, variant: "detail" }))),
|
|
42
|
-
onPress && React.createElement(
|
|
42
|
+
onPress && React.createElement(ButtonIcon, { name: "arrow-right" })));
|
|
43
43
|
};
|
|
44
44
|
export { ProductVariant };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { ComponentType } from "react";
|
|
2
1
|
import { Platform } from "react-native";
|
|
2
|
+
import { Logger } from "./Logger";
|
|
3
3
|
interface SentryLoggerFunctionArgs {
|
|
4
4
|
readonly publicKey: string;
|
|
5
5
|
readonly environment: `${typeof Platform.OS}-${"DEV" | "PROD" | "EXPO"}`;
|
|
6
6
|
readonly release: string;
|
|
7
7
|
readonly project: string;
|
|
8
8
|
}
|
|
9
|
-
interface SentryLoggerHOCProps {
|
|
10
|
-
readonly customer: {
|
|
11
|
-
readonly customerId: string;
|
|
12
|
-
} | undefined;
|
|
13
|
-
}
|
|
14
9
|
interface SentryLoggerFunction {
|
|
15
|
-
(args: SentryLoggerFunctionArgs):
|
|
10
|
+
(args: SentryLoggerFunctionArgs): Logger;
|
|
16
11
|
}
|
|
17
12
|
declare const sentryLogger: SentryLoggerFunction;
|
|
18
|
-
export type { SentryLoggerFunctionArgs
|
|
13
|
+
export type { SentryLoggerFunctionArgs };
|
|
19
14
|
export { sentryLogger };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defaultStackParser } from "@sentry/browser";
|
|
2
2
|
import { makeMain } from "@sentry/core";
|
|
3
|
-
import React, { useEffect } from "react";
|
|
4
3
|
import { Platform } from "react-native";
|
|
5
|
-
import {
|
|
6
|
-
import { Client, Hub, transport, integrations, wrapUseRoutes, wrapComponent, ErrorBoundary, } from "./SentryDependencies";
|
|
4
|
+
import { Client, Hub, integrations, transport } from "./SentryDependencies";
|
|
7
5
|
// This configuration is obtained from
|
|
8
6
|
// https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry
|
|
9
7
|
const IGNORED_ERRORS = [
|
|
@@ -51,10 +49,10 @@ const DENIED_URLS = [
|
|
|
51
49
|
/webappstoolbarba\.texthelp\.com\//i,
|
|
52
50
|
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
|
|
53
51
|
];
|
|
54
|
-
const sentryLogger = ({
|
|
52
|
+
const sentryLogger = ({ environment, release, publicKey, project }) => {
|
|
55
53
|
let globalHub;
|
|
56
54
|
let currentHub;
|
|
57
|
-
const
|
|
55
|
+
const createHub = () => {
|
|
58
56
|
const client = new Client({
|
|
59
57
|
environment,
|
|
60
58
|
release,
|
|
@@ -72,28 +70,30 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
|
72
70
|
});
|
|
73
71
|
return new Hub(client);
|
|
74
72
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
const init = () => {
|
|
74
|
+
/**
|
|
75
|
+
* BrowserClient must be initialized before wrapUseRoutes is used.
|
|
76
|
+
*
|
|
77
|
+
* ReactNativeClient cannot be initialized until actual component is rendered.
|
|
78
|
+
* Its initialization will trigger the native sdk setup with the provided settings,
|
|
79
|
+
* but by the time an event will be sent to Sentry, the host project (UAF)
|
|
80
|
+
* will have overridden its configuration (dsn, etc) after initializing it
|
|
81
|
+
* so we have to initialize it after the component mount.
|
|
82
|
+
*/
|
|
83
|
+
if (Platform.OS === "web") {
|
|
84
|
+
currentHub = createHub();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
87
|
const onMount = (customerId) => {
|
|
88
88
|
// currentHub won't be initialized in native until this time
|
|
89
|
-
currentHub = currentHub ??
|
|
89
|
+
currentHub = currentHub ?? createHub();
|
|
90
90
|
currentHub.setUser({ id: customerId });
|
|
91
91
|
currentHub.startSession();
|
|
92
92
|
if (!globalHub) {
|
|
93
93
|
globalHub = makeMain(currentHub);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
const
|
|
96
|
+
const onUnmount = () => {
|
|
97
97
|
if (currentHub) {
|
|
98
98
|
currentHub.endSession();
|
|
99
99
|
currentHub.setUser(null);
|
|
@@ -104,20 +104,14 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
|
104
104
|
globalHub = null;
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
|
-
}, []);
|
|
117
|
-
return (React.createElement(ErrorBoundary, null,
|
|
118
|
-
React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes })));
|
|
119
|
-
};
|
|
120
|
-
return SentryLogger;
|
|
107
|
+
const captureException = (error) => {
|
|
108
|
+
currentHub?.captureException(error);
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
init,
|
|
112
|
+
onMount,
|
|
113
|
+
onUnmount,
|
|
114
|
+
captureException,
|
|
121
115
|
};
|
|
122
116
|
};
|
|
123
117
|
export { sentryLogger };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
import { Logger } from "./Logger";
|
|
3
|
+
interface SentryLoggerHOCFunctionArgs {
|
|
4
|
+
readonly logger: Logger;
|
|
5
|
+
}
|
|
6
|
+
interface SentryLoggerHOCProps {
|
|
7
|
+
readonly customer: {
|
|
8
|
+
readonly customerId: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
}
|
|
11
|
+
interface SentryLoggerHOCFunction {
|
|
12
|
+
(args: SentryLoggerHOCFunctionArgs): <P extends SentryLoggerHOCProps>(Component: ComponentType<P>) => ComponentType<P & JSX.IntrinsicAttributes>;
|
|
13
|
+
}
|
|
14
|
+
declare const sentryLoggerHOC: SentryLoggerHOCFunction;
|
|
15
|
+
export { sentryLoggerHOC };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
3
|
+
import { wrapUseRoutes, wrapComponent, ErrorBoundary } from "./SentryDependencies";
|
|
4
|
+
import { LoggerProvider } from "./useLogger";
|
|
5
|
+
const sentryLoggerHOC = ({ logger }) => {
|
|
6
|
+
logger.init();
|
|
7
|
+
const useRoutes = wrapUseRoutes(reactRouterUseRoutes);
|
|
8
|
+
return (Component) => {
|
|
9
|
+
const WrappedComponent = wrapComponent(Component);
|
|
10
|
+
const SentryLogger = (props) => {
|
|
11
|
+
const { customer } = props;
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
logger.onMount(customer?.customerId);
|
|
14
|
+
return logger.onUnmount;
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
}, []);
|
|
17
|
+
return (React.createElement(ErrorBoundary, null,
|
|
18
|
+
React.createElement(LoggerProvider, { logger: logger },
|
|
19
|
+
React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes }))));
|
|
20
|
+
};
|
|
21
|
+
return SentryLogger;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export { sentryLoggerHOC };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { Logger } from "./Logger";
|
|
3
|
+
interface LoggerContextProviderProps {
|
|
4
|
+
readonly logger: Logger;
|
|
5
|
+
readonly children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const LoggerProvider: FC<LoggerContextProviderProps>;
|
|
8
|
+
interface UseLoggerFunction {
|
|
9
|
+
(): Logger;
|
|
10
|
+
}
|
|
11
|
+
declare const useLogger: UseLoggerFunction;
|
|
12
|
+
export { useLogger, LoggerProvider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
|
+
import invariant from "tiny-invariant";
|
|
3
|
+
const LoggerContext = createContext(null);
|
|
4
|
+
const LoggerProvider = ({ logger, children }) => (React.createElement(LoggerContext.Provider, { value: logger }, children));
|
|
5
|
+
const useLogger = () => {
|
|
6
|
+
const logger = useContext(LoggerContext);
|
|
7
|
+
invariant(logger, "Your are trying to use the useLogger hook without wrapping your app with the <LoggerProvider>.");
|
|
8
|
+
return logger;
|
|
9
|
+
};
|
|
10
|
+
export { useLogger, LoggerProvider };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
import { Logger } from "../../../../../logging/Logger";
|
|
2
3
|
import { NotificationLevel } from "../../../../domain/notification/model/notification";
|
|
3
4
|
interface CreateNotificationFunctionArgs {
|
|
4
5
|
readonly aggregateId?: string;
|
|
@@ -11,6 +12,7 @@ interface CreateNotificationFunction {
|
|
|
11
12
|
}
|
|
12
13
|
interface UseCreateNotificationFunctionArgs {
|
|
13
14
|
readonly contextId: string;
|
|
15
|
+
readonly logger: Logger;
|
|
14
16
|
}
|
|
15
17
|
interface UseCreateNotificationFunction {
|
|
16
18
|
(args: UseCreateNotificationFunctionArgs): [create: CreateNotificationFunction, status: CommandStatus];
|