@lookiero/checkout 10.0.0-beta.2 → 10.0.0-beta.4

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 (231) hide show
  1. package/dist/index.js +2 -1
  2. package/dist/src/Expo.js +2 -0
  3. package/dist/src/ExpoRoot.js +3 -2
  4. package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +2 -1
  5. package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +3 -2
  6. package/dist/src/infrastructure/ui/components/atoms/price/Price.js +3 -0
  7. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +7 -3
  8. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.d.ts +18 -2
  9. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.js +14 -2
  10. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +2 -1
  11. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +2 -1
  12. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +4 -3
  13. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +0 -1
  14. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +0 -1
  15. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +3 -3
  16. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +3 -2
  17. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +4 -4
  18. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +3 -2
  19. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -2
  20. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -1
  21. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +5 -4
  22. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +6 -6
  23. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +4 -3
  24. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +0 -1
  25. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +0 -1
  26. package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -2
  27. package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -2
  28. package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +2 -2
  29. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +9 -9
  30. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
  31. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +55 -22
  32. package/dist/src/infrastructure/ui/i18n/i18n.d.ts +2 -1
  33. package/dist/src/infrastructure/ui/i18n/i18n.js +2 -1
  34. package/dist/src/infrastructure/ui/test/render.js +4 -2
  35. package/dist/src/infrastructure/ui/views/App.js +2 -1
  36. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +3 -3
  37. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +16 -16
  38. package/dist/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +2 -2
  39. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -2
  40. package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
  41. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +11 -5
  42. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -4
  43. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
  44. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +1 -0
  45. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +2 -1
  46. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
  47. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -4
  48. package/dist/src/infrastructure/ui/views/return/components/price/Price.js +3 -0
  49. package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +3 -3
  50. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +4 -4
  51. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +1 -0
  52. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -1
  53. package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +4 -4
  54. package/dist/src/infrastructure/ui/views/summary/Summary.js +4 -4
  55. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +3 -2
  56. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +8 -6
  57. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
  58. package/dist/src/version.d.ts +1 -1
  59. package/dist/src/version.js +1 -1
  60. package/index.ts +2 -1
  61. package/jest.config.js +2 -2
  62. package/package.json +9 -9
  63. package/src/Expo.tsx +3 -0
  64. package/src/ExpoRoot.tsx +3 -2
  65. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.ts +3 -2
  66. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.tsx +3 -2
  67. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/__snapshots__/FiveItemsDiscountBanner.test.tsx.snap +1 -1
  68. package/src/infrastructure/ui/components/atoms/price/Price.tsx +3 -0
  69. package/src/infrastructure/ui/components/atoms/price/__snapshots__/Price.test.tsx.snap +3 -3
  70. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.ts +25 -4
  71. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +13 -7
  72. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +2 -1
  73. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +2 -1
  74. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +0 -1
  75. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +4 -2
  76. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +3 -3
  77. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +3 -2
  78. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +5 -5
  79. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +3 -2
  80. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +3 -2
  81. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +2 -1
  82. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +6 -5
  83. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +7 -7
  84. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +0 -1
  85. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +4 -2
  86. package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.tsx +2 -2
  87. package/src/infrastructure/ui/components/templates/header/checkoutHeader/__snapshots__/CheckoutHeader.test.tsx.snap +1 -1
  88. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx +2 -2
  89. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/__snapshots__/ItemDetailHeader.test.tsx.snap +1 -1
  90. package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.tsx +2 -2
  91. package/src/infrastructure/ui/components/templates/header/itemHeader/__snapshots__/ItemHeader.test.tsx.snap +1 -1
  92. package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +302 -0
  93. package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +9 -9
  94. package/src/infrastructure/ui/i18n/i18n.ts +3 -1
  95. package/src/infrastructure/ui/test/render.tsx +6 -3
  96. package/src/infrastructure/ui/views/App.tsx +2 -1
  97. package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +51 -40
  98. package/src/infrastructure/ui/views/checkout/Checkout.tsx +3 -3
  99. package/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.tsx +2 -2
  100. package/src/infrastructure/ui/views/checkout/components/deliveryBanner/__snapshots__/DeliveryBanner.test.tsx.snap +1 -1
  101. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +2 -2
  102. package/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.tsx +3 -3
  103. package/src/infrastructure/ui/views/item/components/banner/__snapshots__/CustomerDecissionBanner.test.tsx.snap +3 -3
  104. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +11 -5
  105. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +160 -88
  106. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +4 -4
  107. package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +244 -128
  108. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.ts +2 -1
  109. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.tsx +3 -3
  110. package/src/infrastructure/ui/views/item/components/productVariantDescription/__snapshots__/ProductVariantDescription.test.tsx.snap +10 -8
  111. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +30 -30
  112. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -2
  113. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +1 -1
  114. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -4
  115. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +75 -41
  116. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +105 -102
  117. package/src/infrastructure/ui/views/return/components/price/Price.tsx +3 -0
  118. package/src/infrastructure/ui/views/return/components/price/__snapshots__/Price.test.tsx.snap +3 -3
  119. package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +3 -3
  120. package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +1 -1
  121. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +2 -1
  122. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +4 -4
  123. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.tsx +4 -4
  124. package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +30 -30
  125. package/src/infrastructure/ui/views/summary/Summary.tsx +4 -4
  126. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +3 -2
  127. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +154 -82
  128. package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +8 -6
  129. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +5 -5
  130. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +62 -62
  131. package/dist/pact.config.d.ts +0 -21
  132. package/dist/pact.config.js +0 -16
  133. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
  134. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -55
  135. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
  136. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -116
  137. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
  138. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -56
  139. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
  140. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -51
  141. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
  142. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -51
  143. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
  144. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -51
  145. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -13
  146. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -19
  147. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
  148. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -56
  149. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
  150. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -57
  151. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
  152. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -55
  153. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
  154. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -120
  155. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
  156. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -55
  157. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
  158. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -55
  159. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -22
  160. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +0 -1
  161. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +0 -7
  162. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -5
  163. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -7
  164. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -6
  165. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +0 -4
  166. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +0 -20
  167. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -4
  168. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -43
  169. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
  170. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +0 -14
  171. package/dist/src/infrastructure/ui/components/templates/footer/Footer.d.ts +0 -3
  172. package/dist/src/infrastructure/ui/components/templates/footer/Footer.js +0 -13
  173. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -7
  174. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -21
  175. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -8
  176. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -12
  177. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -12
  178. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -64
  179. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -10
  180. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -17
  181. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -20
  182. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -27
  183. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -10
  184. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -27
  185. package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
  186. package/dist/src/infrastructure/ui/views/App.style.js +0 -8
  187. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +0 -7
  188. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +0 -11
  189. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -12
  190. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -64
  191. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -12
  192. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +0 -16
  193. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
  194. package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -44
  195. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -14
  196. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -28
  197. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -7
  198. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -11
  199. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -26
  200. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -21
  201. package/dist/src/projection/shared/country.d.ts +0 -14
  202. package/dist/src/projection/shared/country.js +0 -15
  203. package/dist/src/projection/shared/customer.d.ts +0 -9
  204. package/dist/src/projection/shared/customer.js +0 -1
  205. package/dist/src/projection/shared/locale.d.ts +0 -12
  206. package/dist/src/projection/shared/locale.js +0 -13
  207. package/dist/src/projection/shared/order.d.ts +0 -6
  208. package/dist/src/projection/shared/order.js +0 -1
  209. package/dist/src/projection/shared/price.d.ts +0 -11
  210. package/dist/src/projection/shared/price.js +0 -1
  211. package/dist/src/projection/shared/size.d.ts +0 -21
  212. package/dist/src/projection/shared/size.js +0 -4
  213. package/dist/src/projection/shared/subscription.d.ts +0 -2
  214. package/dist/src/projection/shared/subscription.js +0 -1
  215. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +0 -15
  216. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +0 -16
  217. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +0 -11
  218. package/dist/src/shared/ui/components/atoms/error/Error.js +0 -6
  219. package/dist/src/shared/ui/components/atoms/field/Field.d.ts +0 -14
  220. package/dist/src/shared/ui/components/atoms/field/Field.js +0 -29
  221. package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +0 -16
  222. package/dist/src/shared/ui/components/atoms/field/Field.style.js +0 -19
  223. package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +0 -24
  224. package/dist/src/shared/ui/components/molecules/inputField/InputField.js +0 -28
  225. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +0 -29
  226. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +0 -37
  227. package/src/infrastructure/ui/components/templates/footer/Footer.test.tsx +0 -15
  228. package/src/infrastructure/ui/components/templates/footer/Footer.tsx +0 -19
  229. package/src/infrastructure/ui/components/templates/footer/__snapshots__/Footer.test.tsx.snap +0 -1127
  230. package/src/infrastructure/ui/hooks/useCheckoutFlow.test.ts +0 -297
  231. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.test.tsx +0 -126
@@ -1,8 +1,9 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import React, { useCallback, useEffect, useState } from "react";
3
3
  import { View, Option, OPTION_VARIANT, SIZE } from "@lookiero/aurora";
4
- import { useIntl } from "@lookiero/i18n-react";
4
+ import { useI18n } from "@lookiero/i18n-react";
5
5
  import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
6
+ import { DOMAIN } from "../../../../../i18n/i18n";
6
7
  import {
7
8
  useReturnQuestionFeedback,
8
9
  useReturnQuestionFeedbackForReturnQuestion,
@@ -21,7 +22,7 @@ const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = (
21
22
  testID,
22
23
  portalHostName,
23
24
  }) => {
24
- const intl = useIntl();
25
+ const { formatMessage } = useI18n({ domain: DOMAIN });
25
26
  const [modalVisible, setModalVisible] = useState(false);
26
27
  const {
27
28
  feedback: feedbackId,
@@ -30,12 +31,12 @@ const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = (
30
31
  } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
31
32
  const feedback = useReturnQuestionFeedback();
32
33
  const translate = useCallback(
33
- (returnQuestionName: string) => intl.formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
34
- [intl],
34
+ (returnQuestionName: string) => formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
35
+ [formatMessage],
35
36
  );
36
37
 
37
38
  const inputValue = feedbackForReturnQuestion({ feedback, returnQuestion, translate }).join(" / ");
38
- const optionText = intl.formatMessage({ id: returnQuestion.translationKey });
39
+ const optionText = formatMessage({ id: returnQuestion.translationKey });
39
40
 
40
41
  const hasChildren = Boolean(returnQuestion.children && returnQuestion.children.length > 0);
41
42
 
@@ -2,24 +2,24 @@
2
2
  import React, { useCallback } from "react";
3
3
  import { View } from "react-native";
4
4
  import { Text } from "@lookiero/aurora";
5
- import { useI18nMessage, useIntl } from "@lookiero/i18n-react";
5
+ import { useI18nMessage, useI18n } from "@lookiero/i18n-react";
6
6
  import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
7
- import { I18nMessages } from "../../../../../i18n/i18n";
7
+ import { DOMAIN, I18nMessages } from "../../../../../i18n/i18n";
8
8
  import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeedback";
9
9
  import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
10
10
  import { ReturnQuestionItem } from "../ReturnQuestionItem";
11
11
  import { style } from "./ReturnQuestionFeedbackItem.style";
12
12
 
13
13
  const ReturnQuestionFeedbackItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = ({ returnQuestion }) => {
14
- const titleText = useI18nMessage({ id: returnQuestion.translationKey });
15
- const unansweredText = useI18nMessage({ id: I18nMessages.FEEDBACK_UNANSWERED });
14
+ const titleText = useI18nMessage({ domain: DOMAIN, id: returnQuestion.translationKey });
15
+ const unansweredText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.FEEDBACK_UNANSWERED });
16
16
 
17
17
  const returnQuestionFeedback = useReturnQuestionFeedback();
18
18
 
19
- const intl = useIntl();
19
+ const { formatMessage } = useI18n({ domain: DOMAIN });
20
20
  const translate = useCallback(
21
- (returnQuestionName: string) => intl.formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
22
- [intl],
21
+ (returnQuestionName: string) => formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
22
+ [formatMessage],
23
23
  );
24
24
  const feedback = feedbackForReturnQuestion({ feedback: returnQuestionFeedback, returnQuestion, translate }).join(
25
25
  " / ",
@@ -11,7 +11,6 @@ const style = StyleSheet.create({
11
11
  ...Platform.select({
12
12
  android: {
13
13
  paddingTop: space2,
14
- height: "auto",
15
14
  },
16
15
  }),
17
16
  },
@@ -1,9 +1,10 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import React, { useCallback, useMemo } from "react";
3
3
  import { View } from "@lookiero/aurora";
4
- import { useIntl } from "@lookiero/i18n-react";
4
+ import { useI18n } from "@lookiero/i18n-react";
5
5
  import { InputField, TextInput } from "@lookiero/sty-psp-ui";
6
6
  import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
7
+ import { DOMAIN } from "../../../../../i18n/i18n";
7
8
  import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
8
9
  import { ReturnQuestionItem } from "../ReturnQuestionItem";
9
10
  import { style } from "./TextareaReturnQuestionItem.style";
@@ -13,7 +14,7 @@ const TextareaReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.TEXTAREA
13
14
  returnQuestionParent,
14
15
  testID,
15
16
  }) => {
16
- const { formatMessage } = useIntl();
17
+ const { formatMessage } = useI18n({ domain: DOMAIN });
17
18
 
18
19
  const placeholderText = useMemo(
19
20
  () => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
@@ -37,6 +38,7 @@ const TextareaReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.TEXTAREA
37
38
  placeholder={placeholderText}
38
39
  style={style}
39
40
  testID={testID}
41
+ textAlignVertical="top"
40
42
  value={feedback}
41
43
  multiline
42
44
  onBlur={onBlur}
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from "react";
2
2
  import { ButtonIcon, Text } from "@lookiero/aurora";
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
- import { I18nMessages } from "../../../../i18n/i18n";
4
+ import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
5
5
  import { Header } from "../Header";
6
6
  import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
7
7
  import { style } from "./CheckoutHeader.style";
@@ -11,7 +11,7 @@ interface CheckoutHeaderProps {
11
11
  }
12
12
 
13
13
  const CheckoutHeader: FC<CheckoutHeaderProps> = ({ onBack }) => {
14
- const title = useI18nMessage({ id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
14
+ const title = useI18nMessage({ domain: DOMAIN, id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
15
15
 
16
16
  return (
17
17
  <Header testID="checkout-header">
@@ -183,7 +183,7 @@ exports[`CheckoutHeader template matches the snapshot 1`] = `
183
183
  "paddingBottom": 0,
184
184
  "paddingLeft": 0,
185
185
  "paddingRight": 0,
186
- "paddingTop": 2,
186
+ "paddingTop": 0,
187
187
  },
188
188
  ]
189
189
  }
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from "react";
2
2
  import { ButtonIcon, Text } from "@lookiero/aurora";
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
- import { I18nMessages } from "../../../../i18n/i18n";
4
+ import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
5
5
  import { Header } from "../Header";
6
6
  import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
7
7
  import { style } from "./ItemDetailHeader.style";
@@ -10,7 +10,7 @@ interface ItemDetailHeaderProps {
10
10
  readonly onBack: () => void;
11
11
  }
12
12
  const ItemDetailHeader: FC<ItemDetailHeaderProps> = ({ onBack }) => {
13
- const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
13
+ const title = useI18nMessage({ domain: DOMAIN, id: I18nMessages.HEADER_CHECKOUT_TITLE });
14
14
 
15
15
  return (
16
16
  <Header testID="item-detail-header">
@@ -72,7 +72,7 @@ exports[`ItemDetailHeader template matches the snapshot 1`] = `
72
72
  "paddingBottom": 0,
73
73
  "paddingLeft": 0,
74
74
  "paddingRight": 0,
75
- "paddingTop": 2,
75
+ "paddingTop": 0,
76
76
  },
77
77
  ]
78
78
  }
@@ -5,7 +5,7 @@ import { ButtonIcon, Text } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
7
7
  import { useStaticInfo } from "../../../../hooks/useStaticInfo";
8
- import { I18nMessages } from "../../../../i18n/i18n";
8
+ import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
9
9
  import { Routes } from "../../../../routing/routes";
10
10
  import { Header } from "../Header";
11
11
  import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
@@ -35,7 +35,7 @@ interface ItemHeaderProps {
35
35
  }
36
36
 
37
37
  const ItemHeader: FC<ItemHeaderProps> = ({ items, item, onNext, onPrevious }) => {
38
- const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
38
+ const title = useI18nMessage({ domain: DOMAIN, id: I18nMessages.HEADER_CHECKOUT_TITLE });
39
39
  const itemIndex = items.indexOf(item);
40
40
  const isFirstItem = itemIndex === 0;
41
41
  const isLastItem = itemIndex === items.length - 1;
@@ -183,7 +183,7 @@ exports[`ItemHeader template matches the snapshot 1`] = `
183
183
  "paddingBottom": 0,
184
184
  "paddingLeft": 0,
185
185
  "paddingRight": 0,
186
- "paddingTop": 2,
186
+ "paddingTop": 0,
187
187
  },
188
188
  ]
189
189
  }
@@ -0,0 +1,302 @@
1
+ import { act, render, renderHook, waitFor } from "@testing-library/react-native";
2
+ import React from "react";
3
+ import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
4
+ import { Country } from "@lookiero/sty-psp-locale";
5
+ import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
6
+ import { Segment } from "@lookiero/sty-psp-segment";
7
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
8
+ import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
9
+ import { OrderProjection } from "../../../projection/order/order";
10
+ import { SubscriptionProjection } from "../../../projection/subscription/subscription";
11
+ import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
12
+ import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
13
+ import { checkout } from "../../projection/checkout/checkout.mock";
14
+ import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
15
+ import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
16
+ import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
17
+ import { pricing } from "../../projection/pricing/pricing.mock";
18
+ import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
19
+ import { I18nMessages } from "../i18n/i18n";
20
+ import { Routes } from "../routing/routes";
21
+ import { useCheckoutFlow as sut } from "./useCheckoutFlow";
22
+ import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
23
+ import { useQueryBus } from "./useQueryBus";
24
+
25
+ const getAuthToken = () => Promise.resolve("token");
26
+ const mockCheckout = checkout({
27
+ items: [
28
+ { status: CheckoutItemStatus.KEPT },
29
+ { status: CheckoutItemStatus.KEPT },
30
+ { status: CheckoutItemStatus.KEPT },
31
+ { status: CheckoutItemStatus.KEPT },
32
+ { status: CheckoutItemStatus.RETURNED },
33
+ ],
34
+ });
35
+ const order: OrderProjection = {
36
+ orderNumber: 12345,
37
+ isFirstOrder: false,
38
+ coupon: null,
39
+ };
40
+ const mockPricing = pricing();
41
+ const subscription: SubscriptionProjection = "o";
42
+ const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
43
+ const basePath = "/checkout";
44
+ const country = Country.ES;
45
+ const email = "email@example.com";
46
+ const name = "Adèle Léonce Émilie";
47
+ const segment = Segment.WOMEN;
48
+ jest.mock("./useStaticInfo", () => ({
49
+ useStaticInfo: () => ({ customer: { customerId, country, segment, name, email }, basePath }),
50
+ }));
51
+
52
+ // const errorChargeStatuses = Object.values(ChargeStatus).filter((status) => status !== ChargeStatus.EXECUTED);
53
+ const mockStartLegacyBoxCheckout = jest.fn();
54
+ jest.mock("@lookiero/payments-front", () => {
55
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
56
+ const { useImperativeHandle, forwardRef } = require("react");
57
+
58
+ return {
59
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
60
+ // @ts-ignore
61
+ // eslint-disable-next-line @typescript-eslint/naming-convention, react/display-name
62
+ PaymentFlow: forwardRef((params, ref) => {
63
+ useImperativeHandle(ref, () => ({
64
+ startLegacyBoxCheckout: mockStartLegacyBoxCheckout,
65
+ }));
66
+
67
+ return null;
68
+ }),
69
+ Section: {
70
+ ["BOX_CHECKOUT"]: "box-checkout",
71
+ },
72
+ };
73
+ });
74
+
75
+ jest.mock("@lookiero/sty-psp-logging", () => ({
76
+ useLogger: () => jest.fn(),
77
+ }));
78
+
79
+ jest.mock("@lookiero/sty-psp-notifications");
80
+ jest.mock("./useQueryBus");
81
+ jest.mock("../../domain/checkout/react/useSubmitCheckout");
82
+ jest.mock("../../domain/checkoutBooking/react/useBlockCheckoutBooking");
83
+ jest.mock("../../domain/checkout/react/useSubmitCheckout");
84
+ jest.mock("../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId");
85
+ jest.mock("../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId");
86
+ jest.mock("../../projection/pricing/react/useViewPricingByCheckoutId");
87
+ jest.mock("./usePaymentInstrumentEvents");
88
+
89
+ beforeEach(() => {
90
+ mockStartLegacyBoxCheckout.mockClear();
91
+ });
92
+
93
+ describe("useCheckoutFlow custom hook", () => {
94
+ test("successfully executes 'checkoutFlow'", async () => {
95
+ const mockBlockCheckoutBooking = jest.fn();
96
+ const mockSubmitCheckout = jest.fn();
97
+ const mockCreateToastNotification = jest.fn();
98
+ const mockOnSuccess = jest.fn();
99
+
100
+ (useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
101
+ (useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
102
+ (useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
103
+ (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
104
+ (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
105
+ (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
106
+ (useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
107
+ (usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onSuccess }) => {
108
+ setTimeout(() => onSuccess(), 1000);
109
+ });
110
+
111
+ const { result } = renderHook(() =>
112
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
113
+ );
114
+
115
+ let checkoutFlow: () => void, status, paymentFlowComponent;
116
+
117
+ await waitFor(() => {
118
+ [checkoutFlow, , paymentFlowComponent] = result.current;
119
+
120
+ expect(paymentFlowComponent).not.toBeNull();
121
+ });
122
+
123
+ render(<>{paymentFlowComponent}</>);
124
+
125
+ await act(async () => {
126
+ await checkoutFlow();
127
+ });
128
+
129
+ await waitFor(() => {
130
+ [, status] = result.current;
131
+
132
+ expect(status).toBe("success");
133
+ expect(mockBlockCheckoutBooking).toHaveBeenCalled();
134
+ expect(mockStartLegacyBoxCheckout).toHaveBeenCalledWith(
135
+ expect.objectContaining({
136
+ ...mockPaymentFlowPayload,
137
+ userInformation: { email, name },
138
+ returnUrl: `${basePath}/${Routes.CHECKOUT}`,
139
+ }),
140
+ );
141
+ expect(mockSubmitCheckout).toHaveBeenCalled();
142
+ expect(mockCreateToastNotification).toHaveBeenCalledWith({
143
+ bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
144
+ level: NotificationLevel.SUCCESS,
145
+ });
146
+ expect(mockOnSuccess).toHaveBeenCalled();
147
+ });
148
+ });
149
+
150
+ test("does not call blockCheckoutBooking if sizeChange is not enabled", async () => {
151
+ const mockBlockCheckoutBooking = jest.fn();
152
+ const mockSubmitCheckout = jest.fn();
153
+ const mockCreateToastNotification = jest.fn();
154
+ const mockOnSuccess = jest.fn();
155
+
156
+ (useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
157
+ (useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
158
+ (useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
159
+ (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
160
+ (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([false, QueryStatus.SUCCESS]);
161
+ (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
162
+ (useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
163
+ (usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onSuccess }) => {
164
+ setTimeout(() => onSuccess(), 1000);
165
+ });
166
+
167
+ const { result } = renderHook(() =>
168
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
169
+ );
170
+
171
+ let checkoutFlow: () => void, status, paymentFlowComponent;
172
+
173
+ await waitFor(() => {
174
+ [checkoutFlow, , paymentFlowComponent] = result.current;
175
+
176
+ expect(paymentFlowComponent).not.toBeNull();
177
+ });
178
+
179
+ render(<>{paymentFlowComponent}</>);
180
+
181
+ await act(async () => {
182
+ await checkoutFlow();
183
+ });
184
+
185
+ await waitFor(() => {
186
+ [, status] = result.current;
187
+
188
+ expect(status).toBe("success");
189
+ expect(mockBlockCheckoutBooking).not.toHaveBeenCalled();
190
+ expect(mockStartLegacyBoxCheckout).toHaveBeenCalledWith(
191
+ expect.objectContaining({
192
+ ...mockPaymentFlowPayload,
193
+ userInformation: { email, name },
194
+ returnUrl: `${basePath}/${Routes.CHECKOUT}`,
195
+ }),
196
+ );
197
+ expect(mockSubmitCheckout).toHaveBeenCalled();
198
+ expect(mockCreateToastNotification).toHaveBeenCalledWith({
199
+ bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
200
+ level: NotificationLevel.SUCCESS,
201
+ });
202
+ expect(mockOnSuccess).toHaveBeenCalled();
203
+ });
204
+ });
205
+
206
+ test("breaks execution and returns error as the status when blockCheckoutBooking fails", async () => {
207
+ const mockBlockCheckoutBooking = jest.fn().mockRejectedValue("error");
208
+ const mockSubmitCheckout = jest.fn();
209
+ const mockCreateToastNotification = jest.fn();
210
+ const mockOnSuccess = jest.fn();
211
+
212
+ (useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
213
+ (useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.ERROR]);
214
+ (useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
215
+ (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
216
+ (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
217
+ (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
218
+ (useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
219
+ (usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onSuccess }) => {
220
+ setTimeout(() => onSuccess(), 1000);
221
+ });
222
+
223
+ const { result } = renderHook(() =>
224
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
225
+ );
226
+
227
+ let checkoutFlow: () => void, status, paymentFlowComponent;
228
+
229
+ await waitFor(() => {
230
+ [checkoutFlow, , paymentFlowComponent] = result.current;
231
+
232
+ expect(paymentFlowComponent).not.toBeNull();
233
+ });
234
+
235
+ render(<>{paymentFlowComponent}</>);
236
+
237
+ await act(async () => {
238
+ await checkoutFlow();
239
+ });
240
+
241
+ await waitFor(() => {
242
+ [, status] = result.current;
243
+
244
+ expect(status).toBe("error");
245
+ expect(mockBlockCheckoutBooking).toHaveBeenCalled();
246
+ expect(mockStartLegacyBoxCheckout).not.toHaveBeenCalled();
247
+ expect(mockSubmitCheckout).not.toHaveBeenCalled();
248
+ expect(mockCreateToastNotification).not.toHaveBeenCalled();
249
+ expect(mockOnSuccess).not.toHaveBeenCalled();
250
+ });
251
+ });
252
+
253
+ test("shows a notification and returns error as the status when payment fails", async () => {
254
+ const mockBlockCheckoutBooking = jest.fn();
255
+ const mockSubmitCheckout = jest.fn();
256
+ const mockCreateToastNotification = jest.fn();
257
+ const mockOnSuccess = jest.fn();
258
+
259
+ (useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
260
+ (useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
261
+ (useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
262
+ (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
263
+ (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
264
+ (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
265
+ (useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
266
+ (usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onError }) => {
267
+ setTimeout(() => onError({ metadata: null }), 1000);
268
+ });
269
+
270
+ const { result } = renderHook(() =>
271
+ sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
272
+ );
273
+
274
+ let checkoutFlow: () => void, status, paymentFlowComponent;
275
+
276
+ await waitFor(() => {
277
+ [checkoutFlow, , paymentFlowComponent] = result.current;
278
+
279
+ expect(paymentFlowComponent).not.toBeNull();
280
+ });
281
+
282
+ render(<>{paymentFlowComponent}</>);
283
+
284
+ await act(async () => {
285
+ await checkoutFlow();
286
+ });
287
+
288
+ await waitFor(() => {
289
+ [, status] = result.current;
290
+
291
+ expect(status).toBe("error");
292
+ expect(mockBlockCheckoutBooking).toHaveBeenCalled();
293
+ expect(mockStartLegacyBoxCheckout).toHaveBeenCalled();
294
+ expect(mockSubmitCheckout).not.toHaveBeenCalled();
295
+ expect(mockCreateToastNotification).toHaveBeenCalledWith({
296
+ bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
297
+ level: NotificationLevel.ERROR,
298
+ });
299
+ expect(mockOnSuccess).not.toHaveBeenCalled();
300
+ });
301
+ });
302
+ });
@@ -13,7 +13,7 @@ import {
13
13
  import { OrderProjection } from "../../../projection/order/order";
14
14
  import { SubscriptionProjection } from "../../../projection/subscription/subscription";
15
15
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
16
- import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/checkout/react/useSubmitCheckout";
16
+ import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
17
17
  import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
18
18
  import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
19
19
  import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
@@ -71,7 +71,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
71
71
  checkoutId: checkoutProjection?.id,
72
72
  queryOptions: { refetchOnMount: true },
73
73
  });
74
- const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({
74
+ const [submitCheckout, submitCheckoutStatus] = useSubmitCheckout({
75
75
  checkoutId: checkoutProjection?.id,
76
76
  logger,
77
77
  });
@@ -120,7 +120,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
120
120
  paymentFlowRef.current?.startLegacyBoxCheckout({
121
121
  ...paymentFlowPayload,
122
122
  userInformation: { email, name },
123
- returnUrl: `${basePath}/${Routes.CHECKOUT}?foo=bar`,
123
+ returnUrl: `${basePath}/${Routes.CHECKOUT}`,
124
124
  } as unknown as LegacyBoxCheckoutStrategyPayload);
125
125
  }, [
126
126
  checkoutProjection?.checkoutBookingId,
@@ -136,7 +136,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
136
136
  const onPaymentSuccess = useCallback(async () => {
137
137
  setStartLegacyBoxCheckoutStatus("success");
138
138
 
139
- await submitCheckoutCommand();
139
+ await submitCheckout();
140
140
 
141
141
  createNotification({
142
142
  bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
@@ -145,7 +145,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
145
145
 
146
146
  trackCheckout();
147
147
  onSuccess();
148
- }, [createNotification, onSuccess, submitCheckoutCommand, trackCheckout]);
148
+ }, [createNotification, onSuccess, submitCheckout, trackCheckout]);
149
149
  const onPaymentError = useCallback(
150
150
  (payload: PaymentPayload) => {
151
151
  setStartLegacyBoxCheckoutStatus("error");
@@ -163,7 +163,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
163
163
  if (
164
164
  blockCheckoutBookingStatus === CommandStatus.LOADING ||
165
165
  startLegacyBoxCheckoutStatus === "loading" ||
166
- submitCheckoutCommandStatus === CommandStatus.LOADING
166
+ submitCheckoutStatus === CommandStatus.LOADING
167
167
  ) {
168
168
  return "loading";
169
169
  }
@@ -171,7 +171,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
171
171
  if (
172
172
  blockCheckoutBookingStatus === CommandStatus.SUCCESS &&
173
173
  startLegacyBoxCheckoutStatus === "success" &&
174
- submitCheckoutCommandStatus === CommandStatus.SUCCESS
174
+ submitCheckoutStatus === CommandStatus.SUCCESS
175
175
  ) {
176
176
  return "success";
177
177
  }
@@ -179,14 +179,14 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
179
179
  if (
180
180
  blockCheckoutBookingStatus === CommandStatus.ERROR ||
181
181
  startLegacyBoxCheckoutStatus === "error" ||
182
- submitCheckoutCommandStatus === CommandStatus.ERROR ||
182
+ submitCheckoutStatus === CommandStatus.ERROR ||
183
183
  checkoutBookingExpired
184
184
  ) {
185
185
  return "error";
186
186
  }
187
187
 
188
188
  return "idle";
189
- }, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus, submitCheckoutCommandStatus, checkoutBookingExpired]);
189
+ }, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus, submitCheckoutStatus, checkoutBookingExpired]);
190
190
 
191
191
  const paymentFlow = useMemo(
192
192
  () => (authToken ? <PaymentFlow ref={paymentFlowRef} section={Section.BOX_CHECKOUT} token={authToken} /> : null),
@@ -1,3 +1,5 @@
1
+ const DOMAIN = "CheckoutI18n";
2
+
1
3
  // TODO: deprecated?
2
4
  const COLOR_I18N_PREFIX = "catalog.color.";
3
5
 
@@ -59,4 +61,4 @@ enum I18nMessages {
59
61
  CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired",
60
62
  }
61
63
 
62
- export { I18nMessages, COLOR_I18N_PREFIX };
64
+ export { DOMAIN, I18nMessages, COLOR_I18N_PREFIX };
@@ -1,10 +1,13 @@
1
1
  import { render, RenderAPI } from "@testing-library/react-native";
2
2
  import { mock } from "jest-mock-extended";
3
3
  import React, { FC, Fragment, ReactElement } from "react";
4
- import { IntlProvider } from "react-intl";
5
4
  import { Aurora } from "@lookiero/aurora";
5
+ import { createI18nProvider } from "@lookiero/i18n-react";
6
6
  import { TranslationMessages } from "@lookiero/i18n/domain/translation/model/translationMessages";
7
7
  import { Logger, LoggerProvider } from "@lookiero/sty-psp-logging";
8
+ import { DOMAIN } from "../i18n/i18n";
9
+
10
+ const I18nProvider = createI18nProvider({ domain: DOMAIN });
8
11
 
9
12
  interface RenderArgs {
10
13
  readonly locale?: string;
@@ -23,11 +26,11 @@ const renderWrapper: RenderWrapperFunction =
23
26
  // eslint-disable-next-line react/display-name, react/prop-types
24
27
  ({ children }) => (
25
28
  <Aurora>
26
- <IntlProvider locale={locale as string} messages={messages} onError={() => void 0}>
29
+ <I18nProvider locale={locale as string} messages={messages} onError={() => void 0}>
27
30
  <LoggerProvider logger={logger}>
28
31
  <Wrapper>{children}</Wrapper>
29
32
  </LoggerProvider>
30
- </IntlProvider>
33
+ </I18nProvider>
31
34
  </Aurora>
32
35
  );
33
36
 
@@ -5,6 +5,7 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
5
5
  import { Notifications } from "@lookiero/sty-psp-notifications";
6
6
  import { theme } from "@lookiero/sty-psp-ui";
7
7
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
8
+ import { DOMAIN } from "../i18n/i18n";
8
9
 
9
10
  const { colorBgBase } = theme();
10
11
 
@@ -15,7 +16,7 @@ interface AppProps {
15
16
  const App: FC<AppProps> = ({ children }) => (
16
17
  <SafeAreaProvider>
17
18
  <StatusBar backgroundColor={colorBgBase} barStyle="dark-content" translucent />
18
- <Notifications contextId={MESSAGING_CONTEXT_ID} portalHostName="Checkout" />
19
+ <Notifications contextId={MESSAGING_CONTEXT_ID} domain={DOMAIN} portalHostName="Checkout" />
19
20
  <PortalHost name="Checkout" />
20
21
  {children}
21
22
  </SafeAreaProvider>