@lookiero/checkout 9.14.0 → 10.0.0-beta.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 (288) hide show
  1. package/dist/fake-dependencies/@lookiero/payments-front/index.d.ts +8 -6
  2. package/dist/fake-dependencies/@lookiero/payments-front/index.js +7 -4
  3. package/dist/index.d.ts +3 -3
  4. package/dist/index.js +1 -2
  5. package/dist/pact.config.d.ts +21 -0
  6. package/dist/pact.config.js +16 -0
  7. package/dist/public/public/assets/adaptive-icon.png +0 -0
  8. package/dist/public/public/assets/favicon.png +0 -0
  9. package/dist/public/public/assets/icon.png +0 -0
  10. package/dist/public/public/assets/splash.png +0 -0
  11. package/dist/public/public/images/not-found.png +0 -0
  12. package/dist/src/Expo.js +0 -2
  13. package/dist/src/ExpoRoot.js +19 -15
  14. package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +1 -1
  15. package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +2 -0
  16. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +1 -0
  17. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +55 -0
  18. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +1 -0
  19. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +116 -0
  20. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +1 -0
  21. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +56 -0
  22. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +1 -0
  23. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +51 -0
  24. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +1 -0
  25. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +51 -0
  26. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +1 -0
  27. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +51 -0
  28. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +13 -0
  29. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +19 -0
  30. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +1 -0
  31. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +56 -0
  32. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +1 -0
  33. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +57 -0
  34. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +1 -0
  35. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +55 -0
  36. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +1 -0
  37. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +120 -0
  38. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +1 -0
  39. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +55 -0
  40. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.d.ts +1 -1
  41. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +2 -1
  42. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +1 -0
  43. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +55 -0
  44. package/dist/src/infrastructure/tracking/tracking.d.ts +2 -2
  45. package/dist/src/infrastructure/tracking/useTrackCheckout.d.ts +10 -17
  46. package/dist/src/infrastructure/tracking/useTrackCheckout.js +27 -12
  47. package/dist/src/infrastructure/ui/Root.d.ts +6 -6
  48. package/dist/src/infrastructure/ui/Root.js +2 -3
  49. package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +1 -2
  50. package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +2 -3
  51. package/dist/src/infrastructure/ui/components/atoms/price/Price.js +0 -3
  52. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +22 -0
  53. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
  54. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +7 -0
  55. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +5 -0
  56. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +7 -0
  57. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +6 -0
  58. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
  59. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +20 -0
  60. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +4 -0
  61. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +43 -0
  62. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
  63. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +14 -0
  64. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +3 -7
  65. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.d.ts +2 -18
  66. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.js +2 -14
  67. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +1 -2
  68. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +1 -2
  69. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +3 -4
  70. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +1 -0
  71. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +1 -0
  72. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +3 -3
  73. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -3
  74. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +4 -4
  75. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +2 -3
  76. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +2 -3
  77. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -2
  78. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +4 -5
  79. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +6 -6
  80. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +3 -4
  81. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +1 -0
  82. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +1 -0
  83. package/dist/src/infrastructure/ui/components/templates/footer/Footer.d.ts +3 -0
  84. package/dist/src/infrastructure/ui/components/templates/footer/Footer.js +13 -0
  85. package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -2
  86. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +7 -0
  87. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +21 -0
  88. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
  89. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
  90. package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -2
  91. package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +4 -4
  92. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.d.ts +26 -0
  93. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +135 -0
  94. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +12 -0
  95. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +64 -0
  96. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +3 -2
  97. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +17 -26
  98. package/dist/src/infrastructure/ui/hooks/useStaticInfo.d.ts +2 -0
  99. package/dist/src/infrastructure/ui/hooks/useStaticInfo.js +2 -2
  100. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
  101. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +22 -55
  102. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +10 -0
  103. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +17 -0
  104. package/dist/src/infrastructure/ui/i18n/i18n.d.ts +2 -2
  105. package/dist/src/infrastructure/ui/i18n/i18n.js +2 -2
  106. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +20 -0
  107. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +27 -0
  108. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +10 -0
  109. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +27 -0
  110. package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +3 -14
  111. package/dist/src/infrastructure/ui/routing/Routing.d.ts +5 -5
  112. package/dist/src/infrastructure/ui/routing/Routing.js +8 -18
  113. package/dist/src/infrastructure/ui/routing/routes.d.ts +0 -1
  114. package/dist/src/infrastructure/ui/routing/routes.js +0 -1
  115. package/dist/src/infrastructure/ui/test/render.js +3 -7
  116. package/dist/src/infrastructure/ui/views/App.js +5 -7
  117. package/dist/src/infrastructure/ui/views/App.style.d.ts +6 -0
  118. package/dist/src/infrastructure/ui/views/App.style.js +8 -0
  119. package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +7 -2
  120. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +24 -15
  121. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
  122. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
  123. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +16 -16
  124. package/dist/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +2 -2
  125. package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
  126. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -2
  127. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
  128. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +11 -0
  129. package/dist/src/infrastructure/ui/views/item/Item.js +1 -3
  130. package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
  131. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +5 -11
  132. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -4
  133. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
  134. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +0 -1
  135. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +1 -2
  136. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
  137. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +12 -0
  138. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +64 -0
  139. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
  140. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +16 -0
  141. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -4
  142. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +40 -0
  143. package/dist/src/infrastructure/ui/views/return/Return.style.js +44 -0
  144. package/dist/src/infrastructure/ui/views/return/components/price/Price.js +0 -3
  145. package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +3 -3
  146. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +6 -6
  147. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -1
  148. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +1 -2
  149. package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +4 -4
  150. package/dist/src/infrastructure/ui/views/summary/Summary.js +5 -6
  151. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -3
  152. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +6 -8
  153. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +14 -0
  154. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +28 -0
  155. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
  156. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +11 -0
  157. package/dist/src/infrastructure/ui/views/summaryTabs/SummaryTabs.js +1 -3
  158. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
  159. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +26 -0
  160. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +21 -0
  161. package/dist/src/projection/customer/customer.d.ts +2 -0
  162. package/dist/src/projection/order/order.d.ts +1 -1
  163. package/dist/src/projection/shared/country.d.ts +14 -0
  164. package/dist/src/projection/shared/country.js +15 -0
  165. package/dist/src/projection/shared/customer.d.ts +9 -0
  166. package/dist/src/projection/shared/customer.js +1 -0
  167. package/dist/src/projection/shared/locale.d.ts +12 -0
  168. package/dist/src/projection/shared/locale.js +13 -0
  169. package/dist/src/projection/shared/order.d.ts +6 -0
  170. package/dist/src/projection/shared/order.js +1 -0
  171. package/dist/src/projection/shared/price.d.ts +11 -0
  172. package/dist/src/projection/shared/price.js +1 -0
  173. package/dist/src/projection/shared/size.d.ts +21 -0
  174. package/dist/src/projection/shared/size.js +4 -0
  175. package/dist/src/projection/shared/subscription.d.ts +2 -0
  176. package/dist/src/projection/shared/subscription.js +1 -0
  177. package/dist/src/projection/subscription/subscription.d.ts +1 -1
  178. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +15 -0
  179. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +16 -0
  180. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +11 -0
  181. package/dist/src/shared/ui/components/atoms/error/Error.js +6 -0
  182. package/dist/src/shared/ui/components/atoms/field/Field.d.ts +14 -0
  183. package/dist/src/shared/ui/components/atoms/field/Field.js +29 -0
  184. package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +16 -0
  185. package/dist/src/shared/ui/components/atoms/field/Field.style.js +19 -0
  186. package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +24 -0
  187. package/dist/src/shared/ui/components/molecules/inputField/InputField.js +28 -0
  188. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +29 -0
  189. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +37 -0
  190. package/dist/src/version.d.ts +1 -1
  191. package/dist/src/version.js +1 -1
  192. package/fake-dependencies/@lookiero/payments-front/index.tsx +32 -9
  193. package/index.ts +11 -5
  194. package/jest.config.js +2 -2
  195. package/package.json +9 -9
  196. package/src/Expo.tsx +0 -3
  197. package/src/ExpoRoot.tsx +44 -38
  198. package/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.ts +4 -1
  199. package/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.ts +3 -2
  200. package/src/infrastructure/tracking/tracking.ts +2 -2
  201. package/src/infrastructure/tracking/useTrackCheckout.ts +66 -56
  202. package/src/infrastructure/ui/Root.tsx +9 -9
  203. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.ts +2 -3
  204. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.tsx +2 -3
  205. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/__snapshots__/FiveItemsDiscountBanner.test.tsx.snap +1 -1
  206. package/src/infrastructure/ui/components/atoms/price/Price.tsx +0 -3
  207. package/src/infrastructure/ui/components/atoms/price/__snapshots__/Price.test.tsx.snap +3 -3
  208. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.ts +4 -25
  209. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +7 -13
  210. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +1 -2
  211. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +1 -2
  212. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +1 -0
  213. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +2 -4
  214. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +3 -3
  215. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +2 -3
  216. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +5 -5
  217. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +2 -3
  218. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +2 -3
  219. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +1 -2
  220. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +5 -6
  221. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +7 -7
  222. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +1 -0
  223. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +2 -4
  224. package/src/infrastructure/ui/components/templates/footer/Footer.test.tsx +15 -0
  225. package/src/infrastructure/ui/components/templates/footer/Footer.tsx +19 -0
  226. package/src/infrastructure/ui/components/templates/footer/__snapshots__/Footer.test.tsx.snap +1127 -0
  227. package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.tsx +2 -2
  228. package/src/infrastructure/ui/components/templates/header/checkoutHeader/__snapshots__/CheckoutHeader.test.tsx.snap +1 -1
  229. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx +2 -2
  230. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/__snapshots__/ItemDetailHeader.test.tsx.snap +1 -1
  231. package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.tsx +5 -4
  232. package/src/infrastructure/ui/components/templates/header/itemHeader/__snapshots__/ItemHeader.test.tsx.snap +1 -1
  233. package/src/infrastructure/ui/hooks/{useSubmitCheckout.test.ts → useCheckoutFlow.test.ts} +1 -1
  234. package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +212 -0
  235. package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +18 -60
  236. package/src/infrastructure/ui/hooks/useStaticInfo.tsx +4 -2
  237. package/src/infrastructure/ui/i18n/i18n.ts +2 -3
  238. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +3 -3
  239. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +3 -17
  240. package/src/infrastructure/ui/routing/Routing.tsx +25 -39
  241. package/src/infrastructure/ui/routing/routes.ts +0 -1
  242. package/src/infrastructure/ui/test/render.tsx +4 -10
  243. package/src/infrastructure/ui/views/App.tsx +5 -14
  244. package/src/infrastructure/ui/views/checkout/Checkout.style.ts +3 -0
  245. package/src/infrastructure/ui/views/checkout/Checkout.tsx +55 -18
  246. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.test.tsx +116 -121
  247. package/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.tsx +2 -2
  248. package/src/infrastructure/ui/views/checkout/components/deliveryBanner/__snapshots__/DeliveryBanner.test.tsx.snap +1 -1
  249. package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
  250. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +2 -2
  251. package/src/infrastructure/ui/views/item/Item.tsx +1 -2
  252. package/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.tsx +3 -3
  253. package/src/infrastructure/ui/views/item/components/banner/__snapshots__/CustomerDecissionBanner.test.tsx.snap +3 -3
  254. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +5 -11
  255. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +88 -160
  256. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +4 -4
  257. package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +128 -244
  258. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.ts +1 -2
  259. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.tsx +3 -3
  260. package/src/infrastructure/ui/views/item/components/productVariantDescription/__snapshots__/ProductVariantDescription.test.tsx.snap +8 -10
  261. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +30 -30
  262. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -2
  263. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +1 -1
  264. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -4
  265. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +41 -75
  266. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +102 -105
  267. package/src/infrastructure/ui/views/return/components/price/Price.tsx +0 -3
  268. package/src/infrastructure/ui/views/return/components/price/__snapshots__/Price.test.tsx.snap +3 -3
  269. package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +3 -3
  270. package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +1 -1
  271. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +1 -2
  272. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +6 -6
  273. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.tsx +4 -4
  274. package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +30 -30
  275. package/src/infrastructure/ui/views/summary/Summary.tsx +5 -6
  276. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -3
  277. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +82 -154
  278. package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +6 -8
  279. package/src/infrastructure/ui/views/summaryTabs/SummaryTabs.tsx +1 -2
  280. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +5 -5
  281. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +62 -62
  282. package/src/projection/customer/customer.ts +2 -0
  283. package/src/projection/order/order.ts +1 -1
  284. package/src/projection/subscription/subscription.ts +1 -1
  285. package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +0 -169
  286. package/src/infrastructure/ui/routing/useBasePath.test.tsx +0 -19
  287. package/src/infrastructure/ui/routing/useBasePath.tsx +0 -24
  288. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +0 -125
@@ -1,21 +1,23 @@
1
1
  import { FC, ForwardRefExoticComponent, PropsWithChildren, RefAttributes } from "react";
2
+ import { PaymentPayload } from "@lookiero/payments-front";
2
3
  declare const setPaymentsBridge: () => undefined;
3
4
  declare const PaymentsQueryProvider: FC<PropsWithChildren>;
4
5
  declare const PaymentInstrumentSelect: FC;
5
- interface StartLegacyBoxCheckoutCallbackArgs {
6
- readonly status: string;
7
- readonly final: boolean;
8
- }
9
6
  interface StartLegacyBoxCheckoutFunction {
10
- (paymentFlowPayload: unknown, callback: (params: StartLegacyBoxCheckoutCallbackArgs) => Promise<void>): void;
7
+ (paymentFlowPayload: unknown): void;
11
8
  }
12
9
  interface PaymentFlowRef {
13
10
  readonly startLegacyBoxCheckout: StartLegacyBoxCheckoutFunction;
14
11
  }
15
12
  declare const paymentFlowRef: PaymentFlowRef;
16
13
  declare const PaymentFlow: ForwardRefExoticComponent<RefAttributes<PaymentFlowRef>>;
14
+ interface UsePaymentStatusManagerResult {
15
+ isLoading: boolean;
16
+ consumePayload: (callback: (payload: PaymentPayload) => void) => void;
17
+ }
18
+ declare const usePaymentStatusManager: (section: Section) => UsePaymentStatusManagerResult;
17
19
  declare enum Section {
18
20
  BOX_CHECKOUT = "box-checkout"
19
21
  }
20
22
  export type { PaymentFlowRef };
21
- export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
23
+ export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef, usePaymentStatusManager, };
@@ -4,17 +4,20 @@ const setPaymentsBridge = () => void 0;
4
4
  const PaymentsQueryProvider = ({ children }) => children;
5
5
  const PaymentInstrumentSelect = () => null;
6
6
  const paymentFlowRef = {
7
- startLegacyBoxCheckout: async (_paymentFlowPayload, callback) => {
8
- await callback({ status: "EXECUTED", final: true });
9
- },
7
+ startLegacyBoxCheckout: async () => { },
10
8
  };
11
9
  const PaymentFlow = forwardRef((_props, ref) => {
12
10
  useImperativeHandle(ref, () => paymentFlowRef, []);
13
11
  return null;
14
12
  });
15
13
  PaymentFlow.displayName = "PaymentFlow";
14
+ const paymentStatusManagerResult = {
15
+ isLoading: false,
16
+ consumePayload: (callback) => callback({ success: true }),
17
+ };
18
+ const usePaymentStatusManager = () => paymentStatusManagerResult;
16
19
  var Section;
17
20
  (function (Section) {
18
21
  Section["BOX_CHECKOUT"] = "box-checkout";
19
22
  })(Section || (Section = {}));
20
- export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef };
23
+ export { PaymentsQueryProvider, PaymentInstrumentSelect, PaymentFlow, Section, setPaymentsBridge, paymentFlowRef, usePaymentStatusManager, };
package/dist/index.d.ts CHANGED
@@ -9,8 +9,8 @@ import { KameleoonEnvironment } from "./src/infrastructure/ab-testing/kameleoonE
9
9
  import { RootProps } from "./src/infrastructure/ui/Root";
10
10
  import { CheckoutProjection } from "./src/projection/checkout/checkout";
11
11
  import { Customer } from "./src/projection/customer/customer";
12
- import { Order } from "./src/projection/order/order";
13
- import { Subscription } from "./src/projection/subscription/subscription";
12
+ import { OrderProjection } from "./src/projection/order/order";
13
+ import { SubscriptionProjection } from "./src/projection/subscription/subscription";
14
14
  interface FirstAvailableCheckoutByCustomerIdFunctionArgs {
15
15
  readonly customerId: string | undefined;
16
16
  }
@@ -33,4 +33,4 @@ interface BootstrapFunction {
33
33
  }
34
34
  declare const bootstrap: BootstrapFunction;
35
35
  export { bootstrap, translationEndpoint, translationExternalEndpoint, Country, Segment, CheckoutStatus };
36
- export type { SentryEnvironment, KameleoonEnvironment, Customer, Subscription, Order, Locale };
36
+ export type { SentryEnvironment, KameleoonEnvironment, Customer, SubscriptionProjection as Subscription, OrderProjection as Order, Locale, };
package/dist/index.js CHANGED
@@ -5,13 +5,12 @@ import { Segment } from "@lookiero/sty-psp-segment";
5
5
  import { CheckoutStatus } from "./src/domain/checkout/model/checkout";
6
6
  import { bootstrap as checkoutBootstrap } from "./src/infrastructure/delivery/bootstrap";
7
7
  import { root } from "./src/infrastructure/ui/Root";
8
- import { DOMAIN } from "./src/infrastructure/ui/i18n/i18n";
9
8
  import { viewFirstAvailableCheckoutByCustomerId } from "./src/projection/checkout/viewFirstAvailableCheckoutByCustomerId";
10
9
  const bootstrap = ({ apiUrl, getAuthToken, translations, sentry, kameleoon }) => {
11
10
  const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
12
11
  const I18n = i18n({
13
12
  fetchTranslation: fetchTranslations({ translations }),
14
- domain: DOMAIN,
13
+ contextId: "CheckoutI18n",
15
14
  });
16
15
  const firstAvailableCheckoutByCustomerId = ({ customerId }) => queryBus(viewFirstAvailableCheckoutByCustomerId({ customerId: customerId }));
17
16
  return {
@@ -0,0 +1,21 @@
1
+ import { V3MockServer } from "@pact-foundation/pact";
2
+
3
+ interface StringObject {
4
+ readonly [k: string]: string;
5
+ }
6
+ declare const DEFAULT_PACT_OPTIONS: StringObject;
7
+ declare const AUTH_TOKEN =
8
+ "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
9
+ declare const DEFAULT_REQUEST_HEADERS: StringObject;
10
+ declare const DEFAULT_RESPONSE_HEADERS: StringObject;
11
+ interface FromMockServerUrlToApiUrlFunction {
12
+ (mockServer: V3MockServer): string;
13
+ }
14
+ declare const fromMockServerUrlToApiUrl: FromMockServerUrlToApiUrlFunction;
15
+ export {
16
+ fromMockServerUrlToApiUrl,
17
+ AUTH_TOKEN,
18
+ DEFAULT_PACT_OPTIONS,
19
+ DEFAULT_REQUEST_HEADERS,
20
+ DEFAULT_RESPONSE_HEADERS,
21
+ };
@@ -0,0 +1,16 @@
1
+ const DEFAULT_PACT_OPTIONS = { dir: ".contracts", logDir: ".pact/logs" };
2
+ const AUTH_TOKEN =
3
+ "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
4
+ const DEFAULT_REQUEST_HEADERS = {
5
+ Authorization: `Bearer ${AUTH_TOKEN}`,
6
+ ["Content-Type"]: "application/json",
7
+ };
8
+ const DEFAULT_RESPONSE_HEADERS = { ["Content-Type"]: "application/json" };
9
+ const fromMockServerUrlToApiUrl = (mockServer) => mockServer.url.concat("/api");
10
+ export {
11
+ fromMockServerUrlToApiUrl,
12
+ AUTH_TOKEN,
13
+ DEFAULT_PACT_OPTIONS,
14
+ DEFAULT_REQUEST_HEADERS,
15
+ DEFAULT_RESPONSE_HEADERS,
16
+ };
package/dist/src/Expo.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import { registerRootComponent } from "expo";
2
- import { enableLegacyWebImplementation } from "react-native-gesture-handler";
3
2
  import "react-native-get-random-values";
4
3
  import { ExpoRoot } from "./ExpoRoot";
5
- enableLegacyWebImplementation(true);
6
4
  registerRootComponent(ExpoRoot);
@@ -1,3 +1,4 @@
1
+ import { PortalProvider } from "@gorhom/portal";
1
2
  import { useFonts } from "expo-font";
2
3
  import "expo/build/Expo.fx";
3
4
  import React, { useCallback, useState } from "react";
@@ -14,10 +15,9 @@ import { DummyLayout } from "@lookiero/sty-psp-ui";
14
15
  import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
15
16
  import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
16
17
  import { root } from "./infrastructure/ui/Root";
17
- import { DOMAIN } from "./infrastructure/ui/i18n/i18n";
18
18
  import { Router } from "./infrastructure/ui/routing/router/Router";
19
19
  import { VERSION } from "./version";
20
- const locale = Locale.en_GB;
20
+ const locale = Locale.es_ES;
21
21
  const subscription = "b";
22
22
  const order = {
23
23
  isFirstOrder: false,
@@ -25,9 +25,11 @@ const order = {
25
25
  coupon: "MYLOOKIERO",
26
26
  };
27
27
  const customer = {
28
- customerId: "a4355713-469b-4684-bf90-3215702dfb1c",
29
- country: Country.ES,
28
+ customerId: "9cfb056e-6008-44b1-9075-320479bf92ac",
29
+ country: Country.NL,
30
30
  segment: Segment.WOMEN,
31
+ email: "email@example.com",
32
+ name: "Adèle Léonce Émilie",
31
33
  };
32
34
  const sentryConfig = {
33
35
  publicKey: "66cadf9444db4ea5945670f12ec08ae7",
@@ -40,7 +42,7 @@ const apiUrl = Platform.OS !== "web"
40
42
  : __DEV__
41
43
  ? "/local-to-dev"
42
44
  : "/checkout/api";
43
- const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2ODkxMDAsImV4cCI6MTc0NjI3ODQwMiwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjUtMDQtMDMiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiYTQzNTU3MTMtNDY5Yi00Njg0LWJmOTAtMzIxNTcwMmRmYjFjIiwiaWF0IjoxNzQzNjg2NDAyfQ.pmqFo-4s0USFpzCnijRt78bWuBdu2Q7f4L9UtOkfAwo";
45
+ const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NDk0NjYsImV4cCI6MTc0MjQ3MDI5OSwiZGlzcGxheU5hbWUiOiJNaWtlbCIsImNvdW50cnlfY29kZSI6IkVTIiwiYWNjZXNzVmlhIjoiZW1haWwiLCJzdWJzY3JpcHRpb25TdGFydGluZ0RhdGUiOiIyMDI0LTExLTExIiwiaW1wZXJzb25hdGVkIjpmYWxzZSwidXVpZCI6ImQzYzIzNTRiLTk4MTEtNDZkNC1iMmJhLTVmYmEwMTJlZDk0ZCIsImlhdCI6MTc0MDA1MTA5OX0.AkuUZTsn9mgplQwatg0dPKyv1Hsc6r267UMahxMH19g";
44
46
  const getAuthToken = () => Promise.resolve(authToken);
45
47
  const externalTranslationsUrl = Platform.OS !== "web"
46
48
  ? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
@@ -50,7 +52,7 @@ const externalTranslationsUrl = Platform.OS !== "web"
50
52
  const translations = [
51
53
  (locale) => translationExternalEndpoint({
52
54
  translationsUrl: externalTranslationsUrl,
53
- projects: [["checkout"]],
55
+ projects: [["user-area-front"], ["inventory-catalog", "feature;feature_value;Color"], ["checkout"]],
54
56
  })(locale),
55
57
  ];
56
58
  const useRedirect = () => ({
@@ -75,6 +77,7 @@ setPaymentsBridge({
75
77
  useFeatureFlags: () => ({}),
76
78
  locale: () => Promise.resolve("es-ES"),
77
79
  scrollView: ScrollView,
80
+ hostUrl: "",
78
81
  });
79
82
  const kameleoonConfig = {
80
83
  siteCode: "aplm4v3ckn",
@@ -85,7 +88,7 @@ const { Component: Messaging, queryBus } = process.env.EXPO_PUBLIC_APP_VARIANT =
85
88
  : checkoutBootstrap({ apiUrl: () => apiUrl, getAuthToken });
86
89
  const I18n = i18n({
87
90
  fetchTranslation: fetchTranslations({ translations }),
88
- domain: DOMAIN,
91
+ contextId: "CheckoutI18n",
89
92
  });
90
93
  const Root = root({
91
94
  Messaging,
@@ -105,13 +108,14 @@ const ExpoRoot = () => {
105
108
  });
106
109
  const [isAccessible, setIsAccessible] = useState();
107
110
  const onNotAccessible = useCallback(() => setIsAccessible(false), []);
108
- return fontsLoaded ? (React.createElement(PaymentsQueryProvider, null,
109
- React.createElement(EventProvider, null,
110
- React.createElement(Aurora, null,
111
- isAccessible === false && React.createElement(Text, { heading: true }, "Checkout is not accessible!"),
112
- React.createElement(Router, null,
113
- React.createElement(Routes, null,
114
- React.createElement(Route, { path: "/checkout/*", element: React.createElement(Root, { basePath: "/checkout", customer: customer, layout: DummyLayout, locale: locale, order: order, subscription: subscription, useRedirect: useRedirect, onNotAccessible: onNotAccessible }) }),
115
- React.createElement(Route, { element: React.createElement(Navigate, { to: "/checkout", replace: true }), path: "*" }))))))) : null;
111
+ return fontsLoaded ? (React.createElement(PortalProvider, null,
112
+ React.createElement(PaymentsQueryProvider, null,
113
+ React.createElement(EventProvider, null,
114
+ React.createElement(Aurora, null,
115
+ isAccessible === false && React.createElement(Text, { heading: true }, "Checkout is not accessible!"),
116
+ React.createElement(Router, null,
117
+ React.createElement(Routes, null,
118
+ React.createElement(Route, { path: "/checkout/*", element: React.createElement(Root, { basePath: "/checkout", customer: customer, layout: DummyLayout, locale: locale, order: order, subscription: subscription, useRedirect: useRedirect, onCheckoutFlowSuccess: () => console.log("Checkout flow success!"), onNotAccessible: onNotAccessible }) }),
119
+ React.createElement(Route, { element: React.createElement(Navigate, { to: "/checkout", replace: true }), path: "*" })))))))) : null;
116
120
  };
117
121
  export { ExpoRoot };
@@ -5,7 +5,7 @@ interface BlockCheckoutBookingFunction {
5
5
  }
6
6
  type UseBlockCheckoutBooking = [blockCheckoutBooking: BlockCheckoutBookingFunction, status: CommandStatus];
7
7
  interface UseBlockCheckoutBookingFunctionArgs {
8
- readonly checkoutBookingId: string;
8
+ readonly checkoutBookingId: string | undefined;
9
9
  readonly logger: Logger;
10
10
  }
11
11
  interface UseBlockCheckoutBookingFunction {
@@ -1,4 +1,5 @@
1
1
  import { useCallback } from "react";
2
+ import invariant from "tiny-invariant";
2
3
  import { useCommand } from "@lookiero/messaging-react";
3
4
  import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
4
5
  import { blockCheckoutBooking as blockCheckoutBookingCommand } from "../../../../domain/checkoutBooking/command/blockCheckoutBooking";
@@ -8,6 +9,7 @@ const useBlockCheckoutBooking = ({ checkoutBookingId, logger }) => {
8
9
  const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
9
10
  const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
10
11
  const blockCheckoutBooking = useCallback(async () => {
12
+ invariant(checkoutBookingId, "checkoutBookingId is required");
11
13
  try {
12
14
  await commandBus(blockCheckoutBookingCommand({
13
15
  aggregateId: checkoutBookingId,
@@ -0,0 +1,55 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { bookedProductsVariants } from "./bookedProductsVariants.mock";
11
+ import { httpBookedProductsVariantsForCheckoutItemView } from "./httpBookedProductsVariantsForCheckoutItemView";
12
+
13
+ const provider = new PactV3({
14
+ ...DEFAULT_PACT_OPTIONS,
15
+ consumer: "STY-BOX_CHECKOUT-FRONT",
16
+ provider: "STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem",
17
+ });
18
+ const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
19
+ const bookedProductsVariantsResponse = {
20
+ result: bookedProductsVariants,
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-ignore
24
+ const EXPECTED_BODY = MatchersV3.like(bookedProductsVariantsResponse);
25
+ describe("STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem API", () => {
26
+ it("returns a valid booked size change product variants for the given checkout item", () => {
27
+ provider
28
+ .given("a valid booked size change product variants for the given checkout item")
29
+ .uponReceiving("booked size change product variants projection")
30
+ .withRequest({
31
+ method: "POST",
32
+ path: "/api/view-booked-product-variants-for-checkout-item",
33
+ headers: DEFAULT_REQUEST_HEADERS,
34
+ body: { checkoutItemId },
35
+ })
36
+ .willRespondWith({
37
+ status: 200,
38
+ headers: DEFAULT_RESPONSE_HEADERS,
39
+ body: EXPECTED_BODY,
40
+ });
41
+ return provider.executeTest(async (mockserver) => {
42
+ const httpPost = fetchHttpPost({
43
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
44
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
45
+ device: "web",
46
+ version: "1.0.0",
47
+ });
48
+ const response = await httpBookedProductsVariantsForCheckoutItemView({ httpPost })({
49
+ checkoutItemId,
50
+ signal: undefined,
51
+ });
52
+ expect(response).toStrictEqual(bookedProductsVariantsResponse.result);
53
+ });
54
+ });
55
+ });
@@ -0,0 +1,116 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
11
+ import { MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
12
+ import { checkout } from "./checkout.mock";
13
+ import { httpCheckoutByIdView } from "./httpCheckoutByIdView";
14
+
15
+ const provider = new PactV3({
16
+ ...DEFAULT_PACT_OPTIONS,
17
+ consumer: "STY-BOX_CHECKOUT-FRONT",
18
+ provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutById",
19
+ });
20
+ const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
21
+ const replacedFor = {
22
+ id: "2bf7fb8f-a283-4f53-bc27-0e7fc9466a33",
23
+ media: [
24
+ {
25
+ id: "d7ec731b-4123-4394-829b-297b952e73e5",
26
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
27
+ perspective: MediaPerspective.MAIN,
28
+ },
29
+ {
30
+ id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
31
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
32
+ perspective: MediaPerspective.DETAIL,
33
+ },
34
+ ],
35
+ brand: "CKS",
36
+ name: "Sari Tshirt lines",
37
+ size: {
38
+ id: "b3a76aea-ce7a-4ecb-82a4-6637d0ac2afd",
39
+ lookiero: "S",
40
+ uk: "S",
41
+ it: "S",
42
+ europe: "S",
43
+ unique: false,
44
+ },
45
+ color: {
46
+ id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
47
+ label: "black_C2",
48
+ name: "black",
49
+ },
50
+ };
51
+ const checkoutResponseWithReplacedFor = {
52
+ result: checkout({ items: [{ status: CheckoutItemStatus.KEPT, replacedFor }] }),
53
+ };
54
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
55
+ // @ts-ignore
56
+ const EXPECTED_BODY_WITH_REPLACED_FOR = MatchersV3.like(checkoutResponseWithReplacedFor);
57
+ const checkoutResponseWithoutReplacedFor = {
58
+ result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
59
+ };
60
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61
+ // @ts-ignore
62
+ const EXPECTED_BODY_WITHOUT_REPLACED_FOR = MatchersV3.like(checkoutResponseWithoutReplacedFor);
63
+ describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutById API", () => {
64
+ it("returns a valid checkout with replacedFor for the given id", () => {
65
+ provider
66
+ .given("a valid checkout with replacedFor for the given id")
67
+ .uponReceiving("checkout projection")
68
+ .withRequest({
69
+ method: "POST",
70
+ path: "/api/view-checkout-by-id",
71
+ headers: DEFAULT_REQUEST_HEADERS,
72
+ body: { checkoutId },
73
+ })
74
+ .willRespondWith({
75
+ status: 200,
76
+ headers: DEFAULT_RESPONSE_HEADERS,
77
+ body: EXPECTED_BODY_WITH_REPLACED_FOR,
78
+ });
79
+ return provider.executeTest(async (mockserver) => {
80
+ const httpPost = fetchHttpPost({
81
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
82
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
83
+ device: "web",
84
+ version: "1.0.0",
85
+ });
86
+ const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
87
+ expect(response).toStrictEqual(checkoutResponseWithReplacedFor.result);
88
+ });
89
+ });
90
+ it("returns a valid checkout without replacedFor for the given id", () => {
91
+ provider
92
+ .given("a valid checkout without replacedFor for the given id")
93
+ .uponReceiving("checkout projection")
94
+ .withRequest({
95
+ method: "POST",
96
+ path: "/api/view-checkout-by-id",
97
+ headers: DEFAULT_REQUEST_HEADERS,
98
+ body: { checkoutId },
99
+ })
100
+ .willRespondWith({
101
+ status: 200,
102
+ headers: DEFAULT_RESPONSE_HEADERS,
103
+ body: EXPECTED_BODY_WITHOUT_REPLACED_FOR,
104
+ });
105
+ return provider.executeTest(async (mockserver) => {
106
+ const httpPost = fetchHttpPost({
107
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
108
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
109
+ device: "web",
110
+ version: "1.0.0",
111
+ });
112
+ const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
113
+ expect(response).toStrictEqual(checkoutResponseWithoutReplacedFor.result);
114
+ });
115
+ });
116
+ });
@@ -0,0 +1,56 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpPost } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
11
+ import { checkout } from "./checkout.mock";
12
+ import { httpFirstAvailableCheckoutByCustomerIdView } from "./httpFirstAvailableCheckoutByCustomerIdView";
13
+
14
+ const provider = new PactV3({
15
+ ...DEFAULT_PACT_OPTIONS,
16
+ consumer: "STY-BOX_CHECKOUT-FRONT",
17
+ provider: "STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId",
18
+ });
19
+ const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
20
+ const checkoutResponse = {
21
+ result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
22
+ };
23
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
+ // @ts-ignore
25
+ const EXPECTED_BODY = MatchersV3.like(checkoutResponse);
26
+ describe("STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId API", () => {
27
+ it("returns a first available checkout for the given customer id", () => {
28
+ provider
29
+ .given("a first available checkout for the given customer id")
30
+ .uponReceiving("checkout projection")
31
+ .withRequest({
32
+ method: "POST",
33
+ path: "/api/view-first-available-checkout-by-customer-id",
34
+ headers: DEFAULT_REQUEST_HEADERS,
35
+ body: { customerId },
36
+ })
37
+ .willRespondWith({
38
+ status: 200,
39
+ headers: DEFAULT_RESPONSE_HEADERS,
40
+ body: EXPECTED_BODY,
41
+ });
42
+ return provider.executeTest(async (mockserver) => {
43
+ const httpPost = fetchHttpPost({
44
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
45
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
46
+ device: "web",
47
+ version: "1.0.0",
48
+ });
49
+ const response = await httpFirstAvailableCheckoutByCustomerIdView({ httpPost })({
50
+ customerId,
51
+ signal: undefined,
52
+ });
53
+ expect(response).toStrictEqual(checkoutResponse.result);
54
+ });
55
+ });
56
+ });
@@ -0,0 +1,51 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpGet } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { httpFiveItemsDiscountByCustomerIdView } from "./httpFiveItemsDiscountByCustomerIdView";
11
+
12
+ const provider = new PactV3({
13
+ ...DEFAULT_PACT_OPTIONS,
14
+ consumer: "STY-BOX_CHECKOUT-FRONT",
15
+ provider: "STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId",
16
+ });
17
+ const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
18
+ const fiveItemsDiscountResponse = 25;
19
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
+ // @ts-ignore
21
+ const EXPECTED_BODY = MatchersV3.number(fiveItemsDiscountResponse);
22
+ describe("STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId API", () => {
23
+ it("returns a five items discount for the given customer id", () => {
24
+ provider
25
+ .given("a five items discount for the given customer id")
26
+ .uponReceiving("five items discount")
27
+ .withRequest({
28
+ method: "GET",
29
+ path: `/api/view-five-items-discount-by-customer-id/${customerId}`,
30
+ headers: DEFAULT_REQUEST_HEADERS,
31
+ })
32
+ .willRespondWith({
33
+ status: 200,
34
+ headers: DEFAULT_RESPONSE_HEADERS,
35
+ body: EXPECTED_BODY,
36
+ });
37
+ return provider.executeTest(async (mockserver) => {
38
+ const httpGet = fetchHttpGet({
39
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
40
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
41
+ device: "web",
42
+ version: "1.0.0",
43
+ });
44
+ const response = await httpFiveItemsDiscountByCustomerIdView({ httpGet })({
45
+ customerId,
46
+ signal: undefined,
47
+ });
48
+ expect(response).toStrictEqual(fiveItemsDiscountResponse);
49
+ });
50
+ });
51
+ });
@@ -0,0 +1,51 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
2
+ import { fetchHttpGet } from "@lookiero/sty-psp-http";
3
+ import {
4
+ AUTH_TOKEN,
5
+ DEFAULT_PACT_OPTIONS,
6
+ DEFAULT_REQUEST_HEADERS,
7
+ DEFAULT_RESPONSE_HEADERS,
8
+ fromMockServerUrlToApiUrl,
9
+ } from "../../../../pact.config";
10
+ import { httpIsCheckoutEnabledByCustomerIdView } from "./httpIsCheckoutEnabledByCustomerIdView";
11
+
12
+ const provider = new PactV3({
13
+ ...DEFAULT_PACT_OPTIONS,
14
+ consumer: "STY-BOX_CHECKOUT-FRONT",
15
+ provider: "STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId",
16
+ });
17
+ const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
18
+ const isCheckoutEnabledResponse = true;
19
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
+ // @ts-ignore
21
+ const EXPECTED_BODY = MatchersV3.boolean(isCheckoutEnabledResponse);
22
+ describe("STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId API", () => {
23
+ it("returns is new checkout enabled for the given customer id", () => {
24
+ provider
25
+ .given("is new checkout enabled for the given customer id")
26
+ .uponReceiving("is new checkout enabled")
27
+ .withRequest({
28
+ method: "GET",
29
+ path: `/api/is-new-checkout-enabled/${customerId}`,
30
+ headers: DEFAULT_REQUEST_HEADERS,
31
+ })
32
+ .willRespondWith({
33
+ status: 200,
34
+ headers: DEFAULT_RESPONSE_HEADERS,
35
+ body: EXPECTED_BODY,
36
+ });
37
+ return provider.executeTest(async (mockserver) => {
38
+ const httpGet = fetchHttpGet({
39
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
40
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
41
+ device: "web",
42
+ version: "1.0.0",
43
+ });
44
+ const response = await httpIsCheckoutEnabledByCustomerIdView({ httpGet })({
45
+ customerId,
46
+ signal: undefined,
47
+ });
48
+ expect(response).toStrictEqual(isCheckoutEnabledResponse);
49
+ });
50
+ });
51
+ });