@lookiero/checkout 0.2.48 → 0.2.49
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/i18n/i18n.d.ts +4 -1
- package/dist/infrastructure/ui/i18n/i18n.js +3 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +10 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +28 -17
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +22 -0
- package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +23 -1
- package/dist/infrastructure/ui/views/summary/Summary.js +3 -2
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +1 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +10 -6
- 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 +4 -1
- package/package.json +2 -1
|
@@ -34,6 +34,9 @@ declare enum I18nMessages {
|
|
|
34
34
|
RETURN_QUESTIONS_TITLE = "return_questions.title",
|
|
35
35
|
RETURN_QUESTIONS_SUBMIT_BUTTON = "return_questions.submit_button",
|
|
36
36
|
SUMMARY_KEEP_TAB = "summary.keep_tab",
|
|
37
|
-
SUMMARY_RETURN_TAB = "summary.return_tab"
|
|
37
|
+
SUMMARY_RETURN_TAB = "summary.return_tab",
|
|
38
|
+
SUMMARY_KEEP_EMPTY = "summary.keep_empty",
|
|
39
|
+
SUMMARY_RETURN_EMPTY = "summary.return_empty",
|
|
40
|
+
PRODUCT_VARIANT_SIZE_CHANGE = "product_variant.size_change"
|
|
38
41
|
}
|
|
39
42
|
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
|
|
@@ -36,5 +36,8 @@ var I18nMessages;
|
|
|
36
36
|
I18nMessages["RETURN_QUESTIONS_SUBMIT_BUTTON"] = "return_questions.submit_button";
|
|
37
37
|
I18nMessages["SUMMARY_KEEP_TAB"] = "summary.keep_tab";
|
|
38
38
|
I18nMessages["SUMMARY_RETURN_TAB"] = "summary.return_tab";
|
|
39
|
+
I18nMessages["SUMMARY_KEEP_EMPTY"] = "summary.keep_empty";
|
|
40
|
+
I18nMessages["SUMMARY_RETURN_EMPTY"] = "summary.return_empty";
|
|
41
|
+
I18nMessages["PRODUCT_VARIANT_SIZE_CHANGE"] = "product_variant.size_change";
|
|
39
42
|
})(I18nMessages || (I18nMessages = {}));
|
|
40
43
|
export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
+
import { ImageStyle, StyleProp } from "react-native";
|
|
3
|
+
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
2
4
|
import { ColorProjection, MediaProjection, PriceProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
3
5
|
import { SizeProjection } from "../../../../../../projection/shared/size";
|
|
6
|
+
interface ProductVariantStyle {
|
|
7
|
+
readonly image: StyleProp<ImageStyle>;
|
|
8
|
+
}
|
|
4
9
|
interface ProductVariantProps {
|
|
5
10
|
readonly media: MediaProjection[];
|
|
6
11
|
readonly brand: string;
|
|
@@ -8,6 +13,11 @@ interface ProductVariantProps {
|
|
|
8
13
|
readonly price: PriceProjection;
|
|
9
14
|
readonly size: SizeProjection;
|
|
10
15
|
readonly color: ColorProjection;
|
|
16
|
+
readonly status?: CheckoutItemStatus;
|
|
17
|
+
readonly discarded?: boolean;
|
|
18
|
+
readonly style?: Partial<ProductVariantStyle>;
|
|
19
|
+
readonly onPress?: () => void;
|
|
11
20
|
}
|
|
12
21
|
declare const ProductVariant: FC<ProductVariantProps>;
|
|
22
|
+
export type { ProductVariantStyle };
|
|
13
23
|
export { ProductVariant };
|
|
@@ -1,30 +1,41 @@
|
|
|
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 { Image, View } from "react-native";
|
|
4
|
+
import { Image, Pressable, View } from "react-native";
|
|
5
|
+
import Svg, { Line } from "react-native-svg";
|
|
6
|
+
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
7
|
import { Price } from "../../../../components/atoms/price/Price";
|
|
6
8
|
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
7
9
|
import { COLOR_I18N_PREFIX, I18nMessages } from "../../../../i18n/i18n";
|
|
10
|
+
import { ButtonIcon } from "../../../../shared/components/molecules/buttonIcon/ButtonIcon";
|
|
8
11
|
import { IMAGE_WIDTH, style } from "./ProductVariant.style";
|
|
9
|
-
const ProductVariant = ({ media, brand, name, price, size, color }) => {
|
|
12
|
+
const ProductVariant = ({ media, brand, name, price, size, color, status, discarded, style: customStyle, onPress, }) => {
|
|
10
13
|
const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
|
|
11
14
|
const colorLabel = useI18nMessage({ id: color.label, prefix: COLOR_I18N_PREFIX });
|
|
15
|
+
const sizeChangeText = useI18nMessage({ id: I18nMessages.PRODUCT_VARIANT_SIZE_CHANGE });
|
|
12
16
|
const cdnImageUrl = useMediaImage();
|
|
13
|
-
return (React.createElement(
|
|
14
|
-
React.createElement(
|
|
15
|
-
uri: cdnImageUrl({
|
|
16
|
-
url: media[0]?.url,
|
|
17
|
-
width: IMAGE_WIDTH,
|
|
18
|
-
}),
|
|
19
|
-
} }),
|
|
20
|
-
React.createElement(View, { style: style.descriptionContainer },
|
|
17
|
+
return (React.createElement(Pressable, { style: style.container, testID: "product-variant", onPress: onPress },
|
|
18
|
+
React.createElement(View, { style: style.row },
|
|
21
19
|
React.createElement(View, null,
|
|
22
|
-
React.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
React.createElement(Image, { resizeMode: "contain", style: [style.media, customStyle?.image], testID: "product-variant-media", source: {
|
|
21
|
+
uri: cdnImageUrl({
|
|
22
|
+
url: media[0]?.url,
|
|
23
|
+
width: IMAGE_WIDTH,
|
|
24
|
+
}),
|
|
25
|
+
} }),
|
|
26
|
+
discarded && (React.createElement(Svg, { preserveAspectRatio: "none", style: style.discarded, testID: "discarded", viewBox: "0 0 100 100" },
|
|
27
|
+
React.createElement(Line, { vectorEffect: "non-scaling-stroke", x1: "100", x2: "0", y1: "0", y2: "100" })))),
|
|
28
|
+
React.createElement(View, { style: style.descriptionContainer },
|
|
29
|
+
React.createElement(View, null,
|
|
30
|
+
React.createElement(Text, { level: 2, style: style.brand, detail: true }, brand),
|
|
31
|
+
React.createElement(Text, { level: 2, detail: true }, name),
|
|
32
|
+
React.createElement(Text, { level: 2, style: style.priceAndColor, detail: true },
|
|
33
|
+
size.unique ? uniqueText : size.lookiero,
|
|
34
|
+
" / ",
|
|
35
|
+
colorLabel),
|
|
36
|
+
status === CheckoutItemStatus.REPLACED && (React.createElement(View, { style: style.sizeChange },
|
|
37
|
+
React.createElement(Text, { level: 3, style: style.sizeChangeText, detail: true }, sizeChangeText)))),
|
|
38
|
+
React.createElement(Price, { price: price, variant: "detail" }))),
|
|
39
|
+
onPress && React.createElement(ButtonIcon, { name: "arrow-right" })));
|
|
29
40
|
};
|
|
30
41
|
export { ProductVariant };
|
package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts
CHANGED
|
@@ -5,11 +5,21 @@ declare const style: {
|
|
|
5
5
|
};
|
|
6
6
|
container: {
|
|
7
7
|
flexDirection: "row";
|
|
8
|
+
justifyContent: "space-between";
|
|
8
9
|
};
|
|
9
10
|
descriptionContainer: {
|
|
10
11
|
justifyContent: "space-between";
|
|
11
12
|
marginLeft: number;
|
|
12
13
|
};
|
|
14
|
+
discarded: {
|
|
15
|
+
height: string;
|
|
16
|
+
left: number;
|
|
17
|
+
position: "absolute";
|
|
18
|
+
stroke: string;
|
|
19
|
+
top: number;
|
|
20
|
+
width: string;
|
|
21
|
+
zIndex: number;
|
|
22
|
+
};
|
|
13
23
|
media: {
|
|
14
24
|
borderColor: string;
|
|
15
25
|
borderWidth: number;
|
|
@@ -19,5 +29,17 @@ declare const style: {
|
|
|
19
29
|
priceAndColor: {
|
|
20
30
|
color: string;
|
|
21
31
|
};
|
|
32
|
+
row: {
|
|
33
|
+
flexDirection: "row";
|
|
34
|
+
};
|
|
35
|
+
sizeChange: {
|
|
36
|
+
backgroundColor: string;
|
|
37
|
+
marginTop: number;
|
|
38
|
+
paddingHorizontal: number;
|
|
39
|
+
paddingVertical: number;
|
|
40
|
+
};
|
|
41
|
+
sizeChangeText: {
|
|
42
|
+
textTransform: "uppercase";
|
|
43
|
+
};
|
|
22
44
|
};
|
|
23
45
|
export { style, IMAGE_WIDTH };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { borderSize, colorGrayscaleL, spaceS } = theme();
|
|
3
|
+
const { borderSize, colorContent, colorGrayscaleL, colorInfo, spaceXS, spaceS, spaceM } = theme();
|
|
4
4
|
const IMAGE_WIDTH = 96;
|
|
5
5
|
const IMAGE_HEIGHT = 120;
|
|
6
6
|
const style = StyleSheet.create({
|
|
@@ -9,11 +9,21 @@ const style = StyleSheet.create({
|
|
|
9
9
|
},
|
|
10
10
|
container: {
|
|
11
11
|
flexDirection: "row",
|
|
12
|
+
justifyContent: "space-between",
|
|
12
13
|
},
|
|
13
14
|
descriptionContainer: {
|
|
14
15
|
justifyContent: "space-between",
|
|
15
16
|
marginLeft: spaceS,
|
|
16
17
|
},
|
|
18
|
+
discarded: {
|
|
19
|
+
height: "100%",
|
|
20
|
+
left: 0,
|
|
21
|
+
position: "absolute",
|
|
22
|
+
stroke: colorContent,
|
|
23
|
+
top: 0,
|
|
24
|
+
width: "100%",
|
|
25
|
+
zIndex: 10,
|
|
26
|
+
},
|
|
17
27
|
media: {
|
|
18
28
|
borderColor: colorGrayscaleL,
|
|
19
29
|
borderWidth: borderSize,
|
|
@@ -23,5 +33,17 @@ const style = StyleSheet.create({
|
|
|
23
33
|
priceAndColor: {
|
|
24
34
|
color: colorGrayscaleL,
|
|
25
35
|
},
|
|
36
|
+
row: {
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
},
|
|
39
|
+
sizeChange: {
|
|
40
|
+
backgroundColor: colorInfo,
|
|
41
|
+
marginTop: spaceM,
|
|
42
|
+
paddingHorizontal: spaceS,
|
|
43
|
+
paddingVertical: spaceXS,
|
|
44
|
+
},
|
|
45
|
+
sizeChangeText: {
|
|
46
|
+
textTransform: "uppercase",
|
|
47
|
+
},
|
|
26
48
|
});
|
|
27
49
|
export { style, IMAGE_WIDTH };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
3
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
4
4
|
import { Body } from "../../components/layouts/body/Body";
|
|
5
5
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
@@ -7,12 +7,13 @@ import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
|
|
|
7
7
|
import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsTabs";
|
|
8
8
|
const Summary = ({ customerId }) => {
|
|
9
9
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
10
|
+
const handleOnPressItem = useCallback(() => void 0, []);
|
|
10
11
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
11
12
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus);
|
|
12
13
|
if (!dependenciesLoaded)
|
|
13
14
|
return React.createElement(Spinner, null);
|
|
14
15
|
return (React.createElement(SafeAreaScrollView, null,
|
|
15
16
|
React.createElement(Body, null,
|
|
16
|
-
React.createElement(CheckoutItemsTabs, { checkoutItems: checkout?.items || [] }))));
|
|
17
|
+
React.createElement(CheckoutItemsTabs, { checkoutItems: checkout?.items || [], onPressItem: handleOnPressItem }))));
|
|
17
18
|
};
|
|
18
19
|
export { Summary };
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { FC } from "react";
|
|
|
2
2
|
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
3
3
|
interface CheckoutItemsTabsProps {
|
|
4
4
|
readonly checkoutItems: CheckoutItemProjection[];
|
|
5
|
+
readonly onPressItem: (checkoutItemId: string) => void;
|
|
5
6
|
}
|
|
6
7
|
declare const CheckoutItemsTabs: FC<CheckoutItemsTabsProps>;
|
|
7
8
|
export { CheckoutItemsTabs };
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
1
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
2
|
-
import React, { useMemo } from "react";
|
|
3
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
4
|
import { View } from "react-native";
|
|
4
5
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
6
|
import { Tabs } from "../../../../components/layouts/tabs/Tabs";
|
|
6
7
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
7
8
|
import { ProductVariant } from "../../../item/components/productVariant/ProductVariant";
|
|
8
9
|
import { style } from "./CheckoutItemsTabs.style";
|
|
9
|
-
const CheckoutItem = ({ checkoutItem, testID }) => (React.createElement(View, { style: style.checkoutItem, testID: testID },
|
|
10
|
-
React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, size: checkoutItem.productVariant.size })));
|
|
11
|
-
const CheckoutItemsTabs = ({ checkoutItems }) => {
|
|
10
|
+
const CheckoutItem = ({ checkoutItem, discarded = false, testID, style: customStyle, onPress, }) => (React.createElement(View, { style: style.checkoutItem, testID: testID },
|
|
11
|
+
React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, discarded: discarded, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, size: checkoutItem.productVariant.size, status: checkoutItem.status, style: customStyle, onPress: onPress })));
|
|
12
|
+
const CheckoutItemsTabs = ({ checkoutItems, onPressItem }) => {
|
|
12
13
|
const keepTabText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_TAB });
|
|
13
14
|
const returnTabText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_TAB });
|
|
15
|
+
const keepEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_EMPTY });
|
|
16
|
+
const returnEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_EMPTY });
|
|
14
17
|
const keepCheckoutItems = useMemo(() => checkoutItems.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkoutItems]);
|
|
15
18
|
const returnCheckoutItems = useMemo(() => checkoutItems.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.RETURNED || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkoutItems]);
|
|
19
|
+
const handleOnPressItem = useCallback((checkoutItemId) => onPressItem(checkoutItemId), [onPressItem]);
|
|
16
20
|
return (React.createElement(Tabs, { style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${keepCheckoutItems.length})`, `${returnTabText} (${returnCheckoutItems.length})`] },
|
|
17
|
-
React.createElement(React.Fragment, null, keepCheckoutItems.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, testID: "keep-checkout-item" })))),
|
|
18
|
-
React.createElement(React.Fragment, null, returnCheckoutItems.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, testID: "return-checkout-item" }))))));
|
|
21
|
+
React.createElement(React.Fragment, null, keepCheckoutItems.length === 0 ? (React.createElement(Text, null, keepEmptyText)) : (keepCheckoutItems.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, testID: "keep-checkout-item", onPress: () => handleOnPressItem(checkoutItem.id) }))))),
|
|
22
|
+
React.createElement(React.Fragment, null, returnCheckoutItems.length === 0 ? (React.createElement(Text, null, returnEmptyText)) : (returnCheckoutItems.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) })))))));
|
|
19
23
|
};
|
|
20
24
|
export { CheckoutItemsTabs };
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.style.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { spaceM, spaceXL } = theme();
|
|
3
|
+
const { colorContent, spaceM, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
checkoutItem: {
|
|
6
6
|
paddingVertical: spaceM,
|
|
7
7
|
},
|
|
8
|
+
returnCheckoutItem: {
|
|
9
|
+
borderColor: colorContent,
|
|
10
|
+
},
|
|
8
11
|
sliderContainer: {
|
|
9
12
|
paddingHorizontal: spaceXL,
|
|
10
13
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.49",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@lookiero/messaging-react": "^8.0.0",
|
|
34
34
|
"@react-spring/native": "^9.5.5",
|
|
35
35
|
"react-native-safe-area-context": "^4.4.1",
|
|
36
|
+
"react-native-svg": "^13.5.0",
|
|
36
37
|
"react-router-dom": "^6.4.2",
|
|
37
38
|
"react-router-native": "^6.4.2",
|
|
38
39
|
"tiny-invariant": "^1.2.0",
|