@lookiero/checkout 0.3.12 → 0.3.13
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/i18n/i18n.d.ts +2 -1
- package/dist/src/infrastructure/ui/i18n/i18n.js +1 -0
- 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 };
|
|
@@ -55,6 +55,7 @@ declare enum I18nMessages {
|
|
|
55
55
|
CHECKOUT_TOAST_ERROR = "checkout.toast_error",
|
|
56
56
|
CHECKOUT_SUCCESS_MODAL_TITLE = "checkout.success_modal_title",
|
|
57
57
|
CHECKOUT_SUCCESS_MODAL_DESCRIPTION = "checkout.success_modal_description",
|
|
58
|
-
CHECKOUT_SUCCESS_MODAL_BUTTON = "checkout.success_modal_button"
|
|
58
|
+
CHECKOUT_SUCCESS_MODAL_BUTTON = "checkout.success_modal_button",
|
|
59
|
+
CHECKOUT_DELIVERY_BANNER = "checkout.delivery_banner"
|
|
59
60
|
}
|
|
60
61
|
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
|
|
@@ -57,5 +57,6 @@ var I18nMessages;
|
|
|
57
57
|
I18nMessages["CHECKOUT_SUCCESS_MODAL_TITLE"] = "checkout.success_modal_title";
|
|
58
58
|
I18nMessages["CHECKOUT_SUCCESS_MODAL_DESCRIPTION"] = "checkout.success_modal_description";
|
|
59
59
|
I18nMessages["CHECKOUT_SUCCESS_MODAL_BUTTON"] = "checkout.success_modal_button";
|
|
60
|
+
I18nMessages["CHECKOUT_DELIVERY_BANNER"] = "checkout.delivery_banner";
|
|
60
61
|
})(I18nMessages || (I18nMessages = {}));
|
|
61
62
|
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_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
|