@lookiero/checkout 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain/checkout/command/startCheckout.d.ts +12 -0
- package/dist/domain/checkout/command/startCheckout.js +4 -0
- package/dist/domain/checkout/model/checkout.d.ts +17 -0
- package/dist/domain/checkout/model/checkout.js +20 -0
- package/dist/domain/checkout/model/checkoutStarted.d.ts +13 -0
- package/dist/domain/checkout/model/checkoutStarted.js +4 -0
- package/dist/domain/checkout/model/checkouts.d.ts +7 -0
- package/dist/domain/checkout/model/checkouts.js +1 -0
- package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -1
- package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +0 -1
- package/dist/domain/checkoutBooking/model/checkoutBooking.js +1 -3
- package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +0 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/infrastructure/delivery/baseBootstrap.d.ts +31 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +33 -0
- package/dist/infrastructure/delivery/bootstrap.d.ts +2 -3
- package/dist/infrastructure/delivery/bootstrap.js +21 -30
- package/dist/infrastructure/delivery/bootstrap.mock.d.ts +3 -0
- package/dist/infrastructure/delivery/bootstrap.mock.js +63 -0
- package/dist/infrastructure/delivery/http/fetchHttpClient.d.ts +1 -1
- package/dist/infrastructure/delivery/http/fetchHttpClient.js +2 -2
- package/dist/infrastructure/domain/checkout/model/httpCheckouts.d.ts +16 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +21 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.d.ts +5 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsStart.js +14 -0
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.d.ts +13 -0
- package/dist/infrastructure/domain/checkout/react/useStartCheckout.js +10 -0
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +2 -2
- package/dist/infrastructure/domain/{react → checkoutBooking/react}/useBookSizeReplaceableProductVariantsForCheckoutItem.js +2 -3
- package/dist/infrastructure/domain/{react → uiSetting/react}/useSetCheckoutIntroShown.js +1 -1
- package/dist/infrastructure/domain/{react → uiSetting/react}/useUpdateUiSetting.js +3 -3
- package/dist/infrastructure/projection/{httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts → bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts} +2 -2
- package/dist/infrastructure/projection/{react → bookedSizeReplaceableProductVariants/react}/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +1 -1
- package/dist/infrastructure/projection/{react → bookedSizeReplaceableProductVariants/react}/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +3 -3
- package/dist/infrastructure/projection/checkout/checkout.d.ts +53 -0
- package/dist/infrastructure/projection/{httpFirstAvailableCheckoutByCustomerIdView.js → checkout/checkout.js} +1 -8
- package/dist/infrastructure/projection/checkout/checkout.mock.d.ts +17 -0
- package/dist/infrastructure/{delivery/_mock → projection/checkout}/checkout.mock.js +13 -10
- package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkout/httpCheckoutByIdView.js +9 -0
- package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.d.ts +12 -0
- package/dist/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.js +9 -0
- package/dist/infrastructure/projection/{httpFiveItemsDiscountByCustomerIdView.d.ts → checkout/httpFiveItemsDiscountByCustomerIdView.d.ts} +2 -2
- package/dist/infrastructure/projection/{httpIsCheckoutEnabledByCustomerIdView.d.ts → checkout/httpIsCheckoutEnabledByCustomerIdView.d.ts} +2 -2
- package/dist/infrastructure/projection/{react → checkout/react}/useViewFirstAvailableCheckoutByCustomerId.d.ts +1 -1
- package/dist/infrastructure/projection/{react → checkout/react}/useViewFirstAvailableCheckoutByCustomerId.js +3 -3
- package/dist/infrastructure/projection/{react → checkout/react}/useViewFiveItemsDiscountByCustomerId.d.ts +1 -1
- package/dist/infrastructure/projection/{react → checkout/react}/useViewFiveItemsDiscountByCustomerId.js +3 -3
- package/dist/infrastructure/projection/{react → checkout/react}/useViewIsCheckoutAccessibleByCustomerId.d.ts +1 -1
- package/dist/infrastructure/projection/{react → checkout/react}/useViewIsCheckoutAccessibleByCustomerId.js +3 -3
- package/dist/infrastructure/projection/uiSetting/react/useViewCheckoutIntroShown.d.ts +2 -0
- package/dist/infrastructure/projection/{react → uiSetting/react}/useViewCheckoutIntroShown.js +1 -1
- package/dist/infrastructure/projection/{react → uiSetting/react}/useViewUiSettingByKey.d.ts +1 -1
- package/dist/infrastructure/projection/{react → uiSetting/react}/useViewUiSettingByKey.js +4 -4
- package/dist/infrastructure/projection/{storageUiSettingByKeyView.d.ts → uiSetting/storageUiSettingByKeyView.d.ts} +3 -3
- package/dist/infrastructure/ui/Root.js +1 -1
- package/dist/infrastructure/ui/components/atoms/price/Price.d.ts +1 -1
- package/dist/infrastructure/ui/components/atoms/price/Price.js +2 -2
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -1
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +2 -3
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +3 -3
- package/dist/infrastructure/ui/routing/Routing.js +1 -1
- package/dist/infrastructure/ui/views/intro/Intro.js +6 -6
- package/dist/infrastructure/ui/views/item/Item.d.ts +4 -1
- package/dist/infrastructure/ui/views/item/Item.js +4 -1
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.d.ts +1 -1
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
- package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.d.ts +1 -1
- package/dist/infrastructure/ui/views/item/components/productVariantActions/ProductVariantActions.js +2 -2
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +1 -1
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.d.ts +1 -1
- package/dist/projection/checkout/checkout.d.ts +78 -0
- package/dist/projection/checkout/checkout.js +29 -0
- package/dist/projection/checkout/viewCheckoutById.d.ts +25 -0
- package/dist/projection/checkout/viewCheckoutById.js +8 -0
- package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +3 -83
- package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +1 -36
- package/package.json +3 -1
- package/dist/infrastructure/delivery/_mock/bootstrap.mock.d.ts +0 -6
- package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +0 -33
- package/dist/infrastructure/delivery/_mock/checkout.mock.d.ts +0 -9
- package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.d.ts +0 -60
- package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.d.ts +0 -2
- /package/dist/infrastructure/domain/{react → checkoutBooking/react}/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +0 -0
- /package/dist/infrastructure/domain/{react → uiSetting/react}/useSetCheckoutIntroShown.d.ts +0 -0
- /package/dist/infrastructure/domain/{react → uiSetting/react}/useUpdateUiSetting.d.ts +0 -0
- /package/dist/infrastructure/projection/{httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js → bookedSizeReplaceableProductVariants/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js} +0 -0
- /package/dist/infrastructure/projection/{httpFiveItemsDiscountByCustomerIdView.js → checkout/httpFiveItemsDiscountByCustomerIdView.js} +0 -0
- /package/dist/infrastructure/projection/{httpIsCheckoutEnabledByCustomerIdView.js → checkout/httpIsCheckoutEnabledByCustomerIdView.js} +0 -0
- /package/dist/infrastructure/projection/{storageUiSettingByKeyView.js → uiSetting/storageUiSettingByKeyView.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const START_CHECKOUT = "start_checkout";
|
|
3
|
+
interface StartCheckoutPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface StartCheckout extends Command<typeof START_CHECKOUT>, StartCheckoutPayload {
|
|
7
|
+
}
|
|
8
|
+
interface StartCheckoutFunction {
|
|
9
|
+
(payload: StartCheckoutPayload): StartCheckout;
|
|
10
|
+
}
|
|
11
|
+
declare const startCheckout: StartCheckoutFunction;
|
|
12
|
+
export { START_CHECKOUT, StartCheckout, startCheckout };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
+
import { StartCheckout } from "../command/startCheckout";
|
|
3
|
+
declare enum CheckoutStatus {
|
|
4
|
+
AVAILABLE = "AVAILABLE",
|
|
5
|
+
NOTIFIED = "NOTIFIED",
|
|
6
|
+
STARTED = "STARTED",
|
|
7
|
+
COMPLETED = "COMPLETED"
|
|
8
|
+
}
|
|
9
|
+
interface Checkout extends AggregateRoot {
|
|
10
|
+
readonly status: CheckoutStatus;
|
|
11
|
+
readonly customerId: string;
|
|
12
|
+
readonly boxId: string;
|
|
13
|
+
readonly bookingId: string;
|
|
14
|
+
readonly expiresOn: Date;
|
|
15
|
+
}
|
|
16
|
+
declare const startCheckoutHandler: CommandHandlerFunction<StartCheckout, Checkout>;
|
|
17
|
+
export { Checkout, CheckoutStatus, startCheckoutHandler };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
import { checkoutStarted } from "./checkoutStarted";
|
|
3
|
+
var CheckoutStatus;
|
|
4
|
+
(function (CheckoutStatus) {
|
|
5
|
+
CheckoutStatus["AVAILABLE"] = "AVAILABLE";
|
|
6
|
+
CheckoutStatus["NOTIFIED"] = "NOTIFIED";
|
|
7
|
+
CheckoutStatus["STARTED"] = "STARTED";
|
|
8
|
+
CheckoutStatus["COMPLETED"] = "COMPLETED";
|
|
9
|
+
})(CheckoutStatus || (CheckoutStatus = {}));
|
|
10
|
+
const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
11
|
+
const { aggregateId } = command;
|
|
12
|
+
invariant(aggregateRoot.status !== CheckoutStatus.STARTED, "Checkout is already started");
|
|
13
|
+
invariant(aggregateRoot.status !== CheckoutStatus.COMPLETED, "Checkout is already completed");
|
|
14
|
+
return {
|
|
15
|
+
...aggregateRoot,
|
|
16
|
+
status: CheckoutStatus.STARTED,
|
|
17
|
+
domainEvents: checkoutStarted({ aggregateId }),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { CheckoutStatus, startCheckoutHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_STARTED = "checkout_started";
|
|
3
|
+
interface CheckoutStartedPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutStarted extends DomainEvent<typeof CHECKOUT_STARTED>, CheckoutStartedPayload {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutStartedFunction {
|
|
9
|
+
(payload: CheckoutStartedPayload): CheckoutStarted;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutStarted: CheckoutStartedFunction;
|
|
12
|
+
export type { CheckoutStarted };
|
|
13
|
+
export { CHECKOUT_STARTED, checkoutStarted };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { Checkout } from "./checkout";
|
|
3
|
+
interface CheckoutsGetFunction<CheckoutsGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<Checkout, CheckoutsGetFunctionArgs> {
|
|
4
|
+
}
|
|
5
|
+
interface CheckoutsSaveFunction<CheckoutsSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<Checkout, CheckoutsSaveFunctionArgs> {
|
|
6
|
+
}
|
|
7
|
+
export { CheckoutsGetFunction, CheckoutsSaveFunction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
|
4
4
|
readonly aggregateId: string;
|
|
5
5
|
readonly checkoutId: string;
|
|
6
6
|
readonly checkoutItemId: string;
|
|
7
|
-
readonly checkoutBookingId: string;
|
|
8
7
|
}
|
|
9
8
|
interface BookSizeReplaceableProductVariantsForCheckoutItem extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
10
9
|
}
|
|
@@ -3,7 +3,6 @@ import { BookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bo
|
|
|
3
3
|
interface CheckoutBooking extends AggregateRoot {
|
|
4
4
|
readonly checkoutId: string;
|
|
5
5
|
readonly checkoutItemId: string;
|
|
6
|
-
readonly checkoutBookingId: string;
|
|
7
6
|
}
|
|
8
7
|
declare const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<BookSizeReplaceableProductVariantsForCheckoutItem, CheckoutBooking>;
|
|
9
8
|
export { CheckoutBooking, bookSizeReplaceableProductVariantsForCheckoutItemHandler };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { checkoutBookingBooked } from "./checkoutBookingBooked";
|
|
2
2
|
const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
|
-
const { aggregateId, checkoutId, checkoutItemId
|
|
3
|
+
const { aggregateId, checkoutId, checkoutItemId } = command;
|
|
4
4
|
return {
|
|
5
5
|
...aggregateRoot,
|
|
6
6
|
checkoutId,
|
|
7
7
|
checkoutItemId,
|
|
8
|
-
checkoutBookingId,
|
|
9
8
|
domainEvents: checkoutBookingBooked({
|
|
10
9
|
aggregateId,
|
|
11
10
|
checkoutId,
|
|
12
11
|
checkoutItemId,
|
|
13
|
-
checkoutBookingId,
|
|
14
12
|
}),
|
|
15
13
|
};
|
|
16
14
|
};
|
|
@@ -4,7 +4,6 @@ interface CheckoutBookingBookedPayload {
|
|
|
4
4
|
readonly aggregateId: string;
|
|
5
5
|
readonly checkoutId: string;
|
|
6
6
|
readonly checkoutItemId: string;
|
|
7
|
-
readonly checkoutBookingId: string;
|
|
8
7
|
}
|
|
9
8
|
interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {
|
|
10
9
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EndpointFunction } from "@lookiero/i18n";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
+
import "react-native-get-random-values";
|
|
3
4
|
import { RootProps } from "./infrastructure/ui/Root";
|
|
4
5
|
import { IsCheckoutAccessibleByCustomerIdProjection } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
5
6
|
interface IsCheckoutAccessibleFunctionArgs {
|
|
@@ -9,7 +10,7 @@ interface IsCheckoutAccessibleFunction {
|
|
|
9
10
|
(args: IsCheckoutAccessibleFunctionArgs): Promise<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
10
11
|
}
|
|
11
12
|
interface BootstrapFunctionArgs {
|
|
12
|
-
readonly getAuthToken: () => string
|
|
13
|
+
readonly getAuthToken: () => Promise<string>;
|
|
13
14
|
readonly apiUrl: string;
|
|
14
15
|
readonly translations: EndpointFunction;
|
|
15
16
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fetchFetchTranslation } from "@lookiero/i18n";
|
|
2
2
|
import { i18n } from "@lookiero/i18n-react";
|
|
3
|
+
import "react-native-get-random-values";
|
|
3
4
|
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
4
5
|
import { root } from "./infrastructure/ui/Root";
|
|
5
6
|
import { viewIsCheckoutAccessibleByCustomerId, } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AggregateRoot, RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
|
|
3
|
+
import { Checkout } from "../../domain/checkout/model/checkout";
|
|
4
|
+
import { CheckoutsGetFunction, CheckoutsSaveFunction } from "../../domain/checkout/model/checkouts";
|
|
5
|
+
import { UiSetting } from "../../domain/uiSetting/model/uiSetting";
|
|
6
|
+
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../domain/uiSetting/model/uiSettings";
|
|
7
|
+
import { CheckoutByIdView } from "../../projection/checkout/viewCheckoutById";
|
|
8
|
+
import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
9
|
+
import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
10
|
+
import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
11
|
+
import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
12
|
+
declare const MESSAGING_CONTEXT_ID = "Checkout";
|
|
13
|
+
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>;
|
|
14
|
+
interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs, UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs> {
|
|
15
|
+
readonly checkoutByIdView: CheckoutByIdView;
|
|
16
|
+
readonly firstAvailableCheckoutByCustomerIdView: FirstAvailableCheckoutByCustomerIdView;
|
|
17
|
+
readonly isCheckoutEnabledByCustomerIdView: IsCheckoutEnabledByCustomerIdView;
|
|
18
|
+
readonly fiveItemsDiscountByCustomerIdView: FiveItemsDiscountByCustomerIdView;
|
|
19
|
+
readonly uiSettingByKeyView: UiSettingByKeyView;
|
|
20
|
+
readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
|
|
21
|
+
readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
|
|
22
|
+
readonly uiSettingsDependencies: RepositoryDependencies<UiSetting, UiSettingGetFunctionArgs, UiSettingSaveFunctionArgs>;
|
|
23
|
+
readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
|
|
24
|
+
readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
|
|
25
|
+
readonly checkoutsDependencies: RepositoryDependencies<Checkout, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs>;
|
|
26
|
+
}
|
|
27
|
+
interface BaseBootstrapFunction {
|
|
28
|
+
<UiSettingGetArgs extends RepositoryGetFunctionArgs, UiSettingSaveArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs>(args: BaseBootstrapFunctionArgs<UiSettingGetArgs, UiSettingSaveArgs, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs>): BuildBootstrapFunctionReturn;
|
|
29
|
+
}
|
|
30
|
+
declare const baseBootstrap: BaseBootstrapFunction;
|
|
31
|
+
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
2
|
+
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
3
|
+
import { startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
4
|
+
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
5
|
+
import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
6
|
+
import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID, } from "../../projection/checkout/viewCheckoutById";
|
|
7
|
+
import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
8
|
+
import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
9
|
+
import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
10
|
+
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
11
|
+
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
12
|
+
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
13
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, }) => messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
14
|
+
.query(VIEW_CHECKOUT_BY_ID, viewCheckoutByIdHandler, {
|
|
15
|
+
view: checkoutByIdView,
|
|
16
|
+
})
|
|
17
|
+
.query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
|
|
18
|
+
view: firstAvailableCheckoutByCustomerIdView,
|
|
19
|
+
})
|
|
20
|
+
.query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
|
|
21
|
+
view: isCheckoutEnabledByCustomerIdView,
|
|
22
|
+
})
|
|
23
|
+
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
|
|
24
|
+
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
25
|
+
view: fiveItemsDiscountByCustomerIdView,
|
|
26
|
+
})
|
|
27
|
+
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
28
|
+
view: uiSettingByKeyView,
|
|
29
|
+
})
|
|
30
|
+
.command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, uiSettingsDependencies)
|
|
31
|
+
.command(START_CHECKOUT, startCheckoutHandler, {})(getCheckout, saveCheckout, checkoutsDependencies)
|
|
32
|
+
.build();
|
|
33
|
+
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
|
|
2
|
-
declare const CHECKOUT_MESSAGING_REACT_ID = "Checkout";
|
|
3
2
|
interface BootstrapFunctionArgs {
|
|
4
|
-
readonly getAuthToken: () => string
|
|
3
|
+
readonly getAuthToken: () => Promise<string>;
|
|
5
4
|
readonly apiUrl: string;
|
|
6
5
|
}
|
|
7
6
|
interface BootstrapFunction {
|
|
8
7
|
(args: BootstrapFunctionArgs): BuildBootstrapFunctionReturn;
|
|
9
8
|
}
|
|
10
9
|
declare const bootstrap: BootstrapFunction;
|
|
11
|
-
export { bootstrap
|
|
10
|
+
export { bootstrap };
|
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
3
|
-
import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
4
|
-
import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
5
|
-
import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
6
|
-
import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
7
|
-
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
8
|
-
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
1
|
+
import { getCheckout, saveCheckout } from "../domain/checkout/model/httpCheckouts";
|
|
9
2
|
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
10
3
|
import { read, write } from "../persistence/asyncStorageStorage";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
4
|
+
import { httpCheckoutByIdView } from "../projection/checkout/httpCheckoutByIdView";
|
|
5
|
+
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checkout/httpFirstAvailableCheckoutByCustomerIdView";
|
|
6
|
+
import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/httpFiveItemsDiscountByCustomerIdView";
|
|
7
|
+
import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
|
|
8
|
+
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
9
|
+
import { baseBootstrap } from "./baseBootstrap";
|
|
15
10
|
import { fetchHttpGet, fetchHttpPost } from "./http/fetchHttpClient";
|
|
16
|
-
const CHECKOUT_MESSAGING_REACT_ID = "Checkout";
|
|
17
11
|
const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
18
12
|
const httpGet = fetchHttpGet({ apiUrl, getAuthToken });
|
|
19
13
|
const httpPost = fetchHttpPost({ apiUrl, getAuthToken });
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
.command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, { read, write })
|
|
35
|
-
.build();
|
|
14
|
+
return baseBootstrap({
|
|
15
|
+
checkoutByIdView: httpCheckoutByIdView({ httpPost }),
|
|
16
|
+
firstAvailableCheckoutByCustomerIdView: httpFirstAvailableCheckoutByCustomerIdView({ httpPost }),
|
|
17
|
+
isCheckoutEnabledByCustomerIdView: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
|
|
18
|
+
fiveItemsDiscountByCustomerIdView: httpFiveItemsDiscountByCustomerIdView({ httpGet }),
|
|
19
|
+
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
20
|
+
getUiSetting,
|
|
21
|
+
saveUiSetting,
|
|
22
|
+
uiSettingsDependencies: { read, write },
|
|
23
|
+
getCheckout,
|
|
24
|
+
saveCheckout,
|
|
25
|
+
checkoutsDependencies: { httpPost },
|
|
26
|
+
});
|
|
36
27
|
};
|
|
37
|
-
export { bootstrap
|
|
28
|
+
export { bootstrap };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
import { CheckoutItemStatus } from "../../projection/checkout/checkout";
|
|
3
|
+
import { viewCheckoutById, } from "../../projection/checkout/viewCheckoutById";
|
|
4
|
+
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
5
|
+
import { read, write } from "../persistence/asyncStorageStorage";
|
|
6
|
+
import { startedCheckoutWithStatusProjection } from "../projection/checkout/checkout.mock";
|
|
7
|
+
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
8
|
+
import { baseBootstrap } from "./baseBootstrap";
|
|
9
|
+
const checkoutDataSource = () => {
|
|
10
|
+
let data = startedCheckoutWithStatusProjection({
|
|
11
|
+
status: [
|
|
12
|
+
CheckoutItemStatus.INITIAL,
|
|
13
|
+
CheckoutItemStatus.INITIAL,
|
|
14
|
+
CheckoutItemStatus.INITIAL,
|
|
15
|
+
CheckoutItemStatus.INITIAL,
|
|
16
|
+
CheckoutItemStatus.INITIAL,
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
const get = () => data;
|
|
20
|
+
const save = (checkout) => {
|
|
21
|
+
data = { ...data, ...checkout };
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
get,
|
|
25
|
+
save,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const isCheckoutEnabled = true;
|
|
29
|
+
const checkoutByIdView = async () => checkoutDataSource().get();
|
|
30
|
+
const firstAvailableCheckoutByCustomerIdView = async () => checkoutDataSource().get();
|
|
31
|
+
const isCheckoutEnabledByCustomerIdView = async () => isCheckoutEnabled;
|
|
32
|
+
const fiveItemsDiscountByCustomerIdView = async () => 25;
|
|
33
|
+
const toCheckoutDomain = (checkout) => {
|
|
34
|
+
invariant(checkout, "No checkout found!");
|
|
35
|
+
return {
|
|
36
|
+
id: checkout.id,
|
|
37
|
+
status: checkout.status,
|
|
38
|
+
customerId: checkout.customerId,
|
|
39
|
+
boxId: checkout.boxId,
|
|
40
|
+
bookingId: checkout.bookingId,
|
|
41
|
+
expiresOn: checkout.expiresOn,
|
|
42
|
+
aggregateId: checkout.id,
|
|
43
|
+
domainEvents: [],
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const getCheckout = ({ queryBus }) => async (aggregateId) => toCheckoutDomain(await queryBus(viewCheckoutById({ checkoutId: aggregateId })));
|
|
47
|
+
const saveCheckout = () => async (aggregateRoot) => {
|
|
48
|
+
checkoutDataSource().save(aggregateRoot);
|
|
49
|
+
};
|
|
50
|
+
const bootstrap = () => baseBootstrap({
|
|
51
|
+
checkoutByIdView,
|
|
52
|
+
firstAvailableCheckoutByCustomerIdView,
|
|
53
|
+
isCheckoutEnabledByCustomerIdView,
|
|
54
|
+
fiveItemsDiscountByCustomerIdView,
|
|
55
|
+
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
56
|
+
getUiSetting,
|
|
57
|
+
saveUiSetting,
|
|
58
|
+
uiSettingsDependencies: { read, write },
|
|
59
|
+
getCheckout,
|
|
60
|
+
saveCheckout,
|
|
61
|
+
checkoutsDependencies: {},
|
|
62
|
+
});
|
|
63
|
+
export { bootstrap };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HttpGetFunction, HttpPostFunction } from "./httpClient";
|
|
2
2
|
interface FetchHttpFunctionArgs {
|
|
3
3
|
readonly apiUrl: string;
|
|
4
|
-
readonly getAuthToken: () => string
|
|
4
|
+
readonly getAuthToken: () => Promise<string>;
|
|
5
5
|
}
|
|
6
6
|
interface FetchHttpPostFunction {
|
|
7
7
|
(args: FetchHttpFunctionArgs): HttpPostFunction;
|
|
@@ -2,7 +2,7 @@ const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body }) =
|
|
|
2
2
|
method: "POST",
|
|
3
3
|
headers: {
|
|
4
4
|
["Content-Type"]: "application/json",
|
|
5
|
-
authorization: `Bearer ${getAuthToken()}`,
|
|
5
|
+
authorization: `Bearer ${await getAuthToken()}`,
|
|
6
6
|
},
|
|
7
7
|
body: JSON.stringify(body),
|
|
8
8
|
});
|
|
@@ -10,7 +10,7 @@ const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint }) => fetch
|
|
|
10
10
|
method: "GET",
|
|
11
11
|
credentials: "include",
|
|
12
12
|
headers: {
|
|
13
|
-
authorization: `Bearer ${getAuthToken()}`,
|
|
13
|
+
authorization: `Bearer ${await getAuthToken()}`,
|
|
14
14
|
},
|
|
15
15
|
referrer: "",
|
|
16
16
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { CheckoutsGetFunction, CheckoutsSaveFunction } from "../../../../domain/checkout/model/checkouts";
|
|
3
|
+
import { HttpPostFunction } from "../../../delivery/http/httpClient";
|
|
4
|
+
interface HttpCheckoutsGetFunctionArgs extends RepositoryGetFunctionArgs {
|
|
5
|
+
}
|
|
6
|
+
interface HttpCheckoutsGetFunction extends CheckoutsGetFunction<HttpCheckoutsGetFunctionArgs> {
|
|
7
|
+
}
|
|
8
|
+
declare const getCheckout: HttpCheckoutsGetFunction;
|
|
9
|
+
interface HttpCheckoutsSaveFunctionArgs extends RepositorySaveFunctionArgs {
|
|
10
|
+
readonly httpPost: HttpPostFunction;
|
|
11
|
+
}
|
|
12
|
+
interface HttpCheckoutsSaveFunction extends CheckoutsSaveFunction<HttpCheckoutsSaveFunctionArgs> {
|
|
13
|
+
}
|
|
14
|
+
declare const saveCheckout: HttpCheckoutsSaveFunction;
|
|
15
|
+
export type { HttpCheckoutsSaveFunction };
|
|
16
|
+
export { getCheckout, saveCheckout };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
import { viewCheckoutById, } from "../../../../projection/checkout/viewCheckoutById";
|
|
3
|
+
import { httpCheckoutsStart } from "./httpCheckoutsStart";
|
|
4
|
+
const toDomain = (checkout) => {
|
|
5
|
+
invariant(checkout, "No checkout found!");
|
|
6
|
+
return {
|
|
7
|
+
id: checkout.id,
|
|
8
|
+
status: checkout.status,
|
|
9
|
+
customerId: checkout.customerId,
|
|
10
|
+
boxId: checkout.boxId,
|
|
11
|
+
bookingId: checkout.bookingId,
|
|
12
|
+
expiresOn: checkout.expiresOn,
|
|
13
|
+
aggregateId: checkout.id,
|
|
14
|
+
domainEvents: [],
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const getCheckout = ({ queryBus }) => async (aggregateId) => toDomain(await queryBus(viewCheckoutById({ checkoutId: aggregateId })));
|
|
18
|
+
const saveCheckout = ({ httpPost }) => async (aggregateRoot) => {
|
|
19
|
+
await httpCheckoutsStart({ httpPost })(aggregateRoot);
|
|
20
|
+
};
|
|
21
|
+
export { getCheckout, saveCheckout };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CHECKOUT_STARTED } from "../../../../domain/checkout/model/checkoutStarted";
|
|
2
|
+
const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
|
|
3
|
+
const httpCheckoutsStart = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutEvents = Array.isArray(domainEvents) ? domainEvents : [domainEvents];
|
|
5
|
+
const checkoutStarted = checkoutEvents.find(isCheckoutStarted);
|
|
6
|
+
if (!checkoutStarted) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
httpPost({
|
|
10
|
+
endpoint: "/start-checkout",
|
|
11
|
+
body: { checkout_id: aggregateId },
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export { httpCheckoutsStart };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface StartCheckoutFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
interface UseStartCheckoutArgs {
|
|
6
|
+
readonly checkoutId: string;
|
|
7
|
+
}
|
|
8
|
+
declare type UseStartCheckoutResult = [start: StartCheckoutFunction, status: CommandStatus];
|
|
9
|
+
interface UseStartCheckout {
|
|
10
|
+
(args: UseStartCheckoutArgs): UseStartCheckoutResult;
|
|
11
|
+
}
|
|
12
|
+
declare const useStartCheckout: UseStartCheckout;
|
|
13
|
+
export { useStartCheckout };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { startCheckout } from "../../../../domain/checkout/command/startCheckout";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const useStartCheckout = ({ checkoutId }) => {
|
|
6
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
7
|
+
const start = useCallback(async () => await commandBus(startCheckout({ aggregateId: checkoutId })), [checkoutId, commandBus]);
|
|
8
|
+
return [start, status];
|
|
9
|
+
};
|
|
10
|
+
export { useStartCheckout };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checkoutItemId
|
|
1
|
+
const saveCheckoutBooking = ({ httpPost }) => async ({ aggregateId, checkoutId, checkoutItemId }) => {
|
|
2
2
|
try {
|
|
3
3
|
const response = await httpPost({
|
|
4
4
|
endpoint: "/book-size-replaceable-product-variants-for-checkout-item",
|
|
5
5
|
body: {
|
|
6
6
|
checkout_id: checkoutId,
|
|
7
7
|
checkout_item_id: checkoutItemId,
|
|
8
|
-
checkout_booking_id:
|
|
8
|
+
checkout_booking_id: aggregateId,
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
11
|
if (!response.ok) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
|
-
import { bookSizeReplaceableProductVariantsForCheckoutItem } from "
|
|
4
|
+
import { bookSizeReplaceableProductVariantsForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
5
5
|
const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
|
|
6
6
|
const [commandBus, status] = useCommand();
|
|
7
7
|
const book = useCallback(async () => await commandBus(bookSizeReplaceableProductVariantsForCheckoutItem({
|
|
8
|
-
aggregateId: uuid(),
|
|
8
|
+
aggregateId: checkoutBookingId || uuid(),
|
|
9
9
|
checkoutId,
|
|
10
10
|
checkoutItemId,
|
|
11
|
-
checkoutBookingId,
|
|
12
11
|
})), [checkoutBookingId, checkoutId, checkoutItemId, commandBus]);
|
|
13
12
|
return [book, status];
|
|
14
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
import { UISettings } from "
|
|
2
|
+
import { UISettings } from "../../../ui/settings/UISettings";
|
|
3
3
|
import { useUpdateUiSetting } from "./useUpdateUiSetting";
|
|
4
4
|
const useSetCheckoutIntroShown = () => {
|
|
5
5
|
const [update, status] = useUpdateUiSetting();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
|
-
import { updateUiSetting } from "
|
|
5
|
-
import {
|
|
4
|
+
import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
|
|
5
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
6
|
const useUpdateUiSetting = () => {
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId:
|
|
7
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
8
|
const update = useCallback(async ({ key, value }) => await commandBus(updateUiSetting({
|
|
9
9
|
aggregateId: uuid(),
|
|
10
10
|
key,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HttpPostFunction } from "
|
|
1
|
+
import { BookedSizeReplaceableProductVariantsForCheckoutItemView, BookedSizeReplaceableProductVariantsProjection } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
3
|
interface SizeFormatDto {
|
|
4
4
|
readonly size: string;
|
|
5
5
|
readonly format: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
-
import { BookedSizeReplaceableProductVariantsProjection } from "
|
|
2
|
+
import { BookedSizeReplaceableProductVariantsProjection } from "../../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
3
|
interface UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
|
|
4
4
|
readonly checkoutItemId: string;
|
|
5
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
-
import { viewBookedSizeReplaceableProductVariantsForCheckoutItem, } from "
|
|
3
|
-
import {
|
|
2
|
+
import { viewBookedSizeReplaceableProductVariantsForCheckoutItem, } from "../../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
4
|
const useViewBookedSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
|
|
5
5
|
query: viewBookedSizeReplaceableProductVariantsForCheckoutItem({ checkoutItemId }),
|
|
6
|
-
contextId:
|
|
6
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
7
7
|
options: { staleTime: Infinity },
|
|
8
8
|
});
|
|
9
9
|
export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
|