@lookiero/checkout 8.14.0-beta.2 → 8.14.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 (225) hide show
  1. package/.eslintrc.js +1 -1
  2. package/cypress/integration/checkout.spec.ts +259 -0
  3. package/cypress/support/e2e.ts +3 -0
  4. package/cypress/support/index.d.ts +8 -0
  5. package/cypress/support/interceptBlockCheckoutBooking.ts +4 -0
  6. package/cypress/support/interceptGiveCheckoutFeedback.ts +4 -0
  7. package/cypress/support/interceptKeepCheckoutItem.ts +4 -0
  8. package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +9 -0
  9. package/cypress/support/interceptListReturnQuestionsByCheckoutItemId.ts +9 -0
  10. package/cypress/support/interceptPayment.ts +23 -0
  11. package/cypress/support/interceptReplaceCheckoutItem.ts +4 -0
  12. package/cypress/support/interceptReturnCheckoutItem.ts +4 -0
  13. package/cypress/support/interceptSubmitCheckout.ts +4 -0
  14. package/cypress/support/interceptViewBookedProductsVariantsForCheckoutItem.ts +9 -0
  15. package/cypress/support/interceptViewCheckoutById.ts +6 -0
  16. package/cypress/support/interceptViewFirstAvailableCheckoutByCustomerId.ts +9 -0
  17. package/cypress/support/interceptViewFiveItemsDiscountByCustomerId.ts +6 -0
  18. package/cypress/support/interceptViewIsSizeChangeEnabledByCheckoutId.ts +6 -0
  19. package/cypress/support/interceptViewPaymentFlowPayloadByCheckoutId.ts +9 -0
  20. package/cypress/support/interceptViewPricingByCheckoutId.ts +6 -0
  21. package/cypress/tsconfig.json +8 -0
  22. package/cypress.config.ts +50 -0
  23. package/dist/src/ExpoRoot.js +2 -2
  24. package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
  25. package/dist/src/infrastructure/ui/Root.d.ts +0 -2
  26. package/dist/src/infrastructure/ui/Root.js +2 -2
  27. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.d.ts +0 -5
  28. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +5 -3
  29. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.d.ts +0 -5
  30. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.js +1 -1
  31. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.js +2 -1
  32. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.d.ts +3 -3
  33. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +4 -8
  34. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.d.ts +2 -1
  35. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.js +1 -0
  36. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.d.ts +2 -1
  37. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +8 -6
  38. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.d.ts +2 -1
  39. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -1
  40. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.d.ts +2 -1
  41. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +4 -3
  42. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
  43. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
  44. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.d.ts +2 -1
  45. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +2 -1
  46. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.d.ts +2 -1
  47. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +7 -5
  48. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.d.ts +1 -3
  49. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +6 -4
  50. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.d.ts +2 -1
  51. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -1
  52. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.d.ts +2 -1
  53. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +6 -5
  54. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.d.ts +2 -1
  55. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +2 -1
  56. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.d.ts +2 -1
  57. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -1
  58. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.js +18 -9
  59. package/dist/src/infrastructure/ui/routing/Routing.d.ts +0 -7
  60. package/dist/src/infrastructure/ui/routing/Routing.js +5 -5
  61. package/dist/src/infrastructure/ui/views/App.d.ts +0 -8
  62. package/dist/src/infrastructure/ui/views/App.js +6 -8
  63. package/dist/src/infrastructure/ui/views/item/Item.d.ts +0 -5
  64. package/dist/src/infrastructure/ui/views/item/Item.js +3 -3
  65. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.d.ts +0 -2
  66. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +2 -2
  67. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
  68. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
  69. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +1 -5
  70. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -2
  71. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.d.ts +0 -5
  72. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +3 -3
  73. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +3 -3
  74. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +2 -2
  75. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
  76. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
  77. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.d.ts +0 -2
  78. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +2 -2
  79. package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.d.ts +0 -5
  80. package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -2
  81. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.d.ts +0 -5
  82. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +2 -2
  83. package/dist/src/infrastructure/ui/views/return/Return.d.ts +0 -5
  84. package/dist/src/infrastructure/ui/views/return/Return.js +2 -2
  85. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -5
  86. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +15 -13
  87. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +6 -2
  88. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +6 -2
  89. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -2
  90. package/dist/src/projection/returnQuestion/returnQuestion.constants.d.ts +9 -0
  91. package/dist/src/projection/returnQuestion/returnQuestion.constants.js +10 -0
  92. package/dist/src/projection/returnQuestion/returnQuestion.d.ts +23 -16
  93. package/dist/src/projection/returnQuestion/returnQuestion.js +1 -11
  94. package/dist/src/projection/returnQuestion/returnQuestion.metadata.d.ts +12 -0
  95. package/dist/src/projection/returnQuestion/returnQuestion.metadata.js +1 -0
  96. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.d.ts +5 -0
  97. package/dist/src/projection/returnQuestion/returnQuestion.typeguard.js +10 -0
  98. package/dist/src/version.d.ts +1 -1
  99. package/dist/src/version.js +1 -1
  100. package/jest.setup.js +0 -20
  101. package/package.json +9 -8
  102. package/src/ExpoRoot.tsx +2 -2
  103. package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.test.ts +1 -1
  104. package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
  105. package/src/infrastructure/projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId.test.ts +4 -9
  106. package/src/infrastructure/projection/returnQuestion/returnQuestions.mock.ts +72 -117
  107. package/src/infrastructure/ui/Root.tsx +1 -4
  108. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.test.tsx +10 -12
  109. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +11 -22
  110. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.test.tsx +10 -9
  111. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.tsx +1 -8
  112. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/isChildReturnQuestion.ts +2 -1
  113. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.test.tsx +7 -9
  114. package/src/infrastructure/ui/components/organisms/returnQuestions/behaviors/useReturnQuestionItem.tsx +3 -3
  115. package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +4 -9
  116. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.test.tsx +7 -13
  117. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionFeedbackItem/HostDefaultReturnQuestionFeedbackItem.tsx +4 -2
  118. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.test.tsx +8 -14
  119. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +13 -7
  120. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +7 -5
  121. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
  122. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.test.tsx +10 -14
  123. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +8 -7
  124. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +5 -5
  125. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.test.tsx +43 -36
  126. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +10 -9
  127. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +13 -14
  128. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.test.tsx +8 -14
  129. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +6 -4
  130. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +8 -7
  131. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.test.tsx +23 -25
  132. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +5 -3
  133. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.test.tsx +9 -29
  134. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +7 -5
  135. package/src/infrastructure/ui/components/organisms/returnQuestions/util/__snapshots__/returnQuestionFeedback.test.ts.snap +5 -4
  136. package/src/infrastructure/ui/components/organisms/returnQuestions/util/returnQuestionFeedback.ts +32 -18
  137. package/src/infrastructure/ui/routing/Routing.tsx +5 -13
  138. package/src/infrastructure/ui/views/App.tsx +11 -21
  139. package/src/infrastructure/ui/views/item/Item.tsx +2 -8
  140. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
  141. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +3 -9
  142. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +7 -0
  143. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +1 -8
  144. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +5 -16
  145. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
  146. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +6 -6
  147. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +7 -0
  148. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +3 -4
  149. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +7 -0
  150. package/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.tsx +2 -12
  151. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +4 -14
  152. package/src/infrastructure/ui/views/return/Return.tsx +1 -8
  153. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +6 -2
  154. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +39 -34
  155. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -2
  156. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +2 -2
  157. package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.test.ts +4 -12
  158. package/src/projection/returnQuestion/returnQuestion.constants.ts +10 -0
  159. package/src/projection/returnQuestion/returnQuestion.metadata.ts +17 -0
  160. package/src/projection/returnQuestion/returnQuestion.ts +42 -20
  161. package/src/projection/returnQuestion/returnQuestion.typeguard.ts +24 -0
  162. package/dist/pact.config.d.ts +0 -13
  163. package/dist/pact.config.js +0 -9
  164. package/dist/public/public/assets/adaptive-icon.png +0 -0
  165. package/dist/public/public/assets/favicon.png +0 -0
  166. package/dist/public/public/assets/icon.png +0 -0
  167. package/dist/public/public/assets/splash.png +0 -0
  168. package/dist/public/public/images/not-found.png +0 -0
  169. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -3
  170. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +0 -27
  171. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
  172. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -48
  173. package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +0 -19
  174. package/dist/src/infrastructure/projection/checkout/checkout.mock.js +0 -21
  175. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
  176. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -109
  177. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
  178. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -49
  179. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
  180. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -44
  181. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
  182. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -44
  183. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
  184. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -44
  185. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -3
  186. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +0 -6
  187. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
  188. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -49
  189. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +0 -15
  190. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +0 -43
  191. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
  192. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -50
  193. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
  194. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
  195. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
  196. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -48
  197. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
  198. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -109
  199. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +0 -6
  200. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +0 -183
  201. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
  202. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -48
  203. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +0 -9
  204. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +0 -42
  205. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
  206. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -48
  207. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -3
  208. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +0 -400
  209. package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
  210. package/dist/src/infrastructure/ui/views/App.style.js +0 -7
  211. package/pact.config.ts +0 -31
  212. package/pact.publish.js +0 -32
  213. package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +0 -62
  214. package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +0 -128
  215. package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +0 -63
  216. package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +0 -57
  217. package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +0 -57
  218. package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +0 -57
  219. package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +0 -63
  220. package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +0 -64
  221. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +0 -62
  222. package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +0 -136
  223. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +0 -62
  224. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +0 -62
  225. package/src/infrastructure/ui/views/App.style.ts +0 -9
@@ -1,5 +1,4 @@
1
1
  import React, { FC } from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
2
  import { useParams } from "react-router-native";
4
3
  import { Spinner } from "@lookiero/aurora";
5
4
  import { QueryStatus } from "@lookiero/messaging-react";
@@ -10,16 +9,11 @@ import { ReturnQuestionFeedbackProvider } from "../../components/organisms/retur
10
9
  import { useStaticInfo } from "../../hooks/useStaticInfo";
11
10
  import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
12
11
 
13
- interface ReturnStyle {
14
- readonly modal: StyleProp<ViewStyle>;
15
- }
16
-
17
12
  interface ReturnProps {
18
13
  readonly layout: UiLayout;
19
- readonly style?: Partial<ReturnStyle>;
20
14
  }
21
15
 
22
- const Return: FC<ReturnProps> = ({ layout, style: customStyle }) => {
16
+ const Return: FC<ReturnProps> = ({ layout }) => {
23
17
  const { id } = useParams();
24
18
  const {
25
19
  customer: { customerId, country, segment },
@@ -43,7 +37,6 @@ const Return: FC<ReturnProps> = ({ layout, style: customStyle }) => {
43
37
  country={country}
44
38
  layout={layout}
45
39
  segment={segment}
46
- style={customStyle}
47
40
  />
48
41
  </ReturnQuestionFeedbackProvider>
49
42
  );
@@ -5,6 +5,9 @@ import { HEADER_HEIGHT } from "../../../../components/templates/header/Header.st
5
5
  const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space4, space6, space8 } = theme();
6
6
 
7
7
  const style = StyleSheet.create({
8
+ background: {
9
+ backgroundColor: colorBgPrimaryLight,
10
+ },
8
11
  description: {
9
12
  color: colorTextMedium,
10
13
  },
@@ -33,7 +36,6 @@ const style = StyleSheet.create({
33
36
  justifyContent: "center",
34
37
  },
35
38
  safeAreaView: {
36
- backgroundColor: colorBgPrimaryLight,
37
39
  flex: 1,
38
40
  },
39
41
  scrollView: {
@@ -41,9 +43,11 @@ const style = StyleSheet.create({
41
43
  },
42
44
  submit: {
43
45
  backgroundColor: colorBgBase,
46
+ padding: space6,
47
+ },
48
+ submitDesktop: {
44
49
  borderBottomLeftRadius: borderRadius5,
45
50
  borderBottomRightRadius: borderRadius5,
46
- padding: space6,
47
51
  },
48
52
  });
49
53
 
@@ -1,6 +1,7 @@
1
1
  import { PortalHost } from "@gorhom/portal";
2
2
  import React, { FC, useCallback, useMemo } from "react";
3
- import { ScrollView, StyleProp, ViewStyle } from "react-native";
3
+ import { Platform } from "react-native";
4
+ import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
4
5
  import { generatePath, useNavigate } from "react-router-native";
5
6
  import { Box, Button, Layout as AuroraLayout, Spinner, Text, View, useDevice } from "@lookiero/aurora";
6
7
  import { useI18nMessage } from "@lookiero/i18n-react";
@@ -11,7 +12,7 @@ import { Segment } from "@lookiero/sty-psp-segment";
11
12
  import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
12
13
  import { CheckoutProjection } from "../../../../../../projection/checkout/checkout";
13
14
  import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
14
- import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion";
15
+ import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion.constants";
15
16
  import { useReturnCheckoutItem } from "../../../../../domain/checkoutItem/react/useReturnCheckoutItem";
16
17
  import { useListReturnQuestionsByCheckoutItemId } from "../../../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
17
18
  import { TrackingPage } from "../../../../../tracking/tracking";
@@ -48,17 +49,12 @@ const returnQuestionItems: ReturnQuestionItems = {
48
49
  [ReturnQuestionType.OPTION]: RadioReturnQuestionItem,
49
50
  };
50
51
 
51
- interface ReturnQuestionsFormStyle {
52
- readonly modal: StyleProp<ViewStyle>;
53
- }
54
-
55
52
  interface ReturnQuestionsFormProps {
56
53
  readonly checkout: CheckoutProjection;
57
54
  readonly checkoutItem: CheckoutItemProjection;
58
55
  readonly country: Country;
59
56
  readonly layout: UiLayout;
60
57
  readonly segment: Segment;
61
- readonly style?: Partial<ReturnQuestionsFormStyle>;
62
58
  }
63
59
 
64
60
  const ReturnQuestionsForm: FC<ReturnQuestionsFormProps> = ({
@@ -67,7 +63,6 @@ const ReturnQuestionsForm: FC<ReturnQuestionsFormProps> = ({
67
63
  country,
68
64
  layout: Layout,
69
65
  segment,
70
- style: customStyle,
71
66
  }) => {
72
67
  const navigate = useNavigate();
73
68
  const basePath = useBasePath();
@@ -148,6 +143,7 @@ const ReturnQuestionsForm: FC<ReturnQuestionsFormProps> = ({
148
143
  <PortalHost name={RETURN_QUESTION_FORM_PORTAL_HOST_NAME} />
149
144
 
150
145
  <Layout
146
+ footer={null}
151
147
  header={header}
152
148
  scrollEnabled={false}
153
149
  style={{
@@ -158,32 +154,41 @@ const ReturnQuestionsForm: FC<ReturnQuestionsFormProps> = ({
158
154
  >
159
155
  <ProductVariantPreview country={country} item={checkoutItem} />
160
156
 
161
- <ScrollView showsVerticalScrollIndicator={false} testID="return-questions-form">
162
- <AuroraLayout fullWidth={!screen.L} style={[style.layout, screen.L ? style.desktopLayoutSpacing : undefined]}>
163
- <Box size={{ L: "2/3" }}>
164
- <View style={[style.info, !screen.S && style.desktopInfo]}>
165
- <Text level={3} heading>
166
- {titleText}
167
- </Text>
168
- <Text level={1} style={style.description} detail>
169
- {descriptionText}
170
- </Text>
171
- </View>
172
-
173
- <ReturnQuestions
174
- portalHostName={RETURN_QUESTION_FORM_PORTAL_HOST_NAME}
175
- returnQuestions={returnQuestions}
176
- style={customStyle}
177
- />
178
-
179
- <View style={style.submit}>
180
- <Button testID="return-questions-button" onPress={handleOnSubmit}>
181
- {submitButtonText}
182
- </Button>
183
- </View>
184
- </Box>
185
- </AuroraLayout>
186
- </ScrollView>
157
+ <KeyboardAwareScrollView
158
+ extraScrollHeight={Platform.OS === "android" ? 10 : 120}
159
+ keyboardShouldPersistTaps="handled"
160
+ showsVerticalScrollIndicator={false}
161
+ testID="return-questions-form"
162
+ >
163
+ <View style={style.background}>
164
+ <AuroraLayout
165
+ fullWidth={!screen.L}
166
+ style={[style.layout, screen.L ? style.desktopLayoutSpacing : undefined]}
167
+ >
168
+ <Box size={{ L: "2/3" }}>
169
+ <View style={[style.info, !screen.S && style.desktopInfo]}>
170
+ <Text level={3} heading>
171
+ {titleText}
172
+ </Text>
173
+ <Text level={1} style={style.description} detail>
174
+ {descriptionText}
175
+ </Text>
176
+ </View>
177
+
178
+ <ReturnQuestions
179
+ portalHostName={RETURN_QUESTION_FORM_PORTAL_HOST_NAME}
180
+ returnQuestions={returnQuestions}
181
+ />
182
+
183
+ <View style={[style.submit, !screen.S && style.submitDesktop]}>
184
+ <Button testID="return-questions-button" onPress={handleOnSubmit}>
185
+ {submitButtonText}
186
+ </Button>
187
+ </View>
188
+ </Box>
189
+ </AuroraLayout>
190
+ </View>
191
+ </KeyboardAwareScrollView>
187
192
  </Layout>
188
193
  </ReturnQuestionItemProvider>
189
194
  );
@@ -60,7 +60,7 @@ const CollapsiblePricing: FC<CollapsiblePricingProps> = ({
60
60
  </View>
61
61
 
62
62
  <View style={style.collapsedContent}>
63
- <Button testID="confirm-checkout-collpased-button" small onPress={onSubmit}>
63
+ <Button testID="submit-checkout-collpased-button" small onPress={onSubmit}>
64
64
  {submitButtonText}
65
65
  </Button>
66
66
  </View>
@@ -69,7 +69,7 @@ const CollapsiblePricing: FC<CollapsiblePricingProps> = ({
69
69
  <animated.View style={{ opacity: notCollapsedStyle.opacitiy }}>
70
70
  <Pricing pricing={pricing} totalCheckoutItemsKept={totalCheckoutItemsKept} />
71
71
 
72
- <Button testID="confirm-checkout-button" onPress={onSubmit}>
72
+ <Button testID="submit-checkout-button" onPress={onSubmit}>
73
73
  {submitButtonText}
74
74
  </Button>
75
75
  </animated.View>
@@ -243,7 +243,7 @@ exports[`Pricing component matches the snapshot for collaped pricing: collapsed
243
243
  },
244
244
  ]
245
245
  }
246
- testID="confirm-checkout-collpased-button"
246
+ testID="submit-checkout-collpased-button"
247
247
  >
248
248
  <View
249
249
  collapsable={false}
@@ -543,7 +543,7 @@ exports[`Pricing component matches the snapshot for non-collaped pricing: non-co
543
543
  },
544
544
  ]
545
545
  }
546
- testID="confirm-checkout-collpased-button"
546
+ testID="submit-checkout-collpased-button"
547
547
  >
548
548
  <View
549
549
  collapsable={false}
@@ -1,30 +1,22 @@
1
1
  import { mock } from "jest-mock-extended";
2
2
  import { QueryBus } from "@lookiero/messaging";
3
+ import { returnQuestions } from "../../infrastructure/projection/returnQuestion/returnQuestions.mock";
3
4
  import {
4
5
  listReturnQuestionsByCheckoutItemId,
5
6
  listReturnQuestionsByCheckoutItemIdHandler as sut,
6
7
  } from "./listReturnQuestionsByCheckoutItemId";
7
- import { ReturnQuestionProjection, ReturnQuestionType } from "./returnQuestion";
8
8
 
9
9
  const checkoutItemId = "29790d24-b139-4ab8-b618-d796d101e974";
10
- const returnQuestionsProjection: ReturnQuestionProjection[] = [
11
- {
12
- id: "efe07b97-f6fb-4b6a-ba92-b68519320b2c",
13
- name: "main_title",
14
- placeholder: "",
15
- type: ReturnQuestionType.HOST_DEFAULT,
16
- },
17
- ];
18
10
  const queryBus = mock<QueryBus>();
19
11
  const signal = mock<AbortSignal>();
20
12
 
21
13
  describe("listReturnQuestionsByCheckoutItemId", () => {
22
14
  it("returns return questions by checkout item id", async () => {
23
15
  const query = listReturnQuestionsByCheckoutItemId({ checkoutItemId });
24
- const view = jest.fn(() => Promise.resolve(returnQuestionsProjection));
16
+ const view = jest.fn(() => Promise.resolve(returnQuestions));
25
17
 
26
- const returnQuestionsProjectionResult = await sut({ view, queryBus, signal })(query);
18
+ const returnQuestionsResult = await sut({ view, queryBus, signal })(query);
27
19
 
28
- expect(returnQuestionsProjectionResult).toBe(returnQuestionsProjection);
20
+ expect(returnQuestionsResult).toBe(returnQuestions);
29
21
  });
30
22
  });
@@ -0,0 +1,10 @@
1
+ enum ReturnQuestionType {
2
+ HOST_DEFAULT = "HOST_DEFAULT",
3
+ HOST_TEXTAREA = "HOST_TEXTAREA",
4
+ HOST_SELECT = "HOST_SELECT",
5
+ HOST_STACK = "HOST_STACK",
6
+ TEXTAREA = "TEXTAREA",
7
+ OPTION = "OPTION",
8
+ }
9
+
10
+ export { ReturnQuestionType };
@@ -0,0 +1,17 @@
1
+ import { EmptyObject } from "@lookiero/sty-psp-typescript";
2
+ import { ReturnQuestionType } from "./returnQuestion.constants";
3
+
4
+ interface ComponentPlaceholder {
5
+ readonly placeholder: string;
6
+ }
7
+
8
+ type MetadataDictionary = Record<ReturnQuestionType, EmptyObject>;
9
+
10
+ type ComponentMetadata = MetadataDictionary & {
11
+ [ReturnQuestionType.HOST_SELECT]: ComponentPlaceholder;
12
+ [ReturnQuestionType.TEXTAREA]: ComponentPlaceholder;
13
+ };
14
+
15
+ type Metadata<RQT extends ReturnQuestionType> = ComponentMetadata[RQT];
16
+
17
+ export type { Metadata };
@@ -1,20 +1,42 @@
1
- enum ReturnQuestionType {
2
- HOST_DEFAULT = "HOST_DEFAULT",
3
- HOST_TEXTAREA = "HOST_TEXTAREA",
4
- HOST_SELECT = "HOST_SELECT",
5
- HOST_STACK = "HOST_STACK",
6
- TEXTAREA = "TEXTAREA",
7
- OPTION = "OPTION",
8
- // ICON = "ICON",
9
- }
10
-
11
- interface ReturnQuestionProjection {
12
- readonly id: string;
13
- readonly name: string;
14
- readonly placeholder: string; // required for ReturnQuestionType.SELECT | ReturnQuestionType.TEXTAREA
15
- readonly type: ReturnQuestionType;
16
- readonly children?: ReturnQuestionProjection[];
17
- }
18
-
19
- export { ReturnQuestionType };
20
- export type { ReturnQuestionProjection };
1
+ import { EmptyObject, ExcludePropertyIfOptional, NonEmptyArray } from "@lookiero/sty-psp-typescript";
2
+ import { ReturnQuestionType } from "./returnQuestion.constants";
3
+ import { Metadata } from "./returnQuestion.metadata";
4
+
5
+ type ReturnQuestionTypesWithChildren =
6
+ | ReturnQuestionType.HOST_DEFAULT
7
+ | ReturnQuestionType.HOST_SELECT
8
+ | ReturnQuestionType.HOST_STACK
9
+ | ReturnQuestionType.HOST_TEXTAREA;
10
+
11
+ type ReturnQuestionTypesWithOptionalChildren = ReturnQuestionType.OPTION;
12
+
13
+ type ReturnQuestionTypesWithOptionalTranslationKeys = ReturnQuestionType.HOST_STACK;
14
+
15
+ type ReturnQuestionMetadata<RQT extends ReturnQuestionType> = ExcludePropertyIfOptional<
16
+ "metadata",
17
+ { readonly metadata: Metadata<RQT> }
18
+ >;
19
+
20
+ type ReturnQuestionChildren<RQT extends ReturnQuestionType> = RQT extends ReturnQuestionTypesWithChildren
21
+ ? { readonly children: NonEmptyArray<ReturnQuestion> }
22
+ : RQT extends ReturnQuestionTypesWithOptionalChildren
23
+ ? { readonly children?: NonEmptyArray<ReturnQuestion> }
24
+ : EmptyObject;
25
+
26
+ type ReturnQuestionTranslationKey<RQT extends ReturnQuestionType> =
27
+ RQT extends ReturnQuestionTypesWithOptionalTranslationKeys
28
+ ? { readonly translationKey?: string }
29
+ : { readonly translationKey: string };
30
+
31
+ type ReturnQuestion<RQT extends ReturnQuestionType = ReturnQuestionType> = RQT extends infer K extends
32
+ ReturnQuestionType
33
+ ? { readonly id: string; readonly type: K } & ReturnQuestionTranslationKey<K> &
34
+ ReturnQuestionChildren<K> &
35
+ ReturnQuestionMetadata<K>
36
+ : never;
37
+
38
+ export type {
39
+ ReturnQuestion as ReturnQuestionProjection,
40
+ ReturnQuestionTypesWithOptionalTranslationKeys,
41
+ ReturnQuestionTypesWithChildren,
42
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ ReturnQuestionProjection,
3
+ ReturnQuestionTypesWithChildren,
4
+ ReturnQuestionTypesWithOptionalTranslationKeys,
5
+ } from "./returnQuestion";
6
+ import { ReturnQuestionType } from "./returnQuestion.constants";
7
+
8
+ const returnQuestionWithTranslationKey = (
9
+ question: ReturnQuestionProjection,
10
+ ): question is ReturnQuestionProjection<Exclude<ReturnQuestionType, ReturnQuestionTypesWithOptionalTranslationKeys>> =>
11
+ Boolean(question.translationKey);
12
+
13
+ const returnQuestionHasChildren = (
14
+ question: ReturnQuestionProjection,
15
+ ): question is ReturnQuestionProjection<ReturnQuestionTypesWithChildren> =>
16
+ [
17
+ ReturnQuestionType.HOST_DEFAULT,
18
+ ReturnQuestionType.HOST_SELECT,
19
+ ReturnQuestionType.HOST_STACK,
20
+ ReturnQuestionType.HOST_TEXTAREA,
21
+ ReturnQuestionType.OPTION,
22
+ ].includes(question.type);
23
+
24
+ export { returnQuestionWithTranslationKey, returnQuestionHasChildren };
@@ -1,13 +0,0 @@
1
- import { V3MockServer } from "@pact-foundation/pact";
2
- interface StringObject {
3
- readonly [k: string]: string;
4
- }
5
- declare const DEFAULT_PACT_OPTIONS: StringObject;
6
- declare const AUTH_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
7
- declare const DEFAULT_REQUEST_HEADERS: StringObject;
8
- declare const DEFAULT_RESPONSE_HEADERS: StringObject;
9
- interface FromMockServerUrlToApiUrlFunction {
10
- (mockServer: V3MockServer): string;
11
- }
12
- declare const fromMockServerUrlToApiUrl: FromMockServerUrlToApiUrlFunction;
13
- export { fromMockServerUrlToApiUrl, AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, };
@@ -1,9 +0,0 @@
1
- const DEFAULT_PACT_OPTIONS = { dir: ".contracts", logDir: ".pact/logs" };
2
- const AUTH_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
3
- const DEFAULT_REQUEST_HEADERS = {
4
- Authorization: `Bearer ${AUTH_TOKEN}`,
5
- ["Content-Type"]: "application/json",
6
- };
7
- const DEFAULT_RESPONSE_HEADERS = { ["Content-Type"]: "application/json" };
8
- const fromMockServerUrlToApiUrl = (mockServer) => mockServer.url.concat("/api");
9
- export { fromMockServerUrlToApiUrl, AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, };
Binary file
@@ -1,3 +0,0 @@
1
- import { BookedProductsVariantsProjection } from "../../../projection/bookedProductsVariants/bookedProductsVariants";
2
- declare const bookedProductsVariants: BookedProductsVariantsProjection;
3
- export { bookedProductsVariants };
@@ -1,27 +0,0 @@
1
- const bookedProductsVariants = {
2
- productVariants: [
3
- {
4
- id: "383fab95-56eb-4639-bb18-530ab792b4d3",
5
- size: {
6
- id: "4f8a26b8-8d2d-4012-b49a-7d2820095598",
7
- europe: "S",
8
- lookiero: "S",
9
- uk: "S",
10
- it: "S",
11
- unique: false,
12
- },
13
- },
14
- {
15
- id: "a5422445-0e62-4b11-8a3f-1bb5469ee154",
16
- size: {
17
- id: "a5422445-0e62-4b11-8a3f-1bb5469ee154",
18
- europe: "M",
19
- lookiero: "M",
20
- uk: "M",
21
- it: "M",
22
- unique: false,
23
- },
24
- },
25
- ],
26
- };
27
- export { bookedProductsVariants };
@@ -1,48 +0,0 @@
1
- import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
- import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
- import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
4
- import { bookedProductsVariants } from "./bookedProductsVariants.mock";
5
- import { httpBookedProductsVariantsForCheckoutItemView } from "./httpBookedProductsVariantsForCheckoutItemView";
6
- const provider = new PactV3({
7
- ...DEFAULT_PACT_OPTIONS,
8
- consumer: "STY-BOX_CHECKOUT-FRONT",
9
- provider: "STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem",
10
- });
11
- const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
12
- const bookedProductsVariantsResponse = {
13
- result: bookedProductsVariants,
14
- };
15
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
- // @ts-ignore
17
- const EXPECTED_BODY = MatchersV3.like(bookedProductsVariantsResponse);
18
- describe("STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem API", () => {
19
- it("returns a valid booked size change product variants for the given checkout item", () => {
20
- provider
21
- .given("a valid booked size change product variants for the given checkout item")
22
- .uponReceiving("booked size change product variants projection")
23
- .withRequest({
24
- method: "POST",
25
- path: "/api/view-booked-product-variants-for-checkout-item",
26
- headers: DEFAULT_REQUEST_HEADERS,
27
- body: { checkoutItemId },
28
- })
29
- .willRespondWith({
30
- status: 200,
31
- headers: DEFAULT_RESPONSE_HEADERS,
32
- body: EXPECTED_BODY,
33
- });
34
- return provider.executeTest(async (mockserver) => {
35
- const httpPost = fetchHttpPost({
36
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
37
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
38
- device: "web",
39
- version: "1.0.0",
40
- });
41
- const response = await httpBookedProductsVariantsForCheckoutItemView({ httpPost })({
42
- checkoutItemId,
43
- signal: undefined,
44
- });
45
- expect(response).toStrictEqual(bookedProductsVariantsResponse.result);
46
- });
47
- });
48
- });
@@ -1,19 +0,0 @@
1
- import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
2
- import { CheckoutProjection } from "../../../projection/checkout/checkout";
3
- import { CheckoutItemFunctionArgs } from "../checkoutItem/checkoutItem.mock";
4
- import { CheckoutDto } from "./checkout";
5
- interface CheckoutDtoFunctionArgs {
6
- readonly status?: CheckoutStatus;
7
- readonly items: CheckoutItemFunctionArgs[];
8
- }
9
- interface CheckoutDtoFunction {
10
- (args: CheckoutDtoFunctionArgs): CheckoutDto;
11
- }
12
- declare const checkoutDto: CheckoutDtoFunction;
13
- interface CheckoutFunctionArgs extends CheckoutDtoFunctionArgs {
14
- }
15
- interface CheckoutFunction {
16
- (args: CheckoutFunctionArgs): CheckoutProjection;
17
- }
18
- declare const checkout: CheckoutFunction;
19
- export { checkout, checkoutDto };
@@ -1,21 +0,0 @@
1
- import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
2
- import { checkoutItem } from "../checkoutItem/checkoutItem.mock";
3
- import { toCheckoutProjection } from "./checkout";
4
- const itemIds = [
5
- "a5422445-0e62-4b11-8a3f-1bb5469ee154",
6
- "cfc76463-621a-485a-b152-c5a9c4dc43d9",
7
- "a9a4fa26-fcc2-4efa-a6a8-fa29ea07b128",
8
- "8af02b73-0b0a-46a0-a3a8-d9710815c739",
9
- "8890e00b-d4ed-4220-ae13-52cd88ae8ed5",
10
- ];
11
- const checkoutDto = ({ status = CheckoutStatus.STARTED, items }) => ({
12
- id: "9c450400-0cd7-44a4-b0e3-e0002a9bf8df",
13
- status,
14
- customerId: "0df61ca7-7e4d-462b-a422-a57de0d116b4",
15
- boxId: "9c406e57-100a-4aa6-83c5-016e7c2970e7",
16
- checkoutBookingId: "07c996bb-a0b4-45f9-ae21-6bb9c784d12b",
17
- expiresOn: "2022-09-20",
18
- items: items.map(({ id, status, feedbacks, replacedFor }, index) => checkoutItem({ id: id || itemIds[index], status, feedbacks, replacedFor })),
19
- });
20
- const checkout = ({ status, items }) => toCheckoutProjection(checkoutDto({ status, items }));
21
- export { checkout, checkoutDto };
@@ -1,109 +0,0 @@
1
- import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
- import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
- import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
4
- import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
5
- import { MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
6
- import { checkout } from "./checkout.mock";
7
- import { httpCheckoutByIdView } from "./httpCheckoutByIdView";
8
- const provider = new PactV3({
9
- ...DEFAULT_PACT_OPTIONS,
10
- consumer: "STY-BOX_CHECKOUT-FRONT",
11
- provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutById",
12
- });
13
- const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
14
- const replacedFor = {
15
- id: "2bf7fb8f-a283-4f53-bc27-0e7fc9466a33",
16
- media: [
17
- {
18
- id: "d7ec731b-4123-4394-829b-297b952e73e5",
19
- url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
20
- perspective: MediaPerspective.MAIN,
21
- },
22
- {
23
- id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
24
- url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
25
- perspective: MediaPerspective.DETAIL,
26
- },
27
- ],
28
- brand: "CKS",
29
- name: "Sari Tshirt lines",
30
- size: {
31
- id: "b3a76aea-ce7a-4ecb-82a4-6637d0ac2afd",
32
- lookiero: "S",
33
- uk: "S",
34
- it: "S",
35
- europe: "S",
36
- unique: false,
37
- },
38
- color: {
39
- id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
40
- label: "black_C2",
41
- name: "black",
42
- },
43
- };
44
- const checkoutResponseWithReplacedFor = {
45
- result: checkout({ items: [{ status: CheckoutItemStatus.KEPT, replacedFor }] }),
46
- };
47
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
48
- // @ts-ignore
49
- const EXPECTED_BODY_WITH_REPLACED_FOR = MatchersV3.like(checkoutResponseWithReplacedFor);
50
- const checkoutResponseWithoutReplacedFor = {
51
- result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
52
- };
53
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
54
- // @ts-ignore
55
- const EXPECTED_BODY_WITHOUT_REPLACED_FOR = MatchersV3.like(checkoutResponseWithoutReplacedFor);
56
- describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutById API", () => {
57
- it("returns a valid checkout with replacedFor for the given id", () => {
58
- provider
59
- .given("a valid checkout with replacedFor for the given id")
60
- .uponReceiving("checkout projection")
61
- .withRequest({
62
- method: "POST",
63
- path: "/api/view-checkout-by-id",
64
- headers: DEFAULT_REQUEST_HEADERS,
65
- body: { checkoutId },
66
- })
67
- .willRespondWith({
68
- status: 200,
69
- headers: DEFAULT_RESPONSE_HEADERS,
70
- body: EXPECTED_BODY_WITH_REPLACED_FOR,
71
- });
72
- return provider.executeTest(async (mockserver) => {
73
- const httpPost = fetchHttpPost({
74
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
75
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
76
- device: "web",
77
- version: "1.0.0",
78
- });
79
- const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
80
- expect(response).toStrictEqual(checkoutResponseWithReplacedFor.result);
81
- });
82
- });
83
- it("returns a valid checkout without replacedFor for the given id", () => {
84
- provider
85
- .given("a valid checkout without replacedFor for the given id")
86
- .uponReceiving("checkout projection")
87
- .withRequest({
88
- method: "POST",
89
- path: "/api/view-checkout-by-id",
90
- headers: DEFAULT_REQUEST_HEADERS,
91
- body: { checkoutId },
92
- })
93
- .willRespondWith({
94
- status: 200,
95
- headers: DEFAULT_RESPONSE_HEADERS,
96
- body: EXPECTED_BODY_WITHOUT_REPLACED_FOR,
97
- });
98
- return provider.executeTest(async (mockserver) => {
99
- const httpPost = fetchHttpPost({
100
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
101
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
102
- device: "web",
103
- version: "1.0.0",
104
- });
105
- const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
106
- expect(response).toStrictEqual(checkoutResponseWithoutReplacedFor.result);
107
- });
108
- });
109
- });