@lookiero/checkout 0.2.38 → 0.2.39
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/README.md +1 -3
- package/dist/domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem.d.ts +15 -0
- package/dist/domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem.js +7 -0
- package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +4 -4
- package/dist/domain/checkoutBooking/model/checkoutBooking.js +4 -12
- package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +0 -1
- package/dist/infrastructure/delivery/baseBootstrap.d.ts +11 -2
- package/dist/infrastructure/delivery/baseBootstrap.js +8 -1
- package/dist/infrastructure/delivery/bootstrap.js +8 -0
- package/dist/infrastructure/delivery/mock/checkoutBookingDataSource.d.ts +14 -0
- package/dist/infrastructure/delivery/mock/checkoutBookingDataSource.js +12 -0
- package/dist/infrastructure/delivery/mock/dataSourceCheckoutBookings.d.ts +14 -0
- package/dist/infrastructure/delivery/mock/dataSourceCheckoutBookings.js +21 -0
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.d.ts +10 -3
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +16 -19
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBook.d.ts +5 -0
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookingsBook.js +18 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +15 -0
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +15 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +27 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +21 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +9 -0
- package/dist/infrastructure/projection/checkoutBooking/checkoutBooking.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutBooking/checkoutBooking.js +6 -0
- package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.js +10 -0
- package/dist/infrastructure/ui/views/item/Item.js +26 -13
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +13 -0
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +1 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +25 -0
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +8 -0
- package/dist/projection/checkoutBooking/checkoutBooking.d.ts +6 -0
- package/dist/projection/checkoutBooking/checkoutBooking.js +1 -0
- package/dist/projection/checkoutBooking/viewCheckoutBookingById.d.ts +25 -0
- package/dist/projection/checkoutBooking/viewCheckoutBookingById.js +8 -0
- package/dist/projection/checkoutItem/checkoutItem.d.ts +1 -1
- package/package.json +1 -1
- package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -15
- package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js +0 -7
- package/dist/infrastructure/domain/checkoutBooking/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -15
- package/dist/infrastructure/domain/checkoutBooking/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js +0 -14
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/bookedSizeReplaceableProductVariants.mock.d.ts +0 -3
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/bookedSizeReplaceableProductVariants.mock.js +0 -17
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts +0 -34
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +0 -26
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -10
- package/dist/infrastructure/projection/bookedSizeReplaceableProductVariants/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +0 -9
- package/dist/infrastructure/projection/feedback/feedback.mock.d.ts +0 -3
- package/dist/infrastructure/projection/feedback/feedback.mock.js +0 -6
- package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -33
- package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.js +0 -8
package/README.md
CHANGED
|
@@ -15,7 +15,5 @@ This application is build over **Expo** so, the easiest way to install this libr
|
|
|
15
15
|
```shell
|
|
16
16
|
$ nvm use
|
|
17
17
|
$ nvm install --latest-npm
|
|
18
|
-
$ npm install
|
|
18
|
+
$ npm install
|
|
19
19
|
```
|
|
20
|
-
|
|
21
|
-
> The --legacy-peer-deps flag is required because we need to resolve UAF's fixed dependencies like react-native and aurora
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM = "book_checkout_booking_for_checkout_item";
|
|
3
|
+
interface BookCheckoutBookingForCheckoutItemPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
readonly checkoutId: string;
|
|
6
|
+
readonly checkoutItemId: string;
|
|
7
|
+
}
|
|
8
|
+
interface BookCheckoutBookingForCheckoutItem extends Command<typeof BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM>, BookCheckoutBookingForCheckoutItemPayload {
|
|
9
|
+
}
|
|
10
|
+
interface BookCheckoutBookingForCheckoutItemFunction {
|
|
11
|
+
(payload: BookCheckoutBookingForCheckoutItemPayload): BookCheckoutBookingForCheckoutItem;
|
|
12
|
+
}
|
|
13
|
+
declare const bookCheckoutBookingForCheckoutItem: BookCheckoutBookingForCheckoutItemFunction;
|
|
14
|
+
export type { BookCheckoutBookingForCheckoutItem };
|
|
15
|
+
export { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItem };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { command } from "@lookiero/messaging";
|
|
2
|
+
const BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM = "book_checkout_booking_for_checkout_item";
|
|
3
|
+
const bookCheckoutBookingForCheckoutItem = ({ aggregateId, ...payload }) => ({
|
|
4
|
+
...command({ aggregateId, name: BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
export { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItem };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
-
import {
|
|
2
|
+
import { BookCheckoutBookingForCheckoutItem } from "../command/bookCheckoutBookingForCheckoutItem";
|
|
3
3
|
interface CheckoutBooking extends AggregateRoot {
|
|
4
4
|
readonly checkoutId: string;
|
|
5
|
-
readonly
|
|
5
|
+
readonly checkoutItemIds: string[];
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
7
|
+
declare const bookCheckoutBookingForCheckoutItemHandler: CommandHandlerFunction<BookCheckoutBookingForCheckoutItem, CheckoutBooking>;
|
|
8
8
|
export type { CheckoutBooking };
|
|
9
|
-
export {
|
|
9
|
+
export { bookCheckoutBookingForCheckoutItemHandler };
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { checkoutBookingBooked } from "./checkoutBookingBooked";
|
|
2
|
-
const
|
|
3
|
-
const { aggregateId,
|
|
2
|
+
const bookCheckoutBookingForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
|
+
const { aggregateId, checkoutItemId } = command;
|
|
4
4
|
return {
|
|
5
5
|
...aggregateRoot,
|
|
6
|
-
|
|
7
|
-
checkoutItemId,
|
|
8
|
-
domainEvents: [
|
|
9
|
-
checkoutBookingBooked({
|
|
10
|
-
aggregateId,
|
|
11
|
-
checkoutId,
|
|
12
|
-
checkoutItemId,
|
|
13
|
-
}),
|
|
14
|
-
],
|
|
6
|
+
domainEvents: [checkoutBookingBooked({ aggregateId, checkoutItemId })],
|
|
15
7
|
};
|
|
16
8
|
};
|
|
17
|
-
export {
|
|
9
|
+
export { bookCheckoutBookingForCheckoutItemHandler };
|
|
@@ -2,7 +2,6 @@ import { DomainEvent } from "@lookiero/messaging";
|
|
|
2
2
|
declare const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
|
|
3
3
|
interface CheckoutBookingBookedPayload {
|
|
4
4
|
readonly aggregateId: string;
|
|
5
|
-
readonly checkoutId: string;
|
|
6
5
|
readonly checkoutItemId: string;
|
|
7
6
|
}
|
|
8
7
|
interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {
|
|
@@ -2,10 +2,13 @@ import { AggregateRoot, RepositoryGetFunction, RepositoryGetFunctionArgs, Reposi
|
|
|
2
2
|
import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
|
|
3
3
|
import { Checkout } from "../../domain/checkout/model/checkout";
|
|
4
4
|
import { CheckoutsGetFunction, CheckoutsSaveFunction } from "../../domain/checkout/model/checkouts";
|
|
5
|
+
import { CheckoutBooking } from "../../domain/checkoutBooking/model/checkoutBooking";
|
|
6
|
+
import { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction } from "../../domain/checkoutBooking/model/checkoutBookings";
|
|
5
7
|
import { CheckoutItem } from "../../domain/checkoutItem/model/checkoutItem";
|
|
6
8
|
import { CheckoutItemsGetFunction, CheckoutItemsSaveFunction } from "../../domain/checkoutItem/model/checkoutItems";
|
|
7
9
|
import { UiSetting } from "../../domain/uiSetting/model/uiSetting";
|
|
8
10
|
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../domain/uiSetting/model/uiSettings";
|
|
11
|
+
import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
9
12
|
import { CheckoutByIdView } from "../../projection/checkout/viewCheckoutById";
|
|
10
13
|
import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
11
14
|
import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
@@ -16,7 +19,7 @@ import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKe
|
|
|
16
19
|
declare const MESSAGING_CONTEXT_ID = "Checkout";
|
|
17
20
|
declare type NeverWhenEmptyRecord<K extends [Record<string, unknown>]> = K extends [Record<string, never>] ? [never?] : K;
|
|
18
21
|
declare type RepositoryDependencies<A extends AggregateRoot, GetFunctionArgs extends RepositoryGetFunctionArgs, SaveFunctionArgs extends RepositorySaveFunctionArgs> = Omit<Parameters<RepositoryGetFunction<A, GetFunctionArgs>>[0] & Parameters<RepositorySaveFunction<A, SaveFunctionArgs>>[0], keyof RepositoryGetFunctionArgs>;
|
|
19
|
-
interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs, UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutItemSaveFunctionArgs extends RepositorySaveFunctionArgs> {
|
|
22
|
+
interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs, UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutItemSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutBookingGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutBookingSaveFunctionArgs extends RepositorySaveFunctionArgs> {
|
|
20
23
|
readonly checkoutByIdView: CheckoutByIdView;
|
|
21
24
|
readonly firstAvailableCheckoutByCustomerIdView: FirstAvailableCheckoutByCustomerIdView;
|
|
22
25
|
readonly isCheckoutEnabledByCustomerIdView: IsCheckoutEnabledByCustomerIdView;
|
|
@@ -24,6 +27,7 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
24
27
|
readonly uiSettingByKeyView: UiSettingByKeyView;
|
|
25
28
|
readonly checkoutItemByIdView: CheckoutItemByIdView;
|
|
26
29
|
readonly returnQuestionsByCheckoutItemIdView: ReturnQuestionsByCheckoutItemIdView;
|
|
30
|
+
readonly bookedSizeChangeProductsVariantsForCheckoutItemView: BookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
27
31
|
readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
|
|
28
32
|
readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
|
|
29
33
|
readonly uiSettingsDependencies: NeverWhenEmptyRecord<[
|
|
@@ -39,9 +43,14 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
39
43
|
readonly checkoutItemsDependencies: NeverWhenEmptyRecord<[
|
|
40
44
|
RepositoryDependencies<CheckoutItem, CheckoutItemGetFunctionArgs, CheckoutItemSaveFunctionArgs>
|
|
41
45
|
]>;
|
|
46
|
+
readonly getCheckoutBooking: CheckoutBookingsGetFunction<CheckoutBookingGetFunctionArgs>;
|
|
47
|
+
readonly saveCheckoutBooking: CheckoutBookingsSaveFunction<CheckoutBookingSaveFunctionArgs>;
|
|
48
|
+
readonly checkoutBookingsDependencies: NeverWhenEmptyRecord<[
|
|
49
|
+
RepositoryDependencies<CheckoutBooking, CheckoutBookingGetFunctionArgs, CheckoutBookingSaveFunctionArgs>
|
|
50
|
+
]>;
|
|
42
51
|
}
|
|
43
52
|
interface BaseBootstrapFunction {
|
|
44
|
-
<UiSettingGetArgs extends RepositoryGetFunctionArgs, UiSettingSaveArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutItemSaveFunctionArgs extends RepositorySaveFunctionArgs>(args: BaseBootstrapFunctionArgs<UiSettingGetArgs, UiSettingSaveArgs, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs, CheckoutItemGetFunctionArgs, CheckoutItemSaveFunctionArgs>): BuildBootstrapFunctionReturn;
|
|
53
|
+
<UiSettingGetArgs extends RepositoryGetFunctionArgs, UiSettingSaveArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutItemSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutBookingGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutBookingSaveFunctionArgs extends RepositorySaveFunctionArgs>(args: BaseBootstrapFunctionArgs<UiSettingGetArgs, UiSettingSaveArgs, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs, CheckoutItemGetFunctionArgs, CheckoutItemSaveFunctionArgs, CheckoutBookingGetFunctionArgs, CheckoutBookingSaveFunctionArgs>): BuildBootstrapFunctionReturn;
|
|
45
54
|
}
|
|
46
55
|
declare const baseBootstrap: BaseBootstrapFunction;
|
|
47
56
|
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
2
2
|
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
3
3
|
import { startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
4
|
+
import { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM } from "../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
|
+
import { bookCheckoutBookingForCheckoutItemHandler, } from "../../domain/checkoutBooking/model/checkoutBooking";
|
|
4
6
|
import { KEEP_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/keepCheckoutItem";
|
|
5
7
|
import { keepCheckoutItemHandler } from "../../domain/checkoutItem/model/checkoutItem";
|
|
6
8
|
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
7
9
|
import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
10
|
+
import { viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, } from "../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
8
11
|
import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID, } from "../../projection/checkout/viewCheckoutById";
|
|
9
12
|
import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
10
13
|
import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
@@ -14,7 +17,7 @@ import { viewCheckoutItemByIdHandler, VIEW_CHECKOUT_ITEM_BY_ID, } from "../../pr
|
|
|
14
17
|
import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
15
18
|
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
16
19
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
17
|
-
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, }) => messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
20
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedSizeChangeProductsVariantsForCheckoutItemView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, }) => messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
18
21
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
19
22
|
view: fiveItemsDiscountByCustomerIdView,
|
|
20
23
|
})
|
|
@@ -36,6 +39,10 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
36
39
|
view: returnQuestionsByCheckoutItemIdView,
|
|
37
40
|
})
|
|
38
41
|
.command(KEEP_CHECKOUT_ITEM, keepCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
42
|
+
.query(VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, {
|
|
43
|
+
view: bookedSizeChangeProductsVariantsForCheckoutItemView,
|
|
44
|
+
})
|
|
45
|
+
.command(BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItemHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
39
46
|
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
40
47
|
view: uiSettingByKeyView,
|
|
41
48
|
})
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getCheckout, saveCheckout } from "../domain/checkout/model/httpCheckouts";
|
|
2
|
+
import { getCheckoutBooking, saveCheckoutBooking } from "../domain/checkoutBooking/model/httpCheckoutBookings";
|
|
2
3
|
import { getCheckoutItem, saveCheckoutItem } from "../domain/checkoutItem/model/httpCheckoutItems";
|
|
3
4
|
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
4
5
|
import { read, write } from "../persistence/asyncStorageStorage";
|
|
6
|
+
import { httpBookedSizeChangeProductsVariantsForCheckoutItemView } from "../projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView";
|
|
5
7
|
import { httpCheckoutByIdView } from "../projection/checkout/httpCheckoutByIdView";
|
|
6
8
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checkout/httpFirstAvailableCheckoutByCustomerIdView";
|
|
7
9
|
import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/httpFiveItemsDiscountByCustomerIdView";
|
|
@@ -22,6 +24,9 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
22
24
|
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
23
25
|
checkoutItemByIdView: httpCheckoutItemByIdView({ httpPost }),
|
|
24
26
|
returnQuestionsByCheckoutItemIdView: httpReturnQuestionsByCheckoutItemIdView({ httpPost }),
|
|
27
|
+
bookedSizeChangeProductsVariantsForCheckoutItemView: httpBookedSizeChangeProductsVariantsForCheckoutItemView({
|
|
28
|
+
httpPost,
|
|
29
|
+
}),
|
|
25
30
|
getUiSetting,
|
|
26
31
|
saveUiSetting,
|
|
27
32
|
uiSettingsDependencies: [{ read, write }],
|
|
@@ -31,6 +36,9 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
31
36
|
getCheckoutItem,
|
|
32
37
|
saveCheckoutItem,
|
|
33
38
|
checkoutItemsDependencies: [{ httpPost }],
|
|
39
|
+
getCheckoutBooking,
|
|
40
|
+
saveCheckoutBooking,
|
|
41
|
+
checkoutBookingsDependencies: [{ httpPost }],
|
|
34
42
|
});
|
|
35
43
|
};
|
|
36
44
|
export { bootstrap };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
2
|
+
interface CheckoutBookingDataSourceFunctionArgs {
|
|
3
|
+
readonly data: CheckoutBookingProjection;
|
|
4
|
+
}
|
|
5
|
+
interface CheckoutBookingDataSource {
|
|
6
|
+
readonly getCheckoutBooking: (id: string) => CheckoutBookingProjection | undefined;
|
|
7
|
+
readonly saveCheckoutBooking: (checkoutBooking: CheckoutBookingProjection) => void;
|
|
8
|
+
}
|
|
9
|
+
interface CheckoutBookingDataSourceFunction {
|
|
10
|
+
(args: CheckoutBookingDataSourceFunctionArgs): CheckoutBookingDataSource;
|
|
11
|
+
}
|
|
12
|
+
declare const checkoutBookingDataSource: CheckoutBookingDataSourceFunction;
|
|
13
|
+
export type { CheckoutBookingDataSource };
|
|
14
|
+
export { checkoutBookingDataSource };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const checkoutBookingDataSource = ({ data: initialData }) => {
|
|
2
|
+
let data = initialData;
|
|
3
|
+
const getCheckoutBooking = () => data;
|
|
4
|
+
const saveCheckoutBooking = (checkoutBooking) => {
|
|
5
|
+
data = checkoutBooking;
|
|
6
|
+
};
|
|
7
|
+
return {
|
|
8
|
+
getCheckoutBooking,
|
|
9
|
+
saveCheckoutBooking,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export { checkoutBookingDataSource };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutBooking } from "../../../domain/checkoutBooking/model/checkoutBooking";
|
|
3
|
+
import { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction } from "../../../domain/checkoutBooking/model/checkoutBookings";
|
|
4
|
+
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
5
|
+
import { CheckoutBookingDataSource } from "./checkoutBookingDataSource";
|
|
6
|
+
declare const toCheckoutBookingProjection: (checkoutBooking: CheckoutBooking) => CheckoutBookingProjection;
|
|
7
|
+
declare const getCheckoutBooking: CheckoutBookingsGetFunction<RepositoryGetFunctionArgs>;
|
|
8
|
+
interface DataSourceCheckoutItemsSaveFunctionArgs extends RepositorySaveFunctionArgs {
|
|
9
|
+
readonly dataSource: CheckoutBookingDataSource;
|
|
10
|
+
}
|
|
11
|
+
interface DataSourceCheckoutItemsSaveFunction extends CheckoutBookingsSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {
|
|
12
|
+
}
|
|
13
|
+
declare const saveCheckoutBooking: DataSourceCheckoutItemsSaveFunction;
|
|
14
|
+
export { getCheckoutBooking, saveCheckoutBooking, toCheckoutBookingProjection };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
import { viewBookedSizeChangeProductsVariantsForCheckoutItem, } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
3
|
+
const toCheckoutBookingDomain = (checkoutBooking) => {
|
|
4
|
+
invariant(checkoutBooking, "No checkoutBooking found!");
|
|
5
|
+
return {
|
|
6
|
+
aggregateId: checkoutBooking.id,
|
|
7
|
+
checkoutId: checkoutBooking.checkoutId,
|
|
8
|
+
checkoutItemIds: [checkoutBooking.checkoutItemId],
|
|
9
|
+
domainEvents: [],
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const toCheckoutBookingProjection = (checkoutBooking) => ({
|
|
13
|
+
id: checkoutBooking.aggregateId,
|
|
14
|
+
checkoutId: checkoutBooking.checkoutId,
|
|
15
|
+
checkoutItemIds: checkoutBooking.checkoutItemIds,
|
|
16
|
+
});
|
|
17
|
+
const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toCheckoutBookingDomain(await queryBus(viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId: aggregateId })));
|
|
18
|
+
const saveCheckoutBooking = ({ dataSource }) => async (aggregateRoot) => {
|
|
19
|
+
dataSource.saveCheckoutBooking(toCheckoutBookingProjection(aggregateRoot));
|
|
20
|
+
};
|
|
21
|
+
export { getCheckoutBooking, saveCheckoutBooking, toCheckoutBookingProjection };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction } from "../../../../domain/checkoutBooking/model/checkoutBookings";
|
|
2
3
|
import { HttpPostFunction } from "../../../delivery/http/httpClient";
|
|
3
|
-
interface
|
|
4
|
+
interface HttpCheckoutBookingsGetFunctionArgs extends RepositoryGetFunctionArgs {
|
|
5
|
+
}
|
|
6
|
+
interface HttpCheckoutBookingsGetFunction extends CheckoutBookingsGetFunction<HttpCheckoutBookingsGetFunctionArgs> {
|
|
7
|
+
}
|
|
8
|
+
declare const getCheckoutBooking: HttpCheckoutBookingsGetFunction;
|
|
9
|
+
interface HttpCheckoutBookingsSaveFunctionArgs extends RepositorySaveFunctionArgs {
|
|
4
10
|
readonly httpPost: HttpPostFunction;
|
|
5
11
|
}
|
|
6
12
|
interface HttpCheckoutBookingsSaveFunction extends CheckoutBookingsSaveFunction<HttpCheckoutBookingsSaveFunctionArgs> {
|
|
7
13
|
}
|
|
8
14
|
declare const saveCheckoutBooking: HttpCheckoutBookingsSaveFunction;
|
|
9
|
-
export {
|
|
15
|
+
export type { HttpCheckoutBookingsSaveFunction };
|
|
16
|
+
export { getCheckoutBooking, saveCheckoutBooking };
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
throw new Error("Book size replaceable product variants for checkout item");
|
|
13
|
-
}
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
catch (ignored) {
|
|
17
|
-
throw new Error("Could not fetch BookSizeReplaceableProductVariantsForCheckoutItem");
|
|
18
|
-
}
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
import { viewCheckoutBookingById, } from "../../../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
3
|
+
import { httpCheckoutBookingsBook } from "./httpCheckoutBookingsBook";
|
|
4
|
+
const toDomain = (checkoutBooking) => {
|
|
5
|
+
invariant(checkoutBooking, "No checkout booking found!");
|
|
6
|
+
return {
|
|
7
|
+
checkoutId: checkoutBooking.checkoutId,
|
|
8
|
+
checkoutItemIds: checkoutBooking.checkoutItemIds,
|
|
9
|
+
aggregateId: checkoutBooking.id,
|
|
10
|
+
domainEvents: [],
|
|
11
|
+
};
|
|
19
12
|
};
|
|
20
|
-
|
|
13
|
+
const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toDomain(await queryBus(viewCheckoutBookingById({ checkoutBookingId: aggregateId })));
|
|
14
|
+
const saveCheckoutBooking = ({ httpPost }) => async (aggregateRoot) => {
|
|
15
|
+
await httpCheckoutBookingsBook({ httpPost })(aggregateRoot);
|
|
16
|
+
};
|
|
17
|
+
export { getCheckoutBooking, saveCheckoutBooking };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpCheckoutBookingsSaveFunction } from "./httpCheckoutBookings";
|
|
2
|
+
interface HttpCheckoutBookingsBookFunction extends HttpCheckoutBookingsSaveFunction {
|
|
3
|
+
}
|
|
4
|
+
declare const httpCheckoutBookingsBook: HttpCheckoutBookingsBookFunction;
|
|
5
|
+
export { httpCheckoutBookingsBook };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
2
|
+
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
3
|
+
const httpCheckoutBookingsBook = ({ httpPost }) => async ({ aggregateId, checkoutId, domainEvents }) => {
|
|
4
|
+
const checkoutBookingBooked = domainEvents.find(isCheckoutBookingBooked);
|
|
5
|
+
if (!checkoutBookingBooked) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const { checkoutItemId } = checkoutBookingBooked;
|
|
9
|
+
httpPost({
|
|
10
|
+
endpoint: "/book-size-replaceable-product-variants-for-checkout-item",
|
|
11
|
+
body: {
|
|
12
|
+
checkout_id: checkoutId,
|
|
13
|
+
checkout_item_id: checkoutItemId,
|
|
14
|
+
checkout_booking_id: aggregateId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { httpCheckoutBookingsBook };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface BookFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
declare type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
+
interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
|
|
7
|
+
readonly checkoutId: string;
|
|
8
|
+
readonly checkoutItemId: string;
|
|
9
|
+
readonly checkoutBookingId: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
interface UseBookCheckouBookingForCheckoutItemFunction {
|
|
12
|
+
(args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
|
|
13
|
+
}
|
|
14
|
+
declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
|
|
15
|
+
export { useBookCheckouBookingForCheckoutItem };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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 = ({ checkoutId, checkoutItemId, checkoutBookingId, }) => {
|
|
7
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
+
const book = useCallback(async () => await commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
|
+
aggregateId: checkoutBookingId || uuid(),
|
|
10
|
+
checkoutId,
|
|
11
|
+
checkoutItemId,
|
|
12
|
+
})), [checkoutBookingId, checkoutId, checkoutItemId, commandBus]);
|
|
13
|
+
return [book, status];
|
|
14
|
+
};
|
|
15
|
+
export { useBookCheckouBookingForCheckoutItem };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BookedSizeChangeProductsVariantsProjection } from "../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
|
|
2
|
+
interface SizeDto {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly lookiero: string;
|
|
5
|
+
readonly uk: string;
|
|
6
|
+
readonly it: string;
|
|
7
|
+
readonly europe: string;
|
|
8
|
+
readonly unique: boolean;
|
|
9
|
+
readonly visual_order?: number;
|
|
10
|
+
}
|
|
11
|
+
interface ProductVariantDto {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly size: SizeDto;
|
|
14
|
+
}
|
|
15
|
+
interface BookedSizeChangeProductsVariantsDto {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly checkoutId: string;
|
|
18
|
+
readonly checkoutItemId: string;
|
|
19
|
+
readonly booking: string | null;
|
|
20
|
+
readonly product_variants: ProductVariantDto[];
|
|
21
|
+
}
|
|
22
|
+
interface ToBookedSizeChangeProductsVariantsProjectionFunction {
|
|
23
|
+
(bookedSizeChangeProductsVariantsDto: BookedSizeChangeProductsVariantsDto): BookedSizeChangeProductsVariantsProjection;
|
|
24
|
+
}
|
|
25
|
+
declare const toBookedSizeChangeProductsVariantsProjection: ToBookedSizeChangeProductsVariantsProjectionFunction;
|
|
26
|
+
export type { BookedSizeChangeProductsVariantsDto };
|
|
27
|
+
export { toBookedSizeChangeProductsVariantsProjection };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const toSizeProjection = (size) => ({
|
|
2
|
+
id: size.id,
|
|
3
|
+
lookiero: size.lookiero,
|
|
4
|
+
uk: size.uk,
|
|
5
|
+
it: size.it,
|
|
6
|
+
europe: size.europe,
|
|
7
|
+
unique: size.unique,
|
|
8
|
+
visualOrder: size.visual_order,
|
|
9
|
+
});
|
|
10
|
+
const toProductVariantProjection = (productVariant) => ({
|
|
11
|
+
id: productVariant.id,
|
|
12
|
+
size: toSizeProjection(productVariant.size),
|
|
13
|
+
});
|
|
14
|
+
const toBookedSizeChangeProductsVariantsProjection = (bookedSizeChangeProductsVariantsDto) => ({
|
|
15
|
+
id: bookedSizeChangeProductsVariantsDto.id,
|
|
16
|
+
checkoutId: bookedSizeChangeProductsVariantsDto.checkoutId,
|
|
17
|
+
checkoutItemId: bookedSizeChangeProductsVariantsDto.checkoutItemId,
|
|
18
|
+
booking: bookedSizeChangeProductsVariantsDto.booking,
|
|
19
|
+
productVariants: bookedSizeChangeProductsVariantsDto.product_variants.map(toProductVariantProjection),
|
|
20
|
+
});
|
|
21
|
+
export { toBookedSizeChangeProductsVariantsProjection };
|
|
@@ -0,0 +1,12 @@
|
|
|
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 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { toBookedSizeChangeProductsVariantsProjection } from "./bookedSizeChangeProductsVariants";
|
|
2
|
+
const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
3
|
+
const response = await httpPost({
|
|
4
|
+
endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
|
|
5
|
+
body: { checkoutItemId },
|
|
6
|
+
signal,
|
|
7
|
+
});
|
|
8
|
+
return !response.ok || response.status === 404
|
|
9
|
+
? null
|
|
10
|
+
: toBookedSizeChangeProductsVariantsProjection((await response.json()).result);
|
|
11
|
+
};
|
|
12
|
+
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { viewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
3
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
|
+
const useViewBookedSizeChangeProductsVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
5
|
+
query: viewBookedSizeChangeProductsVariantsForCheckoutItem({ checkoutItemId }),
|
|
6
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
|
+
});
|
|
9
|
+
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
2
|
+
interface CheckoutBookingDto {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly checkoutId: string;
|
|
5
|
+
readonly checkoutItemIds: string[];
|
|
6
|
+
}
|
|
7
|
+
interface ToCheckoutBookingProjectionFunction {
|
|
8
|
+
(checkoutBookingDto: CheckoutBookingDto): CheckoutBookingProjection;
|
|
9
|
+
}
|
|
10
|
+
declare const toCheckoutBookingProjection: ToCheckoutBookingProjectionFunction;
|
|
11
|
+
export type { CheckoutBookingDto };
|
|
12
|
+
export { toCheckoutBookingProjection };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckoutBookingByIdView } from "../../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpCheckoutBookingByIdView extends CheckoutBookingByIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpCheckoutBookingByIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpCheckoutBookingByIdViewFunction {
|
|
9
|
+
(args: HttpCheckoutBookingByIdViewFunctionArgs): HttpCheckoutBookingByIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpCheckoutBookingByIdView: HttpCheckoutBookingByIdViewFunction;
|
|
12
|
+
export { httpCheckoutBookingByIdView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { toCheckoutBookingProjection } from "./checkoutBooking";
|
|
2
|
+
const httpCheckoutBookingByIdView = ({ httpPost }) => async ({ checkoutBookingId, signal }) => {
|
|
3
|
+
const response = await httpPost({
|
|
4
|
+
endpoint: "/view-checkout-booking-by-id",
|
|
5
|
+
body: { checkoutBookingId },
|
|
6
|
+
signal,
|
|
7
|
+
});
|
|
8
|
+
return !response.ok || response.status === 404 ? null : toCheckoutBookingProjection((await response.json()).result);
|
|
9
|
+
};
|
|
10
|
+
export { httpCheckoutBookingByIdView };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React, { useCallback, useState } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { useParams } from "react-router-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
6
|
import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
7
|
-
import {
|
|
7
|
+
import { useBookCheckouBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem";
|
|
8
|
+
import { useKeepCheckoutItem } from "../../../domain/checkoutItem/react/useKeepCheckoutItem";
|
|
9
|
+
import { useViewBookedSizeChangeProductsVariantsForCheckoutItem } from "../../../projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem";
|
|
8
10
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
9
|
-
import { feedback as feedbackMock } from "../../../projection/feedback/feedback.mock";
|
|
10
11
|
import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
|
|
11
12
|
import { Body } from "../../components/layouts/body/Body";
|
|
12
13
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
@@ -22,9 +23,21 @@ const Item = ({ customerId }) => {
|
|
|
22
23
|
const { id } = useParams();
|
|
23
24
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
24
25
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
25
|
-
const [
|
|
26
|
+
const [bookedSizeChangeProductsVariants, bookedSizeChangeProductsVariantsStatus] = useViewBookedSizeChangeProductsVariantsForCheckoutItem({
|
|
26
27
|
checkoutItemId: checkoutItem.id,
|
|
27
28
|
});
|
|
29
|
+
const [bookCheckouBooking] = useBookCheckouBookingForCheckoutItem({
|
|
30
|
+
checkoutBookingId: bookedSizeChangeProductsVariants?.id,
|
|
31
|
+
checkoutId: checkout?.id,
|
|
32
|
+
checkoutItemId: checkoutItem.id,
|
|
33
|
+
});
|
|
34
|
+
const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
|
|
35
|
+
checkoutItemId: checkoutItem.id,
|
|
36
|
+
});
|
|
37
|
+
const [keepCheckoutItem] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id });
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
checkout?.bookingId === undefined && bookCheckouBooking();
|
|
40
|
+
}, [bookCheckouBooking, checkout?.bookingId]);
|
|
28
41
|
const [stickyHeight, setStickyHeight] = useState(0);
|
|
29
42
|
const handleOnStickyLayout = useCallback(({ height }) => setStickyHeight(height), []);
|
|
30
43
|
const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(false);
|
|
@@ -32,21 +45,21 @@ const Item = ({ customerId }) => {
|
|
|
32
45
|
const handleOnHideReturnQuestions = useCallback(() => setReturnQuestionsVisible(false), []);
|
|
33
46
|
const handleOnEditFeedback = useCallback(() => void 0, []);
|
|
34
47
|
const handleOnSubmit = useCallback(() => handleOnHideReturnQuestions(), [handleOnHideReturnQuestions]);
|
|
35
|
-
const handleOnKeep = useCallback(() => void 0, []);
|
|
36
48
|
const handleOnReplace = useCallback(() => void 0, []);
|
|
37
49
|
const handleOnReturn = useCallback(() => handleOnShowReturnQuestions(), [handleOnShowReturnQuestions]);
|
|
38
50
|
const handleOnBannerPress = useCallback(() => void 0, []);
|
|
39
51
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
40
|
-
const dependenciesLoaded = dependenciesLoadedStatuses.includes(returnQuestionsStatus) &&
|
|
52
|
+
const dependenciesLoaded = dependenciesLoadedStatuses.includes(returnQuestionsStatus) &&
|
|
53
|
+
dependenciesLoadedStatuses.includes(checkoutStatus) &&
|
|
54
|
+
dependenciesLoadedStatuses.includes(bookedSizeChangeProductsVariantsStatus);
|
|
41
55
|
if (!dependenciesLoaded)
|
|
42
56
|
return React.createElement(Spinner, null);
|
|
43
57
|
const { price } = checkoutItem;
|
|
44
58
|
const { media, brand, name, size, color } = checkoutItem.productVariant;
|
|
45
59
|
const customerDecissionMade = checkoutItem.status === CheckoutItemStatus.INITIAL || checkoutItem.status === CheckoutItemStatus.EXPIRED;
|
|
46
|
-
const
|
|
47
|
-
const sizes = bookedSizeReplaceableProductVariantsMock.productVariants
|
|
60
|
+
const sizes = bookedSizeChangeProductsVariants?.productVariants
|
|
48
61
|
.map((productVariant) => productVariant.size)
|
|
49
|
-
.concat(checkoutItem.productVariant.size);
|
|
62
|
+
.concat(checkoutItem.productVariant.size) || [];
|
|
50
63
|
return (React.createElement(React.Fragment, null,
|
|
51
64
|
React.createElement(SafeAreaScrollView, null,
|
|
52
65
|
React.createElement(Body, null,
|
|
@@ -55,9 +68,9 @@ const Item = ({ customerId }) => {
|
|
|
55
68
|
React.createElement(View, { style: style.sliderContainer },
|
|
56
69
|
React.createElement(ProductVariantSlider, { producVariantMedia: media })),
|
|
57
70
|
React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: size }),
|
|
58
|
-
|
|
59
|
-
React.createElement(ReturnQuestionsFeedback, { feedback: feedback, returnQuestions: returnQuestions, onEditFeedback: handleOnEditFeedback })))))),
|
|
60
|
-
customerDecissionMade && (React.createElement(ItemActions, { size: checkoutItem.productVariant.size, sizes: sizes, onKeep:
|
|
61
|
-
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, feedback: feedback, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
|
|
71
|
+
checkoutItem.feedback && (React.createElement(View, { style: style.feedbackContainer },
|
|
72
|
+
React.createElement(ReturnQuestionsFeedback, { feedback: checkoutItem.feedback, returnQuestions: returnQuestions || [], onEditFeedback: handleOnEditFeedback })))))),
|
|
73
|
+
customerDecissionMade && (React.createElement(ItemActions, { size: checkoutItem.productVariant.size, sizes: sizes, onKeep: keepCheckoutItem, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn })),
|
|
74
|
+
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, feedback: checkoutItem.feedback || {}, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
|
|
62
75
|
};
|
|
63
76
|
export { Item };
|
package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SizeProjection } from "../shared/size";
|
|
2
|
+
interface ProductVariantProjection {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly size: SizeProjection;
|
|
5
|
+
}
|
|
6
|
+
interface BookedSizeChangeProductsVariantsProjection {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly checkoutId: string;
|
|
9
|
+
readonly checkoutItemId: string;
|
|
10
|
+
readonly booking: string | null;
|
|
11
|
+
readonly productVariants: ProductVariantProjection[];
|
|
12
|
+
}
|
|
13
|
+
export type { BookedSizeChangeProductsVariantsProjection, ProductVariantProjection };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { BookedSizeChangeProductsVariantsProjection } from "./bookedSizeChangeProductsVariants";
|
|
3
|
+
declare const VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_change_product_variants_for_checkout_item";
|
|
4
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload {
|
|
5
|
+
readonly checkoutItemId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItem extends Query<typeof VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
10
|
+
(payload: ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload): ViewBookedSizeChangeProductsVariantsForCheckoutItem;
|
|
11
|
+
}
|
|
12
|
+
declare const viewBookedSizeChangeProductsVariantsForCheckoutItem: ViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
13
|
+
declare type ViewBookedSizeChangeProductsVariantsForCheckoutItemResult = BookedSizeChangeProductsVariantsProjection | null;
|
|
14
|
+
interface BookedSizeChangeProductsVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutItemId: string;
|
|
16
|
+
}
|
|
17
|
+
interface BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
18
|
+
(args: BookedSizeChangeProductsVariantsForCheckoutItemViewArgs): Promise<ViewBookedSizeChangeProductsVariantsForCheckoutItemResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: BookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
22
|
+
}
|
|
23
|
+
declare const viewBookedSizeChangeProductsVariantsForCheckoutItemHandler: QueryHandlerFunction<ViewBookedSizeChangeProductsVariantsForCheckoutItem, ViewBookedSizeChangeProductsVariantsForCheckoutItemResult, ViewBookedSizeChangeProductsVariantsForCheckoutItemHandlerFunctionArgs>;
|
|
24
|
+
export type { ViewBookedSizeChangeProductsVariantsForCheckoutItem, BookedSizeChangeProductsVariantsForCheckoutItemView, ViewBookedSizeChangeProductsVariantsForCheckoutItemResult, };
|
|
25
|
+
export { VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItem, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_change_product_variants_for_checkout_item";
|
|
3
|
+
const viewBookedSizeChangeProductsVariantsForCheckoutItem = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewBookedSizeChangeProductsVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
|
|
8
|
+
export { VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItem, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutBookingProjection } from "./checkoutBooking";
|
|
3
|
+
declare const VIEW_CHECKOUT_BOOKING_BY_ID = "view_checkout_booking_by_id";
|
|
4
|
+
interface ViewCheckoutBookingByIdPayload {
|
|
5
|
+
readonly checkoutBookingId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewCheckoutBookingById extends Query<typeof VIEW_CHECKOUT_BOOKING_BY_ID>, ViewCheckoutBookingByIdPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ViewCheckoutBookingByIdFunction {
|
|
10
|
+
(payload: ViewCheckoutBookingByIdPayload): ViewCheckoutBookingById;
|
|
11
|
+
}
|
|
12
|
+
declare const viewCheckoutBookingById: ViewCheckoutBookingByIdFunction;
|
|
13
|
+
declare type ViewCheckoutBookingByIdResult = CheckoutBookingProjection | null;
|
|
14
|
+
interface CheckoutBookingByIdViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutBookingId: string;
|
|
16
|
+
}
|
|
17
|
+
interface CheckoutBookingByIdView {
|
|
18
|
+
(args: CheckoutBookingByIdViewArgs): Promise<ViewCheckoutBookingByIdResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ViewCheckoutBookingByIdHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: CheckoutBookingByIdView;
|
|
22
|
+
}
|
|
23
|
+
declare const viewCheckoutBookingByIdHandler: QueryHandlerFunction<ViewCheckoutBookingById, ViewCheckoutBookingByIdResult, ViewCheckoutBookingByIdHandlerFunctionArgs>;
|
|
24
|
+
export type { ViewCheckoutBookingById, CheckoutBookingByIdView, ViewCheckoutBookingByIdResult };
|
|
25
|
+
export { VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingById, viewCheckoutBookingByIdHandler };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_CHECKOUT_BOOKING_BY_ID = "view_checkout_booking_by_id";
|
|
3
|
+
const viewCheckoutBookingById = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_CHECKOUT_BOOKING_BY_ID }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewCheckoutBookingByIdHandler = ({ view, signal }) => async ({ checkoutBookingId }) => view({ checkoutBookingId, signal });
|
|
8
|
+
export { VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingById, viewCheckoutBookingByIdHandler };
|
|
@@ -47,7 +47,7 @@ interface CheckoutItemProjection {
|
|
|
47
47
|
readonly price: PriceProjection;
|
|
48
48
|
readonly replacedFor?: string;
|
|
49
49
|
readonly productVariant: CheckoutItemProductVariantProjection;
|
|
50
|
-
readonly feedback: FeedbackProjection |
|
|
50
|
+
readonly feedback: FeedbackProjection | null;
|
|
51
51
|
}
|
|
52
52
|
export type { CheckoutItemProjection, CheckoutItemProductVariantProjection, ColorProjection, MediaProjection, PriceProjection, };
|
|
53
53
|
export { Currency, MediaPerspective };
|
package/package.json
CHANGED
package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from "@lookiero/messaging";
|
|
2
|
-
declare const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
|
|
3
|
-
interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
readonly checkoutId: string;
|
|
6
|
-
readonly checkoutItemId: string;
|
|
7
|
-
}
|
|
8
|
-
interface BookSizeReplaceableProductVariantsForCheckoutItem extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
9
|
-
}
|
|
10
|
-
interface BookSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
11
|
-
(payload: BookSizeReplaceableProductVariantsForCheckoutItemPayload): BookSizeReplaceableProductVariantsForCheckoutItem;
|
|
12
|
-
}
|
|
13
|
-
declare const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
14
|
-
export type { BookSizeReplaceableProductVariantsForCheckoutItem };
|
|
15
|
-
export { BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, bookSizeReplaceableProductVariantsForCheckoutItem };
|
package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { command } from "@lookiero/messaging";
|
|
2
|
-
const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
|
|
3
|
-
const bookSizeReplaceableProductVariantsForCheckoutItem = ({ aggregateId, ...payload }) => ({
|
|
4
|
-
...command({ aggregateId, name: BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
|
-
...payload,
|
|
6
|
-
});
|
|
7
|
-
export { BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, bookSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface BookFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
declare type UseBookSizeReplaceableProductVariantsForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
-
interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
|
|
7
|
-
readonly checkoutId: string;
|
|
8
|
-
readonly checkoutItemId: string;
|
|
9
|
-
readonly checkoutBookingId: string;
|
|
10
|
-
}
|
|
11
|
-
interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
12
|
-
(args: UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs): UseBookSizeReplaceableProductVariantsForCheckoutItem;
|
|
13
|
-
}
|
|
14
|
-
declare const useBookSizeReplaceableProductVariantsForCheckoutItem: UseBookSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
15
|
-
export { useBookSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -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 { bookSizeReplaceableProductVariantsForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
5
|
-
const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
|
|
6
|
-
const [commandBus, status] = useCommand();
|
|
7
|
-
const book = useCallback(async () => await commandBus(bookSizeReplaceableProductVariantsForCheckoutItem({
|
|
8
|
-
aggregateId: checkoutBookingId || uuid(),
|
|
9
|
-
checkoutId,
|
|
10
|
-
checkoutItemId,
|
|
11
|
-
})), [checkoutBookingId, checkoutId, checkoutItemId, commandBus]);
|
|
12
|
-
return [book, status];
|
|
13
|
-
};
|
|
14
|
-
export { useBookSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { BookedSizeReplaceableProductVariantsProjection } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
2
|
-
declare const bookedSizeReplaceableProductVariants: BookedSizeReplaceableProductVariantsProjection;
|
|
3
|
-
export { bookedSizeReplaceableProductVariants };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const bookedSizeReplaceableProductVariants = {
|
|
2
|
-
booking: "b00e2c2d-7d9c-4808-88a4-e1c845ae6889",
|
|
3
|
-
productVariants: [
|
|
4
|
-
{
|
|
5
|
-
id: "383fab95-56eb-4639-bb18-530ab792b4d3",
|
|
6
|
-
size: {
|
|
7
|
-
id: "4f8a26b8-8d2d-4012-b49a-7d2820095598",
|
|
8
|
-
europe: "S",
|
|
9
|
-
lookiero: "S",
|
|
10
|
-
uk: "S",
|
|
11
|
-
it: "S",
|
|
12
|
-
unique: false,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
export { bookedSizeReplaceableProductVariants };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BookedSizeReplaceableProductVariantsForCheckoutItemView, BookedSizeReplaceableProductVariantsProjection } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
2
|
-
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
-
interface SizeDto {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly lookiero: string;
|
|
6
|
-
readonly uk: string;
|
|
7
|
-
readonly it: string;
|
|
8
|
-
readonly europe: string;
|
|
9
|
-
readonly unique: boolean;
|
|
10
|
-
readonly visual_order?: number;
|
|
11
|
-
}
|
|
12
|
-
interface ProductVariantDto {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly size: SizeDto;
|
|
15
|
-
}
|
|
16
|
-
interface BookedSizeReplaceableProductVariantsDto {
|
|
17
|
-
readonly booking: string | null;
|
|
18
|
-
readonly product_variants: ProductVariantDto[];
|
|
19
|
-
}
|
|
20
|
-
interface ToBookedSizeReplaceableProductVariantsFunction {
|
|
21
|
-
(bookedSizeReplaceableProductVariants: BookedSizeReplaceableProductVariantsDto): BookedSizeReplaceableProductVariantsProjection;
|
|
22
|
-
}
|
|
23
|
-
declare const toBookedSizeReplaceableProductVariants: ToBookedSizeReplaceableProductVariantsFunction;
|
|
24
|
-
interface HttpBookedSizeReplaceableProductVariantsForCheckoutItemView extends BookedSizeReplaceableProductVariantsForCheckoutItemView {
|
|
25
|
-
}
|
|
26
|
-
interface HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunctionArgs {
|
|
27
|
-
readonly httpPost: HttpPostFunction;
|
|
28
|
-
}
|
|
29
|
-
interface HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunction {
|
|
30
|
-
(args: HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeReplaceableProductVariantsForCheckoutItemView;
|
|
31
|
-
}
|
|
32
|
-
declare const httpBookedSizeReplaceableProductVariantsForCheckoutItemView: HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunction;
|
|
33
|
-
export type { BookedSizeReplaceableProductVariantsDto };
|
|
34
|
-
export { toBookedSizeReplaceableProductVariants, httpBookedSizeReplaceableProductVariantsForCheckoutItemView };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const toSize = (size) => ({
|
|
2
|
-
id: size.id,
|
|
3
|
-
lookiero: size.lookiero,
|
|
4
|
-
uk: size.uk,
|
|
5
|
-
it: size.it,
|
|
6
|
-
europe: size.europe,
|
|
7
|
-
unique: size.unique,
|
|
8
|
-
visualOrder: size.visual_order,
|
|
9
|
-
});
|
|
10
|
-
const toProductVariant = (productVariant) => ({
|
|
11
|
-
id: productVariant.id,
|
|
12
|
-
size: toSize(productVariant.size),
|
|
13
|
-
});
|
|
14
|
-
const toBookedSizeReplaceableProductVariants = (bookedSizeReplaceableProductVariants) => ({
|
|
15
|
-
booking: bookedSizeReplaceableProductVariants.booking,
|
|
16
|
-
productVariants: bookedSizeReplaceableProductVariants.product_variants.map(toProductVariant),
|
|
17
|
-
});
|
|
18
|
-
const httpBookedSizeReplaceableProductVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
19
|
-
const response = await httpPost({
|
|
20
|
-
endpoint: "/view-booked-size-replaceable-product-variants-for-checkout-item",
|
|
21
|
-
body: { checkout_item_id: checkoutItemId },
|
|
22
|
-
signal,
|
|
23
|
-
});
|
|
24
|
-
return response.status === 404 ? null : toBookedSizeReplaceableProductVariants((await response.json()).result);
|
|
25
|
-
};
|
|
26
|
-
export { toBookedSizeReplaceableProductVariants, httpBookedSizeReplaceableProductVariantsForCheckoutItemView };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
-
import { BookedSizeReplaceableProductVariantsProjection } from "../../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
|
-
interface UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
|
|
4
|
-
readonly checkoutItemId: string;
|
|
5
|
-
}
|
|
6
|
-
interface UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
7
|
-
(args: UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeReplaceableProductVariantsProjection>;
|
|
8
|
-
}
|
|
9
|
-
declare const useViewBookedSizeReplaceableProductVariantsForCheckoutItem: UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
10
|
-
export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
-
import { viewBookedSizeReplaceableProductVariantsForCheckoutItem, } from "../../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
|
-
const useViewBookedSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
5
|
-
query: viewBookedSizeReplaceableProductVariantsForCheckoutItem({ checkoutItemId }),
|
|
6
|
-
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
-
options: { staleTime: Infinity },
|
|
8
|
-
});
|
|
9
|
-
export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const feedback = {
|
|
2
|
-
["0ad1dba8-b02c-4121-a1e3-981f1c30800d"]: "9251dc2c-d76a-484d-9299-346929af932f",
|
|
3
|
-
["542c4d24-e1da-484f-8c3a-7d89ee135adc"]: "68c0bb98-b00a-4b86-af43-528fe903cb69",
|
|
4
|
-
["1123a37d-bc00-43a4-9d28-cee1dfaf356c"]: "Free text comment",
|
|
5
|
-
};
|
|
6
|
-
export { feedback };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
-
import { SizeProjection } from "../shared/size";
|
|
3
|
-
interface ProductVariant {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly size: SizeProjection;
|
|
6
|
-
}
|
|
7
|
-
interface BookedSizeReplaceableProductVariantsProjection {
|
|
8
|
-
readonly booking: string | null;
|
|
9
|
-
readonly productVariants: ProductVariant[];
|
|
10
|
-
}
|
|
11
|
-
declare const VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_replaceable_product_variants_for_checkout_item";
|
|
12
|
-
interface ViewBookedSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
13
|
-
readonly checkoutItemId: string;
|
|
14
|
-
}
|
|
15
|
-
interface ViewBookedSizeReplaceableProductVariantsForCheckoutItem extends Query<typeof VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, ViewBookedSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
16
|
-
}
|
|
17
|
-
interface ViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
18
|
-
(payload: ViewBookedSizeReplaceableProductVariantsForCheckoutItemPayload): ViewBookedSizeReplaceableProductVariantsForCheckoutItem;
|
|
19
|
-
}
|
|
20
|
-
declare const viewBookedSizeReplaceableProductVariantsForCheckoutItem: ViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction;
|
|
21
|
-
declare type ViewBookedSizeReplaceableProductVariantsForCheckoutItemResult = BookedSizeReplaceableProductVariantsProjection | null;
|
|
22
|
-
interface BookedSizeReplaceableProductVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
|
|
23
|
-
readonly checkoutItemId: string;
|
|
24
|
-
}
|
|
25
|
-
interface BookedSizeReplaceableProductVariantsForCheckoutItemView {
|
|
26
|
-
(args: BookedSizeReplaceableProductVariantsForCheckoutItemViewArgs): Promise<ViewBookedSizeReplaceableProductVariantsForCheckoutItemResult>;
|
|
27
|
-
}
|
|
28
|
-
interface ViewBookedSizeReplaceableProductVariantsForCheckoutItemHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
29
|
-
readonly view: BookedSizeReplaceableProductVariantsForCheckoutItemView;
|
|
30
|
-
}
|
|
31
|
-
declare const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler: QueryHandlerFunction<ViewBookedSizeReplaceableProductVariantsForCheckoutItem, ViewBookedSizeReplaceableProductVariantsForCheckoutItemResult, ViewBookedSizeReplaceableProductVariantsForCheckoutItemHandlerFunctionArgs>;
|
|
32
|
-
export type { ProductVariant, BookedSizeReplaceableProductVariantsProjection, BookedSizeReplaceableProductVariantsForCheckoutItemView, };
|
|
33
|
-
export { VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeReplaceableProductVariantsForCheckoutItem, viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler, };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { query, } from "@lookiero/messaging";
|
|
2
|
-
const VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_replaceable_product_variants_for_checkout_item";
|
|
3
|
-
const viewBookedSizeReplaceableProductVariantsForCheckoutItem = (payload) => ({
|
|
4
|
-
...query({ name: VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
|
-
...payload,
|
|
6
|
-
});
|
|
7
|
-
const viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
|
|
8
|
-
export { VIEW_BOOKED_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeReplaceableProductVariantsForCheckoutItem, viewBookedSizeReplaceableProductVariantsForCheckoutItemHandler, };
|