@lookiero/checkout 12.2.0 → 12.4.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 (118) hide show
  1. package/cypress/integration/checkout.spec.ts +14 -9
  2. package/cypress/support/interceptViewCheckoutFeedbackDefinitionByCheckoutId.ts +6 -0
  3. package/dist/src/ExpoRoot.js +2 -2
  4. package/dist/src/domain/checkoutItem/model/price.d.ts +1 -1
  5. package/dist/src/infrastructure/delivery/baseBootstrap.d.ts +2 -2
  6. package/dist/src/infrastructure/delivery/baseBootstrap.js +4 -4
  7. package/dist/src/infrastructure/delivery/bootstrap.js +2 -2
  8. package/dist/src/infrastructure/delivery/bootstrap.mock.js +3 -3
  9. package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.d.ts +3 -0
  10. package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.js +107 -0
  11. package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.d.ts +12 -0
  12. package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.js +10 -0
  13. package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.d.ts +10 -0
  14. package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.js +9 -0
  15. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +1 -1
  16. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +1 -1
  17. package/dist/src/infrastructure/tracking/tracking.d.ts +1 -1
  18. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.d.ts +2 -2
  19. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +4 -2
  20. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.d.ts +2 -2
  21. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.d.ts +5 -5
  22. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.js +1 -1
  23. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +5 -4
  24. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.d.ts +2 -1
  25. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -1
  26. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.d.ts +2 -1
  27. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +2 -1
  28. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.d.ts +2 -1
  29. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +2 -1
  30. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.d.ts +2 -3
  31. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +5 -7
  32. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.d.ts +2 -1
  33. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -1
  34. package/dist/src/infrastructure/ui/views/feedback/Feedback.js +10 -9
  35. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.d.ts +2 -3
  36. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +17 -9
  37. package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.d.ts +11 -0
  38. package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.js +10 -0
  39. package/dist/src/projection/checkoutFeedback/checkoutFeedback.d.ts +22 -2
  40. package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.d.ts +21 -0
  41. package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.js +1 -0
  42. package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.d.ts +3 -0
  43. package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.js +7 -0
  44. package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.d.ts +25 -0
  45. package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.js +8 -0
  46. package/dist/src/projection/price/price.d.ts +1 -1
  47. package/dist/src/version.d.ts +1 -1
  48. package/dist/src/version.js +1 -1
  49. package/package.json +5 -5
  50. package/src/ExpoRoot.tsx +2 -2
  51. package/src/domain/checkoutItem/model/price.ts +1 -1
  52. package/src/infrastructure/delivery/baseBootstrap.ts +9 -9
  53. package/src/infrastructure/delivery/bootstrap.mock.ts +5 -4
  54. package/src/infrastructure/delivery/bootstrap.ts +2 -2
  55. package/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.ts +110 -0
  56. package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.test.ts +52 -0
  57. package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.ts +30 -0
  58. package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.test.ts +58 -0
  59. package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.ts +25 -0
  60. package/src/infrastructure/projection/checkoutItem/checkoutItem.mock.ts +1 -1
  61. package/src/infrastructure/projection/pricing/pricing.mock.ts +1 -1
  62. package/src/infrastructure/tracking/tracking.ts +1 -1
  63. package/src/infrastructure/tracking/useTrackCheckout.test.tsx +1 -2
  64. package/src/infrastructure/tracking/useTrackCheckout.ts +1 -2
  65. package/src/infrastructure/ui/components/atoms/price/Price.test.tsx +1 -1
  66. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.test.tsx +25 -30
  67. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.tsx +12 -13
  68. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.test.tsx +19 -26
  69. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.tsx +3 -3
  70. package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.test.tsx +26 -26
  71. package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.tsx +6 -6
  72. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.ts +5 -4
  73. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.test.tsx +7 -11
  74. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +6 -4
  75. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +6 -4
  76. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultReturnQuestionItem.test.tsx +16 -10
  77. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.test.tsx +16 -22
  78. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +6 -4
  79. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.test.tsx +16 -14
  80. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.tsx +13 -14
  81. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.test.tsx +9 -19
  82. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +7 -5
  83. package/src/infrastructure/ui/views/feedback/Feedback.test.tsx +11 -5
  84. package/src/infrastructure/ui/views/feedback/Feedback.tsx +10 -9
  85. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.test.tsx +2 -2
  86. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +20 -13
  87. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.test.tsx +1 -2
  88. package/src/infrastructure/ui/views/return/components/price/Price.test.tsx +1 -1
  89. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.test.tsx +1 -2
  90. package/src/projection/checkoutFeedback/checkoutFeedback.constants.ts +16 -0
  91. package/src/projection/checkoutFeedback/checkoutFeedback.metadata.ts +28 -0
  92. package/src/projection/checkoutFeedback/checkoutFeedback.ts +38 -2
  93. package/src/projection/checkoutFeedback/checkoutFeedback.typeguards.ts +13 -0
  94. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.test.ts +52 -0
  95. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.ts +61 -0
  96. package/src/projection/price/price.ts +1 -1
  97. package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +0 -9
  98. package/dist/src/domain/checkoutItem/model/currency.d.ts +0 -6
  99. package/dist/src/domain/checkoutItem/model/currency.js +0 -7
  100. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
  101. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
  102. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.d.ts +0 -12
  103. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.js +0 -10
  104. package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.d.ts +0 -10
  105. package/dist/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.js +0 -9
  106. package/dist/src/projection/checkoutQuestion/checkoutQuestion.d.ts +0 -18
  107. package/dist/src/projection/checkoutQuestion/checkoutQuestion.js +0 -10
  108. package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.d.ts +0 -25
  109. package/dist/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.js +0 -8
  110. package/src/domain/checkoutItem/model/currency.ts +0 -7
  111. package/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.ts +0 -108
  112. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.test.ts +0 -55
  113. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.ts +0 -34
  114. package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.test.ts +0 -38
  115. package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.ts +0 -21
  116. package/src/projection/checkoutQuestion/checkoutQuestion.ts +0 -20
  117. package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.test.ts +0 -31
  118. package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.ts +0 -61
@@ -0,0 +1,58 @@
1
+ import { renderHook, waitFor } from "@testing-library/react-native";
2
+ import { bootstrap, QueryStatus } from "@lookiero/messaging-react";
3
+ import { CheckoutFeedbackQuestionProjection } from "../../../../projection/checkoutFeedback/checkoutFeedback";
4
+ import { CheckoutFeedbackQuestionType } from "../../../../projection/checkoutFeedback/checkoutFeedback.constants";
5
+ import {
6
+ viewCheckoutFeedbackDefinitionByCheckoutIdHandler,
7
+ VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID,
8
+ } from "../../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
9
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
10
+ import { useViewCheckoutFeedbackDefinitionByCheckoutId as sut } from "./useViewCheckoutFeedbackDefinitionByCheckoutId";
11
+
12
+ const checkoutId = "29790d24-b139-4ab8-b618-d796d101e974";
13
+ const checkoutFeedbackDefinition: CheckoutFeedbackQuestionProjection[] = [
14
+ {
15
+ id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
16
+ type: CheckoutFeedbackQuestionType.HOST_DEFAULT,
17
+ translationKey: "checkout.feedback.question.default",
18
+ metadata: {
19
+ showCondition: [],
20
+ },
21
+ children: [
22
+ {
23
+ id: "01975911-d451-7651-b1ae-3f977928e8a2",
24
+ type: CheckoutFeedbackQuestionType.HOST_TEXTAREA,
25
+ metadata: {
26
+ showCondition: [],
27
+ },
28
+ children: [
29
+ {
30
+ id: "01975911-ec6b-768e-9b4a-a6f2645b01b2",
31
+ type: CheckoutFeedbackQuestionType.TEXTAREA,
32
+ translationKey: "checkout.feedback.question.textarea",
33
+ metadata: {
34
+ placeholder: "checkout.feedback.question.textarea.placeholder",
35
+ },
36
+ },
37
+ ],
38
+ },
39
+ ],
40
+ },
41
+ ];
42
+ const view = jest.fn().mockReturnValue(checkoutFeedbackDefinition);
43
+ const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
44
+ .query(VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID, viewCheckoutFeedbackDefinitionByCheckoutIdHandler, { view })
45
+ .build();
46
+
47
+ describe("useViewCheckoutFeedbackDefinitionByCheckoutId integration hook", () => {
48
+ it("returns success as the query status and the result itself after rendering the hook", async () => {
49
+ const { result } = renderHook(() => sut({ checkoutId }), { wrapper: Messaging });
50
+
51
+ await waitFor(() => {
52
+ const [projection, status] = result.current;
53
+
54
+ expect(projection).toStrictEqual(checkoutFeedbackDefinition);
55
+ expect(status).toBe(QueryStatus.SUCCESS);
56
+ });
57
+ });
58
+ });
@@ -0,0 +1,25 @@
1
+ import { useQuery, UseQueryFunctionResult } from "@lookiero/messaging-react";
2
+ import { CheckoutFeedbackQuestionProjection } from "../../../../projection/checkoutFeedback/checkoutFeedback";
3
+ import { viewCheckoutFeedbackDefinitionByCheckoutId } from "../../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
4
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
+
6
+ interface UseViewCheckoutFeedbackDefinitionByCheckoutIdFunctionArgs {
7
+ readonly checkoutId: string;
8
+ }
9
+
10
+ interface UseViewCheckoutFeedbackDefinitionByCheckoutIdFunction {
11
+ (
12
+ args: UseViewCheckoutFeedbackDefinitionByCheckoutIdFunctionArgs,
13
+ ): UseQueryFunctionResult<CheckoutFeedbackQuestionProjection[]>;
14
+ }
15
+
16
+ const useViewCheckoutFeedbackDefinitionByCheckoutId: UseViewCheckoutFeedbackDefinitionByCheckoutIdFunction = ({
17
+ checkoutId,
18
+ }) =>
19
+ useQuery({
20
+ query: viewCheckoutFeedbackDefinitionByCheckoutId({ checkoutId }),
21
+ contextId: MESSAGING_CONTEXT_ID,
22
+ options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
23
+ });
24
+
25
+ export { useViewCheckoutFeedbackDefinitionByCheckoutId };
@@ -1,5 +1,5 @@
1
+ import { Currency } from "@lookiero/sty-psp-locale";
1
2
  import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
2
- import { Currency } from "../../../domain/checkoutItem/model/currency";
3
3
  import {
4
4
  CheckoutItemProductVariantProjection,
5
5
  CheckoutItemProjection,
@@ -1,4 +1,4 @@
1
- import { Currency } from "../../../domain/checkoutItem/model/currency";
1
+ import { Currency } from "@lookiero/sty-psp-locale";
2
2
  import { PricingProjection } from "../../../projection/pricing/pricing";
3
3
 
4
4
  interface PricingFunctionArgs {
@@ -1,6 +1,6 @@
1
+ import { Currency } from "@lookiero/sty-psp-locale";
1
2
  import { BaseTrackingEvent, TrackingEventCategory } from "@lookiero/sty-psp-tracking";
2
3
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
3
- import { Currency } from "../../domain/checkoutItem/model/currency";
4
4
  import { MediaPerspective } from "../../projection/checkoutItem/checkoutItem";
5
5
  import { SubscriptionProjection } from "../../projection/subscription/subscription";
6
6
 
@@ -1,11 +1,10 @@
1
1
  import { renderHook } from "@testing-library/react-native";
2
- import { Country } from "@lookiero/sty-psp-locale";
2
+ import { Country, Currency } from "@lookiero/sty-psp-locale";
3
3
  import { Segment } from "@lookiero/sty-psp-segment";
4
4
  import { useEmitUserEvent } from "@lookiero/sty-psp-tracking";
5
5
  import { Tradename } from "@lookiero/sty-sp-tradename";
6
6
  import { CheckoutStatus } from "../../domain/checkout/model/checkout";
7
7
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
8
- import { Currency } from "../../domain/checkoutItem/model/currency";
9
8
  import { CheckoutProjection } from "../../projection/checkout/checkout";
10
9
  import { OrderProjection } from "../../projection/order/order";
11
10
  import { PricingProjection } from "../../projection/pricing/pricing";
@@ -1,11 +1,10 @@
1
1
  import { useCallback } from "react";
2
2
  import invariant from "tiny-invariant";
3
- import { Country } from "@lookiero/sty-psp-locale";
3
+ import { Country, Currency } from "@lookiero/sty-psp-locale";
4
4
  import { Segment } from "@lookiero/sty-psp-segment";
5
5
  import { useEmitUserEvent } from "@lookiero/sty-psp-tracking";
6
6
  import { Tradename } from "@lookiero/sty-sp-tradename";
7
7
  import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
8
- import { Currency } from "../../domain/checkoutItem/model/currency";
9
8
  import { CheckoutProjection } from "../../projection/checkout/checkout";
10
9
  import { OrderProjection } from "../../projection/order/order";
11
10
  import { PricingProjection } from "../../projection/pricing/pricing";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Currency } from "../../../../../domain/checkoutItem/model/currency";
2
+ import { Currency } from "@lookiero/sty-psp-locale";
3
3
  import { PriceProjection } from "../../../../../projection/price/price";
4
4
  import { render } from "../../../test/render";
5
5
  import { Price } from "./Price";
@@ -1,64 +1,59 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { render } from "@testing-library/react-native";
2
3
  import React, { ReactNode } from "react";
3
4
  import { Text } from "react-native";
4
- import {
5
- CheckoutQuestionProjection,
6
- CheckoutQuestionType,
7
- } from "../../../../../projection/checkoutQuestion/checkoutQuestion";
5
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../projection/checkoutFeedback/checkoutFeedback";
6
+ import { CheckoutFeedbackQuestionType } from "../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
8
7
  import CheckoutQuestion from "./CheckoutQuestion";
9
8
  import { CheckoutQuestionItemProvider, CheckoutQuestionItems } from "./behaviors/useCheckoutQuestionItem";
10
- import { CheckoutQuestionItem, CheckoutQuestionItemProps } from "./components/CheckoutQuestionItem";
9
+ import { CheckoutQuestionItem } from "./components/CheckoutQuestionItem";
11
10
 
12
11
  const mockOnChange = jest.fn();
13
12
  jest.mock("./behaviors/useCheckoutQuestionFeedback", () => ({
14
13
  useCheckoutQuestionFeedbackForId: () => ({ onChange: mockOnChange }),
15
14
  }));
16
15
 
17
- const checkoutQuestion: CheckoutQuestionProjection = {
16
+ const checkoutQuestion: CheckoutFeedbackQuestionProjection = {
18
17
  id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
19
- name: "checkout.checkout_question.selection.question",
20
- placeholder: "checkout.checkout_question.selection.placeholder",
21
- type: CheckoutQuestionType.HOST_SELECT,
22
- showCondition: [],
18
+ translationKey: "checkout.checkout_question.selection.question",
19
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
20
+ metadata: {
21
+ placeholder: "checkout.checkout_question.selection.placeholder",
22
+ showCondition: [],
23
+ },
23
24
  children: [
24
25
  {
25
26
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
26
- name: "checkout.checkout_question.icon.bad",
27
- placeholder: "",
28
- type: CheckoutQuestionType.ICON,
29
- showCondition: [],
27
+ translationKey: "checkout.checkout_question.icon.bad",
28
+ type: CheckoutFeedbackQuestionType.ICON,
30
29
  },
31
30
  {
32
31
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
33
- name: "checkout.checkout_question.icon.regular",
34
- placeholder: "",
35
- type: CheckoutQuestionType.ICON,
36
- showCondition: [],
32
+ translationKey: "checkout.checkout_question.icon.regular",
33
+ type: CheckoutFeedbackQuestionType.ICON,
37
34
  },
38
35
  {
39
36
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
40
- name: "checkout.checkout_question.icon.good",
41
- placeholder: "",
42
- type: CheckoutQuestionType.ICON,
43
- showCondition: [],
37
+ translationKey: "checkout.checkout_question.icon.good",
38
+ type: CheckoutFeedbackQuestionType.ICON,
44
39
  },
45
40
  ],
46
41
  };
47
42
 
48
- const Item: CheckoutQuestionItem = ({ checkoutQuestion, children }: CheckoutQuestionItemProps) => (
43
+ const Item: CheckoutQuestionItem<CheckoutFeedbackQuestionType> = ({ checkoutQuestion, children }) => (
49
44
  <>
50
- <Text>{checkoutQuestion.name}</Text>
45
+ <Text>{checkoutQuestion.translationKey}</Text>
51
46
  {children}
52
47
  </>
53
48
  );
54
49
 
55
50
  const checkoutQuestionItems: CheckoutQuestionItems = {
56
- [CheckoutQuestionType.HOST_DEFAULT]: Item,
57
- [CheckoutQuestionType.HOST_TEXTAREA]: Item,
58
- [CheckoutQuestionType.HOST_SELECT]: Item,
59
- [CheckoutQuestionType.TEXTAREA]: Item,
60
- [CheckoutQuestionType.BUTTON]: Item,
61
- [CheckoutQuestionType.ICON]: Item,
51
+ [CheckoutFeedbackQuestionType.HOST_DEFAULT]: Item,
52
+ [CheckoutFeedbackQuestionType.HOST_TEXTAREA]: Item,
53
+ [CheckoutFeedbackQuestionType.HOST_SELECT]: Item,
54
+ [CheckoutFeedbackQuestionType.TEXTAREA]: Item,
55
+ [CheckoutFeedbackQuestionType.BUTTON]: Item,
56
+ [CheckoutFeedbackQuestionType.ICON]: Item,
62
57
  };
63
58
 
64
59
  const Wrapper = ({ children }: { children: ReactNode }) => (
@@ -1,16 +1,14 @@
1
1
  import React, { FC, memo } from "react";
2
- import { CheckoutQuestionProjection } from "../../../../../projection/checkoutQuestion/checkoutQuestion";
2
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../projection/checkoutFeedback/checkoutFeedback";
3
+ import { checkoutFeedbackQuestionHasChildren } from "../../../../../projection/checkoutFeedback/checkoutFeedback.typeguards";
3
4
  import { useCheckoutQuestionItem } from "./behaviors/useCheckoutQuestionItem";
4
5
 
5
6
  interface CheckoutQuestionProps {
6
7
  readonly checkoutQuestionParentId: string;
7
- readonly checkoutQuestion: CheckoutQuestionProjection;
8
+ readonly checkoutQuestion: CheckoutFeedbackQuestionProjection;
8
9
  }
9
10
 
10
- const CheckoutQuestion: FC<CheckoutQuestionProps> = ({
11
- checkoutQuestion,
12
- checkoutQuestionParentId,
13
- }: CheckoutQuestionProps) => {
11
+ const CheckoutQuestion: FC<CheckoutQuestionProps> = ({ checkoutQuestion, checkoutQuestionParentId }) => {
14
12
  const Item = useCheckoutQuestionItem({ type: checkoutQuestion.type });
15
13
 
16
14
  return (
@@ -19,13 +17,14 @@ const CheckoutQuestion: FC<CheckoutQuestionProps> = ({
19
17
  checkoutQuestionParentId={checkoutQuestionParentId}
20
18
  testID={checkoutQuestion.id}
21
19
  >
22
- {checkoutQuestion.children?.map((childCheckoutQuestion) => (
23
- <CheckoutQuestion
24
- key={childCheckoutQuestion.id}
25
- checkoutQuestion={childCheckoutQuestion}
26
- checkoutQuestionParentId={checkoutQuestion.id}
27
- />
28
- ))}
20
+ {checkoutFeedbackQuestionHasChildren(checkoutQuestion) &&
21
+ checkoutQuestion.children.map((childCheckoutQuestion) => (
22
+ <CheckoutQuestion
23
+ key={childCheckoutQuestion.id}
24
+ checkoutQuestion={childCheckoutQuestion}
25
+ checkoutQuestionParentId={checkoutQuestion.id}
26
+ />
27
+ ))}
29
28
  </Item>
30
29
  );
31
30
  };
@@ -1,50 +1,43 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { render } from "@testing-library/react-native";
2
3
  import React, { ReactNode } from "react";
3
4
  import { Text } from "react-native";
4
- import {
5
- CheckoutQuestionProjection,
6
- CheckoutQuestionType,
7
- } from "../../../../../projection/checkoutQuestion/checkoutQuestion";
5
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../projection/checkoutFeedback/checkoutFeedback";
6
+ import { CheckoutFeedbackQuestionType } from "../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
8
7
  import { CheckoutQuestions } from "./CheckoutQuestions";
9
8
  import { CheckoutQuestionFeedbackProvider } from "./behaviors/useCheckoutQuestionFeedback";
10
9
  import { CheckoutQuestionItemProvider, CheckoutQuestionItems } from "./behaviors/useCheckoutQuestionItem";
11
- import { CheckoutQuestionItem, CheckoutQuestionItemProps } from "./components/CheckoutQuestionItem";
10
+ import { CheckoutQuestionItem } from "./components/CheckoutQuestionItem";
12
11
 
13
- const checkoutQuestions: CheckoutQuestionProjection[] = [
12
+ const checkoutQuestions: CheckoutFeedbackQuestionProjection[] = [
14
13
  {
15
14
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
16
- name: "checkout.checkout_question.icon.bad",
17
- placeholder: "",
18
- type: CheckoutQuestionType.ICON,
19
- showCondition: [],
15
+ translationKey: "checkout.checkout_question.icon.bad",
16
+ type: CheckoutFeedbackQuestionType.ICON,
20
17
  },
21
18
  {
22
19
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
23
- name: "checkout.checkout_question.icon.regular",
24
- placeholder: "",
25
- type: CheckoutQuestionType.ICON,
26
- showCondition: [],
20
+ translationKey: "checkout.checkout_question.icon.regular",
21
+ type: CheckoutFeedbackQuestionType.ICON,
27
22
  },
28
23
  {
29
24
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
30
- name: "checkout.checkout_question.icon.good",
31
- placeholder: "",
32
- type: CheckoutQuestionType.ICON,
33
- showCondition: [],
25
+ translationKey: "checkout.checkout_question.icon.good",
26
+ type: CheckoutFeedbackQuestionType.ICON,
34
27
  },
35
28
  ];
36
29
 
37
- const Item: CheckoutQuestionItem = ({ checkoutQuestion }: CheckoutQuestionItemProps) => (
38
- <Text>{checkoutQuestion.name}</Text>
30
+ const Item: CheckoutQuestionItem<CheckoutFeedbackQuestionType> = ({ checkoutQuestion }) => (
31
+ <Text>{checkoutQuestion.translationKey}</Text>
39
32
  );
40
33
 
41
34
  const checkoutQuestionItems: CheckoutQuestionItems = {
42
- [CheckoutQuestionType.HOST_DEFAULT]: Item,
43
- [CheckoutQuestionType.HOST_TEXTAREA]: Item,
44
- [CheckoutQuestionType.HOST_SELECT]: Item,
45
- [CheckoutQuestionType.TEXTAREA]: Item,
46
- [CheckoutQuestionType.BUTTON]: Item,
47
- [CheckoutQuestionType.ICON]: Item,
35
+ [CheckoutFeedbackQuestionType.HOST_DEFAULT]: Item,
36
+ [CheckoutFeedbackQuestionType.HOST_TEXTAREA]: Item,
37
+ [CheckoutFeedbackQuestionType.HOST_SELECT]: Item,
38
+ [CheckoutFeedbackQuestionType.TEXTAREA]: Item,
39
+ [CheckoutFeedbackQuestionType.BUTTON]: Item,
40
+ [CheckoutFeedbackQuestionType.ICON]: Item,
48
41
  };
49
42
 
50
43
  const Wrapper = ({ children }: { children: ReactNode }) => (
@@ -1,14 +1,14 @@
1
1
  import React, { FC } from "react";
2
- import { CheckoutQuestionProjection } from "../../../../../projection/checkoutQuestion/checkoutQuestion";
2
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../projection/checkoutFeedback/checkoutFeedback";
3
3
  import CheckoutQuestion from "./CheckoutQuestion";
4
4
 
5
5
  interface CheckoutQuestionsProps {
6
- readonly checkoutQuestions: CheckoutQuestionProjection[];
6
+ readonly checkoutQuestions: CheckoutFeedbackQuestionProjection[];
7
7
  }
8
8
 
9
9
  const CheckoutQuestions: FC<CheckoutQuestionsProps> = ({ checkoutQuestions }) => (
10
10
  <>
11
- {checkoutQuestions.map((checkoutQuestion: CheckoutQuestionProjection) => (
11
+ {checkoutQuestions.map((checkoutQuestion: CheckoutFeedbackQuestionProjection) => (
12
12
  <CheckoutQuestion key={checkoutQuestion.id} checkoutQuestion={checkoutQuestion} checkoutQuestionParentId="" />
13
13
  ))}
14
14
  </>
@@ -1,10 +1,8 @@
1
1
  import { renderHook } from "@testing-library/react-native";
2
2
  import React from "react";
3
3
  import { Text } from "react-native";
4
- import {
5
- CheckoutQuestionProjection,
6
- CheckoutQuestionType,
7
- } from "../../../../../../projection/checkoutQuestion/checkoutQuestion";
4
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../../projection/checkoutFeedback/checkoutFeedback";
5
+ import { CheckoutFeedbackQuestionType } from "../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
8
6
  import { createWrapper } from "../../../../test/createWrapper";
9
7
  import { render } from "../../../../test/render";
10
8
  import { CheckoutQuestionItem } from "../components/CheckoutQuestionItem";
@@ -15,37 +13,39 @@ import {
15
13
  } from "./useCheckoutQuestionItem";
16
14
 
17
15
  const hostDefaultText = "host default";
18
- const HostDefault: CheckoutQuestionItem = () => <Text>{hostDefaultText}</Text>;
16
+ const HostDefault: CheckoutQuestionItem<CheckoutFeedbackQuestionType.HOST_DEFAULT> = () => (
17
+ <Text>{hostDefaultText}</Text>
18
+ );
19
19
  const hostSelectText = "host select";
20
- const HostSelect: CheckoutQuestionItem = () => <Text>{hostSelectText}</Text>;
20
+ const HostSelect: CheckoutQuestionItem<CheckoutFeedbackQuestionType.HOST_SELECT> = () => <Text>{hostSelectText}</Text>;
21
21
  const buttonText = "button";
22
- const Button: CheckoutQuestionItem = () => <Text>{buttonText}</Text>;
22
+ const Button: CheckoutQuestionItem<CheckoutFeedbackQuestionType.BUTTON> = () => <Text>{buttonText}</Text>;
23
23
  const iconText = "icon";
24
- const Icon: CheckoutQuestionItem = () => <Text>{iconText}</Text>;
24
+ const Icon: CheckoutQuestionItem<CheckoutFeedbackQuestionType.ICON> = () => <Text>{iconText}</Text>;
25
25
  const textareaText = "textarea";
26
- const Textarea: CheckoutQuestionItem = () => <Text>{textareaText}</Text>;
26
+ const Textarea: CheckoutQuestionItem<CheckoutFeedbackQuestionType.TEXTAREA> = () => <Text>{textareaText}</Text>;
27
27
 
28
28
  const checkoutQuestionItems: CheckoutQuestionItems = {
29
- [CheckoutQuestionType.HOST_DEFAULT]: HostDefault,
30
- [CheckoutQuestionType.HOST_TEXTAREA]: HostDefault,
31
- [CheckoutQuestionType.HOST_SELECT]: HostSelect,
32
- [CheckoutQuestionType.TEXTAREA]: Textarea,
33
- [CheckoutQuestionType.BUTTON]: Button,
34
- [CheckoutQuestionType.ICON]: Icon,
29
+ [CheckoutFeedbackQuestionType.HOST_DEFAULT]: HostDefault,
30
+ [CheckoutFeedbackQuestionType.HOST_TEXTAREA]: HostDefault,
31
+ [CheckoutFeedbackQuestionType.HOST_SELECT]: HostSelect,
32
+ [CheckoutFeedbackQuestionType.TEXTAREA]: Textarea,
33
+ [CheckoutFeedbackQuestionType.BUTTON]: Button,
34
+ [CheckoutFeedbackQuestionType.ICON]: Icon,
35
35
  };
36
36
 
37
- const scenarios: [CheckoutQuestionType, string][] = [
38
- [CheckoutQuestionType.HOST_DEFAULT, hostDefaultText],
39
- [CheckoutQuestionType.HOST_TEXTAREA, hostDefaultText],
40
- [CheckoutQuestionType.HOST_SELECT, hostSelectText],
41
- [CheckoutQuestionType.TEXTAREA, textareaText],
42
- [CheckoutQuestionType.BUTTON, buttonText],
43
- [CheckoutQuestionType.ICON, iconText],
37
+ const scenarios: [CheckoutFeedbackQuestionType, string][] = [
38
+ [CheckoutFeedbackQuestionType.HOST_DEFAULT, hostDefaultText],
39
+ [CheckoutFeedbackQuestionType.HOST_TEXTAREA, hostDefaultText],
40
+ [CheckoutFeedbackQuestionType.HOST_SELECT, hostSelectText],
41
+ [CheckoutFeedbackQuestionType.TEXTAREA, textareaText],
42
+ [CheckoutFeedbackQuestionType.BUTTON, buttonText],
43
+ [CheckoutFeedbackQuestionType.ICON, iconText],
44
44
  ];
45
45
 
46
46
  describe("useCheckoutQuestionItem hook", () => {
47
47
  test.each(scenarios)(
48
- "returns the %s component from the context for CheckoutQuestionType.%s",
48
+ "returns the %s component from the context for CheckoutFeedbackQuestionType.%s",
49
49
  async (type, componentText) => {
50
50
  const { result } = renderHook(() => sut({ type }), {
51
51
  wrapper: createWrapper({
@@ -58,7 +58,7 @@ describe("useCheckoutQuestionItem hook", () => {
58
58
 
59
59
  const { findByText } = render(
60
60
  <Component
61
- checkoutQuestion={{} as CheckoutQuestionProjection}
61
+ checkoutQuestion={{} as CheckoutFeedbackQuestionProjection}
62
62
  checkoutQuestionParentId="1d10e62a-27fa-49d0-a89e-b01775dfb4d8"
63
63
  />,
64
64
  );
@@ -69,9 +69,9 @@ describe("useCheckoutQuestionItem hook", () => {
69
69
  },
70
70
  );
71
71
 
72
- it("throws if provided CheckoutQuestionType is not supported", () => {
72
+ it("throws if provided CheckoutFeedbackQuestionType is not supported", () => {
73
73
  expect(async () =>
74
- renderHook(() => sut({ type: "NotSupportedType" as CheckoutQuestionType }), {
74
+ renderHook(() => sut({ type: "NotSupportedType" as CheckoutFeedbackQuestionType }), {
75
75
  wrapper: createWrapper({
76
76
  wrapper: CheckoutQuestionItemProvider,
77
77
  initialProps: { checkoutQuestionItems, children: null },
@@ -1,9 +1,9 @@
1
1
  import React, { createContext, FC, ReactNode, useContext, useMemo } from "react";
2
2
  import invariant from "tiny-invariant";
3
- import { CheckoutQuestionType } from "../../../../../../projection/checkoutQuestion/checkoutQuestion";
3
+ import { CheckoutFeedbackQuestionType } from "../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
4
4
  import { CheckoutQuestionItem } from "../components/CheckoutQuestionItem";
5
5
 
6
- type CheckoutQuestionItems = Record<CheckoutQuestionType, CheckoutQuestionItem>;
6
+ type CheckoutQuestionItems = Record<CheckoutFeedbackQuestionType, CheckoutQuestionItem<CheckoutFeedbackQuestionType>>;
7
7
 
8
8
  const CheckoutQuestionItemContext = createContext<CheckoutQuestionItems>({} as CheckoutQuestionItems);
9
9
 
@@ -19,12 +19,12 @@ const CheckoutQuestionItemProvider: FC<CheckoutQuestionItemContextProviderProps>
19
19
  <CheckoutQuestionItemContext.Provider value={checkoutQuestionItems}>{children}</CheckoutQuestionItemContext.Provider>
20
20
  );
21
21
 
22
- interface UseCheckoutQuestionItemFunctionArgs {
23
- readonly type: CheckoutQuestionType;
22
+ interface UseCheckoutQuestionItemFunctionArgs<QT extends CheckoutFeedbackQuestionType> {
23
+ readonly type: QT;
24
24
  }
25
25
 
26
26
  interface UseCheckoutQuestionItemFunction {
27
- (args: UseCheckoutQuestionItemFunctionArgs): CheckoutQuestionItem;
27
+ <QT extends CheckoutFeedbackQuestionType>(args: UseCheckoutQuestionItemFunctionArgs<QT>): CheckoutQuestionItem<QT>;
28
28
  }
29
29
 
30
30
  const useCheckoutQuestionItem: UseCheckoutQuestionItemFunction = ({ type }) => {
@@ -36,7 +36,7 @@ const useCheckoutQuestionItem: UseCheckoutQuestionItemFunction = ({ type }) => {
36
36
  "Your are trying to use the useCheckoutQuestionItem hook without wrapping your app with the <CheckoutQuestionItemProvider>.",
37
37
  );
38
38
 
39
- invariant(item, `The provided CheckoutQuestionType (${type}) is NOT SUPPORTED`);
39
+ invariant(item, `The provided CheckoutFeedbackQuestionType (${type}) is NOT SUPPORTED`);
40
40
 
41
41
  return item;
42
42
  };
@@ -1,14 +1,15 @@
1
1
  import { FC, ReactNode } from "react";
2
- import { CheckoutQuestionProjection } from "../../../../../../projection/checkoutQuestion/checkoutQuestion";
2
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../../projection/checkoutFeedback/checkoutFeedback";
3
+ import { CheckoutFeedbackQuestionType } from "../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
3
4
 
4
- interface CheckoutQuestionItemProps {
5
- readonly checkoutQuestion: CheckoutQuestionProjection;
5
+ interface CheckoutQuestionItemProps<CFQT extends CheckoutFeedbackQuestionType> {
6
+ readonly checkoutQuestion: CheckoutFeedbackQuestionProjection<CFQT>;
6
7
  readonly checkoutQuestionParentId: string;
7
8
  readonly children?: ReactNode;
8
9
  readonly portalHostName?: string;
9
10
  readonly testID?: string;
10
11
  }
11
12
 
12
- type CheckoutQuestionItem = FC<CheckoutQuestionItemProps>;
13
+ type CheckoutQuestionItem<CFQT extends CheckoutFeedbackQuestionType> = FC<CheckoutQuestionItemProps<CFQT>>;
13
14
 
14
15
  export type { CheckoutQuestionItem, CheckoutQuestionItemProps };
@@ -1,9 +1,7 @@
1
1
  import { fireEvent } from "@testing-library/react-native";
2
2
  import React from "react";
3
- import {
4
- CheckoutQuestionProjection,
5
- CheckoutQuestionType,
6
- } from "../../../../../../../projection/checkoutQuestion/checkoutQuestion";
3
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback";
4
+ import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
7
5
  import { render } from "../../../../../test/render";
8
6
  import { ButtonCheckoutQuestionItem } from "./ButtonCheckoutQuestionItem";
9
7
 
@@ -13,12 +11,10 @@ jest.mock("../../behaviors/useCheckoutQuestionFeedback", () => ({
13
11
  }));
14
12
 
15
13
  const checkoutQuestionParentId = "0ad1dba8-b02c-4121-a1e3-981f1c30800d";
16
- const checkoutQuestion: CheckoutQuestionProjection = {
14
+ const checkoutQuestion: CheckoutFeedbackQuestionProjection = {
17
15
  id: "9251dc2c-d76a-484d-9299-346929af932f",
18
- name: "checkout.checkout_question.personalshopper.yes",
19
- placeholder: "",
20
- type: CheckoutQuestionType.BUTTON,
21
- showCondition: [],
16
+ translationKey: "checkout.checkout_question.personalshopper.yes",
17
+ type: CheckoutFeedbackQuestionType.BUTTON,
22
18
  };
23
19
 
24
20
  describe("ButtonCheckoutQuestionItem component (CheckoutQuestions organism)", () => {
@@ -30,9 +26,9 @@ describe("ButtonCheckoutQuestionItem component (CheckoutQuestions organism)", ()
30
26
  />,
31
27
  );
32
28
 
33
- expect(getByText(checkoutQuestion.name)).toBeTruthy();
29
+ expect(getByText(checkoutQuestion.translationKey)).toBeTruthy();
34
30
 
35
- fireEvent.press(getByText(checkoutQuestion.name));
31
+ fireEvent.press(getByText(checkoutQuestion.translationKey));
36
32
 
37
33
  expect(mockOnChange).toHaveBeenCalledWith({
38
34
  checkoutQuestionId: checkoutQuestionParentId,
@@ -1,22 +1,24 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import React, { useCallback, useMemo } from "react";
2
3
  import { TouchableOpacity } from "react-native";
3
4
  import { Text } from "@lookiero/aurora";
4
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
+ import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
5
7
  import { DOMAIN } from "../../../../../i18n/i18n";
6
8
  import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
7
- import { CheckoutQuestionItem, CheckoutQuestionItemProps } from "../CheckoutQuestionItem";
9
+ import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
8
10
  import { style as buttonCheckoutQuestionItemStyle } from "./ButtonCheckoutQuestionItem.style";
9
11
 
10
12
  const ACTIVE_OPACITY = 0.6;
11
13
 
12
- const ButtonCheckoutQuestionItem: CheckoutQuestionItem = ({
14
+ const ButtonCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.BUTTON> = ({
13
15
  checkoutQuestion,
14
16
  checkoutQuestionParentId,
15
17
  testID,
16
- }: CheckoutQuestionItemProps) => {
18
+ }) => {
17
19
  const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
18
20
 
19
- const optionText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.name });
21
+ const optionText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.translationKey });
20
22
  const handleOnPress = useCallback(
21
23
  () => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: checkoutQuestion.id }),
22
24
  [onChange, checkoutQuestion.id, checkoutQuestionParentId],
@@ -1,16 +1,18 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import React, { useMemo } from "react";
2
3
  import { View } from "react-native";
3
4
  import { Text } from "@lookiero/aurora";
4
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
+ import { CheckoutFeedbackQuestionType } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
5
7
  import { DOMAIN } from "../../../../../i18n/i18n";
6
- import { CheckoutQuestionItem, CheckoutQuestionItemProps } from "../CheckoutQuestionItem";
8
+ import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
7
9
  import { style as hostDefaultCheckoutQuestionItemStyle } from "./HostDefaultCheckoutQuestionItem.style";
8
10
 
9
- const HostDefaultCheckoutQuestionItem: CheckoutQuestionItem = ({
11
+ const HostDefaultCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.HOST_DEFAULT> = ({
10
12
  checkoutQuestion,
11
13
  children,
12
- }: CheckoutQuestionItemProps) => {
13
- const titleText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.name });
14
+ }) => {
15
+ const titleText = useI18nMessage({ domain: DOMAIN, id: checkoutQuestion.translationKey });
14
16
 
15
17
  const style = useMemo(() => hostDefaultCheckoutQuestionItemStyle(), []);
16
18