@lookiero/checkout 0.2.38 → 0.2.40
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/http/fetchHttpClient.js +2 -1
- 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/checkout/model/httpCheckoutsStart.js +1 -1
- 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/domain/checkoutItem/model/httpCheckoutItems.js +1 -1
- package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsKeep.js +1 -1
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +9 -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/checkout/checkout.d.ts +6 -6
- package/dist/infrastructure/projection/checkout/checkout.js +2 -45
- package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.js +9 -0
- package/dist/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.js +2 -3
- package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +2 -3
- 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/checkoutItem/checkoutItem.d.ts +0 -45
- package/dist/infrastructure/projection/checkoutItem/checkoutItem.js +0 -40
- package/dist/infrastructure/projection/feedback/feedback.mock.d.ts +0 -3
- package/dist/infrastructure/projection/feedback/feedback.mock.js +0 -6
- package/dist/infrastructure/projection/returnQuestion/returnQuestion.d.ts +0 -14
- package/dist/infrastructure/projection/returnQuestion/returnQuestion.js +0 -9
- 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 };
|
|
@@ -11,7 +11,8 @@ const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint, signal })
|
|
|
11
11
|
method: "GET",
|
|
12
12
|
credentials: "include",
|
|
13
13
|
headers: {
|
|
14
|
-
|
|
14
|
+
Authorization: `Bearer ${await getAuthToken()}`,
|
|
15
|
+
["Content-Type"]: "application/json",
|
|
15
16
|
},
|
|
16
17
|
referrer: "",
|
|
17
18
|
signal,
|
|
@@ -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
|
+
checkoutId,
|
|
13
|
+
checkoutItemId,
|
|
14
|
+
checkoutBookingId: 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 };
|
|
@@ -7,7 +7,7 @@ const httpCheckoutItemsKeep = ({ httpPost }) => async ({ aggregateId, domainEven
|
|
|
7
7
|
}
|
|
8
8
|
httpPost({
|
|
9
9
|
endpoint: "/keep-checkout-item",
|
|
10
|
-
body: {
|
|
10
|
+
body: { checkoutItemId: aggregateId },
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
13
|
export { httpCheckoutItemsKeep };
|
|
@@ -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,9 @@
|
|
|
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 };
|
|
@@ -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 };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
2
|
import { CheckoutProjection } from "../../../projection/checkout/checkout";
|
|
3
|
-
import {
|
|
3
|
+
import { CheckoutItemProjection } from "../../../projection/checkoutItem/checkoutItem";
|
|
4
4
|
interface CheckoutDto {
|
|
5
5
|
readonly id: string;
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
6
|
+
readonly customerId: string;
|
|
7
|
+
readonly boxId: string;
|
|
8
|
+
readonly bookingId: string;
|
|
9
9
|
readonly status: CheckoutStatus;
|
|
10
|
-
readonly
|
|
11
|
-
readonly items:
|
|
10
|
+
readonly expiresOn: string;
|
|
11
|
+
readonly items: CheckoutItemProjection[];
|
|
12
12
|
}
|
|
13
13
|
interface ToCheckoutProjectionFunction {
|
|
14
14
|
(checkoutDto: CheckoutDto): CheckoutProjection;
|
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
const toCheckoutProjection = (checkoutDto) => ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
boxId: checkoutDto.box_id,
|
|
5
|
-
bookingId: checkoutDto.booking_id,
|
|
6
|
-
status: checkoutDto.status,
|
|
7
|
-
expiresOn: new Date(checkoutDto.expires_on),
|
|
8
|
-
items: checkoutDto.items.map((item) => ({
|
|
9
|
-
id: item.id,
|
|
10
|
-
status: item.status,
|
|
11
|
-
price: {
|
|
12
|
-
amount: item.price.amount,
|
|
13
|
-
currency: item.price.currency,
|
|
14
|
-
discountedPrice: item.price.discounted_price
|
|
15
|
-
? {
|
|
16
|
-
amount: item.price.discounted_price.amount,
|
|
17
|
-
percentage: item.price.discounted_price.percentage,
|
|
18
|
-
}
|
|
19
|
-
: undefined,
|
|
20
|
-
},
|
|
21
|
-
replacedFor: item.replaced_for,
|
|
22
|
-
feedback: {},
|
|
23
|
-
productVariant: {
|
|
24
|
-
id: item.product_variant.id,
|
|
25
|
-
media: item.product_variant.media.map((media) => ({
|
|
26
|
-
id: media.id,
|
|
27
|
-
url: media.url,
|
|
28
|
-
perspective: media.perspective,
|
|
29
|
-
})),
|
|
30
|
-
brand: item.product_variant.brand,
|
|
31
|
-
name: item.product_variant.name,
|
|
32
|
-
size: {
|
|
33
|
-
id: item.product_variant.size.id,
|
|
34
|
-
lookiero: item.product_variant.size.lookiero,
|
|
35
|
-
uk: item.product_variant.size.uk,
|
|
36
|
-
it: item.product_variant.size.it,
|
|
37
|
-
europe: item.product_variant.size.europe,
|
|
38
|
-
unique: item.product_variant.size.unique,
|
|
39
|
-
visualOrder: item.product_variant.size.visual_order,
|
|
40
|
-
},
|
|
41
|
-
color: {
|
|
42
|
-
id: item.product_variant.color.id,
|
|
43
|
-
label: item.product_variant.color.label,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
})),
|
|
2
|
+
...checkoutDto,
|
|
3
|
+
expiresOn: new Date(checkoutDto.expiresOn),
|
|
47
4
|
});
|
|
48
5
|
export { toCheckoutProjection };
|
|
@@ -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,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
|
+
};
|
|
9
|
+
export { httpCheckoutBookingByIdView };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { toCheckoutItemProjection } from "./checkoutItem";
|
|
2
1
|
const httpCheckoutItemByIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
3
2
|
const response = await httpPost({
|
|
4
3
|
endpoint: "/view-checkout-item-by-id",
|
|
5
|
-
body: {
|
|
4
|
+
body: { checkoutItemId },
|
|
6
5
|
signal,
|
|
7
6
|
});
|
|
8
|
-
return !response.ok || response.status === 404 ? null :
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
9
8
|
};
|
|
10
9
|
export { httpCheckoutItemByIdView };
|
package/dist/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { toReturnQuestionsProjection } from "./returnQuestion";
|
|
2
1
|
const httpReturnQuestionsByCheckoutItemIdView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
3
2
|
const response = await httpPost({
|
|
4
3
|
endpoint: "/list-return-questions-by-checkout-item-id",
|
|
5
|
-
body: {
|
|
4
|
+
body: { checkoutItemId },
|
|
6
5
|
signal,
|
|
7
6
|
});
|
|
8
|
-
return !response.ok || response.status === 404 ? null :
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
9
8
|
};
|
|
10
9
|
export { httpReturnQuestionsByCheckoutItemIdView };
|