@lookiero/checkout 0.3.12 → 0.3.14
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/package.json +1 -1
- package/dist/src/infrastructure/ui/components/layouts/banner/Banner.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/layouts/banner/Banner.js +8 -0
- package/dist/src/infrastructure/ui/components/layouts/banner/Banner.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/components/layouts/banner/Banner.style.js +15 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestionItem.d.ts +10 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestionItem.js +1 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.d.ts +3 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +18 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.d.ts +6 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.js +9 -0
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +4 -2
- package/dist/src/infrastructure/ui/i18n/i18n.js +3 -1
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +5 -1
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
- package/dist/src/infrastructure/ui/views/checkout/components/{CheckoutSuccessModal.js → checkoutSuccessModal/CheckoutSuccessModal.js} +2 -2
- package/dist/src/infrastructure/ui/views/checkout/components/{CheckoutSuccessModal.style.js → checkoutSuccessModal/CheckoutSuccessModal.style.js} +1 -1
- package/dist/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.d.ts +3 -0
- package/dist/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +9 -0
- package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +5 -5
- package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.style.d.ts +3 -11
- package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.style.js +4 -12
- package/package.json +1 -1
- /package/dist/src/infrastructure/ui/views/checkout/components/{CheckoutSuccessModal.d.ts → checkoutSuccessModal/CheckoutSuccessModal.d.ts} +0 -0
- /package/dist/src/infrastructure/ui/views/checkout/components/{CheckoutSuccessModal.style.d.ts → checkoutSuccessModal/CheckoutSuccessModal.style.d.ts} +0 -0
package/dist/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { style } from "./Banner.style";
|
|
5
|
+
const Banner = ({ children, text }) => (React.createElement(View, { style: style.container },
|
|
6
|
+
React.createElement(Text, { level: 2, style: style.text, detail: true }, text),
|
|
7
|
+
children));
|
|
8
|
+
export { Banner };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../theme/theme";
|
|
3
|
+
const { colorInfo, spaceM, spaceL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
backgroundColor: colorInfo,
|
|
8
|
+
paddingHorizontal: spaceL,
|
|
9
|
+
paddingVertical: spaceM,
|
|
10
|
+
},
|
|
11
|
+
text: {
|
|
12
|
+
textAlign: "center",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
export { style };
|
package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestionItem.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { CheckoutQuestionProjection } from "../../../../../projection/checkoutQuestion/checkoutQuestion";
|
|
3
|
+
interface CheckoutQuestionItemProps {
|
|
4
|
+
readonly checkoutQuestion: CheckoutQuestionProjection;
|
|
5
|
+
readonly checkoutQuestionParentId: string;
|
|
6
|
+
readonly children?: ReactNode;
|
|
7
|
+
readonly portalHostName?: string;
|
|
8
|
+
}
|
|
9
|
+
type CheckoutQuestionItem = FC<CheckoutQuestionItemProps>;
|
|
10
|
+
export type { CheckoutQuestionItem, CheckoutQuestionItemProps };
|
package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestionItem.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
|
|
2
|
+
import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
|
|
3
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
|
+
import React, { useCallback } from "react";
|
|
5
|
+
import { CHECKOUT_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
|
|
6
|
+
import { style } from "./ButtonCheckoutQuestionItem.style";
|
|
7
|
+
const ButtonCheckoutQuestionItem = ({ checkoutQuestion }) => {
|
|
8
|
+
const optionText = useI18nMessage({ id: checkoutQuestion.name, prefix: CHECKOUT_QUESTIONS_PREFIX });
|
|
9
|
+
const handleOnPress = useCallback(() => void 0, []);
|
|
10
|
+
return (React.createElement(Button
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
, {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
style: style.button, variant: BUTTON_VARIANT.SECONDARY, onPress: handleOnPress }, optionText));
|
|
17
|
+
};
|
|
18
|
+
export { ButtonCheckoutQuestionItem };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare const COLOR_I18N_PREFIX = "color.";
|
|
2
2
|
declare const RETURN_QUESTIONS_PREFIX = "return_questions.";
|
|
3
3
|
declare const RETURN_QUESTIONS_FEEDBACK_PREFIX = "return_questions_feedback.";
|
|
4
|
+
declare const CHECKOUT_QUESTIONS_PREFIX = "checkout_questions.";
|
|
4
5
|
declare enum I18nMessages {
|
|
5
6
|
INTRO_TITLE = "intro.title",
|
|
6
7
|
INTRO_SUBTITLE = "intro.subtitle",
|
|
@@ -55,6 +56,7 @@ declare enum I18nMessages {
|
|
|
55
56
|
CHECKOUT_TOAST_ERROR = "checkout.toast_error",
|
|
56
57
|
CHECKOUT_SUCCESS_MODAL_TITLE = "checkout.success_modal_title",
|
|
57
58
|
CHECKOUT_SUCCESS_MODAL_DESCRIPTION = "checkout.success_modal_description",
|
|
58
|
-
CHECKOUT_SUCCESS_MODAL_BUTTON = "checkout.success_modal_button"
|
|
59
|
+
CHECKOUT_SUCCESS_MODAL_BUTTON = "checkout.success_modal_button",
|
|
60
|
+
CHECKOUT_DELIVERY_BANNER = "checkout.delivery_banner"
|
|
59
61
|
}
|
|
60
|
-
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
|
|
62
|
+
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX, CHECKOUT_QUESTIONS_PREFIX, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const COLOR_I18N_PREFIX = "color.";
|
|
2
2
|
const RETURN_QUESTIONS_PREFIX = "return_questions.";
|
|
3
3
|
const RETURN_QUESTIONS_FEEDBACK_PREFIX = "return_questions_feedback.";
|
|
4
|
+
const CHECKOUT_QUESTIONS_PREFIX = "checkout_questions.";
|
|
4
5
|
var I18nMessages;
|
|
5
6
|
(function (I18nMessages) {
|
|
6
7
|
I18nMessages["INTRO_TITLE"] = "intro.title";
|
|
@@ -57,5 +58,6 @@ var I18nMessages;
|
|
|
57
58
|
I18nMessages["CHECKOUT_SUCCESS_MODAL_TITLE"] = "checkout.success_modal_title";
|
|
58
59
|
I18nMessages["CHECKOUT_SUCCESS_MODAL_DESCRIPTION"] = "checkout.success_modal_description";
|
|
59
60
|
I18nMessages["CHECKOUT_SUCCESS_MODAL_BUTTON"] = "checkout.success_modal_button";
|
|
61
|
+
I18nMessages["CHECKOUT_DELIVERY_BANNER"] = "checkout.delivery_banner";
|
|
60
62
|
})(I18nMessages || (I18nMessages = {}));
|
|
61
|
-
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
|
|
63
|
+
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX, CHECKOUT_QUESTIONS_PREFIX, };
|
|
@@ -21,7 +21,8 @@ import { useBasePath } from "../../routing/useBasePath";
|
|
|
21
21
|
import { ProductVariant } from "../item/components/productVariant/ProductVariant";
|
|
22
22
|
import { Pricing } from "../summary/components/pricing/Pricing";
|
|
23
23
|
import { style } from "./Checkout.style";
|
|
24
|
-
import { CheckoutSuccessModal } from "./components/CheckoutSuccessModal";
|
|
24
|
+
import { CheckoutSuccessModal } from "./components/checkoutSuccessModal/CheckoutSuccessModal";
|
|
25
|
+
import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
|
|
25
26
|
const Checkout = ({ customerId, authToken, useRedirect }) => {
|
|
26
27
|
const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
|
|
27
28
|
const paymentInstrumentSelectRef = useRef(null);
|
|
@@ -67,6 +68,7 @@ const Checkout = ({ customerId, authToken, useRedirect }) => {
|
|
|
67
68
|
}, [createNotification, markAsPaid, paymentFlowPayload]);
|
|
68
69
|
const handleOnSuccessModalDismiss = useCallback(() => navigate(`${basePath}/${Routes.FEEDBACK}`), [basePath, navigate]);
|
|
69
70
|
const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
71
|
+
const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
70
72
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
71
73
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) && dependenciesLoadedStatuses.includes(pricingStatus);
|
|
72
74
|
if (!dependenciesLoaded)
|
|
@@ -75,6 +77,8 @@ const Checkout = ({ customerId, authToken, useRedirect }) => {
|
|
|
75
77
|
React.createElement(CheckoutSuccessModal, { visible: markAsPaidStatus === CommandStatus.SUCCESS, onDismiss: handleOnSuccessModalDismiss }),
|
|
76
78
|
React.createElement(SafeAreaScrollView, null,
|
|
77
79
|
React.createElement(Body, { style: { column: style.bodyColumn } },
|
|
80
|
+
hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
|
|
81
|
+
React.createElement(DeliveryBanner, null))),
|
|
78
82
|
React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, hidePaymentMethods: [PaymentMethod.GOOGLE_PAY], section: Section.BOX_CHECKOUT }),
|
|
79
83
|
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
80
84
|
checkoutItemsKept?.map((checkoutItem) => (React.createElement(View, { key: checkoutItem.id, style: style.checkoutItemKept, testID: "checkout-items-kept" },
|
|
@@ -3,8 +3,8 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
|
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { View } from "react-native";
|
|
6
|
-
import { Modal } from "
|
|
7
|
-
import { I18nMessages } from "
|
|
6
|
+
import { Modal } from "../../../../../../shared/ui/components/layouts/modal/Modal";
|
|
7
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
8
|
import { style } from "./CheckoutSuccessModal.style";
|
|
9
9
|
const CheckoutSuccessModal = ({ visible, onDismiss }) => {
|
|
10
10
|
const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_TITLE });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Banner } from "../../../../components/layouts/banner/Banner";
|
|
4
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
5
|
+
const DeliveryBanner = () => {
|
|
6
|
+
const deliveryBannerText = useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER }) || "";
|
|
7
|
+
return React.createElement(Banner, { text: deliveryBannerText });
|
|
8
|
+
};
|
|
9
|
+
export { DeliveryBanner };
|
|
@@ -1,8 +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 { Pressable
|
|
4
|
+
import { Pressable } from "react-native";
|
|
5
5
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
|
+
import { Banner } from "../../../../components/layouts/banner/Banner";
|
|
6
7
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
8
|
import { style } from "./CustomerDecissionBanner.style";
|
|
8
9
|
const i18nMessageForCheckoutItemStatus = {
|
|
@@ -11,11 +12,10 @@ const i18nMessageForCheckoutItemStatus = {
|
|
|
11
12
|
[CheckoutItemStatus.RETURNED]: I18nMessages.ITEM_BANNER_CUSTOMER_RETURNED_DECISSION,
|
|
12
13
|
};
|
|
13
14
|
const CustomerDecissionBanner = ({ checkoutItemStatus, onPress }) => {
|
|
14
|
-
const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] });
|
|
15
|
+
const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] }) || "";
|
|
15
16
|
const bannerButtonText = useI18nMessage({ id: I18nMessages.ITEM_BANNER_BUTTON });
|
|
16
|
-
return (React.createElement(
|
|
17
|
-
React.createElement(
|
|
18
|
-
React.createElement(Pressable, { onPress: onPress },
|
|
17
|
+
return (React.createElement(Banner, { text: decissionText },
|
|
18
|
+
React.createElement(Pressable, { style: style.button, onPress: onPress },
|
|
19
19
|
React.createElement(Text, { level: 2, style: style.buttonText, detail: true }, bannerButtonText))));
|
|
20
20
|
};
|
|
21
21
|
export { CustomerDecissionBanner };
|
package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.style.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
declare const style: {
|
|
2
|
+
button: {
|
|
3
|
+
marginTop: number;
|
|
4
|
+
};
|
|
2
5
|
buttonText: {
|
|
3
6
|
textDecorationLine: "underline";
|
|
4
7
|
};
|
|
5
|
-
container: {
|
|
6
|
-
alignItems: "center";
|
|
7
|
-
backgroundColor: string;
|
|
8
|
-
paddingBottom: number;
|
|
9
|
-
paddingHorizontal: number;
|
|
10
|
-
paddingTop: number;
|
|
11
|
-
};
|
|
12
|
-
decissionText: {
|
|
13
|
-
marginBottom: number;
|
|
14
|
-
textAlign: "center";
|
|
15
|
-
};
|
|
16
8
|
};
|
|
17
9
|
export { style };
|
package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.style.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const {
|
|
3
|
+
const { spaceM } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
button: {
|
|
6
|
+
marginTop: spaceM,
|
|
7
|
+
},
|
|
5
8
|
buttonText: {
|
|
6
9
|
textDecorationLine: "underline",
|
|
7
10
|
},
|
|
8
|
-
container: {
|
|
9
|
-
alignItems: "center",
|
|
10
|
-
backgroundColor: colorInfo,
|
|
11
|
-
paddingBottom: spaceL,
|
|
12
|
-
paddingHorizontal: spaceL,
|
|
13
|
-
paddingTop: spaceM,
|
|
14
|
-
},
|
|
15
|
-
decissionText: {
|
|
16
|
-
marginBottom: spaceM,
|
|
17
|
-
textAlign: "center",
|
|
18
|
-
},
|
|
19
11
|
});
|
|
20
12
|
export { style };
|
package/package.json
CHANGED
|
File without changes
|