@lookiero/checkout 0.4.1 → 0.4.3
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 -2
- package/dist/infrastructure/delivery/baseBootstrap.js +4 -4
- package/dist/infrastructure/delivery/bootstrap.js +2 -2
- package/dist/infrastructure/delivery/mock/dataSourceCheckoutBookings.js +2 -2
- package/dist/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.d.ts +12 -0
- package/dist/infrastructure/projection/{bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.js → bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.js} +2 -2
- package/dist/infrastructure/projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem.d.ts +10 -0
- package/dist/infrastructure/projection/{bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.js → bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem.js} +4 -4
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +1 -2
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +1 -2
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +1 -2
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.d.ts +1 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +3 -3
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +1 -5
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -3
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +2 -3
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +4 -10
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +1 -2
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +1 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +3 -5
- package/dist/infrastructure/ui/i18n/i18n.d.ts +3 -6
- package/dist/infrastructure/ui/i18n/i18n.js +3 -6
- package/dist/infrastructure/ui/views/App.js +1 -3
- package/dist/infrastructure/ui/views/App.style.d.ts +0 -5
- package/dist/infrastructure/ui/views/App.style.js +0 -7
- package/dist/infrastructure/ui/views/checkout/Checkout.js +2 -1
- package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +1 -0
- package/dist/infrastructure/ui/views/checkout/Checkout.style.js +1 -0
- package/dist/infrastructure/ui/views/feedback/Feedback.js +2 -1
- package/dist/infrastructure/ui/views/header/Header.style.d.ts +2 -1
- package/dist/infrastructure/ui/views/header/Header.style.js +3 -2
- package/dist/infrastructure/ui/views/intro/Intro.js +2 -1
- package/dist/infrastructure/ui/views/item/Item.js +13 -10
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +1 -1
- package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -6
- package/dist/infrastructure/ui/views/summary/Summary.js +5 -2
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +2 -2
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +3 -0
- package/dist/projection/{bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.d.ts → bookedProductsVariants/bookedProductsVariants.d.ts} +2 -2
- package/dist/projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem.d.ts +25 -0
- package/dist/projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem.js +8 -0
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +9 -4
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +19 -11
- package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +12 -10
- package/dist/shared/ui/components/layouts/modal/Modal.js +9 -5
- package/dist/shared/ui/components/layouts/modal/Modal.style.d.ts +3 -0
- package/dist/shared/ui/components/layouts/modal/Modal.style.js +1 -0
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.js +1 -1
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.style.d.ts +1 -0
- package/dist/shared/ui/components/molecules/buttonIcon/ButtonIcon.style.js +1 -0
- package/package.json +2 -2
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/httpBookedSizeChangeProductsVariantsForCheckoutItemView.d.ts +0 -12
- package/dist/infrastructure/projection/bookedSizeChangeProductsVariants/react/useViewBookedSizeChangeProductsVariantsForCheckoutItem.d.ts +0 -10
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.d.ts +0 -25
- package/dist/projection/bookedSizeChangeProductsVariants/viewBookedSizeChangeProductVariantsForCheckoutItem.js +0 -8
- /package/dist/projection/{bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants.js → bookedProductsVariants/bookedProductsVariants.js} +0 -0
|
@@ -10,7 +10,7 @@ import { CheckoutItem } from "../../domain/checkoutItem/model/checkoutItem";
|
|
|
10
10
|
import { CheckoutItemsGetFunction, CheckoutItemsSaveFunction } from "../../domain/checkoutItem/model/checkoutItems";
|
|
11
11
|
import { UiSetting } from "../../domain/uiSetting/model/uiSetting";
|
|
12
12
|
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../domain/uiSetting/model/uiSettings";
|
|
13
|
-
import {
|
|
13
|
+
import { BookedProductsVariantsForCheckoutItemView } from "../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
14
14
|
import { CheckoutByIdView } from "../../projection/checkout/viewCheckoutById";
|
|
15
15
|
import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
16
16
|
import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
@@ -34,7 +34,7 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
34
34
|
readonly checkoutItemByIdView: CheckoutItemByIdView;
|
|
35
35
|
readonly checkoutBookingByIdView: CheckoutBookingByIdView;
|
|
36
36
|
readonly returnQuestionsByCheckoutItemIdView: ReturnQuestionsByCheckoutItemIdView;
|
|
37
|
-
readonly
|
|
37
|
+
readonly bookedProductsVariantsForCheckoutItemView: BookedProductsVariantsForCheckoutItemView;
|
|
38
38
|
readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
|
|
39
39
|
readonly paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView;
|
|
40
40
|
readonly checkoutQuestionsByCheckoutIdView: CheckoutQuestionsByCheckoutIdView;
|
|
@@ -13,7 +13,7 @@ import { RETURN_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/returnCh
|
|
|
13
13
|
import { keepCheckoutItemHandler, replaceCheckoutItemHandler, returnCheckoutItemHandler, } from "../../domain/checkoutItem/model/checkoutItem";
|
|
14
14
|
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
15
15
|
import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
16
|
-
import {
|
|
16
|
+
import { viewBookedProductsVariantsForCheckoutItemHandler, VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, } from "../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
17
17
|
import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID, } from "../../projection/checkout/viewCheckoutById";
|
|
18
18
|
import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
19
19
|
import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
|
|
@@ -27,7 +27,7 @@ import { viewPricingByCheckoutIdHandler, VIEW_PRICING_BY_CHECKOUT_ID, } from "..
|
|
|
27
27
|
import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
28
28
|
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
29
29
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
30
|
-
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView,
|
|
30
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
31
31
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
32
32
|
view: fiveItemsDiscountByCustomerIdView,
|
|
33
33
|
})
|
|
@@ -64,8 +64,8 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
64
64
|
.query(VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingByIdHandler, {
|
|
65
65
|
view: checkoutBookingByIdView,
|
|
66
66
|
})
|
|
67
|
-
.query(
|
|
68
|
-
view:
|
|
67
|
+
.query(VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedProductsVariantsForCheckoutItemHandler, {
|
|
68
|
+
view: bookedProductsVariantsForCheckoutItemView,
|
|
69
69
|
})
|
|
70
70
|
.command(BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItemHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
71
71
|
.command(BLOCK_CHECKOUT_BOOKING, blockCheckoutBookingHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
@@ -4,7 +4,7 @@ import { getCheckoutFeedback, saveCheckoutFeedback } from "../domain/checkoutFee
|
|
|
4
4
|
import { getCheckoutItem, saveCheckoutItem } from "../domain/checkoutItem/model/httpCheckoutItems";
|
|
5
5
|
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
6
6
|
import { read, write } from "../persistence/asyncStorageStorage";
|
|
7
|
-
import {
|
|
7
|
+
import { httpBookedProductsVariantsForCheckoutItemView } from "../projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView";
|
|
8
8
|
import { httpCheckoutByIdView } from "../projection/checkout/httpCheckoutByIdView";
|
|
9
9
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checkout/httpFirstAvailableCheckoutByCustomerIdView";
|
|
10
10
|
import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/httpFiveItemsDiscountByCustomerIdView";
|
|
@@ -30,7 +30,7 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
30
30
|
checkoutItemByIdView: httpCheckoutItemByIdView({ httpPost }),
|
|
31
31
|
returnQuestionsByCheckoutItemIdView: httpReturnQuestionsByCheckoutItemIdView({ httpPost }),
|
|
32
32
|
checkoutBookingByIdView: httpCheckoutBookingByIdView({ httpPost }),
|
|
33
|
-
|
|
33
|
+
bookedProductsVariantsForCheckoutItemView: httpBookedProductsVariantsForCheckoutItemView({
|
|
34
34
|
httpPost,
|
|
35
35
|
}),
|
|
36
36
|
pricingByCheckoutIdView: httpPricingByCheckoutIdView({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
2
|
import { v4 as uuid } from "uuid";
|
|
3
3
|
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
4
|
-
import {
|
|
4
|
+
import { viewBookedProductsVariantsForCheckoutItem, } from "../../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
5
5
|
const toCheckoutBookingDomain = (checkoutBooking) => {
|
|
6
6
|
invariant(checkoutBooking, "No checkoutBooking found!");
|
|
7
7
|
return {
|
|
@@ -16,7 +16,7 @@ const toCheckoutBookingProjection = (checkoutBooking) => ({
|
|
|
16
16
|
checkoutItemIds: checkoutBooking.checkoutItemIds,
|
|
17
17
|
checkoutStatus: checkoutBooking.checkoutStatus,
|
|
18
18
|
});
|
|
19
|
-
const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toCheckoutBookingDomain(await queryBus(
|
|
19
|
+
const getCheckoutBooking = ({ queryBus }) => async (aggregateId) => toCheckoutBookingDomain(await queryBus(viewBookedProductsVariantsForCheckoutItem({ checkoutItemId: aggregateId })));
|
|
20
20
|
const saveCheckoutBooking = ({ dataSource }) => async (aggregateRoot) => {
|
|
21
21
|
dataSource.saveCheckoutBooking(toCheckoutBookingProjection(aggregateRoot));
|
|
22
22
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BookedProductsVariantsForCheckoutItemView } from "../../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
2
|
+
import { HttpPostFunction } from "../../delivery/http/httpClient";
|
|
3
|
+
interface HttpBookedProductsVariantsForCheckoutItemView extends BookedProductsVariantsForCheckoutItemView {
|
|
4
|
+
}
|
|
5
|
+
interface HttpBookedProductsVariantsForCheckoutItemViewFunctionArgs {
|
|
6
|
+
readonly httpPost: HttpPostFunction;
|
|
7
|
+
}
|
|
8
|
+
interface HttpBookedProductsVariantsForCheckoutItemViewFunction {
|
|
9
|
+
(args: HttpBookedProductsVariantsForCheckoutItemViewFunctionArgs): HttpBookedProductsVariantsForCheckoutItemView;
|
|
10
|
+
}
|
|
11
|
+
declare const httpBookedProductsVariantsForCheckoutItemView: HttpBookedProductsVariantsForCheckoutItemViewFunction;
|
|
12
|
+
export { httpBookedProductsVariantsForCheckoutItemView };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const httpBookedProductsVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId, signal }) => {
|
|
2
2
|
const response = await httpPost({
|
|
3
3
|
endpoint: "/view-booked-product-variants-for-checkout-item",
|
|
4
4
|
body: { checkoutItemId },
|
|
@@ -6,4 +6,4 @@ const httpBookedSizeChangeProductsVariantsForCheckoutItemView = ({ httpPost }) =
|
|
|
6
6
|
});
|
|
7
7
|
return !response.ok || response.status === 404 ? null : (await response.json()).result;
|
|
8
8
|
};
|
|
9
|
-
export {
|
|
9
|
+
export { httpBookedProductsVariantsForCheckoutItemView };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { BookedProductsVariantsProjection } from "../../../../projection/bookedProductsVariants/bookedProductsVariants";
|
|
3
|
+
interface UseViewBookedProductsVariantsForCheckoutItemFunctionArgs {
|
|
4
|
+
readonly checkoutItemId: string;
|
|
5
|
+
}
|
|
6
|
+
interface UseViewBookedProductsVariantsForCheckoutItemFunction {
|
|
7
|
+
(args: UseViewBookedProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedProductsVariantsProjection>;
|
|
8
|
+
}
|
|
9
|
+
declare const useViewBookedProductsVariantsForCheckoutItem: UseViewBookedProductsVariantsForCheckoutItemFunction;
|
|
10
|
+
export { useViewBookedProductsVariantsForCheckoutItem };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
3
|
-
import {
|
|
3
|
+
import { viewBookedProductsVariantsForCheckoutItem } from "../../../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
4
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
5
|
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
6
|
-
const
|
|
7
|
-
query:
|
|
6
|
+
const useViewBookedProductsVariantsForCheckoutItem = ({ checkoutItemId, }) => useQuery({
|
|
7
|
+
query: viewBookedProductsVariantsForCheckoutItem({ checkoutItemId }),
|
|
8
8
|
contextId: MESSAGING_CONTEXT_ID,
|
|
9
9
|
invalidation: isCheckoutBookingBooked,
|
|
10
10
|
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
11
11
|
});
|
|
12
|
-
export {
|
|
12
|
+
export { useViewBookedProductsVariantsForCheckoutItem };
|
|
@@ -2,14 +2,13 @@ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Butt
|
|
|
2
2
|
import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
4
|
import React, { useCallback } from "react";
|
|
5
|
-
import { CHECKOUT_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
6
5
|
import { theme } from "../../../../../theme/theme";
|
|
7
6
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
8
7
|
import { style } from "./ButtonCheckoutQuestionItem.style";
|
|
9
8
|
const { colorAccent, colorBase } = theme();
|
|
10
9
|
const ButtonCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
11
10
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
12
|
-
const optionText = useI18nMessage({ id: checkoutQuestion.name
|
|
11
|
+
const optionText = useI18nMessage({ id: checkoutQuestion.name });
|
|
13
12
|
const handleOnPress = useCallback(() => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }), [onChange, checkoutQuestion.id, checkoutQuestionParentId]);
|
|
14
13
|
return (React.createElement(Button
|
|
15
14
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
5
4
|
import { style } from "./HostDefaultCheckoutQuestionItem.style";
|
|
6
5
|
const HostDefaultCheckoutQuestionItem = ({ checkoutQuestion, children, }) => {
|
|
7
|
-
const titleText = useI18nMessage({ id: checkoutQuestion.name
|
|
6
|
+
const titleText = useI18nMessage({ id: checkoutQuestion.name });
|
|
8
7
|
return (React.createElement(React.Fragment, null,
|
|
9
8
|
React.createElement(Text, { level: 3, style: style.title }, titleText),
|
|
10
9
|
children));
|
|
@@ -2,10 +2,9 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
-
import { CHECKOUT_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
6
5
|
import { style } from "./HostSelectCheckoutQuestionItem.style";
|
|
7
6
|
const HostSelectCheckoutQuestionItem = ({ checkoutQuestion, children, }) => {
|
|
8
|
-
const titleText = useI18nMessage({ id: checkoutQuestion.name
|
|
7
|
+
const titleText = useI18nMessage({ id: checkoutQuestion.name });
|
|
9
8
|
return (React.createElement(React.Fragment, null,
|
|
10
9
|
React.createElement(Text, { level: 3, style: style.title }, titleText),
|
|
11
10
|
React.createElement(View, { style: style.content }, children)));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
|
|
2
|
-
type IconName = "
|
|
2
|
+
type IconName = "checkout_question.icon.bad" | "checkout_question.icon.regular" | "checkout_question.icon.good";
|
|
3
3
|
declare const IconCheckoutQuestionItem: CheckoutQuestionItem;
|
|
4
4
|
export type { IconName };
|
|
5
5
|
export { IconCheckoutQuestionItem };
|
|
@@ -10,11 +10,11 @@ import { Sad } from "./icons/Sad";
|
|
|
10
10
|
const { colorAccent } = theme();
|
|
11
11
|
const ICON = {
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
"
|
|
13
|
+
"checkout_question.icon.bad": Sad,
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
-
"
|
|
15
|
+
"checkout_question.icon.regular": Normal,
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
-
"
|
|
17
|
+
"checkout_question.icon.good": Happy,
|
|
18
18
|
};
|
|
19
19
|
const IconCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
20
20
|
const Icon = ICON[checkoutQuestion.name];
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
5
4
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
6
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
7
6
|
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
8
|
-
const placeholderText = useI18nMessage({
|
|
9
|
-
id: checkoutQuestion.placeholder,
|
|
10
|
-
prefix: RETURN_QUESTIONS_PREFIX,
|
|
11
|
-
});
|
|
7
|
+
const placeholderText = useI18nMessage({ id: checkoutQuestion.placeholder });
|
|
12
8
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
13
9
|
const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
|
|
14
10
|
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
5
4
|
import { style } from "./HostDefaultReturnQuestionItem.style";
|
|
6
5
|
const HostDefaultReturnQuestionItem = ({ returnQuestion, children }) => {
|
|
7
|
-
const titleText = useI18nMessage({ id: returnQuestion.name
|
|
6
|
+
const titleText = useI18nMessage({ id: returnQuestion.name });
|
|
8
7
|
return (React.createElement(React.Fragment, null,
|
|
9
8
|
React.createElement(Text, { level: 3, style: style.title }, titleText),
|
|
10
9
|
children));
|
|
@@ -4,19 +4,18 @@ import { TouchableHighlight, View } from "react-native";
|
|
|
4
4
|
import { Modal } from "../../../../../../../shared/ui/components/layouts/modal/Modal";
|
|
5
5
|
import { ButtonIcon } from "../../../../../../../shared/ui/components/molecules/buttonIcon/ButtonIcon";
|
|
6
6
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
7
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
8
7
|
import { useReturnQuestionFeedback, useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
9
8
|
import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
|
|
10
9
|
import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
|
|
11
10
|
const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
12
|
-
const placeholderText = useI18nMessage({ id: returnQuestion.placeholder
|
|
11
|
+
const placeholderText = useI18nMessage({ id: returnQuestion.placeholder });
|
|
13
12
|
const [modalVisible, setModalVisible] = useState(false);
|
|
14
13
|
const handleOnPress = useCallback(() => setModalVisible(true), []);
|
|
15
14
|
const handleOnModalClose = useCallback(() => setModalVisible(false), []);
|
|
16
15
|
const feedback = useReturnQuestionFeedback();
|
|
17
16
|
const { onChange } = useReturnQuestionFeedbackForId({ id: returnQuestion.id });
|
|
18
17
|
const intl = useIntl();
|
|
19
|
-
const translate = useCallback((returnQuestionName) => intl.formatMessage({ id:
|
|
18
|
+
const translate = useCallback((returnQuestionName) => intl.formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }), [intl]);
|
|
20
19
|
const inputValue = feedbackForReturnQuestion({ feedback, returnQuestion, translate }).join(" / ");
|
|
21
20
|
const deepestReturnQuestionWithFeedback = deepestReturnQuestionWithFeedbackForReturnQuestion({
|
|
22
21
|
feedback,
|
|
@@ -3,17 +3,16 @@ import { useI18nMessage } from "@lookiero/i18n-react";
|
|
|
3
3
|
import { animated, useSpring } from "@react-spring/native";
|
|
4
4
|
import React, { useCallback, useState } from "react";
|
|
5
5
|
import { View } from "react-native";
|
|
6
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
7
6
|
import ReturnQuestion from "../../ReturnQuestion";
|
|
8
7
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
9
8
|
import { style } from "./HostStackReturnQuestionItem.style";
|
|
10
9
|
const HostStackReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
11
|
-
const titleText = useI18nMessage({ id: returnQuestion.name
|
|
10
|
+
const titleText = useI18nMessage({ id: returnQuestion.name });
|
|
12
11
|
const { feedback } = useReturnQuestionFeedbackForId({ id: returnQuestion.id });
|
|
13
12
|
const feedbackReturnQuestion = feedback
|
|
14
13
|
? returnQuestion.children?.find((returnQuestion) => returnQuestion.id === feedback)
|
|
15
14
|
: undefined;
|
|
16
|
-
const feedbackText = useI18nMessage({ id: feedbackReturnQuestion?.name
|
|
15
|
+
const feedbackText = useI18nMessage({ id: feedbackReturnQuestion?.name });
|
|
17
16
|
const [stackHeight, setStackHeight] = useState();
|
|
18
17
|
const handleOnLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setStackHeight(height), []);
|
|
19
18
|
const stackSyle = useSpring({ height: stackHeight });
|
|
@@ -2,12 +2,11 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
|
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback } from "react";
|
|
4
4
|
import { TouchableHighlight } from "react-native";
|
|
5
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
6
5
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
7
6
|
import { containerUnderlayColor, style } from "./OptionReturnQuestionItem.style";
|
|
8
7
|
const OptionReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
9
8
|
const { onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
10
|
-
const optionText = useI18nMessage({ id: returnQuestion.name
|
|
9
|
+
const optionText = useI18nMessage({ id: returnQuestion.name });
|
|
11
10
|
const handleOnPress = useCallback(() => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: returnQuestion.id }), [onChange, returnQuestion.id, returnQuestionParentId]);
|
|
12
11
|
return (React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
13
12
|
React.createElement(Text, { level: 3, style: style.text }, optionText)));
|
|
@@ -2,22 +2,16 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
|
|
|
2
2
|
import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
|
|
3
3
|
import React, { useCallback } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
-
import { I18nMessages
|
|
5
|
+
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
6
6
|
import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeedback";
|
|
7
7
|
import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
|
|
8
8
|
import { style } from "./ReturnQuestionFeedbackItem.style";
|
|
9
9
|
const ReturnQuestionFeedbackItem = ({ returnQuestion }) => {
|
|
10
|
-
const titleText = useI18nMessage({ id: returnQuestion.name
|
|
11
|
-
const unansweredText = useI18nMessage({
|
|
12
|
-
id: I18nMessages.FEEDBACK_UNANSWERED,
|
|
13
|
-
prefix: RETURN_QUESTIONS_FEEDBACK_PREFIX,
|
|
14
|
-
});
|
|
10
|
+
const titleText = useI18nMessage({ id: returnQuestion.name });
|
|
11
|
+
const unansweredText = useI18nMessage({ id: I18nMessages.FEEDBACK_UNANSWERED });
|
|
15
12
|
const returnQuestionFeedback = useReturnQuestionFeedback();
|
|
16
13
|
const intl = useIntl();
|
|
17
|
-
const translate = useCallback((returnQuestionName) => intl.formatMessage({
|
|
18
|
-
id: `${RETURN_QUESTIONS_PREFIX}${returnQuestionName}`,
|
|
19
|
-
defaultMessage: returnQuestionName,
|
|
20
|
-
}), [intl]);
|
|
14
|
+
const translate = useCallback((returnQuestionName) => intl.formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }), [intl]);
|
|
21
15
|
const feedback = feedbackForReturnQuestion({ feedback: returnQuestionFeedback, returnQuestion, translate }).join(" / ");
|
|
22
16
|
return (React.createElement(View, { style: style.container },
|
|
23
17
|
React.createElement(Text, { level: 2, style: style.title, detail: true }, titleText),
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
|
-
import { RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
5
4
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
6
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
7
6
|
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
8
|
-
const placeholderText = useI18nMessage({ id: returnQuestion.placeholder
|
|
7
|
+
const placeholderText = useI18nMessage({ id: returnQuestion.placeholder });
|
|
9
8
|
const { feedback, onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
10
9
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: value }), [onChange, returnQuestionParentId]);
|
|
11
10
|
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
@@ -4,6 +4,7 @@ import { Edge } from "react-native-safe-area-context";
|
|
|
4
4
|
type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
|
|
5
5
|
interface SafeAreaScrollViewProps {
|
|
6
6
|
readonly children: ReactNode;
|
|
7
|
+
readonly scrollerPaddingTop?: number;
|
|
7
8
|
readonly edges?: Edge[];
|
|
8
9
|
readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
|
|
9
10
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ScrollView } from "react-native";
|
|
3
3
|
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
-
|
|
5
|
-
const { spaceXL } = theme();
|
|
6
|
-
const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"], style: customStyle, }) => {
|
|
4
|
+
const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"], style: customStyle, scrollerPaddingTop = 0, }) => {
|
|
7
5
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
8
6
|
return (React.createElement(SafeAreaView, { edges: edges, style: customStyle?.safeAreaView },
|
|
9
7
|
React.createElement(ScrollView, { contentContainerStyle: [
|
|
10
8
|
{
|
|
11
9
|
// Why did we set this??
|
|
12
|
-
paddingTop:
|
|
13
|
-
paddingBottom:
|
|
10
|
+
paddingTop: safeAreaInsetTop + scrollerPaddingTop,
|
|
11
|
+
paddingBottom: safeAreaInsetBottom,
|
|
14
12
|
},
|
|
15
13
|
customStyle?.scrollView,
|
|
16
14
|
] }, children)));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const COLOR_I18N_PREFIX = "color.";
|
|
2
|
-
declare const RETURN_QUESTIONS_PREFIX = "return_questions.";
|
|
3
|
-
declare const RETURN_QUESTIONS_FEEDBACK_PREFIX = "return_questions_feedback.";
|
|
4
|
-
declare const CHECKOUT_QUESTIONS_PREFIX = "checkout_questions.";
|
|
5
2
|
declare enum I18nMessages {
|
|
6
3
|
INTRO_TITLE = "intro.title",
|
|
7
4
|
INTRO_SUBTITLE = "intro.subtitle",
|
|
@@ -30,8 +27,8 @@ declare enum I18nMessages {
|
|
|
30
27
|
GET_OUT_OF_CHECKOUT_MODAL_DESCRIPTION = "get_out_of_checkout_modal.description",
|
|
31
28
|
GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON = "get_out_of_checkout_modal.dismiss_button",
|
|
32
29
|
GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON = "get_out_of_checkout_modal.confirm_button",
|
|
33
|
-
FEEDBACK_TITLE = "feedback.title",
|
|
34
|
-
FEEDBACK_UNANSWERED = "feedback.unanswered",
|
|
30
|
+
FEEDBACK_TITLE = "return_questions_feedback.feedback.title",
|
|
31
|
+
FEEDBACK_UNANSWERED = "return_questions_feedback.feedback.unanswered",
|
|
35
32
|
RETURN_QUESTIONS_TITLE = "return_questions.title",
|
|
36
33
|
RETURN_QUESTIONS_SUBMIT_BUTTON = "return_questions.submit_button",
|
|
37
34
|
SUMMARY_TITLE = "summary.title",
|
|
@@ -62,4 +59,4 @@ declare enum I18nMessages {
|
|
|
62
59
|
HEADER_COMPLETE_CHECKOUT_TITLE = "header.complete_checkout_title",
|
|
63
60
|
FEEDBACK_BUTTON = "feedback.button"
|
|
64
61
|
}
|
|
65
|
-
export { I18nMessages, COLOR_I18N_PREFIX
|
|
62
|
+
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
const COLOR_I18N_PREFIX = "color.";
|
|
2
|
-
const RETURN_QUESTIONS_PREFIX = "return_questions.";
|
|
3
|
-
const RETURN_QUESTIONS_FEEDBACK_PREFIX = "return_questions_feedback.";
|
|
4
|
-
const CHECKOUT_QUESTIONS_PREFIX = "checkout_questions.";
|
|
5
2
|
var I18nMessages;
|
|
6
3
|
(function (I18nMessages) {
|
|
7
4
|
I18nMessages["INTRO_TITLE"] = "intro.title";
|
|
@@ -31,8 +28,8 @@ var I18nMessages;
|
|
|
31
28
|
I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_DESCRIPTION"] = "get_out_of_checkout_modal.description";
|
|
32
29
|
I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON"] = "get_out_of_checkout_modal.dismiss_button";
|
|
33
30
|
I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON"] = "get_out_of_checkout_modal.confirm_button";
|
|
34
|
-
I18nMessages["FEEDBACK_TITLE"] = "feedback.title";
|
|
35
|
-
I18nMessages["FEEDBACK_UNANSWERED"] = "feedback.unanswered";
|
|
31
|
+
I18nMessages["FEEDBACK_TITLE"] = "return_questions_feedback.feedback.title";
|
|
32
|
+
I18nMessages["FEEDBACK_UNANSWERED"] = "return_questions_feedback.feedback.unanswered";
|
|
36
33
|
I18nMessages["RETURN_QUESTIONS_TITLE"] = "return_questions.title";
|
|
37
34
|
I18nMessages["RETURN_QUESTIONS_SUBMIT_BUTTON"] = "return_questions.submit_button";
|
|
38
35
|
I18nMessages["SUMMARY_TITLE"] = "summary.title";
|
|
@@ -63,4 +60,4 @@ var I18nMessages;
|
|
|
63
60
|
I18nMessages["HEADER_COMPLETE_CHECKOUT_TITLE"] = "header.complete_checkout_title";
|
|
64
61
|
I18nMessages["FEEDBACK_BUTTON"] = "feedback.button";
|
|
65
62
|
})(I18nMessages || (I18nMessages = {}));
|
|
66
|
-
export { I18nMessages, COLOR_I18N_PREFIX
|
|
63
|
+
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PortalProvider } from "@gorhom/portal";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { View } from "react-native";
|
|
4
3
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
5
4
|
import { Notifications } from "../../../shared/notifications/infrastructure/ui/views/Notifications";
|
|
6
5
|
import { style } from "./App.style";
|
|
@@ -8,6 +7,5 @@ import { Header } from "./header/Header";
|
|
|
8
7
|
const App = ({ customerId, menu, children }) => (React.createElement(SafeAreaProvider, null,
|
|
9
8
|
React.createElement(Header, { customerId: customerId, menu: menu, style: style.header }),
|
|
10
9
|
React.createElement(Notifications, null),
|
|
11
|
-
React.createElement(PortalProvider, null,
|
|
12
|
-
React.createElement(View, { style: style.body }, children))));
|
|
10
|
+
React.createElement(PortalProvider, null, children)));
|
|
13
11
|
export { App };
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { Platform, StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "../theme/theme";
|
|
3
|
-
const { spaceXXXL } = theme();
|
|
4
2
|
const style = StyleSheet.create({
|
|
5
|
-
body: {
|
|
6
|
-
minHeight: "100%",
|
|
7
|
-
paddingTop: spaceXXXL,
|
|
8
|
-
zIndex: 0,
|
|
9
|
-
},
|
|
10
3
|
header: {
|
|
11
4
|
...Platform.select({
|
|
12
5
|
web: {
|
|
@@ -19,6 +19,7 @@ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollVie
|
|
|
19
19
|
import { I18nMessages } from "../../i18n/i18n";
|
|
20
20
|
import { Routes } from "../../routing/routes";
|
|
21
21
|
import { useBasePath } from "../../routing/useBasePath";
|
|
22
|
+
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
22
23
|
import { ProductVariant } from "../item/components/productVariant/ProductVariant";
|
|
23
24
|
import { Pricing } from "../summary/components/pricing/Pricing";
|
|
24
25
|
import { style } from "./Checkout.style";
|
|
@@ -86,7 +87,7 @@ const Checkout = ({ customerId, getAuthToken, useRedirect }) => {
|
|
|
86
87
|
return React.createElement(Spinner, null);
|
|
87
88
|
return (React.createElement(React.Fragment, null,
|
|
88
89
|
React.createElement(CheckoutSuccessModal, { visible: success, onDismiss: handleOnSuccessModalDismiss }),
|
|
89
|
-
React.createElement(SafeAreaScrollView,
|
|
90
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT },
|
|
90
91
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
91
92
|
hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
|
|
92
93
|
React.createElement(DeliveryBanner, null))),
|
|
@@ -7,6 +7,7 @@ import { useListCheckoutQuestionsByCheckoutId } from "../../../projection/checko
|
|
|
7
7
|
import { Body } from "../../components/layouts/body/Body";
|
|
8
8
|
import { CheckoutQuestionFeedbackProvider } from "../../components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionFeedback";
|
|
9
9
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
10
|
+
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
10
11
|
import { style } from "./Feedback.style";
|
|
11
12
|
import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
|
|
12
13
|
const Feedback = ({ customerId }) => {
|
|
@@ -28,7 +29,7 @@ const Feedback = ({ customerId }) => {
|
|
|
28
29
|
if (!dependenciesLoaded)
|
|
29
30
|
return React.createElement(Spinner, null);
|
|
30
31
|
return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {} },
|
|
31
|
-
React.createElement(SafeAreaScrollView,
|
|
32
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT },
|
|
32
33
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
33
34
|
React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
|
|
34
35
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../theme/theme";
|
|
3
3
|
const { colorBase, spaceXXL, spaceXXXL, spaceS } = theme();
|
|
4
|
+
const HEADER_HEIGHT = spaceXXXL;
|
|
4
5
|
const style = StyleSheet.create({
|
|
5
6
|
buttonIconPlaceholder: {
|
|
6
7
|
height: spaceXXL,
|
|
@@ -9,7 +10,7 @@ const style = StyleSheet.create({
|
|
|
9
10
|
container: {
|
|
10
11
|
backgroundColor: colorBase,
|
|
11
12
|
flex: 1,
|
|
12
|
-
height:
|
|
13
|
+
height: HEADER_HEIGHT,
|
|
13
14
|
paddingHorizontal: spaceS,
|
|
14
15
|
width: "100%",
|
|
15
16
|
},
|
|
@@ -28,4 +29,4 @@ const style = StyleSheet.create({
|
|
|
28
29
|
textTransform: "uppercase",
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
export { style };
|
|
32
|
+
export { style, HEADER_HEIGHT };
|
|
@@ -11,6 +11,7 @@ import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checko
|
|
|
11
11
|
import { Body } from "../../components/layouts/body/Body";
|
|
12
12
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
13
13
|
import { I18nMessages } from "../../i18n/i18n";
|
|
14
|
+
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
14
15
|
import { style } from "./Intro.style";
|
|
15
16
|
const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
|
|
16
17
|
React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
|
|
@@ -29,7 +30,7 @@ const Intro = ({ customerId }) => {
|
|
|
29
30
|
const [incrementIntroShownCount, incrementIntroShownCountStatus] = useIncrementIntroShownCount();
|
|
30
31
|
if (fiveItemsDiscountStatus === QueryStatus.LOADING)
|
|
31
32
|
return React.createElement(Spinner, null);
|
|
32
|
-
return (React.createElement(SafeAreaScrollView,
|
|
33
|
+
return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT },
|
|
33
34
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
34
35
|
React.createElement(View, { style: style.container },
|
|
35
36
|
React.createElement(View, { style: style.content },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
-
import { View } from "react-native";
|
|
3
|
+
import { Platform, View } from "react-native";
|
|
4
4
|
import { generatePath, useMatch, useNavigate, useParams } from "react-router-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
6
|
import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
@@ -9,7 +9,7 @@ import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutB
|
|
|
9
9
|
import { useKeepCheckoutItem } from "../../../domain/checkoutItem/react/useKeepCheckoutItem";
|
|
10
10
|
import { useReplaceCheckoutItem } from "../../../domain/checkoutItem/react/useReplaceCheckoutItem";
|
|
11
11
|
import { useReturnCheckoutItem } from "../../../domain/checkoutItem/react/useReturnCheckoutItem";
|
|
12
|
-
import {
|
|
12
|
+
import { useViewBookedProductsVariantsForCheckoutItem } from "../../../projection/bookedProductsVariants/react/useViewBookedProductsVariantsForCheckoutItem";
|
|
13
13
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
14
14
|
import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
|
|
15
15
|
import { Body } from "../../components/layouts/body/Body";
|
|
@@ -17,6 +17,8 @@ import { ReturnQuestionFeedbackProvider } from "../../components/organisms/retur
|
|
|
17
17
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
18
18
|
import { Routes } from "../../routing/routes";
|
|
19
19
|
import { useBasePath } from "../../routing/useBasePath";
|
|
20
|
+
import { theme } from "../../theme/theme";
|
|
21
|
+
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
20
22
|
import { style } from "./Item.style";
|
|
21
23
|
import { CustomerDecissionBanner } from "./components/banner/CustomerDecissionBanner";
|
|
22
24
|
import { ItemActions } from "./components/itemActions/ItemActions";
|
|
@@ -26,6 +28,7 @@ import { ReturnQuestionsFeedback } from "./components/returnQuestionsFeedback/Re
|
|
|
26
28
|
import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
|
|
27
29
|
import { SizeChangeModal } from "./components/sizeChangeModal/SizeChangeModal";
|
|
28
30
|
import { SizeWithoutStockModal } from "./components/sizeWithoutStockModal/SizeWithoutStockModal";
|
|
31
|
+
const { spaceXL } = theme();
|
|
29
32
|
const Item = ({ customerId }) => {
|
|
30
33
|
const { id } = useParams();
|
|
31
34
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
@@ -70,7 +73,7 @@ const Item = ({ customerId }) => {
|
|
|
70
73
|
navigateToNextView();
|
|
71
74
|
}
|
|
72
75
|
}, [navigateToNextView, replaceCheckoutItemStatus]);
|
|
73
|
-
const [
|
|
76
|
+
const [bookedProductsVariants, bookedProductsVariantsStatus] = useViewBookedProductsVariantsForCheckoutItem({
|
|
74
77
|
checkoutItemId: checkoutItem.id,
|
|
75
78
|
});
|
|
76
79
|
const [bookCheckoutBooking] = useBookCheckoutBookingForCheckoutItem({
|
|
@@ -78,8 +81,8 @@ const Item = ({ customerId }) => {
|
|
|
78
81
|
checkoutBookingId: checkout?.checkoutBookingId,
|
|
79
82
|
});
|
|
80
83
|
useEffect(() => {
|
|
81
|
-
checkout &&
|
|
82
|
-
}, [bookCheckoutBooking,
|
|
84
|
+
checkout && bookedProductsVariants === null && bookCheckoutBooking();
|
|
85
|
+
}, [bookCheckoutBooking, bookedProductsVariants, checkout]);
|
|
83
86
|
const [returnQuestions, returnQuestionsStatus] = useListReturnQuestionsByCheckoutItemId({
|
|
84
87
|
checkoutItemId: checkoutItem.id,
|
|
85
88
|
});
|
|
@@ -124,8 +127,8 @@ const Item = ({ customerId }) => {
|
|
|
124
127
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
125
128
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(returnQuestionsStatus) &&
|
|
126
129
|
(dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
|
|
127
|
-
dependenciesLoadedStatuses.includes(
|
|
128
|
-
|
|
130
|
+
dependenciesLoadedStatuses.includes(bookedProductsVariantsStatus) &&
|
|
131
|
+
bookedProductsVariants;
|
|
129
132
|
if (!dependenciesLoaded)
|
|
130
133
|
return React.createElement(Spinner, null);
|
|
131
134
|
const { price } = checkoutItem;
|
|
@@ -133,16 +136,16 @@ const Item = ({ customerId }) => {
|
|
|
133
136
|
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
|
|
134
137
|
React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
|
|
135
138
|
React.createElement(SizeChangeModal, { visible: sizeChangeModalVisible, onDismiss: handleOnHideSizeChangeModal }),
|
|
136
|
-
React.createElement(SafeAreaScrollView,
|
|
139
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT },
|
|
137
140
|
React.createElement(Body, null,
|
|
138
141
|
customerDecissionMade && (React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: handleOnBannerPress })),
|
|
139
|
-
React.createElement(View, { style: [style.container, { paddingBottom: stickyHeight }] },
|
|
142
|
+
React.createElement(View, { style: [style.container, { paddingBottom: Platform.OS === "web" ? spaceXL : stickyHeight }] },
|
|
140
143
|
React.createElement(View, { style: style.sliderContainer },
|
|
141
144
|
React.createElement(ProductVariantSlider, { producVariantMedia: media })),
|
|
142
145
|
React.createElement(ProductVariantDescription, { brand: brand, color: color, name: name, price: price, size: productVariantSelected.size }),
|
|
143
146
|
checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: style.feedbackContainer },
|
|
144
147
|
React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions || [], onEditFeedback: handleOnEditFeedback })))))),
|
|
145
|
-
!customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants:
|
|
148
|
+
!customerDecissionMade && (React.createElement(ItemActions, { keepButtonLoading: keepCheckoutItemStatus === CommandStatus.LOADING, productVariantSelected: productVariantSelected, productVariants: bookedProductsVariants?.productVariants || [], returnButtonLoading: returnCheckoutItemStatus === CommandStatus.LOADING, sizeSelectorDisabled: replaceCheckoutItemStatus === CommandStatus.LOADING, onKeep: handleOnKeep, onLayout: handleOnStickyLayout, onReplace: handleOnReplace, onReturn: handleOnReturn, onSizeSelectorPress: handleOnShowSizeWithoutStockModal })),
|
|
146
149
|
React.createElement(ReturnQuestionsForm, { checkoutItemPrice: checkoutItem.price, productVariant: checkoutItem.productVariant, returnQuestions: returnQuestions || [], visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions, onSubmit: handleOnSubmit })));
|
|
147
150
|
};
|
|
148
151
|
export { Item };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { ProductVariantProjection } from "../../../../../../projection/
|
|
2
|
+
import { ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
|
|
3
3
|
import { Layout } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
|
|
4
4
|
interface ItemActionsProps {
|
|
5
5
|
readonly productVariants: ProductVariantProjection[];
|
|
@@ -8,7 +8,7 @@ import { ReturnQuestions } from "../../../../components/organisms/returnQuestion
|
|
|
8
8
|
import { ReturnQuestionItemProvider, } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
|
|
9
9
|
import { HostDefaultReturnQuestionFeedbackItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem";
|
|
10
10
|
import { ReturnQuestionFeedbackItem } from "../../../../components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem";
|
|
11
|
-
import { I18nMessages
|
|
11
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
12
12
|
import { style } from "./ReturnQuestionsFeedback.style";
|
|
13
13
|
const returnQuestionItems = {
|
|
14
14
|
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionFeedbackItem,
|
|
@@ -19,7 +19,7 @@ const returnQuestionItems = {
|
|
|
19
19
|
[ReturnQuestionType.OPTION]: ReturnQuestionFeedbackItem,
|
|
20
20
|
};
|
|
21
21
|
const ReturnQuestionsFeedback = ({ returnQuestions, onEditFeedback }) => {
|
|
22
|
-
const titleText = useI18nMessage({ id: I18nMessages.FEEDBACK_TITLE
|
|
22
|
+
const titleText = useI18nMessage({ id: I18nMessages.FEEDBACK_TITLE });
|
|
23
23
|
return (React.createElement(View, null,
|
|
24
24
|
React.createElement(View, { style: style.titleContainer },
|
|
25
25
|
React.createElement(Text, { level: 2, style: style.title }, titleText),
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
CHANGED
|
@@ -14,7 +14,7 @@ import { HostSelectReturnQuestionItem } from "../../../../components/organisms/r
|
|
|
14
14
|
import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem";
|
|
15
15
|
import { OptionReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem";
|
|
16
16
|
import { TextareaReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
|
|
17
|
-
import { I18nMessages
|
|
17
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
18
18
|
import { ProductVariant } from "../productVariant/ProductVariant";
|
|
19
19
|
import { style } from "./ReturnQuestionsForm.style";
|
|
20
20
|
const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
|
|
@@ -27,11 +27,8 @@ const returnQuestionItems = {
|
|
|
27
27
|
[ReturnQuestionType.OPTION]: OptionReturnQuestionItem,
|
|
28
28
|
};
|
|
29
29
|
const ReturnQuestionsForm = ({ returnQuestions, checkoutItemPrice, productVariant, visible, onSubmit, onClose, }) => {
|
|
30
|
-
const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE
|
|
31
|
-
const submitButtonText = useI18nMessage({
|
|
32
|
-
id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON,
|
|
33
|
-
prefix: RETURN_QUESTIONS_PREFIX,
|
|
34
|
-
});
|
|
30
|
+
const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
|
|
31
|
+
const submitButtonText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON });
|
|
35
32
|
const { media, brand, name, size, color } = productVariant;
|
|
36
33
|
const feedback = useReturnQuestionFeedback();
|
|
37
34
|
const handleOnSubmit = useCallback(() => onSubmit(feedback), [feedback, onSubmit]);
|
|
@@ -14,10 +14,13 @@ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollVie
|
|
|
14
14
|
import { I18nMessages } from "../../i18n/i18n";
|
|
15
15
|
import { Routes } from "../../routing/routes";
|
|
16
16
|
import { useBasePath } from "../../routing/useBasePath";
|
|
17
|
+
import { theme } from "../../theme/theme";
|
|
18
|
+
import { HEADER_HEIGHT } from "../header/Header.style";
|
|
17
19
|
import { style } from "./Summary.style";
|
|
18
20
|
import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsTabs";
|
|
19
21
|
import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
20
22
|
import { StickyPricing } from "./components/stickyPricing/StickyPricing";
|
|
23
|
+
const { spaceXL } = theme();
|
|
21
24
|
const Summary = ({ customerId }) => {
|
|
22
25
|
const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
|
|
23
26
|
const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
|
|
@@ -39,8 +42,8 @@ const Summary = ({ customerId }) => {
|
|
|
39
42
|
if (!dependenciesLoaded)
|
|
40
43
|
return React.createElement(Spinner, null);
|
|
41
44
|
return (React.createElement(React.Fragment, null,
|
|
42
|
-
React.createElement(SafeAreaScrollView, { style: { safeAreaView: style.container } },
|
|
43
|
-
React.createElement(Body,
|
|
45
|
+
React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT, style: { safeAreaView: style.container } },
|
|
46
|
+
React.createElement(Body, { style: { row: { paddingBottom: spaceXL } } },
|
|
44
47
|
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
45
48
|
React.createElement(View, { style: style.content },
|
|
46
49
|
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js
CHANGED
|
@@ -16,9 +16,9 @@ const CheckoutItemsTabs = ({ checkoutItemsKept, checkoutItemsReturned, onPressIt
|
|
|
16
16
|
const returnEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_EMPTY });
|
|
17
17
|
const handleOnPressItem = useCallback((checkoutItemId) => onPressItem(checkoutItemId), [onPressItem]);
|
|
18
18
|
return (React.createElement(Tabs, { style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${checkoutItemsKept.length})`, `${returnTabText} (${checkoutItemsReturned.length})`] },
|
|
19
|
-
React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text,
|
|
19
|
+
React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text, { style: style.emptyText }, keepEmptyText)) : (checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemStatus: checkoutItem.status, testID: "keep-checkout-item", checkoutItemProductVariant: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
|
|
20
20
|
? checkoutItem.replacedFor
|
|
21
21
|
: checkoutItem.productVariant, onPress: () => handleOnPressItem(checkoutItem.id) }))))),
|
|
22
|
-
React.createElement(React.Fragment, null, checkoutItemsReturned.length === 0 ? (React.createElement(Text,
|
|
22
|
+
React.createElement(React.Fragment, null, checkoutItemsReturned.length === 0 ? (React.createElement(Text, { style: style.emptyText }, returnEmptyText)) : (checkoutItemsReturned.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItemPrice: checkoutItem.price, checkoutItemProductVariant: checkoutItem.productVariant, checkoutItemStatus: checkoutItem.status, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) })))))));
|
|
23
23
|
};
|
|
24
24
|
export { CheckoutItemsTabs };
|
|
@@ -3,7 +3,7 @@ interface ProductVariantProjection {
|
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly size: SizeProjection;
|
|
5
5
|
}
|
|
6
|
-
interface
|
|
6
|
+
interface BookedProductsVariantsProjection {
|
|
7
7
|
readonly productVariants: ProductVariantProjection[];
|
|
8
8
|
}
|
|
9
|
-
export type {
|
|
9
|
+
export type { BookedProductsVariantsProjection, ProductVariantProjection };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
+
import { BookedProductsVariantsProjection } from "./bookedProductsVariants";
|
|
3
|
+
declare const VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_product_variants_for_checkout_item";
|
|
4
|
+
interface ViewBookedProductsVariantsForCheckoutItemPayload {
|
|
5
|
+
readonly checkoutItemId: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewBookedProductsVariantsForCheckoutItem extends Query<typeof VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, ViewBookedProductsVariantsForCheckoutItemPayload {
|
|
8
|
+
}
|
|
9
|
+
interface ViewBookedProductsVariantsForCheckoutItemFunction {
|
|
10
|
+
(payload: ViewBookedProductsVariantsForCheckoutItemPayload): ViewBookedProductsVariantsForCheckoutItem;
|
|
11
|
+
}
|
|
12
|
+
declare const viewBookedProductsVariantsForCheckoutItem: ViewBookedProductsVariantsForCheckoutItemFunction;
|
|
13
|
+
type ViewBookedProductsVariantsForCheckoutItemResult = BookedProductsVariantsProjection | null;
|
|
14
|
+
interface BookedProductsVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
|
|
15
|
+
readonly checkoutItemId: string;
|
|
16
|
+
}
|
|
17
|
+
interface BookedProductsVariantsForCheckoutItemView {
|
|
18
|
+
(args: BookedProductsVariantsForCheckoutItemViewArgs): Promise<ViewBookedProductsVariantsForCheckoutItemResult>;
|
|
19
|
+
}
|
|
20
|
+
interface ViewBookedProductsVariantsForCheckoutItemHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
+
readonly view: BookedProductsVariantsForCheckoutItemView;
|
|
22
|
+
}
|
|
23
|
+
declare const viewBookedProductsVariantsForCheckoutItemHandler: QueryHandlerFunction<ViewBookedProductsVariantsForCheckoutItem, ViewBookedProductsVariantsForCheckoutItemResult, ViewBookedProductsVariantsForCheckoutItemHandlerFunctionArgs>;
|
|
24
|
+
export type { ViewBookedProductsVariantsForCheckoutItem, BookedProductsVariantsForCheckoutItemView, ViewBookedProductsVariantsForCheckoutItemResult, };
|
|
25
|
+
export { VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedProductsVariantsForCheckoutItem, viewBookedProductsVariantsForCheckoutItemHandler, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { query, } from "@lookiero/messaging";
|
|
2
|
+
const VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_product_variants_for_checkout_item";
|
|
3
|
+
const viewBookedProductsVariantsForCheckoutItem = (payload) => ({
|
|
4
|
+
...query({ name: VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
|
+
...payload,
|
|
6
|
+
});
|
|
7
|
+
const viewBookedProductsVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
|
|
8
|
+
export { VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedProductsVariantsForCheckoutItem, viewBookedProductsVariantsForCheckoutItemHandler, };
|
|
@@ -3,11 +3,16 @@ import { View } from "react-native";
|
|
|
3
3
|
import { Column } from "../../../../ui/components/layouts/column/Column";
|
|
4
4
|
import { Row } from "../../../../ui/components/layouts/row/Row";
|
|
5
5
|
import { Stack } from "../../../../ui/components/layouts/stack/Stack";
|
|
6
|
+
import { useScreenSize } from "../../../../ui/hooks/useScreenSize";
|
|
6
7
|
import { NotificationItem } from "./NotificationItem";
|
|
7
8
|
import { style } from "./Notifications.style";
|
|
8
9
|
const NOTIFICATIONS_AUTOHIDE_TIMEOUT = 10000;
|
|
9
|
-
const Notifications = ({ notifications = [], onRemove, autoHideTimeout = NOTIFICATIONS_AUTOHIDE_TIMEOUT, }) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const Notifications = ({ notifications = [], onRemove, autoHideTimeout = NOTIFICATIONS_AUTOHIDE_TIMEOUT, }) => {
|
|
11
|
+
const screenSize = useScreenSize();
|
|
12
|
+
const isSmallDevice = screenSize === "S";
|
|
13
|
+
return (React.createElement(View, { pointerEvents: "box-none", style: style.notifications, testID: "notifications" },
|
|
14
|
+
React.createElement(Row, { style: [style.row, isSmallDevice && style.rowSmall] },
|
|
15
|
+
React.createElement(Column, null,
|
|
16
|
+
React.createElement(Stack, null, notifications.map((notification) => (React.createElement(NotificationItem, { key: notification.id, autoHideTimeout: autoHideTimeout, notification: notification, style: { toast: style.toast }, testID: notification.id, onRemove: onRemove }))))))));
|
|
17
|
+
};
|
|
13
18
|
export { Notifications };
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
paddingLeft: number;
|
|
4
|
-
paddingRight: number;
|
|
5
|
-
};
|
|
6
|
-
layoutSmall: {
|
|
7
|
-
paddingLeft: string;
|
|
8
|
-
paddingRight: string;
|
|
9
|
-
};
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
10
3
|
notifications: {
|
|
4
|
+
top: number;
|
|
5
|
+
width: string;
|
|
6
|
+
zIndex: number;
|
|
11
7
|
left: number;
|
|
12
|
-
|
|
8
|
+
} | {
|
|
13
9
|
top: number;
|
|
14
10
|
width: string;
|
|
15
11
|
zIndex: number;
|
|
12
|
+
position: "sticky";
|
|
13
|
+
left: number;
|
|
14
|
+
} | {
|
|
15
|
+
top: number;
|
|
16
|
+
width: string;
|
|
17
|
+
zIndex: number;
|
|
18
|
+
position: "absolute";
|
|
19
|
+
left: number;
|
|
16
20
|
};
|
|
17
21
|
row: {
|
|
18
22
|
flex: number;
|
|
19
23
|
justifyContent: "center";
|
|
20
24
|
};
|
|
25
|
+
rowSmall: {
|
|
26
|
+
paddingLeft: number;
|
|
27
|
+
paddingRight: number;
|
|
28
|
+
};
|
|
21
29
|
toast: {
|
|
22
30
|
marginTop: number;
|
|
23
31
|
};
|
|
24
|
-
}
|
|
32
|
+
}>;
|
|
25
33
|
export { style };
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
1
|
+
import { Platform, StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
3
|
const { spaceM } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
paddingRight: 0,
|
|
8
|
-
},
|
|
9
|
-
layoutSmall: {
|
|
10
|
-
paddingLeft: "$spaceM",
|
|
11
|
-
paddingRight: "$spaceM",
|
|
12
|
-
},
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore
|
|
13
7
|
notifications: {
|
|
14
8
|
left: 0,
|
|
15
|
-
|
|
9
|
+
...Platform.select({
|
|
10
|
+
web: { position: "sticky" },
|
|
11
|
+
ios: { position: "absolute" },
|
|
12
|
+
android: { position: "absolute" },
|
|
13
|
+
}),
|
|
16
14
|
top: 0,
|
|
17
15
|
width: "100%",
|
|
18
16
|
zIndex: 20,
|
|
@@ -21,6 +19,10 @@ const style = StyleSheet.create({
|
|
|
21
19
|
flex: 1,
|
|
22
20
|
justifyContent: "center",
|
|
23
21
|
},
|
|
22
|
+
rowSmall: {
|
|
23
|
+
paddingLeft: spaceM,
|
|
24
|
+
paddingRight: spaceM,
|
|
25
|
+
},
|
|
24
26
|
toast: {
|
|
25
27
|
marginTop: spaceM,
|
|
26
28
|
},
|
|
@@ -10,17 +10,19 @@ import { ButtonIcon } from "../../molecules/buttonIcon/ButtonIcon";
|
|
|
10
10
|
import { Row } from "../row/Row";
|
|
11
11
|
import { Sticky } from "../sticky/Sticky";
|
|
12
12
|
import { style } from "./Modal.style";
|
|
13
|
-
const { spaceXXL } = theme();
|
|
13
|
+
const { spaceXL, spaceXXL } = theme();
|
|
14
14
|
const TRANSITION_MODAL_SCALE = 0.9;
|
|
15
15
|
const DEFAULT_SAFEAREA_INSET_TOP = spaceXXL;
|
|
16
|
+
const MODAL_DESKTOP_VERTICAL_PADDING = spaceXXL;
|
|
16
17
|
const Modal = ({ children, visible, header, footer, portalHostName, onClose, showCloseButton = false, size = { M: "2/3", L: "1/3" }, style: customStyle, scroll = false, }) => {
|
|
17
18
|
const { height: screenHeight } = Dimensions.get(Platform.OS === "web" ? "window" : "screen");
|
|
18
19
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
19
|
-
// On Android safeAreaInsetTop won't return the actual value.
|
|
20
|
-
const screenSizeWithoutInsets = screenHeight - (Platform.OS === "android" ? DEFAULT_SAFEAREA_INSET_TOP : safeAreaInsetTop);
|
|
21
20
|
const screenSize = useScreenSize();
|
|
22
21
|
const isSmallDevice = screenSize === "S";
|
|
23
22
|
const columnSizeForScreenSize = size[screenSize];
|
|
23
|
+
// On Android safeAreaInsetTop won't return the actual value.
|
|
24
|
+
const screenSizeWithoutInsets = screenHeight - (Platform.OS === "android" ? DEFAULT_SAFEAREA_INSET_TOP : safeAreaInsetTop);
|
|
25
|
+
const modalMaxHeight = screenSizeWithoutInsets - (!isSmallDevice ? MODAL_DESKTOP_VERTICAL_PADDING : 0);
|
|
24
26
|
const handleHardwareBackPress = useCallback(() => {
|
|
25
27
|
if (!visible) {
|
|
26
28
|
return;
|
|
@@ -65,7 +67,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
65
67
|
{
|
|
66
68
|
opacity: modalOpacity,
|
|
67
69
|
transform: [{ translateY: modalTranslateY }, { scale: modalScale }],
|
|
68
|
-
maxHeight:
|
|
70
|
+
maxHeight: modalMaxHeight,
|
|
69
71
|
},
|
|
70
72
|
customStyle?.modal,
|
|
71
73
|
], onLayout: handleOnModalLayout },
|
|
@@ -73,7 +75,9 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
73
75
|
React.createElement(View, null, header),
|
|
74
76
|
showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
|
|
75
77
|
React.createElement(ModalContentView, null,
|
|
76
|
-
React.createElement(View, { style: {
|
|
78
|
+
React.createElement(View, { style: {
|
|
79
|
+
paddingBottom: safeAreaInsetBottom + (Platform.OS === "web" ? spaceXL : footerHeight),
|
|
80
|
+
} }, children)),
|
|
77
81
|
footer && (React.createElement(Sticky, { style: style.stickyFooter, onLayout: handleOnFooterLayout }, footer))))))))));
|
|
78
82
|
};
|
|
79
83
|
export { Modal };
|
|
@@ -29,15 +29,18 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
|
29
29
|
"2/3": ViewStyle;
|
|
30
30
|
container: {
|
|
31
31
|
width: string;
|
|
32
|
+
zIndex: number;
|
|
32
33
|
height: string;
|
|
33
34
|
overflow: "hidden";
|
|
34
35
|
} | {
|
|
35
36
|
width: string;
|
|
37
|
+
zIndex: number;
|
|
36
38
|
position: "fixed";
|
|
37
39
|
height: string;
|
|
38
40
|
overflow: "hidden";
|
|
39
41
|
} | {
|
|
40
42
|
width: string;
|
|
43
|
+
zIndex: number;
|
|
41
44
|
position: "absolute";
|
|
42
45
|
height: string;
|
|
43
46
|
overflow: "hidden";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@react-spring/native": "^9.5.5",
|
|
36
36
|
"inline-style-prefixer": "6.0.1",
|
|
37
37
|
"react-native-safe-area-context": "^4.4.1",
|
|
38
|
-
"react-native-svg": "12.
|
|
38
|
+
"react-native-svg": "^12.1.1",
|
|
39
39
|
"tiny-invariant": "^1.3.1",
|
|
40
40
|
"uuid": "^9.0.0"
|
|
41
41
|
},
|
|
@@ -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,10 +0,0 @@
|
|
|
1
|
-
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
-
import { BookedSizeChangeProductsVariantsProjection } from "../../../../projection/bookedSizeChangeProductsVariants/bookedSizeChangeProductsVariants";
|
|
3
|
-
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs {
|
|
4
|
-
readonly checkoutItemId: string;
|
|
5
|
-
}
|
|
6
|
-
interface UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
7
|
-
(args: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeChangeProductsVariantsProjection>;
|
|
8
|
-
}
|
|
9
|
-
declare const useViewBookedSizeChangeProductsVariantsForCheckoutItem: UseViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
10
|
-
export { useViewBookedSizeChangeProductsVariantsForCheckoutItem };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { CancelableQueryViewArgs, Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
|
|
2
|
-
import { BookedSizeChangeProductsVariantsProjection } from "./bookedSizeChangeProductsVariants";
|
|
3
|
-
declare const VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_change_product_variants_for_checkout_item";
|
|
4
|
-
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload {
|
|
5
|
-
readonly checkoutItemId: string;
|
|
6
|
-
}
|
|
7
|
-
interface ViewBookedSizeChangeProductsVariantsForCheckoutItem extends Query<typeof VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload {
|
|
8
|
-
}
|
|
9
|
-
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemFunction {
|
|
10
|
-
(payload: ViewBookedSizeChangeProductsVariantsForCheckoutItemPayload): ViewBookedSizeChangeProductsVariantsForCheckoutItem;
|
|
11
|
-
}
|
|
12
|
-
declare const viewBookedSizeChangeProductsVariantsForCheckoutItem: ViewBookedSizeChangeProductsVariantsForCheckoutItemFunction;
|
|
13
|
-
type ViewBookedSizeChangeProductsVariantsForCheckoutItemResult = BookedSizeChangeProductsVariantsProjection | null;
|
|
14
|
-
interface BookedSizeChangeProductsVariantsForCheckoutItemViewArgs extends CancelableQueryViewArgs {
|
|
15
|
-
readonly checkoutItemId: string;
|
|
16
|
-
}
|
|
17
|
-
interface BookedSizeChangeProductsVariantsForCheckoutItemView {
|
|
18
|
-
(args: BookedSizeChangeProductsVariantsForCheckoutItemViewArgs): Promise<ViewBookedSizeChangeProductsVariantsForCheckoutItemResult>;
|
|
19
|
-
}
|
|
20
|
-
interface ViewBookedSizeChangeProductsVariantsForCheckoutItemHandlerFunctionArgs extends QueryHandlerFunctionArgs {
|
|
21
|
-
readonly view: BookedSizeChangeProductsVariantsForCheckoutItemView;
|
|
22
|
-
}
|
|
23
|
-
declare const viewBookedSizeChangeProductsVariantsForCheckoutItemHandler: QueryHandlerFunction<ViewBookedSizeChangeProductsVariantsForCheckoutItem, ViewBookedSizeChangeProductsVariantsForCheckoutItemResult, ViewBookedSizeChangeProductsVariantsForCheckoutItemHandlerFunctionArgs>;
|
|
24
|
-
export type { ViewBookedSizeChangeProductsVariantsForCheckoutItem, BookedSizeChangeProductsVariantsForCheckoutItemView, ViewBookedSizeChangeProductsVariantsForCheckoutItemResult, };
|
|
25
|
-
export { VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItem, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { query, } from "@lookiero/messaging";
|
|
2
|
-
const VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "view_booked_size_change_product_variants_for_checkout_item";
|
|
3
|
-
const viewBookedSizeChangeProductsVariantsForCheckoutItem = (payload) => ({
|
|
4
|
-
...query({ name: VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
5
|
-
...payload,
|
|
6
|
-
});
|
|
7
|
-
const viewBookedSizeChangeProductsVariantsForCheckoutItemHandler = ({ view, signal }) => async ({ checkoutItemId }) => view({ checkoutItemId, signal });
|
|
8
|
-
export { VIEW_BOOKED_SIZE_CHANGE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, viewBookedSizeChangeProductsVariantsForCheckoutItem, viewBookedSizeChangeProductsVariantsForCheckoutItemHandler, };
|