@lookiero/checkout 0.2.7 → 0.2.8

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.
@@ -8,6 +8,13 @@ declare enum I18nMessages {
8
8
  INTRO_BUTTON = "intro.button",
9
9
  ITEM_SIZE = "item.size",
10
10
  ITEM_COLOR = "item.color",
11
- ITEM_UNIQUE = "item.unique"
11
+ ITEM_UNIQUE = "item.unique",
12
+ ITEM_SIZES_LABEL = "item.sizes_label",
13
+ ITEM_KEEP_BUTTON = "item.keep_button",
14
+ ITEM_RETURN_BUTTON = "item.return_button",
15
+ ITEM_BANNER_CUSTOMER_KEPT_DECISSION = "item.banner_customer_kept_decission",
16
+ ITEM_BANNER_CUSTOMER_REPLACED_DECISSION = "item.banner_customer_replaced_decission",
17
+ ITEM_BANNER_CUSTOMER_RETURNED_DECISSION = "item.banner_customer_returned_decission",
18
+ ITEM_BANNER_BUTTON = "item.banner_button"
12
19
  }
13
20
  export { I18nMessages };
@@ -10,5 +10,12 @@ var I18nMessages;
10
10
  I18nMessages["ITEM_SIZE"] = "item.size";
11
11
  I18nMessages["ITEM_COLOR"] = "item.color";
12
12
  I18nMessages["ITEM_UNIQUE"] = "item.unique";
13
+ I18nMessages["ITEM_SIZES_LABEL"] = "item.sizes_label";
14
+ I18nMessages["ITEM_KEEP_BUTTON"] = "item.keep_button";
15
+ I18nMessages["ITEM_RETURN_BUTTON"] = "item.return_button";
16
+ I18nMessages["ITEM_BANNER_CUSTOMER_KEPT_DECISSION"] = "item.banner_customer_kept_decission";
17
+ I18nMessages["ITEM_BANNER_CUSTOMER_REPLACED_DECISSION"] = "item.banner_customer_replaced_decission";
18
+ I18nMessages["ITEM_BANNER_CUSTOMER_RETURNED_DECISSION"] = "item.banner_customer_returned_decission";
19
+ I18nMessages["ITEM_BANNER_BUTTON"] = "item.banner_button";
13
20
  })(I18nMessages || (I18nMessages = {}));
14
21
  export { I18nMessages };
@@ -0,0 +1,9 @@
1
+ import { FC } from "react";
2
+ import { CheckoutItemStatus } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ declare type Status = Exclude<CheckoutItemStatus, CheckoutItemStatus.INITIAL | CheckoutItemStatus.EXPIRED>;
4
+ interface CustomerDecissionBannerProps {
5
+ readonly checkoutItemStatus: Status;
6
+ readonly onPress: () => void;
7
+ }
8
+ declare const CustomerDecissionBanner: FC<CustomerDecissionBannerProps>;
9
+ export { CustomerDecissionBanner };
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { Pressable, View } from "react-native";
3
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
4
+ import { useI18nMessage } from "@lookiero/i18n-react";
5
+ import { I18nMessages } from "../../../../i18n/i18n";
6
+ import { CheckoutItemStatus } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
7
+ import { style } from "./CustomerDecissionBanner.style";
8
+ const i18nMessageForCheckoutItemStatus = {
9
+ [CheckoutItemStatus.KEPT]: I18nMessages.ITEM_BANNER_CUSTOMER_KEPT_DECISSION,
10
+ [CheckoutItemStatus.REPLACED]: I18nMessages.ITEM_BANNER_CUSTOMER_REPLACED_DECISSION,
11
+ [CheckoutItemStatus.RETURNED]: I18nMessages.ITEM_BANNER_CUSTOMER_RETURNED_DECISSION,
12
+ };
13
+ const CustomerDecissionBanner = ({ checkoutItemStatus, onPress }) => {
14
+ const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] });
15
+ const bannerButtonText = useI18nMessage({ id: I18nMessages.ITEM_BANNER_BUTTON });
16
+ return (React.createElement(View, { style: style.container },
17
+ React.createElement(Text, { detail: true, level: 2, style: style.decissionText }, decissionText),
18
+ React.createElement(Pressable, { onPress: onPress },
19
+ React.createElement(Text, { detail: true, level: 2, style: style.buttonText }, bannerButtonText))));
20
+ };
21
+ export { CustomerDecissionBanner };
@@ -0,0 +1,17 @@
1
+ declare const style: {
2
+ container: {
3
+ alignItems: "center";
4
+ backgroundColor: string;
5
+ paddingTop: number;
6
+ paddingHorizontal: number;
7
+ paddingBottom: number;
8
+ };
9
+ decissionText: {
10
+ textAlign: "center";
11
+ marginBottom: number;
12
+ };
13
+ buttonText: {
14
+ textDecorationLine: "underline";
15
+ };
16
+ };
17
+ export { style };
@@ -0,0 +1,20 @@
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
+ paddingTop: spaceM,
9
+ paddingHorizontal: spaceL,
10
+ paddingBottom: spaceL,
11
+ },
12
+ decissionText: {
13
+ textAlign: "center",
14
+ marginBottom: spaceM,
15
+ },
16
+ buttonText: {
17
+ textDecorationLine: "underline",
18
+ },
19
+ });
20
+ export { style };
@@ -0,0 +1,11 @@
1
+ import { SizeProjection } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { FC } from "react";
3
+ interface ProductVariantActionsProps {
4
+ readonly sizes: SizeProjection[];
5
+ readonly size: SizeProjection;
6
+ readonly onKeep: (value: string) => void;
7
+ readonly onReturn: () => void;
8
+ readonly onReplace: () => void;
9
+ }
10
+ declare const ProductVariantActions: FC<ProductVariantActionsProps>;
11
+ export { ProductVariantActions };
@@ -0,0 +1,23 @@
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 { InputField } from "@lookiero/aurora-next/build/components/atoms/InputField/InputField";
4
+ import { I18nMessages } from "../../../../i18n/i18n";
5
+ import { useI18nMessage } from "@lookiero/i18n-react";
6
+ import { View } from "react-native";
7
+ import React, { useMemo } from "react";
8
+ import { style } from "./ProductVariantActions.style";
9
+ const ProductVariantActions = ({ sizes, size, onKeep, onReplace, onReturn }) => {
10
+ const sizeSelectorLabelText = useI18nMessage({ id: I18nMessages.ITEM_SIZES_LABEL });
11
+ const keepButtonText = useI18nMessage({ id: I18nMessages.ITEM_KEEP_BUTTON });
12
+ const returnButtonText = useI18nMessage({ id: I18nMessages.ITEM_RETURN_BUTTON });
13
+ const sizeSelectorOptions = useMemo(() => sizes.map((size) => ({ name: size.lookiero, value: size.id })), [sizes]);
14
+ const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === size.id, [sizeSelectorOptions, size.id]);
15
+ return (React.createElement(View, { style: style.container },
16
+ React.createElement(Button, { onPress: onKeep }, keepButtonText),
17
+ React.createElement(View, { style: style.row },
18
+ !size.unique && (React.createElement(View, { style: style.dropdownContainer },
19
+ React.createElement(InputField, { label: sizeSelectorLabelText, value: size.id, name: "size-selector", icon: "arrow-down", onChange: onReplace, options: sizeSelectorOptions, disabled: disabledSizeSelector, testID: "size-selector" }))),
20
+ React.createElement(View, { style: style.returnButtonContainer },
21
+ React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn }, returnButtonText)))));
22
+ };
23
+ export { ProductVariantActions };
@@ -0,0 +1,19 @@
1
+ declare const style: {
2
+ container: {
3
+ width: string;
4
+ };
5
+ row: {
6
+ alignItems: "center";
7
+ flexDirection: "row";
8
+ marginTop: number;
9
+ };
10
+ dropdownContainer: {
11
+ flex: number;
12
+ zIndex: number;
13
+ marginRight: number;
14
+ };
15
+ returnButtonContainer: {
16
+ flex: number;
17
+ };
18
+ };
19
+ export { style };
@@ -0,0 +1,22 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../theme/theme";
3
+ const { spaceL } = theme();
4
+ const style = StyleSheet.create({
5
+ container: {
6
+ width: "100%",
7
+ },
8
+ row: {
9
+ alignItems: "center",
10
+ flexDirection: "row",
11
+ marginTop: spaceL,
12
+ },
13
+ dropdownContainer: {
14
+ flex: 1,
15
+ zIndex: 4,
16
+ marginRight: spaceL,
17
+ },
18
+ returnButtonContainer: {
19
+ flex: 1,
20
+ },
21
+ });
22
+ export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -14,6 +14,7 @@
14
14
  "android": "expo start --android",
15
15
  "ios": "expo start --ios",
16
16
  "web": "expo start --web",
17
+ "export-analyze-web": "expo export:web",
17
18
  "build": "tsc -b tsconfig.build.json",
18
19
  "lint": "eslint --fix --cache --cache-location ./node_modules/.cache/.eslintcache --ext ts,tsx .",
19
20
  "format": "prettier --write \"**/*.+(json|css|ts|tsx|md)\"",
@@ -73,6 +74,7 @@
73
74
  "react-native": "^0.69.4",
74
75
  "react-native-web": "^0.18.7",
75
76
  "react-test-renderer": "^18.0.0",
76
- "typescript": "^4.6.3"
77
+ "typescript": "^4.6.3",
78
+ "webpack-bundle-analyzer": "^4.6.1"
77
79
  }
78
80
  }