@lookiero/checkout 0.2.14 → 0.2.15

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/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { EndpointFunction } from "@lookiero/i18n";
2
2
  import { FC } from "react";
3
- import "react-native-get-random-values";
4
3
  import { RootProps } from "./infrastructure/ui/Root";
5
4
  import { IsCheckoutAccessibleByCustomerIdProjection } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
6
5
  interface IsCheckoutAccessibleFunctionArgs {
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { fetchFetchTranslation } from "@lookiero/i18n";
2
2
  import { i18n } from "@lookiero/i18n-react";
3
- import "react-native-get-random-values";
4
3
  import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
5
4
  import { root } from "./infrastructure/ui/Root";
6
5
  import { viewIsCheckoutAccessibleByCustomerId, } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
@@ -1,4 +1,5 @@
1
1
  import { CommandStatus } from "@lookiero/messaging-react";
2
+ import "react-native-get-random-values";
2
3
  interface BookFunction {
3
4
  (): Promise<void>;
4
5
  }
@@ -1,5 +1,6 @@
1
1
  import { useCommand } from "@lookiero/messaging-react";
2
2
  import { useCallback } from "react";
3
+ import "react-native-get-random-values";
3
4
  import { v4 as uuid } from "uuid";
4
5
  import { bookSizeReplaceableProductVariantsForCheckoutItem } from "../../../../domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem";
5
6
  const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
@@ -1,4 +1,5 @@
1
1
  import { CommandStatus } from "@lookiero/messaging-react";
2
+ import "react-native-get-random-values";
2
3
  interface UpdateFunctionArgs {
3
4
  readonly key: string;
4
5
  readonly value: unknown;
@@ -1,5 +1,6 @@
1
1
  import { useCommand } from "@lookiero/messaging-react";
2
2
  import { useCallback } from "react";
3
+ import "react-native-get-random-values";
3
4
  import { v4 as uuid } from "uuid";
4
5
  import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
5
6
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
@@ -1,3 +1,4 @@
1
+ import "react-native-get-random-values";
1
2
  import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
2
3
  import { CheckoutProjection } from "../../../projection/checkout/checkout";
3
4
  import { CheckoutDto } from "./checkout";
@@ -1,3 +1,4 @@
1
+ import "react-native-get-random-values";
1
2
  import { v4 as uuid } from "uuid";
2
3
  import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
3
4
  import { checkoutItemDto } from "../checkoutItem/checkoutItem.mock";
@@ -1,3 +1,4 @@
1
+ import "react-native-get-random-values";
1
2
  import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
2
3
  import { CheckoutItemProjection } from "../../../projection/checkoutItem/checkoutItem";
3
4
  import { CheckoutItemDto } from "./checkoutItem";
@@ -1,3 +1,4 @@
1
+ import "react-native-get-random-values";
1
2
  import { v4 as uuid } from "uuid";
2
3
  import { Currency, MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
3
4
  import { toCheckoutItemProjection } from "./checkoutItem";
@@ -9,8 +10,13 @@ const checkoutItemDto = ({ status }) => ({
9
10
  media: [
10
11
  {
11
12
  id: uuid(),
12
- url: "https://cdn-catalog-back-prod.envs.lookiero.tech/d2/65/d2655b80-7745-4537-bb17-eb38f960a8de.jpg",
13
- perspective: MediaPerspective.FRONT,
13
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
14
+ perspective: MediaPerspective.MAIN,
15
+ },
16
+ {
17
+ id: uuid(),
18
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
19
+ perspective: MediaPerspective.DETAIL,
14
20
  },
15
21
  ],
16
22
  brand: "CKS",
@@ -1,9 +1,10 @@
1
1
  import { Box } from "@lookiero/aurora-next/build/components/atoms/Box/Box";
2
2
  import { Layout } from "@lookiero/aurora-next/build/components/atoms/Layout/Layout";
3
3
  import React from "react";
4
- import { SafeAreaView } from "react-native";
5
4
  import { style } from "./Body.style";
6
- const Body = ({ children }) => (React.createElement(SafeAreaView, { style: style.container },
7
- React.createElement(Layout, { style: style.layout },
8
- React.createElement(Box, { size: { M: "2/3", L: "1/3" }, style: style.box }, children))));
5
+ const Body = ({ children }) => (
6
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7
+ // @ts-ignore
8
+ React.createElement(Layout, { style: style.layout },
9
+ React.createElement(Box, { size: { M: "2/3", L: "1/3" }, style: style.box }, children)));
9
10
  export { Body };
@@ -5,7 +5,7 @@ declare const style: {
5
5
  layout: {
6
6
  flex: number;
7
7
  justifyContent: "center";
8
- padding: number;
8
+ paddingVertical: number;
9
9
  };
10
10
  box: {
11
11
  height: string;
@@ -1,4 +1,4 @@
1
- import { StyleSheet } from "react-native";
1
+ import { Platform, StyleSheet } from "react-native";
2
2
  import { theme } from "../../../theme/theme";
3
3
  const { spaceXL } = theme();
4
4
  const style = StyleSheet.create({
@@ -8,7 +8,7 @@ const style = StyleSheet.create({
8
8
  layout: {
9
9
  flex: 1,
10
10
  justifyContent: "center",
11
- padding: spaceXL,
11
+ paddingVertical: Platform.OS === "web" ? spaceXL : 0,
12
12
  },
13
13
  box: {
14
14
  height: "100%",
@@ -4,7 +4,7 @@ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Tex
4
4
  import { useI18nMessage } from "@lookiero/i18n-react";
5
5
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
6
6
  import React, { useCallback } from "react";
7
- import { View } from "react-native";
7
+ import { SafeAreaView, View } from "react-native";
8
8
  import { useSetCheckoutIntroShown } from "../../../domain/uiSetting/react/useSetCheckoutIntroShown";
9
9
  import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
10
10
  import { Spinner } from "../../components/atoms/spinner/Spinner";
@@ -29,22 +29,23 @@ const Intro = ({ customerId }) => {
29
29
  const handleOnPress = useCallback(() => setCheckoutIntroShown(), [setCheckoutIntroShown]);
30
30
  if (fiveItemsDiscountState === QueryStatus.LOADING)
31
31
  return React.createElement(Spinner, null);
32
- return (React.createElement(Body, null,
33
- React.createElement(View, { style: style.container },
34
- React.createElement(View, { style: style.content },
35
- React.createElement(Text, { heading: true, level: 3, style: style.title }, titleText),
36
- React.createElement(Text, { body: true, level: 3 }, subTitleText),
37
- React.createElement(View, { style: style.discountContainer },
38
- React.createElement(View, { style: style.discount },
39
- React.createElement(Text, { heading: true, level: 2 },
40
- "- ",
41
- fiveItemsDiscount),
42
- React.createElement(Text, { heading: true, level: 3, style: style.percentage }, "%")),
43
- React.createElement(Text, { body: true, level: 3 }, discountText)),
44
- React.createElement(View, { style: style.description },
45
- React.createElement(Bullet, { text: bulletOneText }),
46
- React.createElement(Bullet, { text: bulletTwoText }),
47
- React.createElement(Bullet, { text: bulletThreeText }))),
48
- React.createElement(Button, { disabled: setCheckoutIntroShownStatus === CommandStatus.LOADING, onPress: handleOnPress }, buttonText))));
32
+ return (React.createElement(SafeAreaView, { style: style.safeAreaContainer },
33
+ React.createElement(Body, null,
34
+ React.createElement(View, { style: style.container },
35
+ React.createElement(View, { style: style.content },
36
+ React.createElement(Text, { heading: true, level: 3, style: style.title }, titleText),
37
+ React.createElement(Text, { body: true, level: 3, style: style.subtitle }, subTitleText),
38
+ React.createElement(View, { style: style.discountContainer },
39
+ React.createElement(View, { style: style.discount },
40
+ React.createElement(Text, { heading: true, level: 2 },
41
+ "- ",
42
+ fiveItemsDiscount),
43
+ React.createElement(Text, { heading: true, level: 3, style: style.percentage }, "%")),
44
+ React.createElement(Text, { body: true, level: 3 }, discountText)),
45
+ React.createElement(View, { style: style.description },
46
+ React.createElement(Bullet, { text: bulletOneText }),
47
+ React.createElement(Bullet, { text: bulletTwoText }),
48
+ React.createElement(Bullet, { text: bulletThreeText }))),
49
+ React.createElement(Button, { disabled: setCheckoutIntroShownStatus === CommandStatus.LOADING, onPress: handleOnPress }, buttonText)))));
49
50
  };
50
51
  export { Intro };
@@ -1,14 +1,20 @@
1
1
  declare const style: {
2
+ safeAreaContainer: {
3
+ flex: number;
4
+ };
2
5
  container: {
3
6
  flex: number;
4
7
  justifyContent: "space-between";
5
8
  };
6
9
  content: {
7
10
  alignItems: "center";
8
- textAlign: "center";
9
11
  };
10
12
  title: {
11
13
  marginBottom: number;
14
+ textAlign: "center";
15
+ };
16
+ subtitle: {
17
+ textAlign: "center";
12
18
  };
13
19
  discountContainer: {
14
20
  alignItems: "center";
@@ -34,6 +40,7 @@ declare const style: {
34
40
  width: string;
35
41
  };
36
42
  bullet: {
43
+ alignItems: "center";
37
44
  flexDirection: "row";
38
45
  marginVertical: number;
39
46
  };
@@ -2,16 +2,22 @@ import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../theme/theme";
3
3
  const { borderSize, colorAccent, spaceXS, spaceS, spaceM, spaceL, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
+ safeAreaContainer: {
6
+ flex: 1,
7
+ },
5
8
  container: {
6
9
  flex: 1,
7
10
  justifyContent: "space-between",
8
11
  },
9
12
  content: {
10
13
  alignItems: "center",
11
- textAlign: "center",
12
14
  },
13
15
  title: {
14
16
  marginBottom: spaceM,
17
+ textAlign: "center",
18
+ },
19
+ subtitle: {
20
+ textAlign: "center",
15
21
  },
16
22
  discountContainer: {
17
23
  alignItems: "center",
@@ -37,6 +43,7 @@ const style = StyleSheet.create({
37
43
  width: "100%",
38
44
  },
39
45
  bullet: {
46
+ alignItems: "center",
40
47
  flexDirection: "row",
41
48
  marginVertical: spaceS,
42
49
  },
@@ -1,4 +1,5 @@
1
1
  import { FC } from "react";
2
+ import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
3
  interface ItemProps {
3
4
  readonly customerId: string;
4
5
  }
@@ -1,22 +1,22 @@
1
- import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
2
1
  import React from "react";
3
- import { StyleSheet, View } from "react-native";
2
+ import { SafeAreaView, ScrollView, View } from "react-native";
4
3
  import { useParams } from "react-router-native";
4
+ import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
5
5
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
6
+ import { Body } from "../../components/layouts/body/Body";
7
+ import { style } from "./Item.style";
8
+ import { ProductVariantDescription } from "./components/productVariantDescription/ProductVariantDescription";
9
+ import { ProductVariantSlider } from "./components/productVariantSlider/ProductVariantSlider";
6
10
  const Item = ({ customerId }) => {
7
11
  const { id } = useParams();
8
12
  const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
9
- console.log(checkout);
10
- return (React.createElement(View, { style: styles.container },
11
- React.createElement(Text, { heading: true, level: 3 }, "Item"),
12
- React.createElement(Text, { level: 2 }, id)));
13
+ const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
14
+ const { media, brand, name, price, size, color } = checkoutItem?.productVariant;
15
+ return (React.createElement(SafeAreaView, { style: style.container },
16
+ React.createElement(ScrollView, { contentContainerStyle: style.scrollContainer, showsVerticalScrollIndicator: false },
17
+ React.createElement(Body, null,
18
+ React.createElement(View, { style: style.sliderContainer },
19
+ React.createElement(ProductVariantSlider, { producVariantMedia: media })),
20
+ React.createElement(ProductVariantDescription, { brand: brand, name: name, price: price, size: size, color: color })))));
13
21
  };
14
- const styles = StyleSheet.create({
15
- container: {
16
- flex: 1,
17
- backgroundColor: "#fff",
18
- alignItems: "center",
19
- justifyContent: "center",
20
- },
21
- });
22
22
  export { Item };
@@ -0,0 +1,14 @@
1
+ declare const style: {
2
+ container: {
3
+ flex: number;
4
+ };
5
+ scrollContainer: {
6
+ flex: number;
7
+ flexGrow: number;
8
+ };
9
+ sliderContainer: {
10
+ flex: number;
11
+ marginBottom: number;
12
+ };
13
+ };
14
+ export { style };
@@ -0,0 +1,17 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../theme/theme";
3
+ const { spaceXL } = theme();
4
+ const style = StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ },
8
+ scrollContainer: {
9
+ flex: 1,
10
+ flexGrow: 1,
11
+ },
12
+ sliderContainer: {
13
+ flex: 1,
14
+ marginBottom: spaceXL,
15
+ },
16
+ });
17
+ export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -28,7 +28,7 @@
28
28
  "@lookiero/messaging": "^8.0.0",
29
29
  "@lookiero/messaging-react": "^8.0.0",
30
30
  "react-native-get-random-values": "^1.8.0",
31
- "react-router-dom": "^6.3.0",
31
+ "react-router-dom": "^6.4.1",
32
32
  "react-router-native": "^6.3.0",
33
33
  "tiny-invariant": "^1.2.0",
34
34
  "uuid": "^9.0.0"
@@ -46,7 +46,7 @@
46
46
  "@lookiero/aurora-fonts": "^1.0.6",
47
47
  "@lookiero/aurora-iconfont": "^2.0.37",
48
48
  "@lookiero/aurora-next": "^3.0.181",
49
- "@testing-library/react": "^13.3.0",
49
+ "@testing-library/react": "^13.4.0",
50
50
  "@testing-library/react-hooks": "^8.0.1",
51
51
  "@testing-library/react-native": "^11.0.0",
52
52
  "@trivago/prettier-plugin-sort-imports": "^3.3.0",