@lookiero/checkout 3.3.0 → 3.4.0
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/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +4 -3
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +5 -4
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +5 -4
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +4 -3
- package/dist/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +1 -1
- package/dist/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +1 -1
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +1 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +4 -4
- package/dist/shared/notifications/infrastructure/ui/components/toastNotifications/ToastNotificationItem.js +5 -4
- package/package.json +3 -3
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import { useIntl } from "@lookiero/i18n-react";
|
|
2
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
4
|
import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
|
|
5
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
6
6
|
const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, }) => {
|
|
7
|
-
const
|
|
7
|
+
const { formatMessage } = useIntl();
|
|
8
|
+
const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
|
|
8
9
|
const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
|
|
9
10
|
const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
|
|
10
11
|
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useCallback, useEffect, useState } from "react";
|
|
1
|
+
import { useIntl } from "@lookiero/i18n-react";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
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";
|
|
@@ -8,7 +8,8 @@ import { useReturnQuestionFeedback, useReturnQuestionFeedbackForId } from "../..
|
|
|
8
8
|
import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
|
|
9
9
|
import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
|
|
10
10
|
const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
11
|
-
const
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
12
13
|
const [modalVisible, setModalVisible] = useState(false);
|
|
13
14
|
const handleOnPress = useCallback(() => setModalVisible(true), []);
|
|
14
15
|
const handleOnModalClose = useCallback(() => setModalVisible(false), []);
|
|
@@ -32,7 +33,7 @@ const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName
|
|
|
32
33
|
return (React.createElement(React.Fragment, null,
|
|
33
34
|
React.createElement(TouchableHighlight, { style: style.container, underlayColor: containerUnderlayColor, onPress: handleOnPress },
|
|
34
35
|
React.createElement(View, { pointerEvents: "none" },
|
|
35
|
-
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText
|
|
36
|
+
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholderText, value: inputValue }))),
|
|
36
37
|
React.createElement(Modal, { portalHostName: portalHostName, visible: modalVisible, header: deepestReturnQuestionWithFeedback && (React.createElement(ButtonIcon, { name: "arrow-left", testID: "modal-back-button", onPress: handleOnBackButtonPress })), scroll: true, showCloseButton: true, onClose: handleOnModalClose },
|
|
37
38
|
React.createElement(View, { style: style.modalContent }, children))));
|
|
38
39
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora";
|
|
2
|
-
import {
|
|
2
|
+
import { useIntl } from "@lookiero/i18n-react";
|
|
3
3
|
import { animated, useSpring } from "@react-spring/native";
|
|
4
|
-
import React, { useCallback, useState } from "react";
|
|
4
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
import ReturnQuestion from "../../ReturnQuestion";
|
|
7
7
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
8
8
|
import { style } from "./HostStackReturnQuestionItem.style";
|
|
9
9
|
const HostStackReturnQuestionItem = ({ returnQuestion, children, portalHostName, }) => {
|
|
10
|
-
const
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
11
|
const { feedback } = useReturnQuestionFeedbackForId({ id: returnQuestion.id });
|
|
12
12
|
const feedbackReturnQuestion = feedback
|
|
13
13
|
? returnQuestion.children?.find((returnQuestion) => returnQuestion.id === feedback)
|
|
14
14
|
: undefined;
|
|
15
|
-
const
|
|
15
|
+
const titleText = useMemo(() => (returnQuestion.name ? formatMessage({ id: returnQuestion.name }) : undefined), [formatMessage, returnQuestion.name]);
|
|
16
|
+
const feedbackText = useMemo(() => (feedbackReturnQuestion ? formatMessage({ id: feedbackReturnQuestion.name }) : undefined), [feedbackReturnQuestion, formatMessage]);
|
|
16
17
|
const [stackHeight, setStackHeight] = useState();
|
|
17
18
|
const handleOnLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setStackHeight(height), []);
|
|
18
19
|
const stackSyle = useSpring({ height: stackHeight });
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import { useIntl } from "@lookiero/i18n-react";
|
|
2
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
3
|
import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
|
|
4
4
|
import { useReturnQuestionFeedbackForId } from "../../behaviors/useReturnQuestionFeedback";
|
|
5
5
|
const TEXTAREA_MIN_HEIGHT = 96;
|
|
6
6
|
const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParentId, }) => {
|
|
7
|
-
const
|
|
7
|
+
const { formatMessage } = useIntl();
|
|
8
|
+
const placeholderText = useMemo(() => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""), [formatMessage, returnQuestion.placeholder]);
|
|
8
9
|
const { feedback, onChange } = useReturnQuestionFeedbackForId({ id: returnQuestionParentId });
|
|
9
10
|
const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParentId, returnQuestionFeedback: value }), [onChange, returnQuestionParentId]);
|
|
10
11
|
return (React.createElement(InputField, { label: placeholderText, minHeight: TEXTAREA_MIN_HEIGHT, placeholder: placeholderText, value: feedback, multiline: true, onChange: handleOnChange }));
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { Banner } from "../../../../components/layouts/banner/Banner";
|
|
4
4
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
5
5
|
const DeliveryBanner = () => {
|
|
6
|
-
const deliveryBannerText = useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER })
|
|
6
|
+
const deliveryBannerText = useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER });
|
|
7
7
|
return React.createElement(Banner, { text: deliveryBannerText });
|
|
8
8
|
};
|
|
9
9
|
export { DeliveryBanner };
|
|
@@ -12,7 +12,7 @@ const i18nMessageForCheckoutItemStatus = {
|
|
|
12
12
|
[CheckoutItemStatus.RETURNED]: I18nMessages.ITEM_BANNER_CUSTOMER_RETURNED_DECISSION,
|
|
13
13
|
};
|
|
14
14
|
const CustomerDecissionBanner = ({ checkoutItemStatus, onPress }) => {
|
|
15
|
-
const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] })
|
|
15
|
+
const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] });
|
|
16
16
|
const bannerButtonText = useI18nMessage({ id: I18nMessages.ITEM_BANNER_BUTTON });
|
|
17
17
|
return (React.createElement(Banner, { text: decissionText },
|
|
18
18
|
React.createElement(Pressable, { style: style.button, testID: "customer-decission-banner", onPress: onPress },
|
|
@@ -24,7 +24,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
|
|
|
24
24
|
React.createElement(View, { style: style.row },
|
|
25
25
|
!currentProductVariant.size.unique && productVariants && (React.createElement(SelectField, { ...(disabledSizeSelector && {
|
|
26
26
|
onPress: onSizeSelectorPress,
|
|
27
|
-
}), options: sizeSelectorOptions, placeholder: sizeSelectorLabelText
|
|
27
|
+
}), options: sizeSelectorOptions, placeholder: sizeSelectorLabelText, testID: "size-selector", title: sizeSelectorLabelText, value: currentProductVariant.id, style: {
|
|
28
28
|
selectField: style.sizeSelector,
|
|
29
29
|
inputField: { input: disabledSizeSelector && style.inputDisabled },
|
|
30
30
|
}, onChange: onReplace })),
|
|
@@ -14,7 +14,7 @@ const Row = ({ text, level = 3, children }) => (React.createElement(View, { styl
|
|
|
14
14
|
React.createElement(Text, { level: level, action: true, upperCase: true }, text),
|
|
15
15
|
children));
|
|
16
16
|
const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPercentage = 0, totalCheckoutItemsKept, service, collapsible = true, collapsed = false, busy = false, onPress = () => void 0, onSubmit, }) => {
|
|
17
|
-
const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL })
|
|
17
|
+
const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL });
|
|
18
18
|
const totalCheckoutItemsKeptText = useI18nMessage({
|
|
19
19
|
id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
|
|
20
20
|
values: { items: totalCheckoutItemsKept.toString() },
|
|
@@ -25,9 +25,9 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
25
25
|
const discountText = useI18nMessage({
|
|
26
26
|
id: I18nMessages.SUMMARY_DISCOUNT,
|
|
27
27
|
values: { discount: discountPercentage?.toString() },
|
|
28
|
-
})
|
|
29
|
-
const creditText = useI18nMessage({ id: I18nMessages.SUMMARY_CREDIT })
|
|
30
|
-
const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE })
|
|
28
|
+
});
|
|
29
|
+
const creditText = useI18nMessage({ id: I18nMessages.SUMMARY_CREDIT });
|
|
30
|
+
const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE });
|
|
31
31
|
const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
|
|
32
32
|
const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
|
|
33
33
|
return (React.createElement(Pressable, { testID: "pricing", onPress: collapsible ? onPress : null },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
2
|
-
import React from "react";
|
|
1
|
+
import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
3
|
import { useCallback, useEffect } from "react";
|
|
4
4
|
import { Toast, ToastVariant } from "../../../../../ui/components/molecules/toast/Toast";
|
|
5
5
|
import { NotificationLevel } from "../../../../domain/notification/model/notification";
|
|
@@ -9,8 +9,9 @@ const toastVariantForNotificationLevel = {
|
|
|
9
9
|
[NotificationLevel.SUCCESS]: ToastVariant.SUCCESS,
|
|
10
10
|
};
|
|
11
11
|
const ToastNotificationItem = ({ notification, onRemove, autoHideTimeout, testID = "toast-notification-item", style: customStyle, }) => {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
const title = useMemo(() => (notification.titleI18nKey ? formatMessage({ id: notification.titleI18nKey }) : undefined), [formatMessage, notification.titleI18nKey]);
|
|
14
|
+
const body = useI18nMessage({ id: notification.bodyI18nKey });
|
|
14
15
|
const handleOnClose = useCallback(() => onRemove(notification.id), [notification.id, onRemove]);
|
|
15
16
|
useEffect(() => {
|
|
16
17
|
if (!autoHideTimeout) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@expo/dev-server": "0.1.120",
|
|
30
30
|
"@gorhom/portal": "^1.0.14",
|
|
31
|
-
"@lookiero/i18n": "^0.
|
|
32
|
-
"@lookiero/i18n-react": "^0.
|
|
31
|
+
"@lookiero/i18n": "^0.9.0",
|
|
32
|
+
"@lookiero/i18n-react": "^0.9.0",
|
|
33
33
|
"@lookiero/messaging": "^8.1.1",
|
|
34
34
|
"@lookiero/messaging-react": "^8.1.1",
|
|
35
35
|
"@react-spring/native": "9.6.1",
|