@lookiero/checkout 0.2.22 → 0.2.23

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.
Files changed (24) hide show
  1. package/dist/infrastructure/projection/feedback/feedback.mock.d.ts +3 -0
  2. package/dist/infrastructure/projection/feedback/feedback.mock.js +6 -0
  3. package/dist/infrastructure/ui/components/layouts/body/Body.style.d.ts +1 -5
  4. package/dist/infrastructure/ui/components/layouts/body/Body.style.js +2 -6
  5. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.d.ts +3 -0
  6. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.js +3 -0
  7. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.d.ts +3 -0
  8. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +27 -0
  9. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.style.d.ts +10 -0
  10. package/dist/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.style.js +13 -0
  11. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +2 -0
  12. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +13 -5
  13. package/dist/infrastructure/ui/i18n/i18n.d.ts +5 -2
  14. package/dist/infrastructure/ui/i18n/i18n.js +4 -1
  15. package/dist/infrastructure/ui/views/item/Item.js +9 -6
  16. package/dist/infrastructure/ui/views/item/Item.style.d.ts +6 -1
  17. package/dist/infrastructure/ui/views/item/Item.style.js +7 -2
  18. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.d.ts +10 -0
  19. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +32 -0
  20. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.d.ts +12 -0
  21. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.js +15 -0
  22. package/package.json +1 -1
  23. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.d.ts +0 -10
  24. package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.style.js +0 -11
@@ -0,0 +1,3 @@
1
+ import { FeedbackProjection } from "../../../projection/feedback/feedback";
2
+ declare const feedback: FeedbackProjection;
3
+ export { feedback };
@@ -0,0 +1,6 @@
1
+ const feedback = {
2
+ ["0ad1dba8-b02c-4121-a1e3-981f1c30800d"]: "9251dc2c-d76a-484d-9299-346929af932f",
3
+ ["542c4d24-e1da-484f-8c3a-7d89ee135adc"]: "68c0bb98-b00a-4b86-af43-528fe903cb69",
4
+ ["1123a37d-bc00-43a4-9d28-cee1dfaf356c"]: "Free text comment",
5
+ };
6
+ export { feedback };
@@ -1,14 +1,10 @@
1
1
  declare const style: {
2
- container: {
3
- flex: number;
4
- };
5
2
  row: {
6
3
  flex: number;
7
4
  justifyContent: "center";
8
- paddingVertical: number;
9
5
  };
10
6
  column: {
11
- height: string;
7
+ paddingHorizontal: number;
12
8
  };
13
9
  };
14
10
  export { style };
@@ -1,17 +1,13 @@
1
- import { Platform, StyleSheet } from "react-native";
1
+ import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../../theme/theme";
3
3
  const { spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
- container: {
6
- flex: 1,
7
- },
8
5
  row: {
9
6
  flex: 1,
10
7
  justifyContent: "center",
11
- paddingVertical: Platform.OS === "web" ? spaceXL : 0,
12
8
  },
13
9
  column: {
14
- height: "100%",
10
+ paddingHorizontal: spaceXL,
15
11
  },
16
12
  });
17
13
  export { style };
@@ -0,0 +1,3 @@
1
+ import { ReturnQuestionItem } from "../ReturnQuestionItem";
2
+ declare const HostDefaultReturnQuestionFeedbackItem: ReturnQuestionItem;
3
+ export { HostDefaultReturnQuestionFeedbackItem };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ const HostDefaultReturnQuestionFeedbackItem = ({ children }) => (React.createElement(React.Fragment, null, children));
3
+ export { HostDefaultReturnQuestionFeedbackItem };
@@ -0,0 +1,3 @@
1
+ import { ReturnQuestionItem } from "../ReturnQuestionItem";
2
+ declare const ReturnQuestionFeedbackItem: ReturnQuestionItem;
3
+ export { ReturnQuestionFeedbackItem };
@@ -0,0 +1,27 @@
1
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
2
+ import { useI18nMessage } from "@lookiero/i18n-react";
3
+ import React, { useCallback } from "react";
4
+ import { useIntl } from "react-intl";
5
+ import { View } from "react-native";
6
+ import { I18nMessages, RETURN_QUESTIONS_FEEDBACK_PREFIX, RETURN_QUESTIONS_PREFIX } from "../../../../../i18n/i18n";
7
+ import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeedback";
8
+ import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
9
+ import { style } from "./ReturnQuestionFeedbackItem.style";
10
+ const ReturnQuestionFeedbackItem = ({ returnQuestion }) => {
11
+ const titleText = useI18nMessage({ id: returnQuestion.name, prefix: RETURN_QUESTIONS_FEEDBACK_PREFIX });
12
+ const unansweredText = useI18nMessage({
13
+ id: I18nMessages.FEEDBACK_UNANSWERED,
14
+ prefix: RETURN_QUESTIONS_FEEDBACK_PREFIX,
15
+ });
16
+ const returnQuestionFeedback = useReturnQuestionFeedback();
17
+ const intl = useIntl();
18
+ const translate = useCallback((returnQuestionName) => intl.formatMessage({
19
+ id: `${RETURN_QUESTIONS_PREFIX}${returnQuestionName}`,
20
+ defaultMessage: returnQuestionName,
21
+ }), [intl]);
22
+ const feedback = feedbackForReturnQuestion({ feedback: returnQuestionFeedback, returnQuestion, translate }).join(" / ");
23
+ return (React.createElement(View, { style: style.container },
24
+ React.createElement(Text, { detail: true, level: 2, style: style.title }, titleText),
25
+ React.createElement(Text, { level: 3 }, feedback || unansweredText)));
26
+ };
27
+ export { ReturnQuestionFeedbackItem };
@@ -0,0 +1,10 @@
1
+ declare const style: {
2
+ container: {
3
+ marginBottom: number;
4
+ };
5
+ title: {
6
+ color: string;
7
+ marginBottom: number;
8
+ };
9
+ };
10
+ export { style };
@@ -0,0 +1,13 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../../theme/theme";
3
+ const { colorGrayscaleL, spaceM, spaceXL } = theme();
4
+ const style = StyleSheet.create({
5
+ container: {
6
+ marginBottom: spaceXL,
7
+ },
8
+ title: {
9
+ color: colorGrayscaleL,
10
+ marginBottom: spaceM,
11
+ },
12
+ });
13
+ export { style };
@@ -1,6 +1,8 @@
1
1
  import { FC, ReactNode } from "react";
2
+ import { Edge } from "react-native-safe-area-context";
2
3
  interface SafeAreaScrollViewProps {
3
4
  readonly children: ReactNode;
5
+ readonly edges?: Edge[];
4
6
  }
5
7
  declare const SafeAreaScrollView: FC<SafeAreaScrollViewProps>;
6
8
  export { SafeAreaScrollView };
@@ -1,7 +1,15 @@
1
1
  import React from "react";
2
- import { ScrollView } from "react-native";
3
- import { SafeAreaView } from "react-native-safe-area-context";
4
- import { style } from "./SafeAreaScrollView.style";
5
- const SafeAreaScrollView = ({ children }) => (React.createElement(SafeAreaView, { style: style.container },
6
- React.createElement(ScrollView, { contentContainerStyle: style.scrollContainer, showsVerticalScrollIndicator: false }, children)));
2
+ import { ScrollView, View } from "react-native";
3
+ import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
4
+ import { theme } from "../../theme/theme";
5
+ const { spaceXL } = theme();
6
+ const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"] }) => {
7
+ const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
8
+ return (React.createElement(SafeAreaView, { edges: edges },
9
+ React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
10
+ React.createElement(View, { style: {
11
+ paddingTop: !safeAreaInsetTop ? spaceXL : 0,
12
+ paddingBottom: !safeAreaInsetBottom ? spaceXL : 0,
13
+ } }, children))));
14
+ };
7
15
  export { SafeAreaScrollView };
@@ -1,5 +1,6 @@
1
1
  declare const COLOR_I18N_PREFIX = "color.";
2
2
  declare const RETURN_QUESTIONS_PREFIX = "return_questions.";
3
+ declare const RETURN_QUESTIONS_FEEDBACK_PREFIX = "return_questions_feedback.";
3
4
  declare enum I18nMessages {
4
5
  INTRO_TITLE = "intro.title",
5
6
  INTRO_SUBTITLE = "intro.subtitle",
@@ -27,6 +28,8 @@ declare enum I18nMessages {
27
28
  GET_OUT_OF_CHECKOUT_MODAL_TITLE = "get_out_of_checkout_modal.title",
28
29
  GET_OUT_OF_CHECKOUT_MODAL_DESCRIPTION = "get_out_of_checkout_modal.description",
29
30
  GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON = "get_out_of_checkout_modal.dismiss_button",
30
- GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON = "get_out_of_checkout_modal.confirm_button"
31
+ GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON = "get_out_of_checkout_modal.confirm_button",
32
+ FEEDBACK_TITLE = "feedback.title",
33
+ FEEDBACK_UNANSWERED = "feedback.unanswered"
31
34
  }
32
- export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX };
35
+ export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
@@ -1,5 +1,6 @@
1
1
  const COLOR_I18N_PREFIX = "color.";
2
2
  const RETURN_QUESTIONS_PREFIX = "return_questions.";
3
+ const RETURN_QUESTIONS_FEEDBACK_PREFIX = "return_questions_feedback.";
3
4
  var I18nMessages;
4
5
  (function (I18nMessages) {
5
6
  I18nMessages["INTRO_TITLE"] = "intro.title";
@@ -29,5 +30,7 @@ var I18nMessages;
29
30
  I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_DESCRIPTION"] = "get_out_of_checkout_modal.description";
30
31
  I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON"] = "get_out_of_checkout_modal.dismiss_button";
31
32
  I18nMessages["GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON"] = "get_out_of_checkout_modal.confirm_button";
33
+ I18nMessages["FEEDBACK_TITLE"] = "feedback.title";
34
+ I18nMessages["FEEDBACK_UNANSWERED"] = "feedback.unanswered";
32
35
  })(I18nMessages || (I18nMessages = {}));
33
- export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX };
36
+ export { I18nMessages, COLOR_I18N_PREFIX, RETURN_QUESTIONS_PREFIX, RETURN_QUESTIONS_FEEDBACK_PREFIX };
@@ -4,6 +4,7 @@ import { Text, TouchableHighlight, View } from "react-native";
4
4
  import { useParams } from "react-router-native";
5
5
  import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
6
6
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
7
+ import { feedback as feedbackMock } from "../../../projection/feedback/feedback.mock";
7
8
  import { returnQuestions as returnQuestionsMock } from "../../../projection/returnQuestion/returnQuestions.mock";
8
9
  import { Body } from "../../components/layouts/body/Body";
9
10
  import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
@@ -11,11 +12,8 @@ import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
11
12
  import { style } from "./Item.style";
12
13
  import { ProductVariantDescription } from "./components/productVariantDescription/ProductVariantDescription";
13
14
  import { ProductVariantSlider } from "./components/productVariantSlider/ProductVariantSlider";
15
+ import { ReturnQuestionsFeedback } from "./components/returnQuestionsFeedback/ReturnQuestionsFeedback";
14
16
  import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
15
- // const feedback: FeedbackProjection = {
16
- // ["bb02cedd-09a7-43ed-8e78-ee5b3ad56914"]: "7f336540-4453-4280-9b5f-3bfd4e03ff25",
17
- // };
18
- const feedback = {};
19
17
  const Item = ({ customerId }) => {
20
18
  const { id } = useParams();
21
19
  const [checkout, status] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -23,19 +21,24 @@ const Item = ({ customerId }) => {
23
21
  const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(false);
24
22
  const handleOnShowReturnQuestions = useCallback(() => setReturnQuestionsVisible(true), []);
25
23
  const handleOnHideReturnQuestions = useCallback(() => setReturnQuestionsVisible(false), []);
24
+ const handleOnEditFeedback = useCallback(() => void 0, []);
26
25
  if (status === QueryStatus.LOADING)
27
26
  return React.createElement(Spinner, null);
28
27
  const { price } = checkoutItem;
29
28
  const { media, brand, name, size, color } = checkoutItem.productVariant;
30
29
  const returnQuestions = returnQuestionsMock;
30
+ const feedback = feedbackMock;
31
31
  return (React.createElement(React.Fragment, null,
32
32
  React.createElement(SafeAreaScrollView, null,
33
33
  React.createElement(Body, null,
34
34
  React.createElement(View, { style: style.sliderContainer },
35
35
  React.createElement(ProductVariantSlider, { producVariantMedia: media })),
36
36
  React.createElement(ProductVariantDescription, { brand: brand, name: name, price: price, size: size, color: color }),
37
- React.createElement(TouchableHighlight, { onPress: handleOnShowReturnQuestions },
38
- React.createElement(Text, { style: { padding: 16 } }, "show return questions")))),
37
+ Object.entries(feedback).length !== 0 && (React.createElement(View, { style: style.feedbackContainer },
38
+ React.createElement(ReturnQuestionsFeedback, { feedback: feedback, returnQuestions: returnQuestions, onEditFeedback: handleOnEditFeedback }))),
39
+ React.createElement(View, { style: { flexDirection: "row", justifyContent: "center" } },
40
+ React.createElement(TouchableHighlight, { onPress: handleOnShowReturnQuestions },
41
+ React.createElement(Text, { style: { padding: 16 } }, "show return questions"))))),
39
42
  React.createElement(ReturnQuestionsForm, { feedback: feedback, returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions })));
40
43
  };
41
44
  export { Item };
@@ -1,7 +1,12 @@
1
1
  declare const style: {
2
2
  sliderContainer: {
3
- flex: number;
3
+ minHeight: number;
4
4
  marginBottom: number;
5
5
  };
6
+ feedbackContainer: {
7
+ marginVertical: number;
8
+ borderTopColor: string;
9
+ borderTopWidth: number;
10
+ };
6
11
  };
7
12
  export { style };
@@ -1,10 +1,15 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../theme/theme";
3
- const { spaceXL } = theme();
3
+ const { borderSize, colorGrayscaleM, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
5
  sliderContainer: {
6
- flex: 1,
6
+ minHeight: 500,
7
7
  marginBottom: spaceXL,
8
8
  },
9
+ feedbackContainer: {
10
+ marginVertical: spaceXL,
11
+ borderTopColor: colorGrayscaleM,
12
+ borderTopWidth: borderSize,
13
+ },
9
14
  });
10
15
  export { style };
@@ -0,0 +1,10 @@
1
+ import { FC } from "react";
2
+ import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
3
+ import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
4
+ interface ReturnQuestionsFeedbackProps {
5
+ readonly feedback: FeedbackProjection;
6
+ readonly returnQuestions: ReturnQuestionProjection[];
7
+ readonly onEditFeedback: () => void;
8
+ }
9
+ declare const ReturnQuestionsFeedback: FC<ReturnQuestionsFeedbackProps>;
10
+ export { ReturnQuestionsFeedback };
@@ -0,0 +1,32 @@
1
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
2
+ import { useI18nMessage } from "@lookiero/i18n-react";
3
+ import React from "react";
4
+ import { View } from "react-native";
5
+ import { ReturnQuestionType, } from "../../../../../../projection/returnQuestion/returnQuestion";
6
+ import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
7
+ import { ReturnQuestionFeedbackProvider } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
8
+ import { ReturnQuestionItemProvider, } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
9
+ import { HostDefaultReturnQuestionFeedbackItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem";
10
+ import { ReturnQuestionFeedbackItem } from "../../../../components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem";
11
+ import { I18nMessages, RETURN_QUESTIONS_PREFIX } from "../../../../i18n/i18n";
12
+ import { ButtonIcon } from "../../../../shared/components/molecules/buttonIcon/ButtonIcon";
13
+ import { style } from "./ReturnQuestionsFeedback.style";
14
+ const returnQuestionItems = {
15
+ [ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionFeedbackItem,
16
+ [ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionFeedbackItem,
17
+ [ReturnQuestionType.HOST_SELECT]: ReturnQuestionFeedbackItem,
18
+ [ReturnQuestionType.HOST_STACK]: ReturnQuestionFeedbackItem,
19
+ [ReturnQuestionType.TEXTAREA]: ReturnQuestionFeedbackItem,
20
+ [ReturnQuestionType.OPTION]: ReturnQuestionFeedbackItem,
21
+ };
22
+ const ReturnQuestionsFeedback = ({ feedback, returnQuestions, onEditFeedback }) => {
23
+ const titleText = useI18nMessage({ id: I18nMessages.FEEDBACK_TITLE, prefix: RETURN_QUESTIONS_PREFIX });
24
+ return (React.createElement(View, null,
25
+ React.createElement(View, { style: style.titleContainer },
26
+ React.createElement(Text, { level: 2, style: style.title }, titleText),
27
+ React.createElement(ButtonIcon, { name: "pencil", onPress: onEditFeedback })),
28
+ React.createElement(ReturnQuestionFeedbackProvider, { feedback: feedback },
29
+ React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
30
+ React.createElement(ReturnQuestions, { returnQuestions: returnQuestions })))));
31
+ };
32
+ export { ReturnQuestionsFeedback };
@@ -0,0 +1,12 @@
1
+ declare const style: {
2
+ titleContainer: {
3
+ flexDirection: "row";
4
+ alignItems: "center";
5
+ justifyContent: "space-between";
6
+ };
7
+ title: {
8
+ marginTop: number;
9
+ marginBottom: number;
10
+ };
11
+ };
12
+ export { style };
@@ -0,0 +1,15 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../theme/theme";
3
+ const { spaceL, spaceXL } = theme();
4
+ const style = StyleSheet.create({
5
+ titleContainer: {
6
+ flexDirection: "row",
7
+ alignItems: "center",
8
+ justifyContent: "space-between",
9
+ },
10
+ title: {
11
+ marginTop: spaceXL,
12
+ marginBottom: spaceL,
13
+ },
14
+ });
15
+ export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,10 +0,0 @@
1
- declare const style: {
2
- container: {
3
- flex: number;
4
- };
5
- scrollContainer: {
6
- flex: number;
7
- flexGrow: number;
8
- };
9
- };
10
- export { style };
@@ -1,11 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- const style = StyleSheet.create({
3
- container: {
4
- flex: 1,
5
- },
6
- scrollContainer: {
7
- flex: 1,
8
- flexGrow: 1,
9
- },
10
- });
11
- export { style };