@lookiero/checkout 0.8.9-beta.0 → 0.8.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/checkoutItem/command/resetCheckoutItem.d.ts +13 -0
- package/dist/domain/checkoutItem/command/resetCheckoutItem.js +4 -0
- package/dist/domain/checkoutItem/model/checkoutItem.d.ts +3 -1
- package/dist/domain/checkoutItem/model/checkoutItem.js +9 -1
- package/dist/domain/checkoutItem/model/checkoutItemReset.d.ts +13 -0
- package/dist/domain/checkoutItem/model/checkoutItemReset.js +4 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +3 -1
- package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItems.js +2 -0
- package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsReset.d.ts +5 -0
- package/dist/infrastructure/domain/checkoutItem/model/httpCheckoutItemsReset.js +13 -0
- package/dist/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.d.ts +15 -0
- package/dist/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.js +27 -0
- package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +3 -0
- package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +2 -1
- package/dist/infrastructure/projection/pricing/pricing.d.ts +16 -0
- package/dist/infrastructure/projection/pricing/pricing.js +12 -0
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +1 -7
- package/dist/infrastructure/ui/views/checkout/Checkout.js +1 -1
- package/dist/infrastructure/ui/views/item/Item.js +9 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.d.ts +1 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +3 -3
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +1 -1
- package/dist/projection/pricing/pricing.d.ts +5 -4
- package/dist/shared/ui/components/layouts/modal/Modal.js +2 -3
- package/dist/shared/ui/components/layouts/modal/Modal.style.d.ts +0 -1
- package/dist/shared/ui/components/layouts/modal/Modal.style.js +0 -1
- package/package.json +1 -2
- package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
- package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
- package/dist/domain/checkout/model/checkoutPaid.js +0 -4
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +0 -16
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts +0 -13
- package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js +0 -14
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
- package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js +0 -9
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js +0 -12
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.d.ts +0 -12
- package/dist/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackByCheckoutIdView.js +0 -9
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
- package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
- package/dist/infrastructure/ui/views/App.style.d.ts +0 -4
- package/dist/infrastructure/ui/views/App.style.js +0 -16
- package/dist/infrastructure/ui/views/header/Header.d.ts +0 -15
- package/dist/infrastructure/ui/views/header/Header.js +0 -90
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +0 -35
- package/dist/infrastructure/ui/views/header/Header.style.js +0 -38
- package/dist/infrastructure/ui/views/header/components/Logo.d.ts +0 -7
- package/dist/infrastructure/ui/views/header/components/Logo.js +0 -11
- package/dist/infrastructure/ui/views/header/components/Logo.style.d.ts +0 -7
- package/dist/infrastructure/ui/views/header/components/Logo.style.js +0 -8
- package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
- package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -55
- package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -58
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts +0 -10
- package/dist/projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js +0 -1
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.d.ts +0 -25
- package/dist/projection/checkoutFeedback/viewCheckoutFeedbackByCheckoutId.js +0 -8
- package/dist/shared/logging/location.d.ts +0 -3
- package/dist/shared/logging/location.js +0 -5
- package/dist/shared/logging/matchRoutes.d.ts +0 -3
- package/dist/shared/logging/matchRoutes.js +0 -7
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.d.ts +0 -29
- package/dist/shared/logging/reactRouterV6Instrumentation/reactRouterV6Instrumentation.native.js +0 -134
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.d.ts +0 -22
- package/dist/shared/logging/reactRouterV6Instrumentation/transactionContext.js +0 -15
- package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +0 -27
- package/dist/shared/logging/reactRouterV6Instrumentation.native.js +0 -115
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.d.ts +0 -1
- package/dist/shared/notifications/domain/notification/command/removeNotification.tes.js +0 -9
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const RESET_CHECKOUT_ITEM = "reset_checkout_item";
|
|
3
|
+
interface ResetCheckoutItemPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface ResetCheckoutItem extends Command<typeof RESET_CHECKOUT_ITEM>, ResetCheckoutItemPayload {
|
|
7
|
+
}
|
|
8
|
+
interface ResetCheckoutItemFunction {
|
|
9
|
+
(payload: ResetCheckoutItemPayload): ResetCheckoutItem;
|
|
10
|
+
}
|
|
11
|
+
declare const resetCheckoutItem: ResetCheckoutItemFunction;
|
|
12
|
+
export type { ResetCheckoutItem };
|
|
13
|
+
export { RESET_CHECKOUT_ITEM, resetCheckoutItem };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
2
|
import { KeepCheckoutItem } from "../command/keepCheckoutItem";
|
|
3
3
|
import { ReplaceCheckoutItem } from "../command/replaceCheckoutItem";
|
|
4
|
+
import { ResetCheckoutItem } from "../command/resetCheckoutItem";
|
|
4
5
|
import { ReturnCheckoutItem } from "../command/returnCheckoutItem";
|
|
5
6
|
import { Feedbacks } from "./feedbacks";
|
|
6
7
|
import { Price } from "./price";
|
|
@@ -19,5 +20,6 @@ interface CheckoutItem extends AggregateRoot {
|
|
|
19
20
|
declare const keepCheckoutItemHandler: CommandHandlerFunction<KeepCheckoutItem, CheckoutItem>;
|
|
20
21
|
declare const returnCheckoutItemHandler: CommandHandlerFunction<ReturnCheckoutItem, CheckoutItem>;
|
|
21
22
|
declare const replaceCheckoutItemHandler: CommandHandlerFunction<ReplaceCheckoutItem, CheckoutItem>;
|
|
23
|
+
declare const resetCheckoutItemHandler: CommandHandlerFunction<ResetCheckoutItem, CheckoutItem>;
|
|
22
24
|
export type { CheckoutItem };
|
|
23
|
-
export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler };
|
|
25
|
+
export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { checkoutItemKept } from "./checkoutItemKept";
|
|
2
2
|
import { checkoutItemReplaced } from "./checkoutItemReplaced";
|
|
3
|
+
import { checkoutItemReset } from "./checkoutItemReset";
|
|
3
4
|
import { checkoutItemReturned } from "./checkoutItemReturned";
|
|
4
5
|
var CheckoutItemStatus;
|
|
5
6
|
(function (CheckoutItemStatus) {
|
|
@@ -34,4 +35,11 @@ const replaceCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
|
|
|
34
35
|
domainEvents: [checkoutItemReplaced({ aggregateId })],
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
+
const resetCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
|
|
39
|
+
const { aggregateId } = command;
|
|
40
|
+
return {
|
|
41
|
+
...aggregateRoot,
|
|
42
|
+
domainEvents: [checkoutItemReset({ aggregateId })],
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export { CheckoutItemStatus, keepCheckoutItemHandler, returnCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_ITEM_RESET = "checkout_item_reset";
|
|
3
|
+
interface CheckoutItemResetPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutItemReset extends DomainEvent<typeof CHECKOUT_ITEM_RESET>, CheckoutItemResetPayload {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutItemResetFunction {
|
|
9
|
+
(payload: CheckoutItemResetPayload): CheckoutItemReset;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutItemReset: CheckoutItemResetFunction;
|
|
12
|
+
export type { CheckoutItemReset };
|
|
13
|
+
export { CHECKOUT_ITEM_RESET, checkoutItemReset };
|
|
@@ -11,8 +11,9 @@ import { GIVE_CHECKOUT_FEEDBACK } from "../../domain/checkoutFeedback/command/gi
|
|
|
11
11
|
import { giveCheckoutFeedbackHandler } from "../../domain/checkoutFeedback/model/checkoutFeedback";
|
|
12
12
|
import { KEEP_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/keepCheckoutItem";
|
|
13
13
|
import { REPLACE_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/replaceCheckoutItem";
|
|
14
|
+
import { RESET_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/resetCheckoutItem";
|
|
14
15
|
import { RETURN_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/returnCheckoutItem";
|
|
15
|
-
import { keepCheckoutItemHandler, replaceCheckoutItemHandler, returnCheckoutItemHandler, } from "../../domain/checkoutItem/model/checkoutItem";
|
|
16
|
+
import { keepCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, returnCheckoutItemHandler, } from "../../domain/checkoutItem/model/checkoutItem";
|
|
16
17
|
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
17
18
|
import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
18
19
|
import { viewBookedProductsVariantsForCheckoutItemHandler, VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, } from "../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
@@ -57,6 +58,7 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
57
58
|
.command(KEEP_CHECKOUT_ITEM, keepCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
58
59
|
.command(RETURN_CHECKOUT_ITEM, returnCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
59
60
|
.command(REPLACE_CHECKOUT_ITEM, replaceCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
61
|
+
.command(RESET_CHECKOUT_ITEM, resetCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
60
62
|
.query(VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutIdHandler, {
|
|
61
63
|
view: pricingByCheckoutIdView,
|
|
62
64
|
})
|
|
@@ -2,6 +2,7 @@ import invariant from "tiny-invariant";
|
|
|
2
2
|
import { viewCheckoutItemById, } from "../../../../projection/checkoutItem/viewCheckoutItemById";
|
|
3
3
|
import { httpCheckoutItemsKeep } from "./httpCheckoutItemsKeep";
|
|
4
4
|
import { httpCheckoutItemsReplace } from "./httpCheckoutItemsReplace";
|
|
5
|
+
import { httpCheckoutItemsReset } from "./httpCheckoutItemsReset";
|
|
5
6
|
import { httpCheckoutItemsReturn } from "./httpCheckoutItemsReturn";
|
|
6
7
|
const toDomain = (checkoutItem) => {
|
|
7
8
|
invariant(checkoutItem, "No checkoutItem found!");
|
|
@@ -21,6 +22,7 @@ const saveCheckoutItem = ({ httpPost }) => async (aggregateRoot) => {
|
|
|
21
22
|
httpCheckoutItemsKeep({ httpPost })(aggregateRoot),
|
|
22
23
|
httpCheckoutItemsReturn({ httpPost })(aggregateRoot),
|
|
23
24
|
httpCheckoutItemsReplace({ httpPost })(aggregateRoot),
|
|
25
|
+
httpCheckoutItemsReset({ httpPost })(aggregateRoot),
|
|
24
26
|
]);
|
|
25
27
|
};
|
|
26
28
|
export { getCheckoutItem, saveCheckoutItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
|
|
2
|
+
const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
|
|
3
|
+
const httpCheckoutItemsReset = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutItemReset = domainEvents.find(isCheckoutItemReset);
|
|
5
|
+
if (!checkoutItemReset) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
await httpPost({
|
|
9
|
+
endpoint: "/reset-checkout-item",
|
|
10
|
+
body: { checkoutItemId: aggregateId },
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { httpCheckoutItemsReset };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
import { Logger } from "../../../../shared/logging/Logger";
|
|
3
|
+
interface ResetCheckoutItemFunction {
|
|
4
|
+
(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
interface UseResetCheckoutItemFunctionArgs {
|
|
7
|
+
readonly checkoutItemId: string;
|
|
8
|
+
readonly logger: Logger;
|
|
9
|
+
}
|
|
10
|
+
type UseResetCheckoutItemResult = [reset: ResetCheckoutItemFunction, status: CommandStatus];
|
|
11
|
+
interface UseResetCheckoutItemFunction {
|
|
12
|
+
(args: UseResetCheckoutItemFunctionArgs): UseResetCheckoutItemResult;
|
|
13
|
+
}
|
|
14
|
+
declare const useResetCheckoutItem: UseResetCheckoutItemFunction;
|
|
15
|
+
export { useResetCheckoutItem };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { resetCheckoutItem } from "../../../../domain/checkoutItem/command/resetCheckoutItem";
|
|
4
|
+
import { useCreateNotification } from "../../../../shared/notifications";
|
|
5
|
+
import { NotificationLevel } from "../../../../shared/notifications/domain/notification/model/notification";
|
|
6
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
7
|
+
import { I18nMessages } from "../../../ui/i18n/i18n";
|
|
8
|
+
const useResetCheckoutItem = ({ checkoutItemId, logger }) => {
|
|
9
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
10
|
+
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
11
|
+
const reset = useCallback(async () => {
|
|
12
|
+
try {
|
|
13
|
+
await commandBus(resetCheckoutItem({
|
|
14
|
+
aggregateId: checkoutItemId,
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
logger.captureException(error);
|
|
19
|
+
createNotification({
|
|
20
|
+
level: NotificationLevel.ERROR,
|
|
21
|
+
bodyI18nKey: I18nMessages.TOAST_GENERIC_ERROR,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}, [checkoutItemId, commandBus, createNotification, logger]);
|
|
25
|
+
return [reset, status];
|
|
26
|
+
};
|
|
27
|
+
export { useResetCheckoutItem };
|
package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js
CHANGED
|
@@ -6,12 +6,14 @@ import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/mo
|
|
|
6
6
|
import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
7
7
|
import { CHECKOUT_ITEM_KEPT } from "../../../../domain/checkoutItem/model/checkoutItemKept";
|
|
8
8
|
import { CHECKOUT_ITEM_REPLACED, } from "../../../../domain/checkoutItem/model/checkoutItemReplaced";
|
|
9
|
+
import { CHECKOUT_ITEM_RESET } from "../../../../domain/checkoutItem/model/checkoutItemReset";
|
|
9
10
|
import { CHECKOUT_ITEM_RETURNED, } from "../../../../domain/checkoutItem/model/checkoutItemReturned";
|
|
10
11
|
import { viewFirstAvailableCheckoutByCustomerId } from "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
11
12
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
12
13
|
const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
|
|
13
14
|
const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
|
|
14
15
|
const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
|
|
16
|
+
const isCheckoutItemReset = (event) => event.name === CHECKOUT_ITEM_RESET;
|
|
15
17
|
const isCheckoutStarted = (event) => event.name === CHECKOUT_STARTED;
|
|
16
18
|
const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
|
|
17
19
|
const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
|
|
@@ -20,6 +22,7 @@ const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPI
|
|
|
20
22
|
const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
|
|
21
23
|
isCheckoutItemReplaced(event) ||
|
|
22
24
|
isCheckoutItemReturned(event) ||
|
|
25
|
+
isCheckoutItemReset(event) ||
|
|
23
26
|
isCheckoutStarted(event) ||
|
|
24
27
|
isCheckoutSubmitted(event) ||
|
|
25
28
|
isCheckoutFeedbackGiven(event) ||
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { toPricingProjection } from "./pricing";
|
|
1
2
|
const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => await httpPost({
|
|
2
3
|
endpoint: "/view-pricing-by-checkout-id",
|
|
3
4
|
body: { checkoutId },
|
|
4
5
|
signal,
|
|
5
6
|
result: {
|
|
6
7
|
error: null,
|
|
7
|
-
success: (response) => response.result,
|
|
8
|
+
success: (response) => toPricingProjection(response.result),
|
|
8
9
|
},
|
|
9
10
|
});
|
|
10
11
|
export { httpPricingByCheckoutIdView };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PricingProjection, ServiceProjection } from "../../../projection/pricing/pricing";
|
|
2
|
+
import { PriceProjection } from "../../../projection/shared/price";
|
|
3
|
+
interface PricingDto {
|
|
4
|
+
readonly balanceDiscount: PriceProjection;
|
|
5
|
+
readonly discount: PriceProjection;
|
|
6
|
+
readonly discountPercentage: number;
|
|
7
|
+
readonly orderTotal: PriceProjection;
|
|
8
|
+
readonly pendingToPay: PriceProjection;
|
|
9
|
+
readonly service: ServiceProjection;
|
|
10
|
+
readonly subtotal: PriceProjection;
|
|
11
|
+
}
|
|
12
|
+
interface ToPricingProjectionFunction {
|
|
13
|
+
(pricingDto: PricingDto): PricingProjection;
|
|
14
|
+
}
|
|
15
|
+
declare const toPricingProjection: ToPricingProjectionFunction;
|
|
16
|
+
export { toPricingProjection };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const toPricingProjection = (pricingDto) => ({
|
|
2
|
+
...pricingDto,
|
|
3
|
+
discount: {
|
|
4
|
+
...pricingDto.discount,
|
|
5
|
+
amount: -Math.abs(pricingDto.discount.amount),
|
|
6
|
+
},
|
|
7
|
+
balanceDiscount: {
|
|
8
|
+
...pricingDto.balanceDiscount,
|
|
9
|
+
amount: -Math.abs(pricingDto.balanceDiscount.amount),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export { toPricingProjection };
|
|
@@ -12,7 +12,6 @@ import { useBasePath } from "./useBasePath";
|
|
|
12
12
|
const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
|
|
13
13
|
const logger = useLogger();
|
|
14
14
|
const basePath = useBasePath();
|
|
15
|
-
const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
|
|
16
15
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
17
16
|
const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
|
|
18
17
|
const [startCheckout] = useStartCheckout({ checkoutId: checkout?.id, logger });
|
|
@@ -58,12 +57,7 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
|
|
|
58
57
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.HOME}`, replace: true });
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
navigatedToFirstItemWithoutCustomerDecision.current =
|
|
63
|
-
navigatedToFirstItemWithoutCustomerDecision.current ||
|
|
64
|
-
Boolean(itemRouteMatch && itemRouteMatch.params.id === firstItemWithoutCustomerDecision?.id);
|
|
65
|
-
if (firstItemWithoutCustomerDecision && !navigatedToFirstItemWithoutCustomerDecision.current) {
|
|
66
|
-
navigatedToFirstItemWithoutCustomerDecision.current = true;
|
|
60
|
+
if (firstItemWithoutCustomerDecision && !itemRouteMatch) {
|
|
67
61
|
return (React.createElement(Navigate, { to: generatePath(`${basePath}/${Routes.ITEM}`, { id: firstItemWithoutCustomerDecision.id }), replace: true }));
|
|
68
62
|
}
|
|
69
63
|
return children;
|
|
@@ -54,7 +54,7 @@ const Checkout = ({ children, customerId, country, useRedirect }) => {
|
|
|
54
54
|
? checkoutItem.replacedFor.size
|
|
55
55
|
: checkoutItem.productVariant.size })))),
|
|
56
56
|
pricing && (React.createElement(View, { style: style.pricingContainer },
|
|
57
|
-
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage,
|
|
57
|
+
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsible: false, discount: pricing.discount, discountPercentage: pricing.discountPercentage, pendingToPay: pricing.pendingToPay, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onSubmit: handleOnSubmit }))))),
|
|
58
58
|
children));
|
|
59
59
|
};
|
|
60
60
|
export { Checkout };
|
|
@@ -10,6 +10,7 @@ import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner"
|
|
|
10
10
|
import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
|
|
11
11
|
import { useKeepCheckoutItem } from "../../../domain/checkoutItem/react/useKeepCheckoutItem";
|
|
12
12
|
import { useReplaceCheckoutItem } from "../../../domain/checkoutItem/react/useReplaceCheckoutItem";
|
|
13
|
+
import { useResetCheckoutItem } from "../../../domain/checkoutItem/react/useResetCheckoutItem";
|
|
13
14
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
14
15
|
import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
|
|
15
16
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
@@ -64,7 +65,14 @@ const Item = ({ customerId, country }) => {
|
|
|
64
65
|
useEffect(() => {
|
|
65
66
|
setCustomerDecissionMade(checkoutItem.status !== CheckoutItemStatus.INITIAL);
|
|
66
67
|
}, [checkoutItem.status, id]);
|
|
67
|
-
const
|
|
68
|
+
const [resetCheckoutItem] = useResetCheckoutItem({
|
|
69
|
+
checkoutItemId: checkoutItem.id,
|
|
70
|
+
logger,
|
|
71
|
+
});
|
|
72
|
+
const handleOnBannerPress = useCallback(() => {
|
|
73
|
+
resetCheckoutItem();
|
|
74
|
+
setCustomerDecissionMade(false);
|
|
75
|
+
}, [resetCheckoutItem]);
|
|
68
76
|
const [keepCheckoutItem, keepCheckoutItemStatus] = useKeepCheckoutItem({ checkoutItemId: checkoutItem.id, logger });
|
|
69
77
|
const [returnCheckoutItem, returnCheckoutItemStatus] = useReturnCheckoutItem({
|
|
70
78
|
checkoutItemId: checkoutItem.id,
|
|
@@ -2,7 +2,7 @@ import { FC } from "react";
|
|
|
2
2
|
import { ServiceProjection } from "../../../../../../projection/pricing/pricing";
|
|
3
3
|
import { PriceProjection } from "../../../../../../projection/shared/price";
|
|
4
4
|
interface PricingProps {
|
|
5
|
-
readonly
|
|
5
|
+
readonly pendingToPay: PriceProjection;
|
|
6
6
|
readonly subtotal: PriceProjection;
|
|
7
7
|
readonly balanceDiscount?: PriceProjection;
|
|
8
8
|
readonly discount?: PriceProjection;
|
|
@@ -15,7 +15,7 @@ const PS_SERVICE_FREE_INDICATOR = 100;
|
|
|
15
15
|
const Row = ({ text, level = 3, children }) => (React.createElement(View, { style: style.row },
|
|
16
16
|
React.createElement(Text, { level: level, style: style.uppercase, action: true }, text),
|
|
17
17
|
children));
|
|
18
|
-
const Pricing = ({
|
|
18
|
+
const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPercentage = 0, totalCheckoutItemsKept, service, collapsible = true, collapsed = false, busy = false, onPress = () => void 0, onSubmit, }) => {
|
|
19
19
|
const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL }) || "";
|
|
20
20
|
const totalCheckoutItemsKeptText = useI18nMessage({
|
|
21
21
|
id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
|
|
@@ -41,7 +41,7 @@ const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPerc
|
|
|
41
41
|
totalText,
|
|
42
42
|
" ",
|
|
43
43
|
totalCheckoutItemsKeptText),
|
|
44
|
-
React.createElement(Price, { price:
|
|
44
|
+
React.createElement(Price, { price: pendingToPay, variant: "detail" })),
|
|
45
45
|
React.createElement(View, null,
|
|
46
46
|
React.createElement(Button, { busy: busy, small: true, onPress: onSubmit }, submitButtonText)))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
|
|
47
47
|
React.createElement(Row, { text: `${subtotalText} ${totalCheckoutItemsKeptText}` },
|
|
@@ -53,7 +53,7 @@ const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPerc
|
|
|
53
53
|
React.createElement(Row, { text: feeText }, isPSServiceFree ? (React.createElement(Text, { level: 3, style: style.uppercase, action: true }, freeText)) : (React.createElement(Price, { price: service.finalPrice, variant: "subtotal" }))),
|
|
54
54
|
React.createElement(View, { style: style.divider }),
|
|
55
55
|
React.createElement(Row, { level: 2, text: totalText },
|
|
56
|
-
React.createElement(Price, { price:
|
|
56
|
+
React.createElement(Price, { price: pendingToPay, variant: "total" })),
|
|
57
57
|
React.createElement(Button, { busy: busy, onPress: onSubmit }, submitButtonText)))));
|
|
58
58
|
};
|
|
59
59
|
export { Pricing };
|
|
@@ -5,5 +5,5 @@ import { Pricing } from "../pricing/Pricing";
|
|
|
5
5
|
import { style } from "./StickyPricing.style";
|
|
6
6
|
const StickyPricing = ({ pricing, totalCheckoutItemsKept, collapsed, onPress, onSubmit, onLayout, }) => (React.createElement(Sticky, { onLayout: onLayout },
|
|
7
7
|
React.createElement(Body, { style: { column: style.container } },
|
|
8
|
-
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsed: collapsed, discount: pricing.discount, discountPercentage: pricing.discountPercentage,
|
|
8
|
+
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsed: collapsed, discount: pricing.discount, discountPercentage: pricing.discountPercentage, pendingToPay: pricing.pendingToPay, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: totalCheckoutItemsKept, onPress: onPress, onSubmit: onSubmit }))));
|
|
9
9
|
export { StickyPricing };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { PriceProjection } from "../shared/price";
|
|
2
2
|
interface ServiceProjection {
|
|
3
|
-
readonly reference: string;
|
|
4
|
-
readonly originalPrice: PriceProjection;
|
|
5
3
|
readonly discount: PriceProjection;
|
|
6
4
|
readonly finalPrice: PriceProjection;
|
|
5
|
+
readonly originalPrice: PriceProjection;
|
|
7
6
|
readonly prepaid: boolean;
|
|
7
|
+
readonly reference: string;
|
|
8
8
|
}
|
|
9
9
|
interface PricingProjection {
|
|
10
|
-
readonly orderTotal: PriceProjection;
|
|
11
|
-
readonly subtotal: PriceProjection;
|
|
12
10
|
readonly balanceDiscount: PriceProjection;
|
|
13
11
|
readonly discount: PriceProjection;
|
|
14
12
|
readonly discountPercentage: number;
|
|
13
|
+
readonly orderTotal: PriceProjection;
|
|
14
|
+
readonly pendingToPay: PriceProjection;
|
|
15
15
|
readonly service: ServiceProjection;
|
|
16
|
+
readonly subtotal: PriceProjection;
|
|
16
17
|
}
|
|
17
18
|
export type { PricingProjection, ServiceProjection };
|
|
@@ -2,8 +2,7 @@ import { Portal } from "@gorhom/portal";
|
|
|
2
2
|
import { useBack } from "@lookiero/aurora-next/build/hooks/useBack/useBack";
|
|
3
3
|
import { animated, useTransition } from "@react-spring/native";
|
|
4
4
|
import React, { useCallback, useMemo, useState } from "react";
|
|
5
|
-
import { Dimensions, Platform, TouchableWithoutFeedback, View, } from "react-native";
|
|
6
|
-
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
|
5
|
+
import { Dimensions, Platform, ScrollView, TouchableWithoutFeedback, View, } from "react-native";
|
|
7
6
|
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
7
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
9
8
|
import { useScreenSize } from "../../../hooks/useScreenSize";
|
|
@@ -56,7 +55,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
56
55
|
: { modalOpacity: 0, overlayOpacity: 0, modalTranslateY: 0, modalScale: TRANSITION_MODAL_SCALE },
|
|
57
56
|
unique: true,
|
|
58
57
|
});
|
|
59
|
-
const ModalContentView = useMemo(() => (scroll ?
|
|
58
|
+
const ModalContentView = useMemo(() => (scroll ? ScrollView : View), [scroll]);
|
|
60
59
|
return (React.createElement(Portal, { hostName: portalHostName }, transitions(({ modalOpacity, overlayOpacity, modalTranslateY, modalScale }, item) => item && (React.createElement(View, { pointerEvents: visible ? "auto" : "none", style: style.container, testID: "modal" },
|
|
61
60
|
React.createElement(TouchableWithoutFeedback, { onPress: visible ? onClose : undefined },
|
|
62
61
|
React.createElement(animated.View, { style: [style.overlay, { opacity: overlayOpacity }, customStyle?.overlay] })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"@react-spring/native": "^9.5.5",
|
|
36
36
|
"@sentry/react-native": "^4.13.0",
|
|
37
37
|
"inline-style-prefixer": "6.0.1",
|
|
38
|
-
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
39
38
|
"react-native-safe-area-context": "^4.4.1",
|
|
40
39
|
"react-native-svg": "^12.1.1",
|
|
41
40
|
"tiny-invariant": "^1.3.1",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from "@lookiero/messaging";
|
|
2
|
-
declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
|
|
3
|
-
interface MarkCheckoutAsPaidPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
}
|
|
6
|
-
interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
|
|
7
|
-
}
|
|
8
|
-
interface MarkCheckoutAsPaidFunction {
|
|
9
|
-
(payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
|
|
10
|
-
}
|
|
11
|
-
declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
|
|
12
|
-
export type { MarkCheckoutAsPaid };
|
|
13
|
-
export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
declare const CHECKOUT_PAID = "checkout_paid";
|
|
3
|
-
interface CheckoutPaidPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
}
|
|
6
|
-
interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
|
|
7
|
-
}
|
|
8
|
-
interface CheckoutPaidFunction {
|
|
9
|
-
(payload: CheckoutPaidPayload): CheckoutPaid;
|
|
10
|
-
}
|
|
11
|
-
declare const checkoutPaid: CheckoutPaidFunction;
|
|
12
|
-
export type { CheckoutPaid };
|
|
13
|
-
export { CHECKOUT_PAID, checkoutPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
|
|
2
|
-
const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
|
|
3
|
-
const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
-
const checkoutPaid = domainEvents.find(isCheckoutPaid);
|
|
5
|
-
if (!checkoutPaid) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
await httpPost({
|
|
9
|
-
endpoint: "/mark-checkout-as-paid",
|
|
10
|
-
body: { checkoutId: aggregateId },
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export { httpCheckoutsMarkAsPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface MarkAsPaidFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
|
|
6
|
-
interface UseMarkCheckoutAsPaidFunctionArgs {
|
|
7
|
-
readonly checkoutId?: string;
|
|
8
|
-
}
|
|
9
|
-
interface UseMarkCheckoutAsPaidFunction {
|
|
10
|
-
(args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
|
|
11
|
-
}
|
|
12
|
-
declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
|
|
13
|
-
export { useMarkCheckoutAsPaid };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import invariant from "tiny-invariant";
|
|
4
|
-
import { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
|
|
5
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useMarkCheckoutAsPaid = ({ checkoutId }) => {
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const markAsPaid = useCallback(() => {
|
|
9
|
-
invariant(checkoutId, "CheckoutId must be defined in order to mark the checkout as paid");
|
|
10
|
-
return commandBus(markCheckoutAsPaid({
|
|
11
|
-
aggregateId: checkoutId,
|
|
12
|
-
}));
|
|
13
|
-
}, [checkoutId, commandBus]);
|
|
14
|
-
return [markAsPaid, status];
|
|
15
|
-
};
|
|
16
|
-
export { useMarkCheckoutAsPaid };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface BookFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseBookCheckouBookingForCheckoutItem = [book: BookFunction, status: CommandStatus];
|
|
6
|
-
interface UseBookCheckouBookingForCheckoutItemFunctionArgs {
|
|
7
|
-
readonly checkoutItemId: string;
|
|
8
|
-
}
|
|
9
|
-
interface UseBookCheckouBookingForCheckoutItemFunction {
|
|
10
|
-
(args: UseBookCheckouBookingForCheckoutItemFunctionArgs): UseBookCheckouBookingForCheckoutItem;
|
|
11
|
-
}
|
|
12
|
-
declare const useBookCheckouBookingForCheckoutItem: UseBookCheckouBookingForCheckoutItemFunction;
|
|
13
|
-
export { useBookCheckouBookingForCheckoutItem };
|
package/dist/infrastructure/domain/checkoutBooking/react/useBookCheckouBookingForCheckoutItem.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { v4 as uuid } from "uuid";
|
|
4
|
-
import { bookCheckoutBookingForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useBookCheckouBookingForCheckoutItem = ({ checkoutItemId }) => {
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const book = useCallback(() => commandBus(bookCheckoutBookingForCheckoutItem({
|
|
9
|
-
aggregateId: uuid(),
|
|
10
|
-
checkoutItemId,
|
|
11
|
-
})), [checkoutItemId, commandBus]);
|
|
12
|
-
return [book, status];
|
|
13
|
-
};
|
|
14
|
-
export { useBookCheckouBookingForCheckoutItem };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface IncrementIntroShownCountFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseIncrementIntroShownCount = [incrementIntroShownCount: IncrementIntroShownCountFunction, status: CommandStatus];
|
|
6
|
-
interface UseIncrementIntroShownCountFunction {
|
|
7
|
-
(): UseIncrementIntroShownCount;
|
|
8
|
-
}
|
|
9
|
-
declare const useIncrementIntroShownCount: UseIncrementIntroShownCountFunction;
|
|
10
|
-
export { useIncrementIntroShownCount };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { useViewIntroShownCount } from "../../../projection/uiSetting/react/useViewIntroShownCount";
|
|
3
|
-
import { UISettings } from "../../../ui/settings/UISettings";
|
|
4
|
-
import { useUpdateUiSetting } from "./useUpdateUiSetting";
|
|
5
|
-
const useIncrementIntroShownCount = () => {
|
|
6
|
-
const [update, status] = useUpdateUiSetting();
|
|
7
|
-
const [introShownCount] = useViewIntroShownCount();
|
|
8
|
-
const incrementIntroShownCount = useCallback(() => update({ key: UISettings.INTRO_SHOWN_COUNT, value: introShownCount + 1 }), [introShownCount, update]);
|
|
9
|
-
return [incrementIntroShownCount, status];
|
|
10
|
-
};
|
|
11
|
-
export { useIncrementIntroShownCount };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BookedSizeChangeProductsVariantsForCheckoutItemView } from "../../../projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem";
|
|
2
|
-
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
-
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemView extends BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
4
|
-
}
|
|
5
|
-
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs {
|
|
6
|
-
readonly httpPost: HttpPostFunction;
|
|
7
|
-
}
|
|
8
|
-
interface HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction {
|
|
9
|
-
(args: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
10
|
-
}
|
|
11
|
-
declare const httpBookedSizeChangeProductsVariantsForCheckoutItemView: HttpBookedSizeChangeProductsVariantsForCheckoutItemViewFunction;
|
|
12
|
-
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
|
-
const response = await httpPost({
|
|
3
|
-
endpoint: "/view-booked-size-change-product-variants-for-checkout-item",
|
|
4
|
-
body: { checkoutItemId },
|
|
5
|
-
signal,
|
|
6
|
-
});
|
|
7
|
-
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
-
};
|
|
9
|
-
export { httpBookedSizeChangeProductsVariantsForCheckoutItemView };
|