@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
package/src/ExpoRoot.tsx CHANGED
@@ -37,7 +37,7 @@ const order: OrderProjection = {
37
37
  };
38
38
 
39
39
  const customer: Customer = {
40
- customerId: "5c38e826-3d01-4a4b-a3d1-8a4166dc2a31",
40
+ customerId: "c7373f39-cae1-4b6d-9711-19eaf007d6a8",
41
41
  country: Country.NL,
42
42
  segment: Segment.WOMEN,
43
43
  email: "email@example.com",
@@ -58,7 +58,7 @@ const apiUrl =
58
58
  ? "/local-to-dev"
59
59
  : "/checkout/api";
60
60
  const authToken =
61
- "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU3MDEwMTIsImV4cCI6MTc1MDMyMTgwOSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDUtMTkiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiNWMzOGU4MjYtM2QwMS00YTRiLWEzZDEtOGE0MTY2ZGMyYTMxIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDc2NDM0MDl9.-amqZAXKy9KKeo9a7bOQigWw1flM99OBlddxbMBA_PU";
61
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU5OTQwMTcsImV4cCI6MTc1MjE0NDQ2MywiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDYtMTAiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiOGZjNTBkZGEtMjZiOC00YTE0LWIyYmYtN2Y0Zjk1NDFmOWJkIiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NDk1NTI0NjN9.xFDOdP0an_ki8_JsvTANVDxPXWs0iWpTs1EFMqCrbO8";
62
62
  const getAuthToken = () => Promise.resolve(authToken);
63
63
 
64
64
  const externalTranslationsUrl =
@@ -85,16 +85,16 @@ import {
85
85
  viewCheckoutBookingByIdHandler,
86
86
  VIEW_CHECKOUT_BOOKING_BY_ID,
87
87
  } from "../../projection/checkoutBooking/viewCheckoutBookingById";
88
+ import {
89
+ viewCheckoutFeedbackDefinitionByCheckoutIdHandler,
90
+ VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID,
91
+ CheckoutFeedbackDefinitionByCheckoutIdView,
92
+ } from "../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
88
93
  import {
89
94
  viewCheckoutItemByIdHandler,
90
95
  VIEW_CHECKOUT_ITEM_BY_ID,
91
96
  CheckoutItemByIdView,
92
97
  } from "../../projection/checkoutItem/viewCheckoutItemById";
93
- import {
94
- CheckoutQuestionsByCheckoutIdView,
95
- listCheckoutQuestionsByCheckoutIdHandler,
96
- LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID,
97
- } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
98
98
  import {
99
99
  PaymentFlowPayloadByCheckoutIdView,
100
100
  viewPaymentFlowPayloadByCheckoutIdHandler,
@@ -145,7 +145,7 @@ interface BaseBootstrapFunctionArgs<
145
145
  readonly bookedProductsVariantsForCheckoutItemView: BookedProductsVariantsForCheckoutItemView;
146
146
  readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
147
147
  readonly paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView;
148
- readonly checkoutQuestionsByCheckoutIdView: CheckoutQuestionsByCheckoutIdView;
148
+ readonly checkoutFeedbackDefinitionByCheckoutIdView: CheckoutFeedbackDefinitionByCheckoutIdView;
149
149
  readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
150
150
  readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
151
151
  readonly checkoutsDependencies: NeverWhenEmptyRecord<
@@ -204,7 +204,7 @@ const baseBootstrap: BaseBootstrapFunction = ({
204
204
  checkoutBookingByIdView,
205
205
  pricingByCheckoutIdView,
206
206
  paymentFlowPayloadByCheckoutIdView,
207
- checkoutQuestionsByCheckoutIdView,
207
+ checkoutFeedbackDefinitionByCheckoutIdView,
208
208
  getCheckout,
209
209
  saveCheckout,
210
210
  checkoutsDependencies,
@@ -268,8 +268,8 @@ const baseBootstrap: BaseBootstrapFunction = ({
268
268
  .query(VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, viewPaymentFlowPayloadByCheckoutIdHandler, {
269
269
  view: paymentFlowPayloadByCheckoutIdView,
270
270
  })
271
- .query(LIST_CHECKOUT_QUESTIONS_BY_CHECKOUT_ID, listCheckoutQuestionsByCheckoutIdHandler, {
272
- view: checkoutQuestionsByCheckoutIdView,
271
+ .query(VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID, viewCheckoutFeedbackDefinitionByCheckoutIdHandler, {
272
+ view: checkoutFeedbackDefinitionByCheckoutIdView,
273
273
  })
274
274
  .query(VIEW_CHECKOUT_BOOKING_BY_ID, viewCheckoutBookingByIdHandler, {
275
275
  view: checkoutBookingByIdView,
@@ -7,8 +7,8 @@ import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/vie
7
7
  import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
8
8
  import { IsSizeChangeEnabledByCheckoutIdView } from "../../projection/checkout/viewIsSizeChangeEnabledByCheckoutId";
9
9
  import { CheckoutBookingByIdView } from "../../projection/checkoutBooking/viewCheckoutBookingById";
10
+ import { CheckoutFeedbackDefinitionByCheckoutIdView } from "../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
10
11
  import { CheckoutItemByIdView } from "../../projection/checkoutItem/viewCheckoutItemById";
11
- import { CheckoutQuestionsByCheckoutIdView } from "../../projection/checkoutQuestion/listCheckoutQuestionsByCheckoutId";
12
12
  import { PaymentFlowPayloadByCheckoutIdView } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
13
13
  import { PricingByCheckoutIdView } from "../../projection/pricing/viewPricingByCheckoutId";
14
14
  import { ReturnQuestionsByCheckoutItemIdView } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
@@ -16,7 +16,7 @@ import { bookedProductsVariants } from "../projection/bookedProductsVariants/boo
16
16
  import { checkout } from "../projection/checkout/checkout.mock";
17
17
  import { checkoutBooking as checkoutBookingMock } from "../projection/checkoutBooking/checkoutBooking.mock";
18
18
  import { checkoutFeedback as checkoutFeedbackMock } from "../projection/checkoutFeedback/checkoutFeedback.mock";
19
- import { checkoutQuestions as checkoutQuestionsMock } from "../projection/checkoutQuestion/checkoutQuestions.mock";
19
+ import { checkoutFeedbackDefinition as checkoutFeedbackDefinitionMock } from "../projection/checkoutFeedback/checkoutFeedbackDefinition.mock";
20
20
  import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
21
21
  import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
22
22
  import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
@@ -73,7 +73,8 @@ const bookedProductsVariantsForCheckoutItemView: BookedProductsVariantsForChecko
73
73
  bookedProductsVariants;
74
74
  const pricingByCheckoutIdView: PricingByCheckoutIdView = async () => pricingMock();
75
75
  const paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView = async () => paymentFlowPayloadMock;
76
- const checkoutQuestionsByCheckoutIdView: CheckoutQuestionsByCheckoutIdView = async () => checkoutQuestionsMock;
76
+ const checkoutFeedbackDefinitionByCheckoutIdView: CheckoutFeedbackDefinitionByCheckoutIdView = async () =>
77
+ checkoutFeedbackDefinitionMock;
77
78
 
78
79
  const bootstrap: () => BuildBootstrapFunctionReturn = () =>
79
80
  baseBootstrap({
@@ -88,7 +89,7 @@ const bootstrap: () => BuildBootstrapFunctionReturn = () =>
88
89
  bookedProductsVariantsForCheckoutItemView,
89
90
  pricingByCheckoutIdView,
90
91
  paymentFlowPayloadByCheckoutIdView,
91
- checkoutQuestionsByCheckoutIdView,
92
+ checkoutFeedbackDefinitionByCheckoutIdView,
92
93
  getCheckout,
93
94
  saveCheckout,
94
95
  checkoutsDependencies: [{ dataSource }],
@@ -13,8 +13,8 @@ import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/ht
13
13
  import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
14
14
  import { httpIsSizeChangeEnabledByCheckoutIdView } from "../projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView";
15
15
  import { httpCheckoutBookingByIdView } from "../projection/checkoutBooking/httpCheckoutBookingByIdView";
16
+ import { httpCheckoutFeedbackDefinitionByCheckoutIdView } from "../projection/checkoutFeedback/httpCheckoutFeedbackDefinitionByCheckoutIdView";
16
17
  import { httpCheckoutItemByIdView } from "../projection/checkoutItem/httpCheckoutItemByIdView";
17
- import { httpCheckoutQuestionsByCheckoutIdView } from "../projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView";
18
18
  import { httpPaymentFlowPayloadByCheckoutIdView } from "../projection/payment/httpPaymentFlowPayloadByCheckoutIdView";
19
19
  import { httpPricingByCheckoutIdView } from "../projection/pricing/httpPricingByCheckoutIdView";
20
20
  import { httpReturnQuestionsByCheckoutItemIdView } from "../projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView";
@@ -55,7 +55,7 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken }) => {
55
55
  paymentFlowPayloadByCheckoutIdView: httpPaymentFlowPayloadByCheckoutIdView({
56
56
  httpPost,
57
57
  }),
58
- checkoutQuestionsByCheckoutIdView: httpCheckoutQuestionsByCheckoutIdView({
58
+ checkoutFeedbackDefinitionByCheckoutIdView: httpCheckoutFeedbackDefinitionByCheckoutIdView({
59
59
  httpPost,
60
60
  }),
61
61
  getCheckout,
@@ -0,0 +1,110 @@
1
+ import { CheckoutFeedbackQuestionProjection } from "../../../projection/checkoutFeedback/checkoutFeedback";
2
+ import { CheckoutFeedbackQuestionType } from "../../../projection/checkoutFeedback/checkoutFeedback.constants";
3
+
4
+ const checkoutFeedbackDefinition: CheckoutFeedbackQuestionProjection[] = [
5
+ {
6
+ id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
7
+ translationKey: "checkout_question.selection.question",
8
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
9
+ metadata: {
10
+ placeholder: "checkout_question.selection.placeholder",
11
+ showCondition: [],
12
+ },
13
+ children: [
14
+ {
15
+ id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
16
+ type: CheckoutFeedbackQuestionType.ICON,
17
+ metadata: {
18
+ icon: "checkout_feedback.icon.bad",
19
+ },
20
+ },
21
+ {
22
+ id: "85e84a77-461c-41e6-8544-95b5294d0b80",
23
+ type: CheckoutFeedbackQuestionType.ICON,
24
+ metadata: {
25
+ icon: "checkout_feedback.icon.regular",
26
+ },
27
+ },
28
+ {
29
+ id: "29441d25-8d9f-471e-a13e-a03f61c88091",
30
+ type: CheckoutFeedbackQuestionType.ICON,
31
+ metadata: {
32
+ icon: "checkout_feedback.icon.good",
33
+ },
34
+ },
35
+ ],
36
+ },
37
+ {
38
+ id: "6a6d3878-5561-412c-96f3-7ed79ee587bb",
39
+ translationKey: "checkout_question.experience.question",
40
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
41
+ metadata: {
42
+ placeholder: "checkout_question.experience.placeholder",
43
+ showCondition: [],
44
+ },
45
+ children: [
46
+ {
47
+ id: "a3d937b6-7499-4a3c-86bf-5c0af9ab2e23",
48
+ type: CheckoutFeedbackQuestionType.ICON,
49
+ metadata: {
50
+ icon: "checkout_feedback.icon.bad",
51
+ },
52
+ },
53
+ {
54
+ id: "7970edd3-fb5c-42d3-afe3-ce31bcbb856c",
55
+ type: CheckoutFeedbackQuestionType.ICON,
56
+ metadata: {
57
+ icon: "checkout_feedback.icon.regular",
58
+ },
59
+ },
60
+ {
61
+ id: "bab3d4f9-0227-4550-a53f-3c125d68429c",
62
+ type: CheckoutFeedbackQuestionType.ICON,
63
+ metadata: {
64
+ icon: "checkout_feedback.icon.good",
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ id: "a1acdb2d-62c8-467f-b7cc-dc24d967290c",
71
+ translationKey: "checkout_question.personalshopper.question",
72
+ type: CheckoutFeedbackQuestionType.HOST_SELECT,
73
+ metadata: {
74
+ showCondition: ["68c0bb98-b00a-4b86-af43-528fe903cb69"],
75
+ placeholder: "checkout_question.personalshopper.placeholder",
76
+ },
77
+ children: [
78
+ {
79
+ id: "cce7851c-92c7-461b-8dcb-903c5de59ed1",
80
+ translationKey: "checkout_question.personalshopper.yes",
81
+ type: CheckoutFeedbackQuestionType.BUTTON,
82
+ },
83
+ {
84
+ id: "4bf8f27d-669b-4d36-8d39-b5599c671816",
85
+ translationKey: "checkout_question.personalshopper.no",
86
+ type: CheckoutFeedbackQuestionType.BUTTON,
87
+ },
88
+ ],
89
+ },
90
+ {
91
+ id: "ce3e8d57-5eea-4dd3-bef4-2e811a143612",
92
+ translationKey: "checkout_question.comment.question",
93
+ type: CheckoutFeedbackQuestionType.HOST_TEXTAREA,
94
+ metadata: {
95
+ showCondition: [],
96
+ },
97
+ children: [
98
+ {
99
+ id: "1123a37d-bc00-43a4-9d28-cee1dfaf356c",
100
+ translationKey: "checkout_question.comment.question",
101
+ type: CheckoutFeedbackQuestionType.TEXTAREA,
102
+ metadata: {
103
+ placeholder: "checkout_question.comment.placeholder",
104
+ },
105
+ },
106
+ ],
107
+ },
108
+ ];
109
+
110
+ export { checkoutFeedbackDefinition };
@@ -0,0 +1,52 @@
1
+ import { mock } from "jest-mock-extended";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import { checkoutFeedbackDefinition } from "./checkoutFeedbackDefinition.mock";
4
+ import { httpCheckoutFeedbackDefinitionByCheckoutIdView as sut } from "./httpCheckoutFeedbackDefinitionByCheckoutIdView";
5
+
6
+ const fetchMock = jest.fn();
7
+ global.fetch = fetchMock;
8
+ const apiUrl = "/api";
9
+ const getAuthToken = () => Promise.resolve("token");
10
+ const view = sut({ httpPost: fetchHttpPost({ apiUrl: () => apiUrl, getAuthToken, device: "web", version: "1.0.0" }) });
11
+ const signal = mock<AbortSignal>();
12
+
13
+ const checkoutId = "29790d24-b139-4ab8-b618-d796d101e974";
14
+
15
+ const checkoutFeedbackDefinitionResponseOk: Response = {
16
+ ok: true,
17
+ status: 200,
18
+ text: () => Promise.resolve(JSON.stringify(checkoutFeedbackDefinition)),
19
+ } as Response;
20
+ const checkoutFeedbackDefinitionResponseNotFound: Response = {
21
+ ok: false,
22
+ status: 404,
23
+ } as Response;
24
+ const checkoutFeedbackDefinitionResponseError: Response = {
25
+ ok: false,
26
+ } as Response;
27
+
28
+ describe("httpCheckoutFeedbackDefinitionByCheckoutIdView", () => {
29
+ it("returns a checkoutFeedbackDefinition projection for a 200 response", async () => {
30
+ fetchMock.mockReturnValue(Promise.resolve(checkoutFeedbackDefinitionResponseOk));
31
+
32
+ const returnedCheckoutFeedbackDefinition = await view({ checkoutId, signal });
33
+
34
+ expect(returnedCheckoutFeedbackDefinition).toStrictEqual(checkoutFeedbackDefinition);
35
+ });
36
+
37
+ it("returns null for a 404 response", async () => {
38
+ fetchMock.mockReturnValue(Promise.resolve(checkoutFeedbackDefinitionResponseNotFound));
39
+
40
+ const returnedCheckoutFeedbackDefinition = await view({ checkoutId, signal });
41
+
42
+ expect(returnedCheckoutFeedbackDefinition).toBeNull();
43
+ });
44
+
45
+ it("returns null for a non successfull response", async () => {
46
+ fetchMock.mockReturnValue(Promise.resolve(checkoutFeedbackDefinitionResponseError));
47
+
48
+ const returnedCheckoutFeedbackDefinition = await view({ checkoutId, signal });
49
+
50
+ expect(returnedCheckoutFeedbackDefinition).toBeNull();
51
+ });
52
+ });
@@ -0,0 +1,30 @@
1
+ import { HttpPostFunction } from "@lookiero/sty-psp-http";
2
+ import {
3
+ CheckoutFeedbackDefinitionByCheckoutIdView,
4
+ ViewCheckoutFeedbackDefinitionByCheckoutIdResult,
5
+ } from "../../../projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId";
6
+
7
+ interface HttpCheckoutFeedbackDefinitionByCheckoutIdView extends CheckoutFeedbackDefinitionByCheckoutIdView {}
8
+
9
+ interface HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunctionArgs {
10
+ readonly httpPost: HttpPostFunction;
11
+ }
12
+
13
+ interface HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunction {
14
+ (args: HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunctionArgs): HttpCheckoutFeedbackDefinitionByCheckoutIdView;
15
+ }
16
+
17
+ const httpCheckoutFeedbackDefinitionByCheckoutIdView: HttpCheckoutFeedbackDefinitionByCheckoutIdViewFunction =
18
+ ({ httpPost }) =>
19
+ async ({ checkoutId, signal }) =>
20
+ await httpPost<ViewCheckoutFeedbackDefinitionByCheckoutIdResult>({
21
+ endpoint: "/view-checkout-feedback-definition-by-checkout-id",
22
+ body: { checkoutId },
23
+ signal,
24
+ result: {
25
+ error: null,
26
+ success: (response) => response,
27
+ },
28
+ });
29
+
30
+ export { httpCheckoutFeedbackDefinitionByCheckoutIdView };
@@ -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 };
@@ -8,76 +8,65 @@ const returnQuestions: ReturnQuestionProjection[] = [
8
8
  type: ReturnQuestionType.HOST_DEFAULT,
9
9
  children: [
10
10
  {
11
- id: "ed396b68-1436-48ab-842f-fbfea996fad4",
12
- translationKey: "size",
13
- type: ReturnQuestionType.HOST_SELECT,
14
- metadata: {
15
- placeholder: "size_placeholder",
16
- },
11
+ id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
12
+ type: ReturnQuestionType.HOST_RADIO_GROUP,
17
13
  children: [
18
14
  {
19
- id: "0ad1dba8-b02c-4121-a1e3-981f1c30800d",
20
- translationKey: "size_title",
21
- type: ReturnQuestionType.HOST_STACK,
15
+ id: "9251dc2c-d76a-484d-9299-346929af932f",
16
+ translationKey: "size_large",
17
+ type: ReturnQuestionType.OPTION,
22
18
  children: [
23
19
  {
24
- id: "9251dc2c-d76a-484d-9299-346929af932f",
25
- translationKey: "size_large",
26
- type: ReturnQuestionType.OPTION,
20
+ id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
21
+ type: ReturnQuestionType.HOST_STACK,
27
22
  children: [
28
23
  {
29
- id: "542c4d24-e1da-484f-8c3a-7d89ee135adc",
30
- type: ReturnQuestionType.HOST_STACK,
31
- children: [
32
- {
33
- id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
34
- translationKey: "size_overall",
35
- type: ReturnQuestionType.OPTION,
36
- },
37
- {
38
- id: "85e84a77-461c-41e6-8544-95b5294d0b80",
39
- translationKey: "size_trousers_too_long",
40
- type: ReturnQuestionType.OPTION,
41
- },
42
- {
43
- id: "29441d25-8d9f-471e-a13e-a03f61c88091",
44
- translationKey: "size_fit_cut_does_not_fit",
45
- type: ReturnQuestionType.OPTION,
46
- },
47
- ],
24
+ id: "68c0bb98-b00a-4b86-af43-528fe903cb69",
25
+ translationKey: "size_overall",
26
+ type: ReturnQuestionType.OPTION,
27
+ },
28
+ {
29
+ id: "85e84a77-461c-41e6-8544-95b5294d0b80",
30
+ translationKey: "size_trousers_too_long",
31
+ type: ReturnQuestionType.OPTION,
32
+ },
33
+ {
34
+ id: "29441d25-8d9f-471e-a13e-a03f61c88091",
35
+ translationKey: "size_fit_cut_does_not_fit",
36
+ type: ReturnQuestionType.OPTION,
48
37
  },
49
38
  ],
50
39
  },
40
+ ],
41
+ },
42
+ {
43
+ id: "a081c3e9-1904-4a60-8899-b72c1a3a0291",
44
+ translationKey: "size_correct",
45
+ type: ReturnQuestionType.OPTION,
46
+ },
47
+ {
48
+ id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
49
+ translationKey: "size_small",
50
+ type: ReturnQuestionType.OPTION,
51
+ children: [
51
52
  {
52
- id: "a081c3e9-1904-4a60-8899-b72c1a3a0291",
53
- translationKey: "size_correct",
54
- type: ReturnQuestionType.OPTION,
55
- },
56
- {
57
- id: "624cce3d-bd86-463a-b16b-c862ad73d5f3",
58
- translationKey: "size_small",
59
- type: ReturnQuestionType.OPTION,
53
+ id: "58e5ae9a-bc0d-4d27-b267-854a51c2a79a",
54
+ type: ReturnQuestionType.HOST_STACK,
60
55
  children: [
61
56
  {
62
- id: "58e5ae9a-bc0d-4d27-b267-854a51c2a79a",
63
- type: ReturnQuestionType.HOST_STACK,
64
- children: [
65
- {
66
- id: "6a3d11fc-570c-4085-a850-1967228cdd4c",
67
- translationKey: "size_overall",
68
- type: ReturnQuestionType.OPTION,
69
- },
70
- {
71
- id: "c27e1936-deea-4dbe-a8f1-fe4fb8564deb",
72
- translationKey: "size_trousers_too_short",
73
- type: ReturnQuestionType.OPTION,
74
- },
75
- {
76
- id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
77
- translationKey: "size_fit_cut_does_not_fit",
78
- type: ReturnQuestionType.OPTION,
79
- },
80
- ],
57
+ id: "6a3d11fc-570c-4085-a850-1967228cdd4c",
58
+ translationKey: "size_overall",
59
+ type: ReturnQuestionType.OPTION,
60
+ },
61
+ {
62
+ id: "c27e1936-deea-4dbe-a8f1-fe4fb8564deb",
63
+ translationKey: "size_trousers_too_short",
64
+ type: ReturnQuestionType.OPTION,
65
+ },
66
+ {
67
+ id: "e77232ae-eeec-4722-b2d3-f5c0d34fd0ca",
68
+ translationKey: "size_fit_cut_does_not_fit",
69
+ type: ReturnQuestionType.OPTION,
81
70
  },
82
71
  ],
83
72
  },
@@ -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 }) => (