@lookiero/checkout 9.13.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 (286) 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/ExpoRoot.js +19 -15
  13. package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +1 -1
  14. package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +2 -0
  15. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +1 -0
  16. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +55 -0
  17. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +1 -0
  18. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +116 -0
  19. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +1 -0
  20. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +56 -0
  21. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +1 -0
  22. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +51 -0
  23. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +1 -0
  24. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +51 -0
  25. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +1 -0
  26. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +51 -0
  27. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +13 -0
  28. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +19 -0
  29. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +1 -0
  30. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +56 -0
  31. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +1 -0
  32. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +57 -0
  33. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +1 -0
  34. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +55 -0
  35. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +1 -0
  36. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +120 -0
  37. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +1 -0
  38. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +55 -0
  39. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.d.ts +1 -1
  40. package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +2 -1
  41. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +1 -0
  42. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +55 -0
  43. package/dist/src/infrastructure/tracking/tracking.d.ts +2 -2
  44. package/dist/src/infrastructure/tracking/useTrackCheckout.d.ts +10 -17
  45. package/dist/src/infrastructure/tracking/useTrackCheckout.js +27 -12
  46. package/dist/src/infrastructure/ui/Root.d.ts +6 -6
  47. package/dist/src/infrastructure/ui/Root.js +2 -3
  48. package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +1 -2
  49. package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +2 -3
  50. package/dist/src/infrastructure/ui/components/atoms/price/Price.js +0 -3
  51. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +22 -0
  52. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
  53. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +7 -0
  54. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +5 -0
  55. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +7 -0
  56. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +6 -0
  57. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
  58. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +20 -0
  59. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +4 -0
  60. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +43 -0
  61. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
  62. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +14 -0
  63. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +3 -7
  64. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.d.ts +2 -18
  65. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.js +2 -14
  66. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +1 -2
  67. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +1 -2
  68. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +3 -4
  69. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +1 -0
  70. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +1 -0
  71. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +3 -3
  72. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -3
  73. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +4 -4
  74. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +2 -3
  75. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +2 -3
  76. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -2
  77. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +4 -5
  78. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +6 -6
  79. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +3 -4
  80. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +1 -0
  81. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +1 -0
  82. package/dist/src/infrastructure/ui/components/templates/footer/Footer.d.ts +3 -0
  83. package/dist/src/infrastructure/ui/components/templates/footer/Footer.js +13 -0
  84. package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -2
  85. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +7 -0
  86. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +21 -0
  87. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
  88. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
  89. package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -2
  90. package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +4 -4
  91. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.d.ts +26 -0
  92. package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +135 -0
  93. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +12 -0
  94. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +64 -0
  95. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +3 -2
  96. package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +17 -26
  97. package/dist/src/infrastructure/ui/hooks/useStaticInfo.d.ts +2 -0
  98. package/dist/src/infrastructure/ui/hooks/useStaticInfo.js +2 -2
  99. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
  100. package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +22 -55
  101. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +10 -0
  102. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +17 -0
  103. package/dist/src/infrastructure/ui/i18n/i18n.d.ts +2 -2
  104. package/dist/src/infrastructure/ui/i18n/i18n.js +2 -2
  105. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +20 -0
  106. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +27 -0
  107. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +10 -0
  108. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +27 -0
  109. package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +3 -14
  110. package/dist/src/infrastructure/ui/routing/Routing.d.ts +5 -5
  111. package/dist/src/infrastructure/ui/routing/Routing.js +8 -18
  112. package/dist/src/infrastructure/ui/routing/routes.d.ts +0 -1
  113. package/dist/src/infrastructure/ui/routing/routes.js +0 -1
  114. package/dist/src/infrastructure/ui/test/render.js +3 -7
  115. package/dist/src/infrastructure/ui/views/App.js +5 -7
  116. package/dist/src/infrastructure/ui/views/App.style.d.ts +6 -0
  117. package/dist/src/infrastructure/ui/views/App.style.js +8 -0
  118. package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +7 -2
  119. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +24 -15
  120. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
  121. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
  122. package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +16 -16
  123. package/dist/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +2 -2
  124. package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
  125. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -2
  126. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
  127. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +11 -0
  128. package/dist/src/infrastructure/ui/views/item/Item.js +1 -3
  129. package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
  130. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +5 -11
  131. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -4
  132. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
  133. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +0 -1
  134. package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +1 -2
  135. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
  136. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +12 -0
  137. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +64 -0
  138. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
  139. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +16 -0
  140. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -4
  141. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +40 -0
  142. package/dist/src/infrastructure/ui/views/return/Return.style.js +44 -0
  143. package/dist/src/infrastructure/ui/views/return/components/price/Price.js +0 -3
  144. package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +3 -3
  145. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +6 -6
  146. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -1
  147. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +1 -2
  148. package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +4 -4
  149. package/dist/src/infrastructure/ui/views/summary/Summary.js +5 -6
  150. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -3
  151. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +6 -8
  152. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +14 -0
  153. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +28 -0
  154. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
  155. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +11 -0
  156. package/dist/src/infrastructure/ui/views/summaryTabs/SummaryTabs.js +1 -3
  157. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
  158. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +26 -0
  159. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +21 -0
  160. package/dist/src/projection/customer/customer.d.ts +2 -0
  161. package/dist/src/projection/order/order.d.ts +1 -1
  162. package/dist/src/projection/shared/country.d.ts +14 -0
  163. package/dist/src/projection/shared/country.js +15 -0
  164. package/dist/src/projection/shared/customer.d.ts +9 -0
  165. package/dist/src/projection/shared/customer.js +1 -0
  166. package/dist/src/projection/shared/locale.d.ts +12 -0
  167. package/dist/src/projection/shared/locale.js +13 -0
  168. package/dist/src/projection/shared/order.d.ts +6 -0
  169. package/dist/src/projection/shared/order.js +1 -0
  170. package/dist/src/projection/shared/price.d.ts +11 -0
  171. package/dist/src/projection/shared/price.js +1 -0
  172. package/dist/src/projection/shared/size.d.ts +21 -0
  173. package/dist/src/projection/shared/size.js +4 -0
  174. package/dist/src/projection/shared/subscription.d.ts +2 -0
  175. package/dist/src/projection/shared/subscription.js +1 -0
  176. package/dist/src/projection/subscription/subscription.d.ts +1 -1
  177. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +15 -0
  178. package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +16 -0
  179. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +11 -0
  180. package/dist/src/shared/ui/components/atoms/error/Error.js +6 -0
  181. package/dist/src/shared/ui/components/atoms/field/Field.d.ts +14 -0
  182. package/dist/src/shared/ui/components/atoms/field/Field.js +29 -0
  183. package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +16 -0
  184. package/dist/src/shared/ui/components/atoms/field/Field.style.js +19 -0
  185. package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +24 -0
  186. package/dist/src/shared/ui/components/molecules/inputField/InputField.js +28 -0
  187. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +29 -0
  188. package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +37 -0
  189. package/dist/src/version.d.ts +1 -1
  190. package/dist/src/version.js +1 -1
  191. package/fake-dependencies/@lookiero/payments-front/index.tsx +32 -9
  192. package/index.ts +11 -5
  193. package/jest.config.js +2 -2
  194. package/package.json +8 -7
  195. package/src/ExpoRoot.tsx +44 -38
  196. package/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.ts +4 -1
  197. package/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.ts +3 -2
  198. package/src/infrastructure/tracking/tracking.ts +2 -2
  199. package/src/infrastructure/tracking/useTrackCheckout.ts +66 -56
  200. package/src/infrastructure/ui/Root.tsx +9 -9
  201. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.ts +2 -3
  202. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.tsx +2 -3
  203. package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/__snapshots__/FiveItemsDiscountBanner.test.tsx.snap +1 -1
  204. package/src/infrastructure/ui/components/atoms/price/Price.tsx +0 -3
  205. package/src/infrastructure/ui/components/atoms/price/__snapshots__/Price.test.tsx.snap +3 -3
  206. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.ts +4 -25
  207. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +7 -13
  208. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +1 -2
  209. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +1 -2
  210. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +1 -0
  211. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +2 -4
  212. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +3 -3
  213. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +2 -3
  214. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +5 -5
  215. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +2 -3
  216. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +2 -3
  217. package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +1 -2
  218. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +5 -6
  219. package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +7 -7
  220. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +1 -0
  221. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +2 -4
  222. package/src/infrastructure/ui/components/templates/footer/Footer.test.tsx +15 -0
  223. package/src/infrastructure/ui/components/templates/footer/Footer.tsx +19 -0
  224. package/src/infrastructure/ui/components/templates/footer/__snapshots__/Footer.test.tsx.snap +1127 -0
  225. package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.tsx +2 -2
  226. package/src/infrastructure/ui/components/templates/header/checkoutHeader/__snapshots__/CheckoutHeader.test.tsx.snap +1 -1
  227. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx +2 -2
  228. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/__snapshots__/ItemDetailHeader.test.tsx.snap +1 -1
  229. package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.tsx +5 -4
  230. package/src/infrastructure/ui/components/templates/header/itemHeader/__snapshots__/ItemHeader.test.tsx.snap +1 -1
  231. package/src/infrastructure/ui/hooks/{useSubmitCheckout.test.ts → useCheckoutFlow.test.ts} +1 -1
  232. package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +212 -0
  233. package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +18 -60
  234. package/src/infrastructure/ui/hooks/useStaticInfo.tsx +4 -2
  235. package/src/infrastructure/ui/i18n/i18n.ts +2 -3
  236. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +3 -3
  237. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +3 -17
  238. package/src/infrastructure/ui/routing/Routing.tsx +25 -39
  239. package/src/infrastructure/ui/routing/routes.ts +0 -1
  240. package/src/infrastructure/ui/test/render.tsx +4 -10
  241. package/src/infrastructure/ui/views/App.tsx +5 -14
  242. package/src/infrastructure/ui/views/checkout/Checkout.style.ts +3 -0
  243. package/src/infrastructure/ui/views/checkout/Checkout.tsx +55 -18
  244. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.test.tsx +116 -121
  245. package/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.tsx +2 -2
  246. package/src/infrastructure/ui/views/checkout/components/deliveryBanner/__snapshots__/DeliveryBanner.test.tsx.snap +1 -1
  247. package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
  248. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +2 -2
  249. package/src/infrastructure/ui/views/item/Item.tsx +1 -2
  250. package/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.tsx +3 -3
  251. package/src/infrastructure/ui/views/item/components/banner/__snapshots__/CustomerDecissionBanner.test.tsx.snap +3 -3
  252. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +5 -11
  253. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +88 -160
  254. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +4 -4
  255. package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +128 -244
  256. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.ts +1 -2
  257. package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.tsx +3 -3
  258. package/src/infrastructure/ui/views/item/components/productVariantDescription/__snapshots__/ProductVariantDescription.test.tsx.snap +8 -10
  259. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +30 -30
  260. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -2
  261. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +1 -1
  262. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -4
  263. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +41 -75
  264. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +102 -105
  265. package/src/infrastructure/ui/views/return/components/price/Price.tsx +0 -3
  266. package/src/infrastructure/ui/views/return/components/price/__snapshots__/Price.test.tsx.snap +3 -3
  267. package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +3 -3
  268. package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +1 -1
  269. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +1 -2
  270. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +6 -6
  271. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.tsx +4 -4
  272. package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +30 -30
  273. package/src/infrastructure/ui/views/summary/Summary.tsx +5 -6
  274. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -3
  275. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +82 -154
  276. package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +6 -8
  277. package/src/infrastructure/ui/views/summaryTabs/SummaryTabs.tsx +1 -2
  278. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +5 -5
  279. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +62 -62
  280. package/src/projection/customer/customer.ts +2 -0
  281. package/src/projection/order/order.ts +1 -1
  282. package/src/projection/subscription/subscription.ts +1 -1
  283. package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +0 -169
  284. package/src/infrastructure/ui/routing/useBasePath.test.tsx +0 -19
  285. package/src/infrastructure/ui/routing/useBasePath.tsx +0 -24
  286. package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +0 -125
@@ -0,0 +1,20 @@
1
+ import { EndpointFunction } from "@lookiero/i18n";
2
+
3
+ interface TranslationEndpointFunctionArgs {
4
+ readonly translationsUrl: string;
5
+ readonly translationsApiKey: string;
6
+ }
7
+ interface TranslationEndpointFunction {
8
+ (args: TranslationEndpointFunctionArgs): EndpointFunction;
9
+ }
10
+ declare const translationEndpoint: TranslationEndpointFunction;
11
+ type Project = "user-area-front" | "inventory-catalog" | "checkout";
12
+ interface TranslationExternalEndpointFunctionArgs {
13
+ readonly translationsUrl: string;
14
+ readonly projects: [project: Project, filter?: string][];
15
+ }
16
+ interface TranslationExternalEndpointFunction {
17
+ (args: TranslationExternalEndpointFunctionArgs): EndpointFunction;
18
+ }
19
+ declare const translationExternalEndpoint: TranslationExternalEndpointFunction;
20
+ export { translationEndpoint, translationExternalEndpoint };
@@ -0,0 +1,27 @@
1
+ import { Country } from "../../../projection/shared/country";
2
+ import { Locale } from "../../../projection/shared/locale";
3
+
4
+ const translationEndpoint =
5
+ ({ translationsUrl, translationsApiKey }) =>
6
+ (locale) =>
7
+ `${translationsUrl}/${locale}?key=${translationsApiKey}&no-folding=true`;
8
+ const COUNTRY = {
9
+ [Locale.ES]: Country.ES,
10
+ [Locale.FR]: Country.FR,
11
+ [Locale.EN]: Country.GB,
12
+ [Locale.IT]: Country.IT,
13
+ [Locale.PT]: Country.PT,
14
+ [Locale.DE]: Country.DE,
15
+ [Locale.AT]: Country.AT,
16
+ [Locale.NL]: Country.NL,
17
+ [Locale.SE]: Country.SE,
18
+ };
19
+ const translationExternalEndpoint =
20
+ ({ translationsUrl, projects }) =>
21
+ (locale) => {
22
+ const projectsQueryParam = projects
23
+ .map(([project, filter]) => `projectFilter=${project}${filter ? `:${filter}` : ""}`)
24
+ .join("&");
25
+ return `${translationsUrl}/${locale}/${COUNTRY[locale]}?${projectsQueryParam}`;
26
+ };
27
+ export { translationEndpoint, translationExternalEndpoint };
@@ -0,0 +1,10 @@
1
+ import { FC } from "react";
2
+
3
+ interface CheckoutAccessibilityMiddlewareProps {
4
+ readonly customerId: string | undefined;
5
+ readonly onNotAccessible: () => void;
6
+ readonly loader?: JSX.Element;
7
+ readonly children: JSX.Element;
8
+ }
9
+ declare const CheckoutAccessibilityMiddleware: FC<CheckoutAccessibilityMiddlewareProps>;
10
+ export { CheckoutAccessibilityMiddleware };
@@ -0,0 +1,27 @@
1
+ import React, { useEffect, useRef } from "react";
2
+ import { Spinner } from "@lookiero/aurora";
3
+ import { QueryStatus } from "@lookiero/messaging-react";
4
+ import { useViewIsCheckoutAccessibleByCustomerId } from "../../projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId";
5
+
6
+ const CheckoutAccessibilityMiddleware = ({
7
+ customerId,
8
+ onNotAccessible,
9
+ loader = React.createElement(Spinner, null),
10
+ children,
11
+ }) => {
12
+ const [accessible, status] = useViewIsCheckoutAccessibleByCustomerId({ customerId });
13
+ const onNotAccessibleRef = useRef(onNotAccessible);
14
+ onNotAccessibleRef.current = onNotAccessible;
15
+ const notAccessible = accessible === false || status === QueryStatus.ERROR;
16
+ useEffect(() => {
17
+ if (notAccessible) {
18
+ onNotAccessibleRef.current();
19
+ }
20
+ }, [notAccessible]);
21
+ return accessible === undefined && [QueryStatus.IDLE, QueryStatus.LOADING].includes(status)
22
+ ? loader
23
+ : accessible
24
+ ? children
25
+ : null;
26
+ };
27
+ export { CheckoutAccessibilityMiddleware };
@@ -7,11 +7,11 @@ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutI
7
7
  import { useStartCheckout } from "../../domain/checkout/react/useStartCheckout";
8
8
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
9
9
  import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
10
+ import { useStaticInfo } from "../hooks/useStaticInfo";
10
11
  import { Routes } from "./routes";
11
- import { useBasePath } from "./useBasePath";
12
12
  const CheckoutMiddleware = ({ customerId, onNotAccessible, loader = React.createElement(Spinner, null), children, }) => {
13
13
  const logger = useLogger();
14
- const basePath = useBasePath();
14
+ const { basePath } = useStaticInfo();
15
15
  const navigate = useNavigate();
16
16
  const navigateRef = useRef(navigate);
17
17
  navigateRef.current = navigate;
@@ -33,11 +33,6 @@ const CheckoutMiddleware = ({ customerId, onNotAccessible, loader = React.create
33
33
  const feedbackRouteMatch = useMatch(`${basePath}/${Routes.FEEDBACK}`);
34
34
  const feedbackRouteMatchRef = useRef(feedbackRouteMatch);
35
35
  feedbackRouteMatchRef.current = feedbackRouteMatch;
36
- const checkoutPaymentRouteMatch = useMatch(`${basePath}/${Routes.CHECKOUT}/${Routes.CHECKOUT_PAYMENT}`);
37
- const checkoutPaymentRouteMatchRef = useRef(checkoutPaymentRouteMatch);
38
- checkoutPaymentRouteMatchRef.current = checkoutPaymentRouteMatch;
39
- const checkoutShown = useRef(false);
40
- checkoutShown.current = checkoutShown.current || (Boolean(checkoutRouteMatch) && !Boolean(checkoutPaymentRouteMatch));
41
36
  const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
42
37
  const checkoutItemsRef = useRef();
43
38
  /* This hook is mounted at this level, although not being used directly, for optimization (regarding cache) */
@@ -66,8 +61,7 @@ const CheckoutMiddleware = ({ customerId, onNotAccessible, loader = React.create
66
61
  !(summaryRouteMatchRef.current ||
67
62
  summaryTabsRouteMatchRef.current ||
68
63
  itemDetailRouteMatchRef.current ||
69
- checkoutRouteMatchRef.current ||
70
- checkoutPaymentRouteMatchRef.current)) {
64
+ checkoutRouteMatchRef.current)) {
71
65
  navigateRef.current(`${basePath}/${Routes.SUMMARY}`, { replace: true });
72
66
  }
73
67
  if (itemWithoutCustomerDecision &&
@@ -85,11 +79,6 @@ const CheckoutMiddleware = ({ customerId, onNotAccessible, loader = React.create
85
79
  onNotAccessible();
86
80
  return null;
87
81
  }
88
- /* Prevent direct payment access */
89
- if (checkoutPaymentRouteMatch && !checkoutShown.current) {
90
- onNotAccessible();
91
- return null;
92
- }
93
82
  return children;
94
83
  };
95
84
  export { CheckoutMiddleware };
@@ -4,21 +4,21 @@ import { I18n } from "@lookiero/i18n-react";
4
4
  import { Locale } from "@lookiero/sty-psp-locale";
5
5
  import { Layout } from "@lookiero/sty-psp-ui";
6
6
  import { Customer } from "../../../projection/customer/customer";
7
- import { Order } from "../../../projection/order/order";
8
- import { Subscription } from "../../../projection/subscription/subscription";
7
+ import { OrderProjection } from "../../../projection/order/order";
8
+ import { SubscriptionProjection } from "../../../projection/subscription/subscription";
9
9
  import { KameleoonEnvironment } from "../../ab-testing/kameleoonEnvironment";
10
10
  interface RoutingProps {
11
11
  readonly basePath?: string;
12
12
  readonly customer: Customer;
13
- readonly order: Order | undefined;
14
- readonly subscription: Subscription | undefined;
13
+ readonly order: OrderProjection;
14
+ readonly subscription: SubscriptionProjection;
15
15
  readonly locale: Locale;
16
16
  readonly I18n: I18n;
17
17
  readonly kameleoon: KameleoonEnvironment;
18
18
  readonly layout: Layout;
19
19
  readonly getAuthToken: () => Promise<string>;
20
20
  readonly onNotAccessible: () => void;
21
- readonly onCheckoutSubmitted?: () => void;
21
+ readonly onCheckoutFlowSuccess: () => void;
22
22
  readonly onI18nError?: (err: Error) => void;
23
23
  readonly useRedirect: () => Record<string, string>;
24
24
  readonly useRoutes: typeof reactRouterUseRoutes;
@@ -5,7 +5,6 @@ import { Kameleoon } from "@lookiero/sty-psp-ab-testing";
5
5
  import { StaticInfoProvider } from "../hooks/useStaticInfo";
6
6
  import { App } from "../views/App";
7
7
  import { Checkout } from "../views/checkout/Checkout";
8
- import { CheckoutPaymentModal } from "../views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal";
9
8
  import { Feedback } from "../views/feedback/Feedback";
10
9
  import { Item } from "../views/item/Item";
11
10
  import { Return } from "../views/return/Return";
@@ -13,18 +12,16 @@ import { Summary } from "../views/summary/Summary";
13
12
  import { SummaryTabs } from "../views/summaryTabs/SummaryTabs";
14
13
  import { CheckoutMiddleware } from "./CheckoutMiddleware";
15
14
  import { Routes } from "./routes";
16
- import { BasePathProvider } from "./useBasePath";
17
- const Routing = ({ basePath = "", customer, order, subscription, locale, I18n, kameleoon, layout, getAuthToken, onI18nError, onNotAccessible, onCheckoutSubmitted, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
15
+ const Routing = ({ basePath = "", customer, order, subscription, locale, I18n, kameleoon, layout, getAuthToken, onI18nError, onNotAccessible, onCheckoutFlowSuccess, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
18
16
  return useRoutes([
19
17
  {
20
18
  path: "",
21
- element: (React.createElement(BasePathProvider, { basePath: basePath },
22
- React.createElement(StaticInfoProvider, { customer: customer, kameleoon: kameleoon },
23
- React.createElement(I18n, { loader: React.createElement(Spinner, null), locale: locale, onError: onI18nError },
24
- React.createElement(Kameleoon, { loader: React.createElement(Spinner, null), siteCode: kameleoon.siteCode },
25
- React.createElement(CheckoutMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
26
- React.createElement(App, null,
27
- React.createElement(Outlet, null)))))))),
19
+ element: (React.createElement(StaticInfoProvider, { basePath: basePath, customer: customer, kameleoon: kameleoon },
20
+ React.createElement(I18n, { loader: React.createElement(Spinner, null), locale: locale, onError: onI18nError },
21
+ React.createElement(Kameleoon, { loader: React.createElement(Spinner, null), siteCode: kameleoon.siteCode },
22
+ React.createElement(CheckoutMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
23
+ React.createElement(App, null,
24
+ React.createElement(Outlet, null))))))),
28
25
  children: [
29
26
  {
30
27
  path: Routes.ITEM,
@@ -52,14 +49,7 @@ const Routing = ({ basePath = "", customer, order, subscription, locale, I18n, k
52
49
  {
53
50
  path: Routes.CHECKOUT,
54
51
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
55
- React.createElement(Checkout, { layout: layout, useRedirect: useRedirect },
56
- React.createElement(Outlet, null)))),
57
- children: [
58
- {
59
- path: Routes.CHECKOUT_PAYMENT,
60
- element: (React.createElement(CheckoutPaymentModal, { coupon: order?.coupon || null, getAuthToken: getAuthToken, isFirstOrder: order?.isFirstOrder, orderNumber: order?.orderNumber, subscription: subscription, onCheckoutSubmitted: onCheckoutSubmitted })),
61
- },
62
- ],
52
+ React.createElement(Checkout, { getAuthToken: getAuthToken, layout: layout, order: order, subscription: subscription, useRedirect: useRedirect, onCheckoutFlowSuccess: onCheckoutFlowSuccess }))),
63
53
  },
64
54
  {
65
55
  path: Routes.FEEDBACK,
@@ -5,7 +5,6 @@ export declare enum Routes {
5
5
  SUMMARY = "summary",
6
6
  SUMMARY_TABS = "tabs/:tab",
7
7
  CHECKOUT = "checkout",
8
- CHECKOUT_PAYMENT = "payment",
9
8
  FEEDBACK = "feedback",
10
9
  RETURN = "return/:id"
11
10
  }
@@ -6,7 +6,6 @@ export var Routes;
6
6
  Routes["SUMMARY"] = "summary";
7
7
  Routes["SUMMARY_TABS"] = "tabs/:tab";
8
8
  Routes["CHECKOUT"] = "checkout";
9
- Routes["CHECKOUT_PAYMENT"] = "payment";
10
9
  Routes["FEEDBACK"] = "feedback";
11
10
  Routes["RETURN"] = "return/:id";
12
11
  })(Routes || (Routes = {}));
@@ -1,18 +1,14 @@
1
1
  import { render } from "@testing-library/react-native";
2
2
  import { mock } from "jest-mock-extended";
3
3
  import React, { Fragment } from "react";
4
+ import { IntlProvider } from "react-intl";
4
5
  import { Aurora } from "@lookiero/aurora";
5
- import { createI18nProvider } from "@lookiero/i18n-react";
6
6
  import { LoggerProvider } from "@lookiero/sty-psp-logging";
7
- import { DOMAIN } from "../i18n/i18n";
8
- import { BasePathProvider } from "../routing/useBasePath";
9
- const I18nProvider = createI18nProvider({ domain: DOMAIN });
10
7
  const renderWrapper = ({ locale, messages = {}, wrapper: Wrapper = Fragment, logger = mock() }) =>
11
8
  // eslint-disable-next-line react/display-name, react/prop-types
12
9
  ({ children }) => (React.createElement(Aurora, null,
13
- React.createElement(I18nProvider, { locale: locale, messages: messages, onError: () => void 0 },
10
+ React.createElement(IntlProvider, { locale: locale, messages: messages, onError: () => void 0 },
14
11
  React.createElement(LoggerProvider, { logger: logger },
15
- React.createElement(BasePathProvider, { basePath: "" },
16
- React.createElement(Wrapper, null, children))))));
12
+ React.createElement(Wrapper, null, children)))));
17
13
  const renderWithProviders = (ui, { locale, messages, wrapper } = { locale: "en" }) => render(ui, { wrapper: renderWrapper({ locale, messages, wrapper }) });
18
14
  export { renderWithProviders as render };
@@ -1,16 +1,14 @@
1
- import { PortalProvider } from "@gorhom/portal";
1
+ import { PortalHost } from "@gorhom/portal";
2
2
  import React from "react";
3
3
  import { StatusBar } from "react-native";
4
4
  import { SafeAreaProvider } from "react-native-safe-area-context";
5
- import { PortalProvider as AuroraPortalProvider } from "@lookiero/aurora";
6
5
  import { Notifications } from "@lookiero/sty-psp-notifications";
7
6
  import { theme } from "@lookiero/sty-psp-ui";
8
7
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
9
- import { DOMAIN } from "../i18n/i18n";
10
8
  const { colorBgBase } = theme();
11
9
  const App = ({ children }) => (React.createElement(SafeAreaProvider, null,
12
- React.createElement(PortalProvider, { rootHostName: "Checkout" },
13
- React.createElement(StatusBar, { backgroundColor: colorBgBase, barStyle: "dark-content", translucent: true }),
14
- React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID, domain: DOMAIN, portalHostName: "Checkout" }),
15
- React.createElement(AuroraPortalProvider, null, children))));
10
+ React.createElement(StatusBar, { backgroundColor: colorBgBase, barStyle: "dark-content", translucent: true }),
11
+ React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID, portalHostName: "Checkout" }),
12
+ React.createElement(PortalHost, { name: "Checkout" }),
13
+ children));
16
14
  export { App };
@@ -0,0 +1,6 @@
1
+ declare const style: {
2
+ container: {
3
+ flex: number;
4
+ };
5
+ };
6
+ export { style };
@@ -0,0 +1,8 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ const style = StyleSheet.create({
4
+ container: {
5
+ flex: 1,
6
+ },
7
+ });
8
+ export { style };
@@ -1,8 +1,13 @@
1
- import { FC, ReactNode } from "react";
1
+ import { FC } from "react";
2
2
  import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
3
+ import { OrderProjection } from "../../../../projection/order/order";
4
+ import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
3
5
  interface CheckoutProps {
4
- readonly children?: ReactNode;
5
6
  readonly layout: UiLayout;
7
+ readonly order: OrderProjection;
8
+ readonly subscription: SubscriptionProjection;
9
+ readonly getAuthToken: () => Promise<string>;
10
+ readonly onCheckoutFlowSuccess: () => void;
6
11
  readonly useRedirect: () => Record<string, string>;
7
12
  }
8
13
  declare const Checkout: FC<CheckoutProps>;
@@ -4,6 +4,7 @@ import { useNavigate } from "react-router-native";
4
4
  import { Box, Button, Layout as AuroraLayout, Spinner, Text, useDevice } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { QueryStatus } from "@lookiero/messaging-react";
7
+ import { Country } from "@lookiero/sty-psp-locale";
7
8
  import { Sticky } from "@lookiero/sty-psp-ui";
8
9
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
9
10
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
@@ -14,24 +15,31 @@ import { useTrackPressBack } from "../../../tracking/useTrackPressBack";
14
15
  import { useTrackPressContinue } from "../../../tracking/useTrackPressContinue";
15
16
  import { Body } from "../../components/layouts/body/Body";
16
17
  import { CheckoutHeader } from "../../components/templates/header/checkoutHeader/CheckoutHeader";
18
+ import { useCheckoutFlow } from "../../hooks/useCheckoutFlow";
17
19
  import { useStaticInfo } from "../../hooks/useStaticInfo";
18
- import { DOMAIN, I18nMessages } from "../../i18n/i18n";
20
+ import { I18nMessages } from "../../i18n/i18n";
19
21
  import { Routes } from "../../routing/routes";
20
- import { useBasePath } from "../../routing/useBasePath";
21
22
  import { ProductVariant } from "../shared/components/productVariant/ProductVariant";
22
23
  import { Pricing } from "../summary/components/pricing/Pricing";
23
24
  import { style } from "./Checkout.style";
24
25
  import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
25
26
  import { PaymentInstrument } from "./components/paymentInstrument/PaymentInstrument";
26
- const Checkout = ({ children, layout: Layout, useRedirect }) => {
27
- const { customer: { customerId, country, segment }, } = useStaticInfo();
28
- const titleText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_TITLE });
29
- const submitButtonText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_PAY_BUTTON });
27
+ const Checkout = ({ layout: Layout, order, subscription, getAuthToken, useRedirect, onCheckoutFlowSuccess, }) => {
28
+ const { customer: { customerId, country, segment }, basePath, } = useStaticInfo();
29
+ const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
30
+ const submitButtonText = useI18nMessage({ id: I18nMessages.CHECKOUT_PAY_BUTTON });
30
31
  const { screen } = useDevice();
31
32
  const [pricingHeight, setPricingHeight] = useState(0);
32
33
  const handleOnPricingLayout = useCallback(({ height }) => setPricingHeight(height), []);
33
34
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
34
35
  const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id });
36
+ const [checkoutFlow, checkoutFlowStatus, paymentFlowComponent] = useCheckoutFlow({
37
+ checkout,
38
+ order,
39
+ subscription,
40
+ getAuthToken,
41
+ onSuccess: onCheckoutFlowSuccess,
42
+ });
35
43
  useTrackPageView({
36
44
  page: TrackingPage.CHECKOUT,
37
45
  country,
@@ -39,17 +47,16 @@ const Checkout = ({ children, layout: Layout, useRedirect }) => {
39
47
  checkoutId: checkout?.id,
40
48
  });
41
49
  const navigate = useNavigate();
42
- const basePath = useBasePath();
43
50
  const trackPressContinue = useTrackPressContinue({
44
51
  page: TrackingPage.CHECKOUT,
45
52
  country,
46
53
  segment,
47
54
  checkoutId: checkout?.id,
48
55
  });
49
- const handleOnSubmit = useCallback(() => {
56
+ const handleOnSubmit = useCallback(async () => {
50
57
  trackPressContinue();
51
- navigate(`${basePath}/${Routes.CHECKOUT}/${Routes.CHECKOUT_PAYMENT}`, { replace: true });
52
- }, [basePath, navigate, trackPressContinue]);
58
+ await checkoutFlow();
59
+ }, [checkoutFlow, trackPressContinue]);
53
60
  const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
54
61
  const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
55
62
  const trackPressBack = useTrackPressBack({
@@ -77,19 +84,21 @@ const Checkout = ({ children, layout: Layout, useRedirect }) => {
77
84
  React.createElement(AuroraLayout, { fullWidth: !screen.L, style: [screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }] },
78
85
  React.createElement(Box, { size: { L: "2/3" }, style: screen.L && style.desktopListSpacing },
79
86
  React.createElement(View, { style: [style.contentWrapper, screen.L && style.desktopContentWrapper] },
87
+ country === Country.NL && (React.createElement(View, { style: style.paymentSelectorNL },
88
+ React.createElement(PaymentInstrument, { useRedirect: useRedirect }))),
80
89
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
81
90
  checkoutItemsKept?.map((checkoutItem) => (React.createElement(View, { key: checkoutItem.id, testID: "checkout-items-kept" },
82
91
  React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, country: country, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, status: checkoutItem.status, size: checkoutItem.status === CheckoutItemStatus.REPLACED && checkoutItem.replacedFor
83
92
  ? checkoutItem.replacedFor.size
84
93
  : checkoutItem.productVariant.size })))),
85
- React.createElement(View, { style: style.paymentSelector },
86
- React.createElement(PaymentInstrument, { useRedirect: useRedirect })))),
94
+ country !== Country.NL && (React.createElement(View, { style: style.paymentSelector },
95
+ React.createElement(PaymentInstrument, { useRedirect: useRedirect }))))),
87
96
  React.createElement(Box, { size: { L: "1/3" }, style: [style.resume, screen.L && style.desktopResume] }, pricing ? (React.createElement(View, { style: [style.princingWrapper, !screen.L && style.princingWrapperSmall] },
88
97
  React.createElement(Pricing, { pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0 }),
89
- screen.L ? (React.createElement(Button, { testID: "confirm-checkout-button", onPress: handleOnSubmit }, submitButtonText)) : null)) : null))),
98
+ screen.L ? (React.createElement(Button, { busy: checkoutFlowStatus === "loading", testID: "confirm-checkout-button", onPress: handleOnSubmit }, submitButtonText)) : null)) : null))),
90
99
  pricing && !screen.L ? (React.createElement(Sticky, { style: style.sticky, onLayout: Platform.OS !== "web" ? handleOnPricingLayout : undefined },
91
100
  React.createElement(Body, null,
92
- React.createElement(Button, { testID: "confirm-checkout-button", small: true, onPress: handleOnSubmit }, submitButtonText)))) : null,
93
- children));
101
+ React.createElement(Button, { busy: checkoutFlowStatus === "loading", testID: "confirm-checkout-button", small: true, onPress: handleOnSubmit }, submitButtonText)))) : null,
102
+ paymentFlowComponent));
94
103
  };
95
104
  export { Checkout };
@@ -24,6 +24,9 @@ declare const style: {
24
24
  paymentSelector: {
25
25
  marginTop: number;
26
26
  };
27
+ paymentSelectorNL: {
28
+ marginBottom: number;
29
+ };
27
30
  princingWrapper: {
28
31
  padding: number;
29
32
  };
@@ -28,6 +28,9 @@ const style = StyleSheet.create({
28
28
  paymentSelector: {
29
29
  marginTop: space6,
30
30
  },
31
+ paymentSelectorNL: {
32
+ marginBottom: space6,
33
+ },
31
34
  princingWrapper: {
32
35
  padding: space6,
33
36
  },
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { useNavigate } from "react-router-native";
3
3
  import { QueryStatus } from "@lookiero/messaging-react";
4
- import { PaymentFlow } from "@lookiero/payments-front";
4
+ import { PaymentFlow, Section } from "@lookiero/payments-front";
5
5
  import { useLogger } from "@lookiero/sty-psp-logging";
6
6
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
7
7
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
@@ -10,21 +10,21 @@ import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection
10
10
  import { useViewPricingByCheckoutId } from "../../../../../projection/pricing/react/useViewPricingByCheckoutId";
11
11
  import { TrackingPage } from "../../../../../tracking/tracking";
12
12
  import { useTrackCheckout } from "../../../../../tracking/useTrackCheckout";
13
+ import { useCheckoutFlow } from "../../../../hooks/useCheckoutFlow";
13
14
  import { useStaticInfo } from "../../../../hooks/useStaticInfo";
14
- import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
15
15
  import { Routes } from "../../../../routing/routes";
16
16
  import { useBasePath } from "../../../../routing/useBasePath";
17
17
  const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber, getAuthToken, onCheckoutSubmitted, }) => {
18
18
  const paymentFlowRef = useRef(null);
19
19
  const logger = useLogger();
20
20
  const { customer: { customerId, country, segment }, } = useStaticInfo();
21
- const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
21
+ const [checkoutProjection, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
22
22
  const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
23
- checkoutId: checkout?.id,
23
+ checkoutId: checkoutProjection?.id,
24
24
  });
25
- const [sizeChangeEnabled] = useViewIsSizeChangeEnabledByCheckoutId({ checkoutId: checkout?.id });
25
+ const [sizeChangeEnabled] = useViewIsSizeChangeEnabledByCheckoutId({ checkoutId: checkoutProjection?.id });
26
26
  const [pricing] = useViewPricingByCheckoutId({
27
- checkoutId: checkout?.id,
27
+ checkoutId: checkoutProjection?.id,
28
28
  queryOptions: { refetchOnMount: true },
29
29
  });
30
30
  const [authToken, setAuthToken] = useState();
@@ -36,13 +36,13 @@ const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber,
36
36
  const navigate = useNavigate();
37
37
  const trackCheckout = useTrackCheckout({
38
38
  page: TrackingPage.CHECKOUT,
39
- checkoutId: checkout?.id,
39
+ checkoutId: checkoutProjection?.id,
40
40
  country,
41
41
  segment,
42
42
  });
43
43
  const handleOnSubmitCheckoutError = useCallback(() => navigate(`${basePath}/${Routes.CHECKOUT}`, { replace: true }), [basePath, navigate]);
44
44
  const handleOnSubmitCheckoutSuccess = useCallback(() => {
45
- const checkoutItemsKept = checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED);
45
+ const checkoutItemsKept = checkoutProjection?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED);
46
46
  const totalReplacedFor = checkoutItemsKept?.filter(({ replacedFor }) => Boolean(replacedFor)).length || 0;
47
47
  trackCheckout({
48
48
  totalCheckoutItemsKept: checkoutItemsKept?.length || 0,
@@ -57,7 +57,7 @@ const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber,
57
57
  });
58
58
  onCheckoutSubmitted?.();
59
59
  }, [
60
- checkout?.items,
60
+ checkoutProjection?.items,
61
61
  coupon,
62
62
  customerId,
63
63
  isFirstOrder,
@@ -68,9 +68,9 @@ const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber,
68
68
  subscription,
69
69
  trackCheckout,
70
70
  ]);
71
- const [submitCheckout] = useSubmitCheckout({
72
- checkoutId: checkout?.id,
73
- checkoutBookingId: checkout?.checkoutBookingId,
71
+ const [checkout] = useCheckoutFlow({
72
+ checkoutId: checkoutProjection?.id,
73
+ checkoutBookingId: checkoutProjection?.checkoutBookingId,
74
74
  paymentFlowRef,
75
75
  onError: handleOnSubmitCheckoutError,
76
76
  onSuccess: handleOnSubmitCheckoutSuccess,
@@ -78,13 +78,13 @@ const CheckoutPaymentModal = ({ coupon, isFirstOrder, subscription, orderNumber,
78
78
  });
79
79
  useEffect(() => {
80
80
  if (paymentFlowPayload && sizeChangeEnabled !== undefined && pricing !== undefined) {
81
- submitCheckout({ paymentFlowPayload, sizeChangeEnabled });
81
+ checkout({ paymentFlowPayload, sizeChangeEnabled });
82
82
  }
83
- }, [paymentFlowPayload, pricing, sizeChangeEnabled, submitCheckout]);
83
+ }, [paymentFlowPayload, pricing, sizeChangeEnabled, checkout]);
84
84
  const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
85
- const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) && authToken;
85
+ const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkoutProjection) && authToken;
86
86
  if (!dependenciesLoaded)
87
87
  return null;
88
- return React.createElement(PaymentFlow, { ref: paymentFlowRef, token: authToken });
88
+ return React.createElement(PaymentFlow, { ref: paymentFlowRef, section: Section.BOX_CHECKOUT, token: authToken });
89
89
  };
90
90
  export { CheckoutPaymentModal };
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { ALIGN, InfoBox, INFOBOX_TYPE, useDevice } from "@lookiero/aurora";
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
- import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
4
+ import { I18nMessages } from "../../../../i18n/i18n";
5
5
  const DeliveryBanner = () => {
6
6
  const { screen } = useDevice();
7
- return (React.createElement(InfoBox, { contentAlign: screen.L ? ALIGN.CENTER : undefined, testID: "delivery-banner", text: useI18nMessage({ domain: DOMAIN, id: I18nMessages.CHECKOUT_DELIVERY_BANNER }), type: INFOBOX_TYPE.SQUARED }));
7
+ return (React.createElement(InfoBox, { contentAlign: screen.L ? ALIGN.CENTER : undefined, testID: "delivery-banner", text: useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER }), type: INFOBOX_TYPE.SQUARED }));
8
8
  };
9
9
  export { DeliveryBanner };
@@ -1,12 +1,12 @@
1
- import React, { useRef } from "react";
1
+ import React from "react";
2
2
  import { PaymentInstrumentSelect, Section } from "@lookiero/payments-front";
3
- import { useLogger } from "@lookiero/sty-psp-logging";
4
- import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
3
+ import { useStaticInfo } from "../../../../hooks/useStaticInfo";
5
4
  const PaymentInstrument = ({ useRedirect }) => {
6
- const paymentInstrumentSelectRef = useRef(null);
7
5
  const { returnUrl } = useRedirect();
8
- const logger = useLogger();
9
- usePaymentInstrumentEvents({ logger });
10
- return (React.createElement(PaymentInstrumentSelect, { ref: paymentInstrumentSelectRef, beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, section: Section.BOX_CHECKOUT }));
6
+ const { customer } = useStaticInfo();
7
+ return (React.createElement(PaymentInstrumentSelect, { beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, section: Section.BOX_CHECKOUT, userInformation: {
8
+ email: customer.email,
9
+ name: customer.name,
10
+ }, showSingleUsePaymentMethods: true }));
11
11
  };
12
12
  export { PaymentInstrument };
@@ -11,7 +11,7 @@ import { HostDefaultCheckoutQuestionItem } from "../../../../components/organism
11
11
  import { HostSelectCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem";
12
12
  import { IconCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem";
13
13
  import { TextareaCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem";
14
- import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
14
+ import { I18nMessages } from "../../../../i18n/i18n";
15
15
  const checkoutQuestionItems = {
16
16
  [CheckoutQuestionType.HOST_DEFAULT]: HostDefaultCheckoutQuestionItem,
17
17
  [CheckoutQuestionType.HOST_TEXTAREA]: HostDefaultCheckoutQuestionItem,
@@ -21,7 +21,7 @@ const checkoutQuestionItems = {
21
21
  [CheckoutQuestionType.BUTTON]: ButtonCheckoutQuestionItem,
22
22
  };
23
23
  const CheckoutQuestionsForm = ({ checkoutQuestions, submitButtonDisabled, onSubmit, }) => {
24
- const buttonText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.FEEDBACK_BUTTON });
24
+ const buttonText = useI18nMessage({ id: I18nMessages.FEEDBACK_BUTTON });
25
25
  const feedback = useCheckoutQuestionFeedback();
26
26
  const handlePress = useCallback(() => onSubmit(feedback), [feedback, onSubmit]);
27
27
  const filteredCheckoutQuestions = useMemo(() => {
@@ -0,0 +1,7 @@
1
+ declare const style: {
2
+ buttonContainer: {
3
+ paddingHorizontal: number;
4
+ paddingVertical: number;
5
+ };
6
+ };
7
+ export { style };
@@ -0,0 +1,11 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space6, space8 } = theme();
5
+ const style = StyleSheet.create({
6
+ buttonContainer: {
7
+ paddingHorizontal: space6,
8
+ paddingVertical: space8,
9
+ },
10
+ });
11
+ export { style };
@@ -22,7 +22,6 @@ import { ItemDetailHeader } from "../../components/templates/header/itemDetailHe
22
22
  import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
23
23
  import { useStaticInfo } from "../../hooks/useStaticInfo";
24
24
  import { Routes } from "../../routing/routes";
25
- import { useBasePath } from "../../routing/useBasePath";
26
25
  import { style } from "./Item.style";
27
26
  import { ItemWithCustomerDecission, } from "./views/itemWithCustomerDecission/ItemWithCustomerDecission";
28
27
  import { ItemWithoutCustomerDecission, } from "./views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission";
@@ -30,8 +29,7 @@ const Item = ({ layout: Layout }) => {
30
29
  const logger = useLogger();
31
30
  const screenSize = useScreenSize();
32
31
  const navigate = useNavigate();
33
- const basePath = useBasePath();
34
- const { customer: { customerId, country, segment }, } = useStaticInfo();
32
+ const { customer: { customerId, country, segment }, basePath, } = useStaticInfo();
35
33
  const isDesktopScreen = screenSize !== "S";
36
34
  const { id } = useParams();
37
35
  const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });