@lookiero/checkout 0.2.51 → 0.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/infrastructure/delivery/baseBootstrap.d.ts +2 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +5 -1
- package/dist/infrastructure/delivery/bootstrap.js +4 -0
- package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.d.ts +12 -0
- package/dist/infrastructure/projection/pricing/httpPricingByCheckoutIdView.js +9 -0
- package/dist/infrastructure/projection/pricing/pricing.mock.d.ts +3 -0
- package/dist/{projection → infrastructure/projection}/pricing/pricing.mock.js +1 -1
- package/dist/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.d.ts +10 -0
- package/dist/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +9 -0
- package/dist/infrastructure/ui/views/summary/Summary.js +1 -1
- package/dist/projection/pricing/viewPricingByCheckoutId.d.ts +25 -0
- package/dist/projection/pricing/viewPricingByCheckoutId.js +8 -0
- package/package.json +1 -1
- package/dist/projection/pricing/pricing.mock.d.ts +0 -3
|
@@ -14,6 +14,7 @@ import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkou
|
|
|
14
14
|
import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
15
15
|
import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
16
16
|
import { CheckoutItemByIdView } from "../../projection/checkoutItem/viewCheckoutItemById";
|
|
17
|
+
import { PricingByCheckoutIdView } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
17
18
|
import { ReturnQuestionsByCheckoutItemIdView } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
18
19
|
import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
19
20
|
declare const MESSAGING_CONTEXT_ID = "Checkout";
|
|
@@ -28,6 +29,7 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
28
29
|
readonly checkoutItemByIdView: CheckoutItemByIdView;
|
|
29
30
|
readonly returnQuestionsByCheckoutItemIdView: ReturnQuestionsByCheckoutItemIdView;
|
|
30
31
|
readonly bookedSizeChangeProductsVariantsForCheckoutItemView: BookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
32
|
+
readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
|
|
31
33
|
readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
|
|
32
34
|
readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
|
|
33
35
|
readonly uiSettingsDependencies: NeverWhenEmptyRecord<[
|
|
@@ -16,10 +16,11 @@ import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_C
|
|
|
16
16
|
import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
17
17
|
import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
|
|
18
18
|
import { viewCheckoutItemByIdHandler, VIEW_CHECKOUT_ITEM_BY_ID, } from "../../projection/checkoutItem/viewCheckoutItemById";
|
|
19
|
+
import { viewPricingByCheckoutIdHandler, VIEW_PRICING_BY_CHECKOUT_ID, } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
19
20
|
import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
20
21
|
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
21
22
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
22
|
-
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 })
|
|
23
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedSizeChangeProductsVariantsForCheckoutItemView, pricingByCheckoutIdView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, }) => messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
23
24
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
24
25
|
view: fiveItemsDiscountByCustomerIdView,
|
|
25
26
|
})
|
|
@@ -43,6 +44,9 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
43
44
|
.command(KEEP_CHECKOUT_ITEM, keepCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
44
45
|
.command(RETURN_CHECKOUT_ITEM, returnCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
45
46
|
.command(REPLACE_CHECKOUT_ITEM, replaceCheckoutItemHandler)(getCheckoutItem, saveCheckoutItem, ...checkoutItemsDependencies)
|
|
47
|
+
.query(VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutIdHandler, {
|
|
48
|
+
view: pricingByCheckoutIdView,
|
|
49
|
+
})
|
|
46
50
|
.query(VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, {
|
|
47
51
|
view: bookedSizeChangeProductsVariantsForCheckoutItemView,
|
|
48
52
|
})
|
|
@@ -9,6 +9,7 @@ import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checko
|
|
|
9
9
|
import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/httpFiveItemsDiscountByCustomerIdView";
|
|
10
10
|
import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
|
|
11
11
|
import { httpCheckoutItemByIdView } from "../projection/checkoutItem/httpCheckoutItemByIdView";
|
|
12
|
+
import { httpPricingByCheckoutIdView } from "../projection/pricing/httpPricingByCheckoutIdView";
|
|
12
13
|
import { httpReturnQuestionsByCheckoutItemIdView } from "../projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView";
|
|
13
14
|
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
14
15
|
import { baseBootstrap } from "./baseBootstrap";
|
|
@@ -27,6 +28,9 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
27
28
|
bookedSizeChangeProductsVariantsForCheckoutItemView: httpBookedSizeChangeProductsVariantsForCheckoutItemView({
|
|
28
29
|
httpPost,
|
|
29
30
|
}),
|
|
31
|
+
pricingByCheckoutIdView: httpPricingByCheckoutIdView({
|
|
32
|
+
httpPost,
|
|
33
|
+
}),
|
|
30
34
|
getUiSetting,
|
|
31
35
|
saveUiSetting,
|
|
32
36
|
uiSettingsDependencies: [{ read, write }],
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PricingByCheckoutIdView } from "../../../projection/pricing/viewPricingByCheckoutId";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpPricingByCheckoutIdView extends PricingByCheckoutIdView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpPricingByCheckoutIdViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpPricingByCheckoutIdViewFunction {
|
|
9
|
+
(args: HttpPricingByCheckoutIdViewFunctionArgs): HttpPricingByCheckoutIdView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpPricingByCheckoutIdView: HttpPricingByCheckoutIdViewFunction;
|
|
12
|
+
export { httpPricingByCheckoutIdView };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const httpPricingByCheckoutIdView = ({ httpPost }) => async ({ checkoutId, signal }) => {
|
|
2
|
+
const response = await httpPost({
|
|
3
|
+
endpoint: "/view-pricing-by-checkout-id",
|
|
4
|
+
body: { checkoutId },
|
|
5
|
+
signal,
|
|
6
|
+
});
|
|
7
|
+
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
|
+
};
|
|
9
|
+
export { httpPricingByCheckoutIdView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { PricingProjection } from "../../../../projection/pricing/pricing";
|
|
3
|
+
interface UseViewPricingByCheckoutIdFunctionArgs {
|
|
4
|
+
readonly checkoutId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseViewPricingByCheckoutIdFunction {
|
|
7
|
+
(args: UseViewPricingByCheckoutIdFunctionArgs): UseQueryFunctionResult<PricingProjection>;
|
|
8
|
+
}
|
|
9
|
+
declare const useViewPricingByCheckoutId: UseViewPricingByCheckoutIdFunction;
|
|
10
|
+
export { useViewPricingByCheckoutId };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { viewPricingByCheckoutId } from "../../../../projection/pricing/viewPricingByCheckoutId";
|
|
3
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
4
|
+
const useViewPricingByCheckoutId = ({ checkoutId }) => useQuery({
|
|
5
|
+
query: viewPricingByCheckoutId({ checkoutId }),
|
|
6
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
|
+
});
|
|
9
|
+
export { useViewPricingByCheckoutId };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback, useState } from "react";
|
|
3
|
-
import { pricing } from "../../../../projection/pricing/pricing.mock";
|
|
4
3
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
4
|
+
import { pricing } from "../../../projection/pricing/pricing.mock";
|
|
5
5
|
import { Body } from "../../components/layouts/body/Body";
|
|
6
6
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
7
7
|
import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { PricingProjection } from "./pricing";
|
|
3
|
+
declare const VIEW_PRICING_BY_CHECKOUT_ID = "view_pricing_by_checkout_id";
|
|
4
|
+
interface ViewPricingByCheckoutIdPayload {
|
|
5
|
+
readonly checkoutId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewPricingByCheckoutId extends Query<typeof VIEW_PRICING_BY_CHECKOUT_ID>, ViewPricingByCheckoutIdPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ViewPricingByCheckoutIdFunction {
|
|
10
|
+
(payload: ViewPricingByCheckoutIdPayload): ViewPricingByCheckoutId;
|
|
11
|
+
}
|
|
12
|
+
declare const viewPricingByCheckoutId: ViewPricingByCheckoutIdFunction;
|
|
13
|
+
declare type ViewPricingByCheckoutIdResult = PricingProjection | null;
|
|
14
|
+
interface PricingByCheckoutIdViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutId: string;
|
|
16
|
+
}
|
|
17
|
+
interface PricingByCheckoutIdView {
|
|
18
|
+
(args: PricingByCheckoutIdViewArgs): Promise<ViewPricingByCheckoutIdResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ViewPricingByCheckoutIdHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: PricingByCheckoutIdView;
|
|
22
|
+
}
|
|
23
|
+
declare const viewPricingByCheckoutIdHandler: QueryHandlerFunction<ViewPricingByCheckoutId, ViewPricingByCheckoutIdResult, ViewPricingByCheckoutIdHandlerFunctionArgs>;
|
|
24
|
+
export type { ViewPricingByCheckoutId, PricingByCheckoutIdView, ViewPricingByCheckoutIdResult };
|
|
25
|
+
export { VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutId, viewPricingByCheckoutIdHandler };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_PRICING_BY_CHECKOUT_ID = "view_pricing_by_checkout_id";
|
|
3
|
+
const viewPricingByCheckoutId = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_PRICING_BY_CHECKOUT_ID }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewPricingByCheckoutIdHandler = ({ view, signal }) => async ({ checkoutId }) => view({ checkoutId, signal });
|
|
8
|
+
export { VIEW_PRICING_BY_CHECKOUT_ID, viewPricingByCheckoutId, viewPricingByCheckoutIdHandler };
|
package/package.json
CHANGED