@lookiero/checkout 12.3.0 → 12.5.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 (159) hide show
  1. package/cypress/integration/checkout.spec.ts +14 -9
  2. package/cypress/support/interceptViewCheckoutFeedbackDefinitionByCheckoutId.ts +6 -0
  3. package/dist/public/public/assets/adaptive-icon.png +0 -0
  4. package/dist/public/public/assets/favicon.png +0 -0
  5. package/dist/public/public/assets/icon.png +0 -0
  6. package/dist/public/public/assets/splash.png +0 -0
  7. package/dist/public/public/images/not-found.png +0 -0
  8. package/dist/src/ExpoRoot.js +2 -2
  9. package/dist/src/domain/checkoutItem/model/currency.d.ts +6 -0
  10. package/dist/src/domain/checkoutItem/model/currency.js +7 -0
  11. package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +15 -0
  12. package/dist/src/domain/uiSetting/command/updateUiSetting.js +10 -0
  13. package/dist/src/domain/uiSetting/model/uiSetting.d.ts +9 -0
  14. package/dist/src/domain/uiSetting/model/uiSetting.js +11 -0
  15. package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +15 -0
  16. package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +8 -0
  17. package/dist/src/domain/uiSetting/model/uiSettings.d.ts +7 -0
  18. package/dist/src/domain/uiSetting/model/uiSettings.js +1 -0
  19. package/dist/src/infrastructure/delivery/baseBootstrap.d.ts +2 -2
  20. package/dist/src/infrastructure/delivery/baseBootstrap.js +4 -4
  21. package/dist/src/infrastructure/delivery/bootstrap.js +2 -2
  22. package/dist/src/infrastructure/delivery/bootstrap.mock.js +3 -3
  23. package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +17 -0
  24. package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +20 -0
  25. package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +18 -0
  26. package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +22 -0
  27. package/dist/src/infrastructure/integration/useRedirect.d.ts +7 -0
  28. package/dist/src/infrastructure/integration/useRedirect.js +1 -0
  29. package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +5 -0
  30. package/dist/src/infrastructure/persistence/asyncStorageStorage.js +7 -0
  31. package/dist/src/infrastructure/persistence/uiSettingData.d.ts +6 -0
  32. package/dist/src/infrastructure/persistence/uiSettingData.js +1 -0
  33. package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.d.ts +3 -0
  34. package/dist/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.js +107 -0
  35. package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.d.ts +12 -0
  36. package/dist/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.js +10 -0
  37. package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.d.ts +10 -0
  38. package/dist/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.js +9 -0
  39. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +47 -58
  40. package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +10 -0
  41. package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +11 -0
  42. package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +13 -0
  43. package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +15 -0
  44. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.d.ts +2 -2
  45. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +4 -2
  46. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.d.ts +2 -2
  47. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.d.ts +5 -5
  48. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.js +1 -1
  49. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +5 -4
  50. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.d.ts +2 -1
  51. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -1
  52. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.d.ts +2 -1
  53. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +2 -1
  54. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.d.ts +2 -1
  55. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +2 -1
  56. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.d.ts +2 -3
  57. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +5 -7
  58. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.d.ts +2 -1
  59. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -1
  60. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +1 -2
  61. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.d.ts +4 -0
  62. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.js +17 -0
  63. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.d.ts +11 -0
  64. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.js +16 -0
  65. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +1 -1
  66. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +3 -5
  67. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -3
  68. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +2 -4
  69. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +27 -0
  70. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +97 -0
  71. package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +8 -0
  72. package/dist/src/infrastructure/ui/routing/useBasePath.js +9 -0
  73. package/dist/src/infrastructure/ui/settings/UISettings.d.ts +3 -0
  74. package/dist/src/infrastructure/ui/settings/UISettings.js +4 -0
  75. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +12 -0
  76. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +90 -0
  77. package/dist/src/infrastructure/ui/views/feedback/Feedback.js +10 -9
  78. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.d.ts +2 -3
  79. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +17 -9
  80. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +1 -0
  81. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -1
  82. package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.d.ts +11 -0
  83. package/dist/src/projection/checkoutFeedback/checkoutFeedback.constants.js +10 -0
  84. package/dist/src/projection/checkoutFeedback/checkoutFeedback.d.ts +22 -2
  85. package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.d.ts +21 -0
  86. package/dist/src/projection/checkoutFeedback/checkoutFeedback.metadata.js +1 -0
  87. package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.d.ts +3 -0
  88. package/dist/src/projection/checkoutFeedback/checkoutFeedback.typeguards.js +7 -0
  89. package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.d.ts +25 -0
  90. package/dist/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.js +8 -0
  91. package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +1 -0
  92. package/dist/src/projection/returnQuestion/returnQuestion.constants.js +1 -0
  93. package/dist/src/projection/returnQuestion/returnQuestion.d.ts +2 -2
  94. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +2 -4
  95. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +2 -2
  96. package/dist/src/projection/uiSetting/viewUiSettingByKey.d.ts +29 -0
  97. package/dist/src/projection/uiSetting/viewUiSettingByKey.js +8 -0
  98. package/dist/src/version.d.ts +1 -1
  99. package/dist/src/version.js +1 -1
  100. package/package.json +1 -1
  101. package/src/ExpoRoot.tsx +2 -2
  102. package/src/infrastructure/delivery/baseBootstrap.ts +9 -9
  103. package/src/infrastructure/delivery/bootstrap.mock.ts +5 -4
  104. package/src/infrastructure/delivery/bootstrap.ts +2 -2
  105. package/src/infrastructure/projection/checkoutFeedback/checkoutFeedbackDefinition.mock.ts +110 -0
  106. package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.test.ts +52 -0
  107. package/src/infrastructure/projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView.ts +30 -0
  108. package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.test.ts +58 -0
  109. package/src/infrastructure/projection/checkoutFeedback/react/useViewCheckoutFeedbackDefinitionByCheckoutId.ts +25 -0
  110. package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +47 -58
  111. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.test.tsx +25 -30
  112. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.tsx +12 -13
  113. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.test.tsx +19 -26
  114. package/src/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestions.tsx +3 -3
  115. package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.test.tsx +26 -26
  116. package/src/infrastructure/ui/components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionItem.tsx +6 -6
  117. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.ts +5 -4
  118. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.test.tsx +7 -11
  119. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +6 -4
  120. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +6 -4
  121. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultReturnQuestionItem.test.tsx +16 -10
  122. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.test.tsx +16 -22
  123. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +6 -4
  124. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.test.tsx +16 -14
  125. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.tsx +13 -14
  126. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.test.tsx +9 -19
  127. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +7 -5
  128. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +1 -2
  129. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.style.ts +19 -0
  130. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostLegacyRadioGroupReturnQuestionItem/HostLegacyRadioGroupReturnQuestionItem.tsx +36 -0
  131. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.test.tsx +46 -0
  132. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -12
  133. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +6 -5
  134. package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +22 -2
  135. package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +2 -7
  136. package/src/infrastructure/ui/views/feedback/Feedback.test.tsx +11 -5
  137. package/src/infrastructure/ui/views/feedback/Feedback.tsx +10 -9
  138. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.test.tsx +2 -2
  139. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +20 -13
  140. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +1 -0
  141. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +3 -1
  142. package/src/projection/checkoutFeedback/checkoutFeedback.constants.ts +16 -0
  143. package/src/projection/checkoutFeedback/checkoutFeedback.metadata.ts +28 -0
  144. package/src/projection/checkoutFeedback/checkoutFeedback.ts +38 -2
  145. package/src/projection/checkoutFeedback/checkoutFeedback.typeguards.ts +13 -0
  146. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.test.ts +52 -0
  147. package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.ts +61 -0
  148. package/src/projection/returnQuestion/returnQuestion.constants.ts +1 -0
  149. package/src/projection/returnQuestion/returnQuestion.ts +6 -2
  150. package/src/projection/returnQuestion/returnQuestion.typeguard.ts +3 -11
  151. package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +0 -9
  152. package/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.ts +0 -108
  153. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.test.ts +0 -55
  154. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.ts +0 -34
  155. package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.test.ts +0 -38
  156. package/src/infrastructure/projection/checkoutQuestion/react/useListCheckoutQuestionsByCheckoutId.ts +0 -21
  157. package/src/projection/checkoutQuestion/checkoutQuestion.ts +0 -20
  158. package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.test.ts +0 -31
  159. package/src/projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId.ts +0 -61
@@ -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
 
@@ -1,19 +1,25 @@
1
1
  import React from "react";
2
2
  import { Text } from "react-native";
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 { HostDefaultCheckoutQuestionItem } from "./HostDefaultCheckoutQuestionItem";
9
7
 
10
8
  const checkoutQuestionParentId = "0ad1dba8-b02c-4121-a1e3-981f1c30800d";
11
- const checkoutQuestion: CheckoutQuestionProjection = {
9
+ const checkoutQuestion: CheckoutFeedbackQuestionProjection = {
12
10
  id: "9251dc2c-d76a-484d-9299-346929af932f",
13
- name: "checkout.checkout_question.selection.question",
14
- placeholder: "",
15
- type: CheckoutQuestionType.HOST_DEFAULT,
16
- showCondition: [],
11
+ translationKey: "checkout.checkout_question.selection.question",
12
+ type: CheckoutFeedbackQuestionType.HOST_DEFAULT,
13
+ metadata: {
14
+ showCondition: [],
15
+ },
16
+ children: [
17
+ {
18
+ id: "0197594f-54f3-72bc-aadc-fb079811ad3b",
19
+ type: CheckoutFeedbackQuestionType.BUTTON,
20
+ translationKey: "checkout.checkout_question.personalshopper.yes",
21
+ },
22
+ ],
17
23
  };
18
24
 
19
25
  describe("HostDefaultCheckoutQuestionItem component (CheckoutQuestions organism)", () => {
@@ -27,7 +33,7 @@ describe("HostDefaultCheckoutQuestionItem component (CheckoutQuestions organism)
27
33
  </HostDefaultCheckoutQuestionItem>,
28
34
  );
29
35
 
30
- expect(getByText(checkoutQuestion.name)).toBeTruthy();
36
+ expect(getByText(checkoutQuestion.translationKey)).toBeTruthy();
31
37
  expect(getByText("HostDefaultCheckoutQuestionItem children")).toBeTruthy();
32
38
  });
33
39
  });
@@ -1,40 +1,34 @@
1
1
  import React from "react";
2
2
  import { Text } from "react-native";
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 { HostSelectCheckoutQuestionItem } from "./HostSelectCheckoutQuestionItem";
9
7
 
10
8
  const checkoutQuestionParentId = "0ad1dba8-b02c-4121-a1e3-981f1c30800d";
11
- const checkoutQuestion: CheckoutQuestionProjection = {
9
+ const checkoutQuestion: CheckoutFeedbackQuestionProjection = {
12
10
  id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
13
- name: "checkout.checkout_question.selection.question",
14
- placeholder: "",
15
- type: CheckoutQuestionType.HOST_SELECT,
16
- showCondition: [],
11
+ translationKey: "checkout.checkout_question.selection.question",
12
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
13
+ metadata: {
14
+ placeholder: "checkout.checkout_question.selection.question_placeholder",
15
+ showCondition: [],
16
+ },
17
17
  children: [
18
18
  {
19
19
  id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
20
- name: "checkout.checkout_question.icon.bad",
21
- placeholder: "",
22
- type: CheckoutQuestionType.ICON,
23
- showCondition: [],
20
+ translationKey: "checkout.checkout_question.icon.bad",
21
+ type: CheckoutFeedbackQuestionType.ICON,
24
22
  },
25
23
  {
26
24
  id: "85e84a77-461c-41e6-8544-95b5294d0b80",
27
- name: "checkout.checkout_question.icon.regular",
28
- placeholder: "",
29
- type: CheckoutQuestionType.ICON,
30
- showCondition: [],
25
+ translationKey: "checkout.checkout_question.icon.regular",
26
+ type: CheckoutFeedbackQuestionType.ICON,
31
27
  },
32
28
  {
33
29
  id: "29441d25-8d9f-471e-a13e-a03f61c88091",
34
- name: "checkout.checkout_question.icon.good",
35
- placeholder: "",
36
- type: CheckoutQuestionType.ICON,
37
- showCondition: [],
30
+ translationKey: "checkout.checkout_question.icon.good",
31
+ type: CheckoutFeedbackQuestionType.ICON,
38
32
  },
39
33
  ],
40
34
  };
@@ -53,7 +47,7 @@ describe("HostSelectCheckoutQuestionItem component (CheckoutQuestions organism)"
53
47
  it("renders correctly", async () => {
54
48
  const { getByText } = renderHostSelectCheckoutQuestionItem();
55
49
 
56
- expect(getByText(checkoutQuestion.name)).toBeTruthy();
50
+ expect(getByText(checkoutQuestion.translationKey)).toBeTruthy();
57
51
  expect(getByText("HostSelectCheckoutQuestionItem children")).toBeTruthy();
58
52
  });
59
53
  });
@@ -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 hostSelectCheckoutQuestionItemStyle } from "./HostSelectCheckoutQuestionItem.style";
8
10
 
9
- const HostSelectCheckoutQuestionItem: CheckoutQuestionItem = ({
11
+ const HostSelectCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.HOST_SELECT> = ({
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(() => hostSelectCheckoutQuestionItemStyle(), []);
16
18
 
@@ -1,11 +1,12 @@
1
1
  import { fireEvent } from "@testing-library/react-native";
2
2
  import React from "react";
3
+ import { CheckoutFeedbackQuestionProjection } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback";
3
4
  import {
4
- CheckoutQuestionProjection,
5
- CheckoutQuestionType,
6
- } from "../../../../../../../projection/checkoutQuestion/checkoutQuestion";
5
+ CheckoutFeedbackQuestionIcon,
6
+ CheckoutFeedbackQuestionType,
7
+ } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
7
8
  import { render } from "../../../../../test/render";
8
- import { IconCheckoutQuestionItem, IconName } from "./IconCheckoutQuestionItem";
9
+ import { IconCheckoutQuestionItem } from "./IconCheckoutQuestionItem";
9
10
 
10
11
  const mockOnChange = jest.fn();
11
12
  jest.mock("../../behaviors/useCheckoutQuestionFeedback", () => ({
@@ -13,26 +14,27 @@ jest.mock("../../behaviors/useCheckoutQuestionFeedback", () => ({
13
14
  }));
14
15
 
15
16
  const checkoutQuestionParentId = "0ad1dba8-b02c-4121-a1e3-981f1c30800d";
16
- const checkoutQuestion: CheckoutQuestionProjection = {
17
+ const checkoutQuestion: CheckoutFeedbackQuestionProjection = {
17
18
  id: "9251dc2c-d76a-484d-9299-346929af932f",
18
- name: "icon",
19
- placeholder: "",
20
- type: CheckoutQuestionType.ICON,
21
- showCondition: [],
19
+ translationKey: "icon",
20
+ type: CheckoutFeedbackQuestionType.ICON,
21
+ metadata: {
22
+ icon: "checkout_feedback.icon.regular",
23
+ },
22
24
  };
23
25
 
24
- type Scenario = [IconName];
26
+ type Scenario = [CheckoutFeedbackQuestionIcon];
25
27
  const scenarios: Scenario[] = [
26
- ["checkout_question.icon.bad"],
27
- ["checkout_question.icon.good"],
28
- ["checkout_question.icon.regular"],
28
+ ["checkout_feedback.icon.bad"],
29
+ ["checkout_feedback.icon.good"],
30
+ ["checkout_feedback.icon.regular"],
29
31
  ];
30
32
 
31
33
  describe("IconCheckoutQuestionItem component (CheckoutQuestions organism)", () => {
32
34
  test.each(scenarios)("renders correctly %s icon", (iconName) => {
33
35
  const { getByTestId } = render(
34
36
  <IconCheckoutQuestionItem
35
- checkoutQuestion={{ ...checkoutQuestion, name: iconName }}
37
+ checkoutQuestion={{ ...checkoutQuestion, translationKey: iconName }}
36
38
  checkoutQuestionParentId={checkoutQuestionParentId}
37
39
  testID={iconName}
38
40
  />,
@@ -1,31 +1,31 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import React, { FC, useCallback, useMemo } from "react";
2
3
  import { Pressable } from "react-native";
3
4
  import { SvgProps } from "react-native-svg";
4
5
  import invariant from "tiny-invariant";
6
+ import {
7
+ CheckoutFeedbackQuestionIcon,
8
+ CheckoutFeedbackQuestionType,
9
+ } from "../../../../../../../projection/checkoutFeedback/checkoutFeedback.constants";
5
10
  import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
6
- import { CheckoutQuestionItem, CheckoutQuestionItemProps } from "../CheckoutQuestionItem";
11
+ import { CheckoutQuestionItem } from "../CheckoutQuestionItem";
7
12
  import { style as iconCheckoutQuestionItemStyle } from "./IconCheckoutQuestionItem.style";
8
13
  import { Happy } from "./icons/Happy";
9
14
  import { Normal } from "./icons/Normal";
10
15
  import { Sad } from "./icons/Sad";
11
16
 
12
- type IconName = "checkout_question.icon.bad" | "checkout_question.icon.regular" | "checkout_question.icon.good";
13
-
14
- const ICON: Record<IconName, FC<SvgProps>> = {
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- "checkout_question.icon.bad": Sad,
17
- // eslint-disable-next-line @typescript-eslint/naming-convention
18
- "checkout_question.icon.regular": Normal,
19
- // eslint-disable-next-line @typescript-eslint/naming-convention
20
- "checkout_question.icon.good": Happy,
17
+ const ICON: Record<CheckoutFeedbackQuestionIcon, FC<SvgProps>> = {
18
+ ["checkout_feedback.icon.bad"]: Sad,
19
+ ["checkout_feedback.icon.regular"]: Normal,
20
+ ["checkout_feedback.icon.good"]: Happy,
21
21
  };
22
22
 
23
- const IconCheckoutQuestionItem: CheckoutQuestionItem = ({
23
+ const IconCheckoutQuestionItem: CheckoutQuestionItem<CheckoutFeedbackQuestionType.ICON> = ({
24
24
  checkoutQuestion,
25
25
  checkoutQuestionParentId,
26
26
  testID,
27
- }: CheckoutQuestionItemProps) => {
28
- const Icon = ICON[checkoutQuestion.name as IconName];
27
+ }) => {
28
+ const Icon = ICON[checkoutQuestion.metadata.icon];
29
29
 
30
30
  const style = useMemo(() => iconCheckoutQuestionItemStyle(), []);
31
31
 
@@ -51,5 +51,4 @@ const IconCheckoutQuestionItem: CheckoutQuestionItem = ({
51
51
  );
52
52
  };
53
53
 
54
- export type { IconName };
55
54
  export { IconCheckoutQuestionItem };