@lookiero/checkout 0.8.1-beta.0 → 0.8.1
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/infrastructure/delivery/http/fetchHttpClient.js +19 -34
- package/dist/infrastructure/delivery/http/httpClient.d.ts +3 -9
- 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 +5 -5
- 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/package.json +1 -1
- 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/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
- 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/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/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/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 -55
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -58
- 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/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/notifications/domain/notification/command/removeNotification.tes.d.ts +0 -1
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +0 -9
|
@@ -1,35 +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
|
-
return result?.success(await response.json()) ?? (await response.json());
|
|
29
|
-
}
|
|
30
|
-
if (result?.error) {
|
|
31
|
-
return result.error;
|
|
32
|
-
}
|
|
33
|
-
throw new Error(response.statusText);
|
|
34
|
-
};
|
|
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
|
+
});
|
|
35
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,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 };
|
package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
|
|
5
6
|
import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
6
7
|
import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
|
|
@@ -11,20 +12,19 @@ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
|
11
12
|
const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
|
|
12
13
|
const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
|
|
13
14
|
const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
|
|
14
|
-
const isCheckoutStarted = (event) =>
|
|
15
|
-
console.log(event);
|
|
16
|
-
return event.name === CHECKOUT_STARTED;
|
|
17
|
-
};
|
|
15
|
+
const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
|
|
18
16
|
const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
|
|
19
17
|
const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
|
|
20
18
|
const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
|
|
19
|
+
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
21
20
|
const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
|
|
22
21
|
isCheckoutItemReplaced(event) ||
|
|
23
22
|
isCheckoutItemReturned(event) ||
|
|
24
23
|
isCheckoutStarted(event) ||
|
|
25
24
|
isCheckoutSubmitted(event) ||
|
|
26
25
|
isCheckoutFeedbackGiven(event) ||
|
|
27
|
-
isCheckoutBookingExpired(event)
|
|
26
|
+
isCheckoutBookingExpired(event) ||
|
|
27
|
+
isCheckoutBookingBooked(event);
|
|
28
28
|
const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
|
|
29
29
|
query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
|
|
30
30
|
contextId: MESSAGING_CONTEXT_ID,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-checkout-booking-by-id",
|
|
4
|
+
body: { checkoutBookingId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpCheckoutBookingByIdView };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-checkout-item-by-id",
|
|
4
|
+
body: { checkoutItemId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpCheckoutItemByIdView };
|
package/dist/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpCheckoutQuestionsByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/list-checkout-questions-by-checkout-id",
|
|
4
|
+
body: { checkoutId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpCheckoutQuestionsByCheckoutIdView };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpPaymentFlowPayloadByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpPaymentFlowPayloadByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-payment-flow-payload-by-checkout-id",
|
|
4
|
+
body: { checkoutId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpPaymentFlowPayloadByCheckoutIdView };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-pricing-by-checkout-id",
|
|
4
|
+
body: { checkoutId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpPricingByCheckoutIdView };
|
package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/list-return-questions-by-checkout-item-id",
|
|
4
|
+
body: { checkoutItemId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
10
9
|
export { httpReturnQuestionsByCheckoutItemIdView };
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from "@lookiero/messaging";
|
|
2
|
-
declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
|
|
3
|
-
interface MarkCheckoutAsPaidPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
}
|
|
6
|
-
interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
|
|
7
|
-
}
|
|
8
|
-
interface MarkCheckoutAsPaidFunction {
|
|
9
|
-
(payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
|
|
10
|
-
}
|
|
11
|
-
declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
|
|
12
|
-
export type { MarkCheckoutAsPaid };
|
|
13
|
-
export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
declare const CHECKOUT_PAID = "checkout_paid";
|
|
3
|
-
interface CheckoutPaidPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
}
|
|
6
|
-
interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
|
|
7
|
-
}
|
|
8
|
-
interface CheckoutPaidFunction {
|
|
9
|
-
(payload: CheckoutPaidPayload): CheckoutPaid;
|
|
10
|
-
}
|
|
11
|
-
declare const checkoutPaid: CheckoutPaidFunction;
|
|
12
|
-
export type { CheckoutPaid };
|
|
13
|
-
export { CHECKOUT_PAID, checkoutPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
|
|
2
|
-
const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
|
|
3
|
-
const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
-
const checkoutPaid = domainEvents.find(isCheckoutPaid);
|
|
5
|
-
if (!checkoutPaid) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
await httpPost({
|
|
9
|
-
endpoint: "/mark-checkout-as-paid",
|
|
10
|
-
body: { checkoutId: aggregateId },
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export { httpCheckoutsMarkAsPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface MarkAsPaidFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
|
|
6
|
-
interface UseMarkCheckoutAsPaidFunctionArgs {
|
|
7
|
-
readonly checkoutId?: string;
|
|
8
|
-
}
|
|
9
|
-
interface UseMarkCheckoutAsPaidFunction {
|
|
10
|
-
(args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
|
|
11
|
-
}
|
|
12
|
-
declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
|
|
13
|
-
export { useMarkCheckoutAsPaid };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import invariant from "tiny-invariant";
|
|
4
|
-
import { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
|
|
5
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useMarkCheckoutAsPaid = ({ checkoutId }) => {
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const markAsPaid = useCallback(() => {
|
|
9
|
-
invariant(checkoutId, "CheckoutId must be defined in order to mark the checkout as paid");
|
|
10
|
-
return commandBus(markCheckoutAsPaid({
|
|
11
|
-
aggregateId: checkoutId,
|
|
12
|
-
}));
|
|
13
|
-
}, [checkoutId, commandBus]);
|
|
14
|
-
return [markAsPaid, status];
|
|
15
|
-
};
|
|
16
|
-
export { useMarkCheckoutAsPaid };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface BookFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
-
interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
|
|
7
|
-
readonly checkoutItemId: string;
|
|
8
|
-
}
|
|
9
|
-
interface UseBookCheckouBookingForCheckoutItemFunction {
|
|
10
|
-
(args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
|
|
11
|
-
}
|
|
12
|
-
declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
|
|
13
|
-
export { useBookCheckouBookingForCheckoutItem };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { v4 as uuid } from "uuid";
|
|
4
|
-
import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
|
-
aggregateId: uuid(),
|
|
10
|
-
checkoutItemId,
|
|
11
|
-
})), [checkoutItemId, commandBus]);
|
|
12
|
-
return [book, status];
|
|
13
|
-
};
|
|
14
|
-
export { useBookCheckouBookingForCheckoutItem };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface IncrementIntroShownCountFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseIncrementIntroShownCount = [incrementIntroShownCount: IncrementIntroShownCountFunction, status: CommandStatus];
|
|
6
|
-
interface UseIncrementIntroShownCountFunction {
|
|
7
|
-
(): UseIncrementIntroShownCount;
|
|
8
|
-
}
|
|
9
|
-
declare const useIncrementIntroShownCount: UseIncrementIntroShownCountFunction;
|
|
10
|
-
export { useIncrementIntroShownCount };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { useViewIntroShownCount } from "../../../projection/uiSetting/react/useViewIntroShownCount";
|
|
3
|
-
import { UISettings } from "../../../ui/settings/UISettings";
|
|
4
|
-
import { useUpdateUiSetting } from "./useUpdateUiSetting";
|
|
5
|
-
const useIncrementIntroShownCount = () => {
|
|
6
|
-
const [update, status] = useUpdateUiSetting();
|
|
7
|
-
const [introShownCount] = useViewIntroShownCount();
|
|
8
|
-
const incrementIntroShownCount = useCallback(() => update({ key: UISettings.INTRO_SHOWN_COUNT, value: introShownCount + 1 }), [introShownCount, update]);
|
|
9
|
-
return [incrementIntroShownCount, status];
|
|
10
|
-
};
|
|
11
|
-
export { useIncrementIntroShownCount };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
2
|
-
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
-
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemView extends BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
4
|
-
}
|
|
5
|
-
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs {
|
|
6
|
-
readonly httpPost: HttpPostFunction;
|
|
7
|
-
}
|
|
8
|
-
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction {
|
|
9
|
-
(args: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
10
|
-
}
|
|
11
|
-
declare const httpBookedSizeChangeProductsVariantsForCheckoutItemView: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction;
|
|
12
|
-
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
-
const response = await httpPost({
|
|
3
|
-
endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
|
|
4
|
-
body: { checkoutItemId },
|
|
5
|
-
signal,
|
|
6
|
-
});
|
|
7
|
-
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
-
};
|
|
9
|
-
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
-
import { BookedSizeChangeProductsVariantsProjection } from "../../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
|
|
3
|
-
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs {
|
|
4
|
-
readonly checkoutItemId: string;
|
|
5
|
-
}
|
|
6
|
-
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
7
|
-
(args: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeChangeProductsVariantsProjection>;
|
|
8
|
-
}
|
|
9
|
-
declare const useViewBookedSizeChangeProductsVariantsForCheckoutItem: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
10
|
-
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
-
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
3
|
-
import { viewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
4
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
-
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
6
|
-
const useViewBookedSizeChangeProductsVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
7
|
-
query: viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId }),
|
|
8
|
-
contextId: MESSAGING_CONTEXT_ID,
|
|
9
|
-
invalidation: isCheckoutBookingBooked,
|
|
10
|
-
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
11
|
-
});
|
|
12
|
-
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CheckoutFeedbackByCheckoutIdView } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId";
|
|
2
|
-
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
-
interface HttpCheckoutFeebackByCheckoutIdView extends CheckoutFeedbackByCheckoutIdView {
|
|
4
|
-
}
|
|
5
|
-
interface HttpCheckoutFeebackByCheckoutIdViewFunctionArgs {
|
|
6
|
-
readonly httpPost: HttpPostFunction;
|
|
7
|
-
}
|
|
8
|
-
interface HttpCheckoutFeebackByCheckoutIdViewFunction {
|
|
9
|
-
(args: HttpCheckoutFeebackByCheckoutIdViewFunctionArgs): HttpCheckoutFeebackByCheckoutIdView;
|
|
10
|
-
}
|
|
11
|
-
declare const httpCheckoutFeebackByCheckoutIdView: HttpCheckoutFeebackByCheckoutIdViewFunction;
|
|
12
|
-
export { httpCheckoutFeebackByCheckoutIdView };
|
package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const httpCheckoutFeebackByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
-
const response = await httpPost({
|
|
3
|
-
endpoint: "/view-checkout-feedback-by-checkout-id",
|
|
4
|
-
body: { checkoutId },
|
|
5
|
-
signal,
|
|
6
|
-
});
|
|
7
|
-
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
-
};
|
|
9
|
-
export { httpCheckoutFeebackByCheckoutIdView };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useViewIntroShownCount } from "./useViewIntroShownCount";
|
|
2
|
-
const MAX_INTRO_SHOWN_COUNT = 2;
|
|
3
|
-
const useShouldIntroBeShown = () => {
|
|
4
|
-
const [introShownCount, introShownCountStatus] = useViewIntroShownCount();
|
|
5
|
-
return [introShownCount < MAX_INTRO_SHOWN_COUNT, introShownCountStatus];
|
|
6
|
-
};
|
|
7
|
-
export { useShouldIntroBeShown };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UISettings } from "../../../ui/settings/UISettings";
|
|
2
|
-
import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
|
|
3
|
-
const useViewIntroShownCount = () => {
|
|
4
|
-
const [introShownCount, introShownCountStatus] = useViewUiSettingByKey({
|
|
5
|
-
key: UISettings.INTRO_SHOWN_COUNT,
|
|
6
|
-
});
|
|
7
|
-
return [introShownCount?.value || 0, introShownCountStatus];
|
|
8
|
-
};
|
|
9
|
-
export { useViewIntroShownCount };
|