@lookiero/checkout 0.8.4-beta.10 → 0.8.4-beta.2
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 +0 -1
- package/dist/infrastructure/delivery/http/fetchHttpClient.js +19 -36
- package/dist/infrastructure/delivery/http/httpClient.d.ts +3 -9
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +1 -3
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +4 -11
- package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.d.ts +1 -3
- package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.js +6 -19
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +0 -2
- package/dist/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +4 -19
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts +0 -2
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.js +5 -20
- package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.d.ts +0 -2
- package/dist/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.js +5 -20
- package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.d.ts +0 -2
- package/dist/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.js +4 -19
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.d.ts +0 -2
- package/dist/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.js +5 -20
- package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.d.ts +0 -2
- package/dist/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.js +5 -20
- package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +1 -5
- package/dist/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +6 -13
- package/dist/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.js +8 -9
- package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +8 -9
- package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +8 -9
- package/dist/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.js +7 -8
- package/dist/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.js +7 -8
- package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +4 -1
- package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.js +8 -9
- package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.js +8 -9
- package/dist/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +8 -9
- package/dist/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.js +8 -9
- package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +8 -9
- package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +8 -9
- package/dist/infrastructure/ui/Root.js +1 -2
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +1 -8
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +2 -2
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +2 -0
- package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +28 -0
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.d.ts +0 -2
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +13 -7
- package/dist/infrastructure/ui/i18n/i18n.d.ts +0 -1
- package/dist/infrastructure/ui/i18n/i18n.js +0 -1
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +1 -3
- package/dist/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +0 -3
- package/dist/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +1 -3
- package/dist/infrastructure/ui/views/feedback/Feedback.js +0 -3
- package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -3
- package/dist/infrastructure/ui/views/item/Item.js +1 -6
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +2 -2
- package/dist/shared/logging/SentryLogger.d.ts +8 -3
- package/dist/shared/logging/SentryLogger.js +33 -27
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +0 -2
- package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +7 -14
- package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.d.ts +0 -2
- package/dist/shared/notifications/infrastructure/domain/notification/react/useRemoveNotification.js +2 -9
- package/dist/shared/notifications/infrastructure/ui/views/Notifications.js +1 -3
- package/dist/shared/ui/components/layouts/slider/Slider.js +47 -12
- package/package.json +1 -2
- package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
- package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
- package/dist/domain/checkout/model/checkoutPaid.js +0 -4
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +0 -16
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +0 -14
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +0 -9
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +0 -12
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +0 -12
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +0 -9
- package/dist/infrastructure/ui/views/App.style.d.ts +0 -4
- package/dist/infrastructure/ui/views/App.style.js +0 -16
- package/dist/infrastructure/ui/views/header/Header.d.ts +0 -15
- package/dist/infrastructure/ui/views/header/Header.js +0 -90
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +0 -35
- package/dist/infrastructure/ui/views/header/Header.style.js +0 -38
- package/dist/infrastructure/ui/views/header/components/Logo.d.ts +0 -7
- package/dist/infrastructure/ui/views/header/components/Logo.js +0 -11
- package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +0 -7
- package/dist/infrastructure/ui/views/header/components/Logo.style.js +0 -8
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -10
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +0 -1
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +0 -25
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +0 -8
- package/dist/shared/logging/Logger.d.ts +0 -7
- package/dist/shared/logging/Logger.js +0 -1
- package/dist/shared/logging/SentryLoggerHOC.d.ts +0 -15
- package/dist/shared/logging/SentryLoggerHOC.js +0 -24
- package/dist/shared/logging/location.d.ts +0 -3
- package/dist/shared/logging/location.js +0 -5
- package/dist/shared/logging/matchRoutes.d.ts +0 -3
- package/dist/shared/logging/matchRoutes.js +0 -7
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +0 -29
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +0 -134
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +0 -22
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +0 -15
- package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +0 -27
- package/dist/shared/logging/reactRouterV6Instrumentation.native.js +0 -115
- package/dist/shared/logging/useLogger.d.ts +0 -12
- package/dist/shared/logging/useLogger.js +0 -10
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +0 -1
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +0 -9
|
@@ -11,7 +11,6 @@ var CheckoutStatus;
|
|
|
11
11
|
})(CheckoutStatus || (CheckoutStatus = {}));
|
|
12
12
|
const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
13
13
|
const { aggregateId } = command;
|
|
14
|
-
invariant(aggregateRoot.status !== CheckoutStatus.STARTED, "Checkout is already started");
|
|
15
14
|
invariant(aggregateRoot.status !== CheckoutStatus.SUBMITTED, "Checkout is already submitted");
|
|
16
15
|
invariant(aggregateRoot.status !== CheckoutStatus.COMPLETED, "Checkout is already completed");
|
|
17
16
|
return {
|
|
@@ -1,37 +1,20 @@
|
|
|
1
|
-
const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body, signal
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
referrer: "",
|
|
22
|
-
signal,
|
|
23
|
-
});
|
|
24
|
-
return await processResponse({ response, result });
|
|
25
|
-
};
|
|
26
|
-
const processResponse = async ({ response, result }) => {
|
|
27
|
-
if (response.ok) {
|
|
28
|
-
const responseText = await response.text();
|
|
29
|
-
const responseResult = responseText ? JSON.parse(responseText) : responseText;
|
|
30
|
-
return result?.success(responseResult) ?? responseResult;
|
|
31
|
-
}
|
|
32
|
-
if (result?.error !== undefined) {
|
|
33
|
-
return result.error;
|
|
34
|
-
}
|
|
35
|
-
throw new Error(response.statusText);
|
|
36
|
-
};
|
|
1
|
+
const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body, signal }) => fetch(`${apiUrl}${endpoint}`, {
|
|
2
|
+
method: "POST",
|
|
3
|
+
headers: {
|
|
4
|
+
["Content-Type"]: "application/json",
|
|
5
|
+
authorization: `Bearer ${await getAuthToken()}`,
|
|
6
|
+
},
|
|
7
|
+
body: JSON.stringify(body),
|
|
8
|
+
signal,
|
|
9
|
+
});
|
|
10
|
+
const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint, signal }) => fetch(`${apiUrl}${endpoint}`, {
|
|
11
|
+
method: "GET",
|
|
12
|
+
credentials: "include",
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${await getAuthToken()}`,
|
|
15
|
+
["Content-Type"]: "application/json",
|
|
16
|
+
},
|
|
17
|
+
referrer: "",
|
|
18
|
+
signal,
|
|
19
|
+
});
|
|
37
20
|
export { fetchHttpGet, fetchHttpPost };
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
interface HttpFunctionResult {
|
|
2
|
-
readonly error: any;
|
|
3
|
-
readonly success: (response: any) => any;
|
|
4
|
-
}
|
|
5
1
|
interface HttpGetFunctionArgs {
|
|
6
2
|
readonly endpoint: string;
|
|
7
3
|
readonly signal?: AbortSignal;
|
|
8
|
-
readonly result?: HttpFunctionResult;
|
|
9
4
|
}
|
|
10
5
|
interface HttpGetFunction {
|
|
11
|
-
(args: HttpGetFunctionArgs): Promise<
|
|
6
|
+
(args: HttpGetFunctionArgs): Promise<Response>;
|
|
12
7
|
}
|
|
13
8
|
interface HttpPostFunctionArgs {
|
|
14
9
|
readonly endpoint: string;
|
|
15
10
|
readonly body: Record<string, unknown>;
|
|
16
11
|
readonly signal?: AbortSignal;
|
|
17
|
-
readonly result?: HttpFunctionResult;
|
|
18
12
|
}
|
|
19
13
|
interface HttpPostFunction {
|
|
20
|
-
(args: HttpPostFunctionArgs): Promise<
|
|
14
|
+
(args: HttpPostFunctionArgs): Promise<Response>;
|
|
21
15
|
}
|
|
22
|
-
export type { HttpGetFunction, HttpPostFunction
|
|
16
|
+
export type { HttpGetFunction, HttpPostFunction };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface StartCheckoutFunction {
|
|
4
|
-
(): Promise<void
|
|
3
|
+
(): Promise<void>;
|
|
5
4
|
}
|
|
6
5
|
interface UseStartCheckoutArgs {
|
|
7
6
|
readonly checkoutId?: string;
|
|
8
|
-
readonly logger: Logger;
|
|
9
7
|
}
|
|
10
8
|
type UseStartCheckoutResult = [start: StartCheckoutFunction, status: CommandStatus];
|
|
11
9
|
interface UseStartCheckout {
|
|
@@ -3,19 +3,12 @@ import { useCallback } from "react";
|
|
|
3
3
|
import invariant from "tiny-invariant";
|
|
4
4
|
import { startCheckout } from "../../../../domain/checkout/command/startCheckout";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useStartCheckout = ({ checkoutId
|
|
6
|
+
const useStartCheckout = ({ checkoutId }) => {
|
|
7
7
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const start = useCallback(
|
|
8
|
+
const start = useCallback(() => {
|
|
9
9
|
invariant(checkoutId, "CheckoutId must be defined in order to start checkout");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
if (!error?.message?.includes("Checkout is already started")) {
|
|
15
|
-
logger.captureException(error);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}, [checkoutId, commandBus, logger]);
|
|
10
|
+
return commandBus(startCheckout({ aggregateId: checkoutId }));
|
|
11
|
+
}, [checkoutId, commandBus]);
|
|
19
12
|
return [start, status];
|
|
20
13
|
};
|
|
21
14
|
export { useStartCheckout };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface SubmitFunction {
|
|
4
|
-
(): Promise<void
|
|
3
|
+
(): Promise<void>;
|
|
5
4
|
}
|
|
6
5
|
type UseSubmitCheckout = [submit: SubmitFunction, status: CommandStatus];
|
|
7
6
|
interface UseSubmitCheckoutFunctionArgs {
|
|
8
7
|
readonly checkoutId?: string;
|
|
9
|
-
readonly logger: Logger;
|
|
10
8
|
}
|
|
11
9
|
interface UseSubmitCheckoutFunction {
|
|
12
10
|
(args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckout;
|
|
@@ -2,28 +2,15 @@ import { useCommand } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import invariant from "tiny-invariant";
|
|
4
4
|
import { submitCheckout } from "../../../../domain/checkout/command/submitCheckout";
|
|
5
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
6
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
7
5
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
8
|
-
|
|
9
|
-
const useSubmitCheckout = ({ checkoutId, logger }) => {
|
|
6
|
+
const useSubmitCheckout = ({ checkoutId }) => {
|
|
10
7
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
11
|
-
const
|
|
12
|
-
const submit = useCallback(async () => {
|
|
8
|
+
const submit = useCallback(() => {
|
|
13
9
|
invariant(checkoutId, "CheckoutId must be defined in order to submit checkout");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
logger.captureException(error);
|
|
21
|
-
createNotification({
|
|
22
|
-
level: NotificationLevel.ERROR,
|
|
23
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}, [checkoutId, commandBus, createNotification, logger]);
|
|
10
|
+
return commandBus(submitCheckout({
|
|
11
|
+
aggregateId: checkoutId,
|
|
12
|
+
}));
|
|
13
|
+
}, [checkoutId, commandBus]);
|
|
27
14
|
return [submit, status];
|
|
28
15
|
};
|
|
29
16
|
export { useSubmitCheckout };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface BlockCheckoutBookingFunction {
|
|
4
3
|
(): Promise<void>;
|
|
5
4
|
}
|
|
6
5
|
type UseBlockCheckoutBooking = [blockCheckoutBooking: BlockCheckoutBookingFunction, status: CommandStatus];
|
|
7
6
|
interface UseBlockCheckoutBookingFunctionArgs {
|
|
8
7
|
readonly checkoutBookingId: string;
|
|
9
|
-
readonly logger: Logger;
|
|
10
8
|
}
|
|
11
9
|
interface UseBlockCheckoutBookingFunction {
|
|
12
10
|
(args: UseBlockCheckoutBookingFunctionArgs): UseBlockCheckoutBooking;
|
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { blockCheckoutBooking as blockCheckoutBookingCommand } from "../../../../domain/checkoutBooking/command/blockCheckoutBooking";
|
|
4
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
5
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
6
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
-
|
|
8
|
-
const useBlockCheckoutBooking = ({ checkoutBookingId, logger }) => {
|
|
5
|
+
const useBlockCheckoutBooking = ({ checkoutBookingId }) => {
|
|
9
6
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
await commandBus(blockCheckoutBookingCommand({
|
|
14
|
-
aggregateId: checkoutBookingId,
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
logger.captureException(error);
|
|
19
|
-
createNotification({
|
|
20
|
-
level: NotificationLevel.ERROR,
|
|
21
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}, [checkoutBookingId, commandBus, createNotification, logger]);
|
|
7
|
+
const blockCheckoutBooking = useCallback(() => commandBus(blockCheckoutBookingCommand({
|
|
8
|
+
aggregateId: checkoutBookingId,
|
|
9
|
+
})), [checkoutBookingId, commandBus]);
|
|
25
10
|
return [blockCheckoutBooking, status];
|
|
26
11
|
};
|
|
27
12
|
export { useBlockCheckoutBooking };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface BookFunction {
|
|
4
3
|
(): Promise<void>;
|
|
5
4
|
}
|
|
@@ -7,7 +6,6 @@ type UseBookCheckoutBookingForCheckoutItem = [book: BookFunction, status: Comman
|
|
|
7
6
|
interface UseBookCheckoutBookingForCheckoutItemFunctionArgs {
|
|
8
7
|
readonly checkoutItemId: string;
|
|
9
8
|
readonly checkoutBookingId: string | undefined;
|
|
10
|
-
readonly logger: Logger;
|
|
11
9
|
}
|
|
12
10
|
interface UseBookCheckoutBookingForCheckoutItemFunction {
|
|
13
11
|
(args: UseBookCheckoutBookingForCheckoutItemFunctionArgs): UseBookCheckoutBookingForCheckoutItem;
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem.js
CHANGED
|
@@ -2,28 +2,13 @@ import { useCommand } from "@lookiero/messaging-react";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
4
|
import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
6
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
7
5
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
8
|
-
|
|
9
|
-
const useBookCheckoutBookingForCheckoutItem = ({ checkoutItemId, checkoutBookingId, logger, }) => {
|
|
6
|
+
const useBookCheckoutBookingForCheckoutItem = ({ checkoutItemId, checkoutBookingId, }) => {
|
|
10
7
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
aggregateId: checkoutBookingId || uuid(),
|
|
16
|
-
checkoutItemId,
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
logger.captureException(error);
|
|
21
|
-
createNotification({
|
|
22
|
-
level: NotificationLevel.ERROR,
|
|
23
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}, [checkoutBookingId, checkoutItemId, commandBus, createNotification, logger]);
|
|
8
|
+
const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
|
+
aggregateId: checkoutBookingId || uuid(),
|
|
10
|
+
checkoutItemId,
|
|
11
|
+
})), [checkoutBookingId, checkoutItemId, commandBus]);
|
|
27
12
|
return [book, status];
|
|
28
13
|
};
|
|
29
14
|
export { useBookCheckoutBookingForCheckoutItem };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import { Feedbacks } from "../../../../domain/checkoutFeedback/model/feedbacks";
|
|
3
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
4
3
|
interface GiveCheckoutFeedbackFunctionArgs {
|
|
5
4
|
readonly feedbacks: Feedbacks;
|
|
6
5
|
}
|
|
@@ -10,7 +9,6 @@ interface GiveCheckoutFeedbackFunction {
|
|
|
10
9
|
type UseGiveCheckoutFeedback = [giveCheckoutFeedback: GiveCheckoutFeedbackFunction, status: CommandStatus];
|
|
11
10
|
interface UseGiveCheckoutFeedbackFunctionArgs {
|
|
12
11
|
readonly checkoutId: string;
|
|
13
|
-
readonly logger: Logger;
|
|
14
12
|
}
|
|
15
13
|
interface UseGiveCheckoutFeedbackFunction {
|
|
16
14
|
(args: UseGiveCheckoutFeedbackFunctionArgs): UseGiveCheckoutFeedback;
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { giveCheckoutFeedback as giveCheckoutFeedbackCommand } from "../../../../domain/checkoutFeedback/command/giveCheckoutFeedback";
|
|
4
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
5
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
6
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
-
|
|
8
|
-
const useGiveCheckoutFeedback = ({ checkoutId, logger }) => {
|
|
5
|
+
const useGiveCheckoutFeedback = ({ checkoutId }) => {
|
|
9
6
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
checkoutId,
|
|
15
|
-
feedbacks,
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
logger.captureException(error);
|
|
20
|
-
createNotification({
|
|
21
|
-
level: NotificationLevel.ERROR,
|
|
22
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}, [checkoutId, commandBus, createNotification, logger]);
|
|
7
|
+
const giveCheckoutFeedback = useCallback(({ feedbacks }) => commandBus(giveCheckoutFeedbackCommand({
|
|
8
|
+
checkoutId,
|
|
9
|
+
feedbacks,
|
|
10
|
+
})), [checkoutId, commandBus]);
|
|
26
11
|
return [giveCheckoutFeedback, status];
|
|
27
12
|
};
|
|
28
13
|
export { useGiveCheckoutFeedback };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface KeepCheckoutItemFunction {
|
|
4
3
|
(): Promise<void>;
|
|
5
4
|
}
|
|
6
5
|
interface UseKeepCheckoutItemFunctionArgs {
|
|
7
6
|
readonly checkoutItemId: string;
|
|
8
|
-
readonly logger: Logger;
|
|
9
7
|
}
|
|
10
8
|
type UseKeepCheckoutItemResult = [keep: KeepCheckoutItemFunction, status: CommandStatus];
|
|
11
9
|
interface UseKeepCheckoutItemFunction {
|
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { keepCheckoutItem } from "../../../../domain/checkoutItem/command/keepCheckoutItem";
|
|
4
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
5
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
6
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
-
|
|
8
|
-
const useKeepCheckoutItem = ({ checkoutItemId, logger }) => {
|
|
5
|
+
const useKeepCheckoutItem = ({ checkoutItemId }) => {
|
|
9
6
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
await commandBus(keepCheckoutItem({
|
|
14
|
-
aggregateId: checkoutItemId,
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
logger.captureException(error);
|
|
19
|
-
createNotification({
|
|
20
|
-
level: NotificationLevel.ERROR,
|
|
21
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}, [checkoutItemId, commandBus, createNotification, logger]);
|
|
7
|
+
const keep = useCallback(() => commandBus(keepCheckoutItem({
|
|
8
|
+
aggregateId: checkoutItemId,
|
|
9
|
+
})), [checkoutItemId, commandBus]);
|
|
25
10
|
return [keep, status];
|
|
26
11
|
};
|
|
27
12
|
export { useKeepCheckoutItem };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface ReplaceCheckoutItemFunctionArgs {
|
|
4
3
|
readonly replacedForId: string;
|
|
5
4
|
}
|
|
@@ -8,7 +7,6 @@ interface ReplaceCheckoutItemFunction {
|
|
|
8
7
|
}
|
|
9
8
|
interface UseReplaceCheckoutItemFunctionArgs {
|
|
10
9
|
readonly checkoutItemId: string;
|
|
11
|
-
readonly logger: Logger;
|
|
12
10
|
}
|
|
13
11
|
type UseReplaceCheckoutItemResult = [replace: ReplaceCheckoutItemFunction, status: CommandStatus];
|
|
14
12
|
interface UseReplaceCheckoutItemFunction {
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { replaceCheckoutItem } from "../../../../domain/checkoutItem/command/replaceCheckoutItem";
|
|
4
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
5
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
6
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
-
|
|
8
|
-
const useReplaceCheckoutItem = ({ checkoutItemId, logger }) => {
|
|
5
|
+
const useReplaceCheckoutItem = ({ checkoutItemId }) => {
|
|
9
6
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
aggregateId: checkoutItemId,
|
|
15
|
-
replacedForId,
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
logger.captureException(error);
|
|
20
|
-
createNotification({
|
|
21
|
-
level: NotificationLevel.ERROR,
|
|
22
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}, [checkoutItemId, commandBus, createNotification, logger]);
|
|
7
|
+
const replace = useCallback(({ replacedForId }) => commandBus(replaceCheckoutItem({
|
|
8
|
+
aggregateId: checkoutItemId,
|
|
9
|
+
replacedForId,
|
|
10
|
+
})), [checkoutItemId, commandBus]);
|
|
26
11
|
return [replace, status];
|
|
27
12
|
};
|
|
28
13
|
export { useReplaceCheckoutItem };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import { Feedbacks } from "../../../../domain/checkoutItem/model/feedbacks";
|
|
3
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
4
3
|
interface ReturnCheckoutItemFunctionArgs {
|
|
5
4
|
readonly feedbacks: Feedbacks;
|
|
6
5
|
}
|
|
@@ -9,7 +8,6 @@ interface ReturnCheckoutItemFunction {
|
|
|
9
8
|
}
|
|
10
9
|
interface UseReturnCheckoutItemFunctionArgs {
|
|
11
10
|
readonly checkoutItemId: string;
|
|
12
|
-
readonly logger: Logger;
|
|
13
11
|
}
|
|
14
12
|
type UseReturnCheckoutItemResult = [returnCheckoutItem: ReturnCheckoutItemFunction, status: CommandStatus];
|
|
15
13
|
interface UseReturnCheckoutItemFunction {
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { returnCheckoutItem as returnCheckoutItemCommand } from "../../../../domain/checkoutItem/command/returnCheckoutItem";
|
|
4
|
-
import { useCreateNotification } from "../../../../shared/notifications";
|
|
5
|
-
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
6
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
-
|
|
8
|
-
const useReturnCheckoutItem = ({ checkoutItemId, logger }) => {
|
|
5
|
+
const useReturnCheckoutItem = ({ checkoutItemId }) => {
|
|
9
6
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
aggregateId: checkoutItemId,
|
|
15
|
-
feedbacks,
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
logger.captureException(error);
|
|
20
|
-
createNotification({
|
|
21
|
-
level: NotificationLevel.ERROR,
|
|
22
|
-
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}, [checkoutItemId, commandBus, createNotification, logger]);
|
|
7
|
+
const returnCheckoutItem = useCallback(({ feedbacks }) => commandBus(returnCheckoutItemCommand({
|
|
8
|
+
aggregateId: checkoutItemId,
|
|
9
|
+
feedbacks,
|
|
10
|
+
})), [checkoutItemId, commandBus]);
|
|
26
11
|
return [returnCheckoutItem, status];
|
|
27
12
|
};
|
|
28
13
|
export { useReturnCheckoutItem };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
2
|
interface UpdateFunctionArgs {
|
|
4
3
|
readonly key: string;
|
|
5
4
|
readonly value: unknown;
|
|
@@ -8,11 +7,8 @@ interface UpdateFunction {
|
|
|
8
7
|
(args: UpdateFunctionArgs): Promise<void>;
|
|
9
8
|
}
|
|
10
9
|
type UseUpdateUiSetting = [update: UpdateFunction, status: CommandStatus];
|
|
11
|
-
interface UseUpdateUiSettingArgs {
|
|
12
|
-
readonly logger: Logger;
|
|
13
|
-
}
|
|
14
10
|
interface UseUpdateUiSettingFunction {
|
|
15
|
-
(
|
|
11
|
+
(): UseUpdateUiSetting;
|
|
16
12
|
}
|
|
17
13
|
declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
|
|
18
14
|
export { useUpdateUiSetting };
|
|
@@ -3,20 +3,13 @@ import { useCallback } from "react";
|
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
4
|
import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useUpdateUiSetting = (
|
|
6
|
+
const useUpdateUiSetting = () => {
|
|
7
7
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const update = useCallback(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
value,
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
logger.captureException(error);
|
|
18
|
-
}
|
|
19
|
-
}, [commandBus, logger]);
|
|
8
|
+
const update = useCallback(({ key, value }) => commandBus(updateUiSetting({
|
|
9
|
+
aggregateId: uuid(),
|
|
10
|
+
key,
|
|
11
|
+
value,
|
|
12
|
+
})), [commandBus]);
|
|
20
13
|
return [update, status];
|
|
21
14
|
};
|
|
22
15
|
export { useUpdateUiSetting };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpBookedProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpBookedProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-booked-product-variants-for-checkout-item",
|
|
4
|
+
body: { checkoutItemId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpBookedProductsVariantsForCheckoutItemView };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { toCheckoutProjection } from "./checkout";
|
|
2
|
-
const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId, signal }) =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
2
|
+
const httpCheckoutByIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
3
|
+
const response = await httpPost({
|
|
4
|
+
endpoint: "/view-checkout-by-id",
|
|
5
|
+
body: { checkoutId },
|
|
6
|
+
signal,
|
|
7
|
+
});
|
|
8
|
+
return !response.ok || response.status === 404 ? null : toCheckoutProjection((await response.json()).result);
|
|
9
|
+
};
|
|
11
10
|
export { httpCheckoutByIdView };
|
package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { toCheckoutProjection } from "./checkout";
|
|
2
|
-
const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
2
|
+
const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId, signal }) => {
|
|
3
|
+
const response = await httpPost({
|
|
4
|
+
endpoint: "/view-first-available-checkout-by-customer-id",
|
|
5
|
+
body: { customerId },
|
|
6
|
+
signal,
|
|
7
|
+
});
|
|
8
|
+
return !response.ok || response.status === 404 ? null : toCheckoutProjection((await response.json()).result);
|
|
9
|
+
};
|
|
11
10
|
export { httpFirstAvailableCheckoutByCustomerIdView };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
1
|
+
const httpFiveItemsDiscountByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
|
|
2
|
+
const response = await httpGet({
|
|
3
|
+
endpoint: `/view-five-items-discount-by-customer-id/${customerId}`,
|
|
4
|
+
signal,
|
|
5
|
+
});
|
|
6
|
+
return !response.ok ? 0 : await response.json();
|
|
7
|
+
};
|
|
9
8
|
export { httpFiveItemsDiscountByCustomerIdView };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
1
|
+
const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId, signal }) => {
|
|
2
|
+
const response = await httpGet({
|
|
3
|
+
endpoint: `/is-new-checkout-enabled/${customerId}`,
|
|
4
|
+
signal,
|
|
5
|
+
});
|
|
6
|
+
return !response.ok ? false : await response.json();
|
|
7
|
+
};
|
|
9
8
|
export { httpIsCheckoutEnabledByCustomerIdView };
|