@lookiero/checkout 8.17.1-beta.1 → 8.19.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.
Files changed (124) hide show
  1. package/cypress/support/interceptListReturnQuestionsByCheckoutItemId.ts +1 -1
  2. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.js +1 -1
  3. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -1
  4. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.js +2 -1
  5. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.d.ts +3 -3
  6. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +4 -3
  7. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.d.ts +2 -1
  8. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.js +1 -0
  9. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.d.ts +2 -1
  10. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +8 -6
  11. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +2 -1
  12. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -1
  13. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.d.ts +2 -1
  14. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -1
  15. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.d.ts +2 -1
  16. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +1 -0
  17. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.d.ts +2 -1
  18. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +5 -3
  19. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +4 -2
  20. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.d.ts +2 -1
  21. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -1
  22. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.d.ts +2 -1
  23. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +2 -1
  24. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.d.ts +2 -1
  25. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -1
  26. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.d.ts +2 -1
  27. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -1
  28. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +18 -9
  29. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -1
  30. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +1 -1
  31. package/dist/src/projection/returnQuestion/returnQuestion.d.ts +23 -16
  32. package/dist/src/projection/returnQuestion/returnQuestion.js +1 -11
  33. package/dist/src/version.d.ts +1 -1
  34. package/dist/src/version.js +1 -1
  35. package/package.json +4 -4
  36. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.ts +1 -1
  37. package/src/infrastructure/projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId.test.ts +4 -9
  38. package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +72 -117
  39. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.test.tsx +10 -12
  40. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +10 -8
  41. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.test.tsx +10 -9
  42. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.ts +2 -1
  43. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.test.tsx +7 -9
  44. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.tsx +3 -3
  45. package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +4 -3
  46. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.test.tsx +7 -13
  47. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.tsx +4 -2
  48. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +8 -14
  49. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +13 -7
  50. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -5
  51. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.test.tsx +10 -14
  52. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +7 -5
  53. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +5 -3
  54. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.test.tsx +43 -36
  55. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +10 -7
  56. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +11 -9
  57. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.test.tsx +8 -14
  58. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +6 -4
  59. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +6 -4
  60. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.test.tsx +23 -25
  61. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +5 -3
  62. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +9 -29
  63. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +7 -5
  64. package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +5 -4
  65. package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +32 -18
  66. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +87 -66
  67. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -4
  68. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +261 -198
  69. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +1 -1
  70. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +87 -66
  71. package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.test.ts +4 -12
  72. package/src/projection/returnQuestion/returnQuestion.constants.ts +10 -0
  73. package/src/projection/returnQuestion/returnQuestion.metadata.ts +17 -0
  74. package/src/projection/returnQuestion/returnQuestion.ts +42 -20
  75. package/src/projection/returnQuestion/returnQuestion.typeguard.ts +24 -0
  76. package/dist/pact.config.d.ts +0 -13
  77. package/dist/pact.config.js +0 -9
  78. package/dist/public/public/assets/adaptive-icon.png +0 -0
  79. package/dist/public/public/assets/favicon.png +0 -0
  80. package/dist/public/public/assets/icon.png +0 -0
  81. package/dist/public/public/assets/splash.png +0 -0
  82. package/dist/public/public/images/not-found.png +0 -0
  83. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -3
  84. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +0 -27
  85. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
  86. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -48
  87. package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +0 -19
  88. package/dist/src/infrastructure/projection/checkout/checkout.mock.js +0 -21
  89. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
  90. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -109
  91. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
  92. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -49
  93. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
  94. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -44
  95. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
  96. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -44
  97. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
  98. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -44
  99. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -3
  100. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +0 -6
  101. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
  102. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -49
  103. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +0 -15
  104. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +0 -43
  105. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
  106. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -50
  107. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
  108. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
  109. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
  110. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -48
  111. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
  112. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -109
  113. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +0 -6
  114. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +0 -183
  115. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
  116. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -48
  117. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +0 -9
  118. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +0 -42
  119. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
  120. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -48
  121. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -3
  122. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +0 -400
  123. package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
  124. package/dist/src/infrastructure/ui/views/App.style.js +0 -7
@@ -1,8 +1,6 @@
1
1
  import React from "react";
2
- import {
3
- ReturnQuestionProjection,
4
- ReturnQuestionType,
5
- } from "../../../../../../../projection/returnQuestion/returnQuestion";
2
+ import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
3
+ import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
6
4
  import { feedback as mockFeedback } from "../../../../../../projection/feedback/feedback.mock";
7
5
  import { I18nMessages } from "../../../../../i18n/i18n";
8
6
  import { render } from "../../../../../test/render";
@@ -12,40 +10,34 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
12
10
  useReturnQuestionFeedback: () => mockFeedback,
13
11
  }));
14
12
 
15
- const returnQuestion: ReturnQuestionProjection = {
13
+ const returnQuestion: ReturnQuestionProjection<ReturnQuestionType.HOST_DEFAULT> = {
16
14
  id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
17
- name: "size_title",
18
- placeholder: "",
19
- type: ReturnQuestionType.HOST_STACK,
15
+ translationKey: "size_title",
16
+ type: ReturnQuestionType.HOST_DEFAULT,
20
17
  children: [
21
18
  {
22
19
  id: "9251dc2c-d76a-484d-9299-346929af932f",
23
- name: "size_large",
24
- placeholder: "",
20
+ translationKey: "size_large",
25
21
  type: ReturnQuestionType.OPTION,
26
22
  children: [
27
23
  {
28
24
  id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
29
- name: "",
30
- placeholder: "",
31
- type: ReturnQuestionType.HOST_STACK,
25
+ translationKey: "",
26
+ type: ReturnQuestionType.HOST_DEFAULT,
32
27
  children: [
33
28
  {
34
29
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
35
- name: "size_overall",
36
- placeholder: "",
30
+ translationKey: "size_overall",
37
31
  type: ReturnQuestionType.OPTION,
38
32
  },
39
33
  {
40
34
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
41
- name: "size_trousers_too_long",
42
- placeholder: "",
35
+ translationKey: "size_trousers_too_long",
43
36
  type: ReturnQuestionType.OPTION,
44
37
  },
45
38
  {
46
39
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
47
- name: "size_fit_cut_does_not_fit",
48
- placeholder: "",
40
+ translationKey: "size_fit_cut_does_not_fit",
49
41
  type: ReturnQuestionType.OPTION,
50
42
  },
51
43
  ],
@@ -54,11 +46,17 @@ const returnQuestion: ReturnQuestionProjection = {
54
46
  },
55
47
  ],
56
48
  };
57
- const returnQuestionUnanswered: ReturnQuestionProjection = {
49
+ const returnQuestionUnanswered: ReturnQuestionProjection<ReturnQuestionType.HOST_DEFAULT> = {
58
50
  id: "fd7ff4a0-78ed-4c0d-aa4d-64962739c322",
59
- name: "style_title",
60
- placeholder: "",
61
- type: ReturnQuestionType.HOST_STACK,
51
+ translationKey: "style_title",
52
+ type: ReturnQuestionType.HOST_DEFAULT,
53
+ children: [
54
+ {
55
+ id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
56
+ translationKey: "size_overall",
57
+ type: ReturnQuestionType.OPTION,
58
+ },
59
+ ],
62
60
  };
63
61
 
64
62
  describe("ReturnQuestionFeedbackItem component (ReturnQuestions organism)", () => {
@@ -70,7 +68,7 @@ describe("ReturnQuestionFeedbackItem component (ReturnQuestions organism)", () =
70
68
  />,
71
69
  );
72
70
 
73
- expect(getByText(returnQuestion.name)).toBeTruthy();
71
+ expect(getByText(returnQuestion.translationKey)).toBeTruthy();
74
72
  expect(getByText("size_large / size_overall")).toBeTruthy();
75
73
  });
76
74
 
@@ -82,7 +80,7 @@ describe("ReturnQuestionFeedbackItem component (ReturnQuestions organism)", () =
82
80
  />,
83
81
  );
84
82
 
85
- expect(getByText(returnQuestionUnanswered.name)).toBeTruthy();
83
+ expect(getByText(returnQuestionUnanswered.translationKey)).toBeTruthy();
86
84
  expect(getByText(I18nMessages.FEEDBACK_UNANSWERED)).toBeTruthy();
87
85
  });
88
86
  });
@@ -1,15 +1,17 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import React, { useCallback } from "react";
2
3
  import { View } from "react-native";
3
4
  import { Text } from "@lookiero/aurora";
4
5
  import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
6
+ import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
5
7
  import { I18nMessages } from "../../../../../i18n/i18n";
6
8
  import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeedback";
7
9
  import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
8
- import { ReturnQuestionItem, ReturnQuestionItemProps } from "../ReturnQuestionItem";
10
+ import { ReturnQuestionItem } from "../ReturnQuestionItem";
9
11
  import { style } from "./ReturnQuestionFeedbackItem.style";
10
12
 
11
- const ReturnQuestionFeedbackItem: ReturnQuestionItem = ({ returnQuestion }: ReturnQuestionItemProps) => {
12
- const titleText = useI18nMessage({ id: returnQuestion.name });
13
+ const ReturnQuestionFeedbackItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = ({ returnQuestion }) => {
14
+ const titleText = useI18nMessage({ id: returnQuestion.translationKey });
13
15
  const unansweredText = useI18nMessage({ id: I18nMessages.FEEDBACK_UNANSWERED });
14
16
 
15
17
  const returnQuestionFeedback = useReturnQuestionFeedback();
@@ -1,9 +1,7 @@
1
1
  import { fireEvent } from "@testing-library/react-native";
2
2
  import React from "react";
3
- import {
4
- ReturnQuestionProjection,
5
- ReturnQuestionType,
6
- } from "../../../../../../../projection/returnQuestion/returnQuestion";
3
+ import { ReturnQuestionProjection } from "../../../../../../../projection/returnQuestion/returnQuestion";
4
+ import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
7
5
  import { render } from "../../../../../test/render";
8
6
  import { TextareaReturnQuestionItem } from "./TextareaReturnQuestionItem";
9
7
 
@@ -15,31 +13,13 @@ jest.mock("../../behaviors/useReturnQuestionFeedback", () => ({
15
13
  const returnQuestionParent = {
16
14
  id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
17
15
  } as ReturnQuestionProjection;
18
- const returnQuestion: ReturnQuestionProjection = {
19
- id: "9251dc2c-d76a-484d-9299-346929af932f",
20
- name: "size_large",
21
- placeholder: "",
22
- type: ReturnQuestionType.OPTION,
23
- children: [
24
- {
25
- id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
26
- name: "size_overall",
27
- placeholder: "",
28
- type: ReturnQuestionType.OPTION,
29
- },
30
- {
31
- id: "85e84a77-461c-41e6-8544-95b5294d0b80",
32
- name: "size_trousers_too_long",
33
- placeholder: "",
34
- type: ReturnQuestionType.OPTION,
35
- },
36
- {
37
- id: "29441d25-8d9f-471e-a13e-a03f61c88091",
38
- name: "size_fit_cut_does_not_fit",
39
- placeholder: "",
40
- type: ReturnQuestionType.OPTION,
41
- },
42
- ],
16
+ const returnQuestion: ReturnQuestionProjection<ReturnQuestionType.TEXTAREA> = {
17
+ id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
18
+ translationKey: "comment_textarea",
19
+ type: ReturnQuestionType.TEXTAREA,
20
+ metadata: {
21
+ placeholder: "comment_textarea_placeholder",
22
+ },
43
23
  };
44
24
 
45
25
  describe("TextareaReturnQuestionItem component (ReturnQuestions organism)", () => {
@@ -1,21 +1,23 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import React, { useCallback, useMemo } from "react";
2
3
  import { View } from "@lookiero/aurora";
3
4
  import { useIntl } from "@lookiero/i18n-react";
5
+ import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
4
6
  import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
5
7
  import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
6
- import { ReturnQuestionItem, ReturnQuestionItemProps } from "../ReturnQuestionItem";
8
+ import { ReturnQuestionItem } from "../ReturnQuestionItem";
7
9
  import { style } from "./TextareaReturnQuestionItem.style";
8
10
 
9
- const TextareaReturnQuestionItem: ReturnQuestionItem = ({
11
+ const TextareaReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.TEXTAREA> = ({
10
12
  returnQuestion,
11
13
  returnQuestionParent,
12
14
  testID,
13
- }: ReturnQuestionItemProps) => {
15
+ }) => {
14
16
  const { formatMessage } = useIntl();
15
17
 
16
18
  const placeholderText = useMemo(
17
- () => (returnQuestion.placeholder ? formatMessage({ id: returnQuestion.placeholder }) : ""),
18
- [formatMessage, returnQuestion.placeholder],
19
+ () => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
20
+ [formatMessage, returnQuestion.metadata.placeholder],
19
21
  );
20
22
 
21
23
  const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
@@ -13,14 +13,15 @@ exports[`returnQuestionFeedback utils return the deepest returnQuestion with fee
13
13
  "children": [
14
14
  {
15
15
  "id": "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
16
- "name": "comment_textarea",
17
- "placeholder": "comment_textarea_placeholder",
16
+ "metadata": {
17
+ "placeholder": "comment_textarea_placeholder",
18
+ },
19
+ "translationKey": "comment_textarea",
18
20
  "type": "TEXTAREA",
19
21
  },
20
22
  ],
21
23
  "id": "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
22
- "name": "comment_title",
23
- "placeholder": "",
24
+ "translationKey": "comment_title",
24
25
  "type": "HOST_TEXTAREA",
25
26
  },
26
27
  false,
@@ -1,6 +1,10 @@
1
1
  import { isUuid } from "@lookiero/sty-psp-uuid";
2
2
  import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
3
3
  import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
4
+ import {
5
+ returnQuestionHasChildren,
6
+ returnQuestionWithTranslationKey,
7
+ } from "../../../../../../projection/returnQuestion/returnQuestion.typeguard";
4
8
 
5
9
  interface RecursiveFeedbackForReturnQuestionFunctionArgs {
6
10
  readonly feedback: FeedbackProjection;
@@ -25,14 +29,16 @@ const feedbackForReturnQuestion: RecursiveFeedbackForReturnQuestionFunction = ({
25
29
  const returnQuestionFeedback = feedback[returnQuestionId];
26
30
 
27
31
  if (isUuid(returnQuestionFeedback as string)) {
28
- const feebackReturnQuestionChild = returnQuestion.children?.find(
29
- (childReturnQuestion) => childReturnQuestion.id === returnQuestionFeedback,
30
- );
32
+ const feebackReturnQuestionChild =
33
+ returnQuestionHasChildren(returnQuestion) &&
34
+ returnQuestion.children?.find((childReturnQuestion) => childReturnQuestion.id === returnQuestionFeedback);
31
35
 
32
36
  if (feebackReturnQuestionChild) {
33
37
  return [
34
38
  ...acc,
35
- translate(feebackReturnQuestionChild?.name),
39
+ ...(returnQuestionWithTranslationKey(feebackReturnQuestionChild)
40
+ ? [translate(feebackReturnQuestionChild.translationKey)]
41
+ : []),
36
42
  ...feedbackForReturnQuestion({ feedback, returnQuestion: feebackReturnQuestionChild, translate, acc }),
37
43
  ];
38
44
  }
@@ -44,13 +50,15 @@ const feedbackForReturnQuestion: RecursiveFeedbackForReturnQuestionFunction = ({
44
50
  }
45
51
 
46
52
  return (
47
- returnQuestion.children?.reduce(
48
- (acc, childReturnQuestion) => [
49
- ...acc,
50
- ...feedbackForReturnQuestion({ feedback, returnQuestion: childReturnQuestion, translate, acc }),
51
- ],
52
- [] as string[],
53
- ) || []
53
+ (returnQuestionHasChildren(returnQuestion) &&
54
+ returnQuestion.children?.reduce(
55
+ (acc, childReturnQuestion) => [
56
+ ...acc,
57
+ ...feedbackForReturnQuestion({ feedback, returnQuestion: childReturnQuestion, translate, acc }),
58
+ ],
59
+ [] as string[],
60
+ )) ||
61
+ []
54
62
  );
55
63
  };
56
64
 
@@ -77,9 +85,9 @@ const deepestReturnQuestionWithFeedbackForReturnQuestion: RecursiveDeepestReturn
77
85
  const returnQuestionFeedback = feedback[returnQuestionId];
78
86
 
79
87
  if (isUuid(returnQuestionFeedback as string)) {
80
- const feebackReturnQuestionChild = returnQuestion.children?.find(
81
- (childReturnQuestion) => childReturnQuestion.id === returnQuestionFeedback,
82
- );
88
+ const feebackReturnQuestionChild =
89
+ returnQuestionHasChildren(returnQuestion) &&
90
+ returnQuestion.children?.find((childReturnQuestion) => childReturnQuestion.id === returnQuestionFeedback);
83
91
 
84
92
  if (feebackReturnQuestionChild) {
85
93
  return deepestReturnQuestionWithFeedbackForReturnQuestion({
@@ -95,9 +103,11 @@ const deepestReturnQuestionWithFeedbackForReturnQuestion: RecursiveDeepestReturn
95
103
  return [returnQuestion, false];
96
104
  }
97
105
 
98
- const feebackReturnQuestionChild = returnQuestion.children?.find((childReturnQuestion) =>
99
- Object.keys(feedback).find((id) => id === childReturnQuestion.id),
100
- );
106
+ const feebackReturnQuestionChild =
107
+ returnQuestionHasChildren(returnQuestion) &&
108
+ returnQuestion.children?.find((childReturnQuestion) =>
109
+ Object.keys(feedback).find((id) => id === childReturnQuestion.id),
110
+ );
101
111
 
102
112
  if (feebackReturnQuestionChild) {
103
113
  return deepestReturnQuestionWithFeedbackForReturnQuestion({
@@ -107,7 +117,11 @@ const deepestReturnQuestionWithFeedbackForReturnQuestion: RecursiveDeepestReturn
107
117
  });
108
118
  }
109
119
 
110
- return [deepestReturnQuestion, !returnQuestion.children || returnQuestion.children.length === 0];
120
+ const hasChildren = Boolean(
121
+ returnQuestionHasChildren(returnQuestion) && returnQuestion.children && returnQuestion.children.length > 0,
122
+ );
123
+
124
+ return [deepestReturnQuestion, !hasChildren];
111
125
  };
112
126
 
113
127
  export { feedbackForReturnQuestion, deepestReturnQuestionWithFeedbackForReturnQuestion };
@@ -57,67 +57,67 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
57
57
  }
58
58
  }
59
59
  >
60
- <RNGestureHandlerButton
60
+ <View
61
61
  collapsable={false}
62
- delayLongPress={600}
63
- enabled={true}
64
- exclusive={true}
65
- handlerTag={1}
66
- handlerType="NativeViewGestureHandler"
67
- onGestureEvent={[Function]}
68
- onGestureHandlerEvent={[Function]}
69
- onGestureHandlerStateChange={[Function]}
70
- onHandlerStateChange={[Function]}
71
- rippleColor={0}
72
- touchSoundDisabled={false}
62
+ jestAnimatedStyle={
63
+ {
64
+ "value": {
65
+ "transform": [
66
+ {
67
+ "translateX": 0,
68
+ },
69
+ ],
70
+ },
71
+ }
72
+ }
73
+ style={
74
+ {
75
+ "flex": 1,
76
+ "flexDirection": "row",
77
+ "height": "100%",
78
+ "transform": [
79
+ {
80
+ "translateX": 0,
81
+ },
82
+ ],
83
+ "width": 600,
84
+ }
85
+ }
86
+ testID="carousel-track"
73
87
  >
74
88
  <View
75
- accessible={true}
76
89
  collapsable={false}
77
- style={{}}
78
- >
79
- <View
80
- collapsable={false}
81
- jestAnimatedStyle={
82
- {
83
- "value": {
84
- "transform": [
85
- {
86
- "translateX": 0,
87
- },
88
- ],
89
- },
90
- }
90
+ jestAnimatedStyle={
91
+ {
92
+ "value": {},
91
93
  }
92
- style={
93
- {
94
- "flex": 1,
95
- "flexDirection": "row",
96
- "height": "100%",
97
- "transform": [
98
- {
99
- "translateX": 0,
100
- },
101
- ],
102
- "width": 600,
103
- }
94
+ }
95
+ style={
96
+ {
97
+ "flex": 1,
98
+ "width": 300,
104
99
  }
105
- testID="carousel-track"
100
+ }
101
+ testID="carousel-item"
102
+ >
103
+ <RNGestureHandlerButton
104
+ collapsable={false}
105
+ delayLongPress={600}
106
+ enabled={true}
107
+ exclusive={true}
108
+ handlerTag={2}
109
+ handlerType="NativeViewGestureHandler"
110
+ onGestureEvent={[Function]}
111
+ onGestureHandlerEvent={[Function]}
112
+ onGestureHandlerStateChange={[Function]}
113
+ onHandlerStateChange={[Function]}
114
+ rippleColor={0}
115
+ touchSoundDisabled={false}
106
116
  >
107
117
  <View
118
+ accessible={true}
108
119
  collapsable={false}
109
- jestAnimatedStyle={
110
- {
111
- "value": {},
112
- }
113
- }
114
- style={
115
- {
116
- "flex": 1,
117
- "width": 300,
118
- }
119
- }
120
- testID="carousel-item"
120
+ style={{}}
121
121
  >
122
122
  <View
123
123
  onLayout={[Function]}
@@ -263,20 +263,41 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
263
263
  </View>
264
264
  </View>
265
265
  </View>
266
+ </RNGestureHandlerButton>
267
+ </View>
268
+ <View
269
+ collapsable={false}
270
+ jestAnimatedStyle={
271
+ {
272
+ "value": {},
273
+ }
274
+ }
275
+ style={
276
+ {
277
+ "flex": 1,
278
+ "width": 300,
279
+ }
280
+ }
281
+ testID="carousel-item"
282
+ >
283
+ <RNGestureHandlerButton
284
+ collapsable={false}
285
+ delayLongPress={600}
286
+ enabled={true}
287
+ exclusive={true}
288
+ handlerTag={3}
289
+ handlerType="NativeViewGestureHandler"
290
+ onGestureEvent={[Function]}
291
+ onGestureHandlerEvent={[Function]}
292
+ onGestureHandlerStateChange={[Function]}
293
+ onHandlerStateChange={[Function]}
294
+ rippleColor={0}
295
+ touchSoundDisabled={false}
296
+ >
266
297
  <View
298
+ accessible={true}
267
299
  collapsable={false}
268
- jestAnimatedStyle={
269
- {
270
- "value": {},
271
- }
272
- }
273
- style={
274
- {
275
- "flex": 1,
276
- "width": 300,
277
- }
278
- }
279
- testID="carousel-item"
300
+ style={{}}
280
301
  >
281
302
  <View
282
303
  onLayout={[Function]}
@@ -422,9 +443,9 @@ exports[`ProductVariantSlider matches the snapshot 1`] = `
422
443
  </View>
423
444
  </View>
424
445
  </View>
425
- </View>
446
+ </RNGestureHandlerButton>
426
447
  </View>
427
- </RNGestureHandlerButton>
448
+ </View>
428
449
  </View>
429
450
  </View>
430
451
  <View
@@ -2,10 +2,8 @@ import React, { FC } from "react";
2
2
  import { View } from "react-native";
3
3
  import { ButtonIcon, Text } from "@lookiero/aurora";
4
4
  import { useI18nMessage } from "@lookiero/i18n-react";
5
- import {
6
- ReturnQuestionProjection,
7
- ReturnQuestionType,
8
- } from "../../../../../../projection/returnQuestion/returnQuestion";
5
+ import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
6
+ import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion.constants";
9
7
  import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
10
8
  import {
11
9
  ReturnQuestionItemProvider,