@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.
- package/dist/fake-dependencies/@lookiero/payments-front/index.d.ts +8 -6
- package/dist/fake-dependencies/@lookiero/payments-front/index.js +7 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -2
- package/dist/pact.config.d.ts +21 -0
- package/dist/pact.config.js +16 -0
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/ExpoRoot.js +19 -15
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.d.ts +1 -1
- package/dist/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.js +2 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +55 -0
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +116 -0
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +56 -0
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +51 -0
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +51 -0
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +51 -0
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +13 -0
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +19 -0
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +56 -0
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +57 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +55 -0
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +120 -0
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +55 -0
- package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.d.ts +1 -1
- package/dist/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.js +2 -1
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +55 -0
- package/dist/src/infrastructure/tracking/tracking.d.ts +2 -2
- package/dist/src/infrastructure/tracking/useTrackCheckout.d.ts +10 -17
- package/dist/src/infrastructure/tracking/useTrackCheckout.js +27 -12
- package/dist/src/infrastructure/ui/Root.d.ts +6 -6
- package/dist/src/infrastructure/ui/Root.js +2 -3
- package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +1 -2
- package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +2 -3
- package/dist/src/infrastructure/ui/components/atoms/price/Price.js +0 -3
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +22 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +5 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +6 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +20 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +43 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +14 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +3 -7
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.d.ts +2 -18
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.js +2 -14
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +3 -4
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +1 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.js +3 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.js +2 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +4 -4
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +2 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +2 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +4 -5
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.js +6 -6
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +3 -4
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +1 -0
- package/dist/src/infrastructure/ui/components/templates/footer/Footer.d.ts +3 -0
- package/dist/src/infrastructure/ui/components/templates/footer/Footer.js +13 -0
- package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -2
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +21 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
- package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -2
- package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +4 -4
- package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.d.ts +26 -0
- package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +135 -0
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +12 -0
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +64 -0
- package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +3 -2
- package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +17 -26
- package/dist/src/infrastructure/ui/hooks/useStaticInfo.d.ts +2 -0
- package/dist/src/infrastructure/ui/hooks/useStaticInfo.js +2 -2
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +22 -55
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +10 -0
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +17 -0
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +2 -2
- package/dist/src/infrastructure/ui/i18n/i18n.js +2 -2
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +20 -0
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +27 -0
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +10 -0
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +27 -0
- package/dist/src/infrastructure/ui/routing/CheckoutMiddleware.js +3 -14
- package/dist/src/infrastructure/ui/routing/Routing.d.ts +5 -5
- package/dist/src/infrastructure/ui/routing/Routing.js +8 -18
- package/dist/src/infrastructure/ui/routing/routes.d.ts +0 -1
- package/dist/src/infrastructure/ui/routing/routes.js +0 -1
- package/dist/src/infrastructure/ui/test/render.js +3 -7
- package/dist/src/infrastructure/ui/views/App.js +5 -7
- package/dist/src/infrastructure/ui/views/App.style.d.ts +6 -0
- package/dist/src/infrastructure/ui/views/App.style.js +8 -0
- package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +7 -2
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +24 -15
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +16 -16
- package/dist/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.js +2 -2
- package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -2
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +11 -0
- package/dist/src/infrastructure/ui/views/item/Item.js +1 -3
- package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +5 -11
- package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -4
- package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +3 -3
- package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +0 -1
- package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +1 -2
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +64 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +16 -0
- package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -4
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +40 -0
- package/dist/src/infrastructure/ui/views/return/Return.style.js +44 -0
- package/dist/src/infrastructure/ui/views/return/components/price/Price.js +0 -3
- package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +3 -3
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +6 -6
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -1
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +1 -2
- package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +4 -4
- package/dist/src/infrastructure/ui/views/summary/Summary.js +5 -6
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -3
- package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +6 -8
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +14 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +28 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +11 -0
- package/dist/src/infrastructure/ui/views/summaryTabs/SummaryTabs.js +1 -3
- package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +26 -0
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +21 -0
- package/dist/src/projection/customer/customer.d.ts +2 -0
- package/dist/src/projection/order/order.d.ts +1 -1
- package/dist/src/projection/shared/country.d.ts +14 -0
- package/dist/src/projection/shared/country.js +15 -0
- package/dist/src/projection/shared/customer.d.ts +9 -0
- package/dist/src/projection/shared/customer.js +1 -0
- package/dist/src/projection/shared/locale.d.ts +12 -0
- package/dist/src/projection/shared/locale.js +13 -0
- package/dist/src/projection/shared/order.d.ts +6 -0
- package/dist/src/projection/shared/order.js +1 -0
- package/dist/src/projection/shared/price.d.ts +11 -0
- package/dist/src/projection/shared/price.js +1 -0
- package/dist/src/projection/shared/size.d.ts +21 -0
- package/dist/src/projection/shared/size.js +4 -0
- package/dist/src/projection/shared/subscription.d.ts +2 -0
- package/dist/src/projection/shared/subscription.js +1 -0
- package/dist/src/projection/subscription/subscription.d.ts +1 -1
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +15 -0
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +16 -0
- package/dist/src/shared/ui/components/atoms/error/Error.d.ts +11 -0
- package/dist/src/shared/ui/components/atoms/error/Error.js +6 -0
- package/dist/src/shared/ui/components/atoms/field/Field.d.ts +14 -0
- package/dist/src/shared/ui/components/atoms/field/Field.js +29 -0
- package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +16 -0
- package/dist/src/shared/ui/components/atoms/field/Field.style.js +19 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +24 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.js +28 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +29 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +37 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/fake-dependencies/@lookiero/payments-front/index.tsx +32 -9
- package/index.ts +11 -5
- package/jest.config.js +2 -2
- package/package.json +8 -7
- package/src/ExpoRoot.tsx +44 -38
- package/src/infrastructure/domain/checkoutBooking/react/useBlockCheckoutBooking.ts +4 -1
- package/src/infrastructure/projection/pricing/react/useViewPricingByCheckoutId.ts +3 -2
- package/src/infrastructure/tracking/tracking.ts +2 -2
- package/src/infrastructure/tracking/useTrackCheckout.ts +66 -56
- package/src/infrastructure/ui/Root.tsx +9 -9
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.ts +2 -3
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.tsx +2 -3
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/__snapshots__/FiveItemsDiscountBanner.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/atoms/price/Price.tsx +0 -3
- package/src/infrastructure/ui/components/atoms/price/__snapshots__/Price.test.tsx.snap +3 -3
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.ts +4 -25
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +7 -13
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +1 -2
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +1 -2
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +1 -0
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +2 -4
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +3 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +2 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +5 -5
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +2 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +2 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +1 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +5 -6
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/returnQuestionFeedbackItem/ReturnQuestionFeedbackItem.tsx +7 -7
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +1 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +2 -4
- package/src/infrastructure/ui/components/templates/footer/Footer.test.tsx +15 -0
- package/src/infrastructure/ui/components/templates/footer/Footer.tsx +19 -0
- package/src/infrastructure/ui/components/templates/footer/__snapshots__/Footer.test.tsx.snap +1127 -0
- package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.tsx +2 -2
- package/src/infrastructure/ui/components/templates/header/checkoutHeader/__snapshots__/CheckoutHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx +2 -2
- package/src/infrastructure/ui/components/templates/header/itemDetailHeader/__snapshots__/ItemDetailHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.tsx +5 -4
- package/src/infrastructure/ui/components/templates/header/itemHeader/__snapshots__/ItemHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/hooks/{useSubmitCheckout.test.ts → useCheckoutFlow.test.ts} +1 -1
- package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +212 -0
- package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +18 -60
- package/src/infrastructure/ui/hooks/useStaticInfo.tsx +4 -2
- package/src/infrastructure/ui/i18n/i18n.ts +2 -3
- package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +3 -3
- package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +3 -17
- package/src/infrastructure/ui/routing/Routing.tsx +25 -39
- package/src/infrastructure/ui/routing/routes.ts +0 -1
- package/src/infrastructure/ui/test/render.tsx +4 -10
- package/src/infrastructure/ui/views/App.tsx +5 -14
- package/src/infrastructure/ui/views/checkout/Checkout.style.ts +3 -0
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +55 -18
- package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.test.tsx +116 -121
- package/src/infrastructure/ui/views/checkout/components/deliveryBanner/DeliveryBanner.tsx +2 -2
- package/src/infrastructure/ui/views/checkout/components/deliveryBanner/__snapshots__/DeliveryBanner.test.tsx.snap +1 -1
- package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
- package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +2 -2
- package/src/infrastructure/ui/views/item/Item.tsx +1 -2
- package/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.tsx +3 -3
- package/src/infrastructure/ui/views/item/components/banner/__snapshots__/CustomerDecissionBanner.test.tsx.snap +3 -3
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +5 -11
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +88 -160
- package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +4 -4
- package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +128 -244
- package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.ts +1 -2
- package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.tsx +3 -3
- package/src/infrastructure/ui/views/item/components/productVariantDescription/__snapshots__/ProductVariantDescription.test.tsx.snap +8 -10
- package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +30 -30
- package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +2 -2
- package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +1 -1
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -4
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +41 -75
- package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +102 -105
- package/src/infrastructure/ui/views/return/components/price/Price.tsx +0 -3
- package/src/infrastructure/ui/views/return/components/price/__snapshots__/Price.test.tsx.snap +3 -3
- package/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.tsx +3 -3
- package/src/infrastructure/ui/views/return/components/productVariantPreview/__snapshots__/ProductVariantPreview.test.tsx.snap +1 -1
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +1 -2
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +6 -6
- package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.tsx +4 -4
- package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +30 -30
- package/src/infrastructure/ui/views/summary/Summary.tsx +5 -6
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -3
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +82 -154
- package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +6 -8
- package/src/infrastructure/ui/views/summaryTabs/SummaryTabs.tsx +1 -2
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +5 -5
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +62 -62
- package/src/projection/customer/customer.ts +2 -0
- package/src/projection/order/order.ts +1 -1
- package/src/projection/subscription/subscription.ts +1 -1
- package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +0 -169
- package/src/infrastructure/ui/routing/useBasePath.test.tsx +0 -19
- package/src/infrastructure/ui/routing/useBasePath.tsx +0 -24
- package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +0 -125
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { render, RenderAPI } from "@testing-library/react-native";
|
|
2
2
|
import { mock } from "jest-mock-extended";
|
|
3
3
|
import React, { FC, Fragment, ReactElement } from "react";
|
|
4
|
+
import { IntlProvider } from "react-intl";
|
|
4
5
|
import { Aurora } from "@lookiero/aurora";
|
|
5
|
-
import { createI18nProvider } from "@lookiero/i18n-react";
|
|
6
6
|
import { TranslationMessages } from "@lookiero/i18n/domain/translation/model/translationMessages";
|
|
7
7
|
import { Logger, LoggerProvider } from "@lookiero/sty-psp-logging";
|
|
8
|
-
import { DOMAIN } from "../i18n/i18n";
|
|
9
|
-
import { BasePathProvider } from "../routing/useBasePath";
|
|
10
|
-
|
|
11
|
-
const I18nProvider = createI18nProvider({ domain: DOMAIN });
|
|
12
8
|
|
|
13
9
|
interface RenderArgs {
|
|
14
10
|
readonly locale?: string;
|
|
@@ -27,13 +23,11 @@ const renderWrapper: RenderWrapperFunction =
|
|
|
27
23
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
28
24
|
({ children }) => (
|
|
29
25
|
<Aurora>
|
|
30
|
-
<
|
|
26
|
+
<IntlProvider locale={locale as string} messages={messages} onError={() => void 0}>
|
|
31
27
|
<LoggerProvider logger={logger}>
|
|
32
|
-
<
|
|
33
|
-
<Wrapper>{children}</Wrapper>
|
|
34
|
-
</BasePathProvider>
|
|
28
|
+
<Wrapper>{children}</Wrapper>
|
|
35
29
|
</LoggerProvider>
|
|
36
|
-
</
|
|
30
|
+
</IntlProvider>
|
|
37
31
|
</Aurora>
|
|
38
32
|
);
|
|
39
33
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PortalHost } from "@gorhom/portal";
|
|
2
2
|
import React, { FC } 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
|
|
|
11
9
|
const { colorBgBase } = theme();
|
|
12
10
|
|
|
@@ -16,17 +14,10 @@ interface AppProps {
|
|
|
16
14
|
|
|
17
15
|
const App: FC<AppProps> = ({ children }) => (
|
|
18
16
|
<SafeAreaProvider>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
We are using the Aurora's PortalProvider at this level for notifications to work properly.
|
|
24
|
-
|
|
25
|
-
PaymentInstrumentSelect uses Aurora's Portal, and if we rely on UAF's Portal (injected by <Aurora>)
|
|
26
|
-
notifications would be displayed in a layer below Portal's one (not visible).
|
|
27
|
-
*/}
|
|
28
|
-
<AuroraPortalProvider>{children}</AuroraPortalProvider>
|
|
29
|
-
</PortalProvider>
|
|
17
|
+
<StatusBar backgroundColor={colorBgBase} barStyle="dark-content" translucent />
|
|
18
|
+
<Notifications contextId={MESSAGING_CONTEXT_ID} portalHostName="Checkout" />
|
|
19
|
+
<PortalHost name="Checkout" />
|
|
20
|
+
{children}
|
|
30
21
|
</SafeAreaProvider>
|
|
31
22
|
);
|
|
32
23
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import React, { FC,
|
|
1
|
+
import React, { FC, useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { LayoutRectangle, Platform, ScrollView, View } from "react-native";
|
|
3
3
|
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 { Layout as UiLayout, Sticky } from "@lookiero/sty-psp-ui";
|
|
8
9
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
10
|
+
import { OrderProjection } from "../../../../projection/order/order";
|
|
11
|
+
import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
|
|
9
12
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
10
13
|
import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
11
14
|
import { TrackingPage } from "../../../tracking/tracking";
|
|
@@ -14,10 +17,10 @@ import { useTrackPressBack } from "../../../tracking/useTrackPressBack";
|
|
|
14
17
|
import { useTrackPressContinue } from "../../../tracking/useTrackPressContinue";
|
|
15
18
|
import { Body } from "../../components/layouts/body/Body";
|
|
16
19
|
import { CheckoutHeader } from "../../components/templates/header/checkoutHeader/CheckoutHeader";
|
|
20
|
+
import { useCheckoutFlow } from "../../hooks/useCheckoutFlow";
|
|
17
21
|
import { useStaticInfo } from "../../hooks/useStaticInfo";
|
|
18
|
-
import {
|
|
22
|
+
import { I18nMessages } from "../../i18n/i18n";
|
|
19
23
|
import { Routes } from "../../routing/routes";
|
|
20
|
-
import { useBasePath } from "../../routing/useBasePath";
|
|
21
24
|
import { ProductVariant } from "../shared/components/productVariant/ProductVariant";
|
|
22
25
|
import { Pricing } from "../summary/components/pricing/Pricing";
|
|
23
26
|
import { style } from "./Checkout.style";
|
|
@@ -25,17 +28,28 @@ import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
|
|
|
25
28
|
import { PaymentInstrument } from "./components/paymentInstrument/PaymentInstrument";
|
|
26
29
|
|
|
27
30
|
interface CheckoutProps {
|
|
28
|
-
readonly children?: ReactNode;
|
|
29
31
|
readonly layout: UiLayout;
|
|
32
|
+
readonly order: OrderProjection;
|
|
33
|
+
readonly subscription: SubscriptionProjection;
|
|
34
|
+
readonly getAuthToken: () => Promise<string>;
|
|
35
|
+
readonly onCheckoutFlowSuccess: () => void;
|
|
30
36
|
readonly useRedirect: () => Record<string, string>;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
|
-
const Checkout: FC<CheckoutProps> = ({
|
|
39
|
+
const Checkout: FC<CheckoutProps> = ({
|
|
40
|
+
layout: Layout,
|
|
41
|
+
order,
|
|
42
|
+
subscription,
|
|
43
|
+
getAuthToken,
|
|
44
|
+
useRedirect,
|
|
45
|
+
onCheckoutFlowSuccess,
|
|
46
|
+
}) => {
|
|
34
47
|
const {
|
|
35
48
|
customer: { customerId, country, segment },
|
|
49
|
+
basePath,
|
|
36
50
|
} = useStaticInfo();
|
|
37
|
-
const titleText = useI18nMessage({
|
|
38
|
-
const submitButtonText = useI18nMessage({
|
|
51
|
+
const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
|
|
52
|
+
const submitButtonText = useI18nMessage({ id: I18nMessages.CHECKOUT_PAY_BUTTON });
|
|
39
53
|
const { screen } = useDevice();
|
|
40
54
|
const [pricingHeight, setPricingHeight] = useState(0);
|
|
41
55
|
const handleOnPricingLayout = useCallback(({ height }: LayoutRectangle) => setPricingHeight(height), []);
|
|
@@ -43,6 +57,14 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
43
57
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
44
58
|
const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id as string });
|
|
45
59
|
|
|
60
|
+
const [checkoutFlow, checkoutFlowStatus, paymentFlowComponent] = useCheckoutFlow({
|
|
61
|
+
checkout,
|
|
62
|
+
order,
|
|
63
|
+
subscription,
|
|
64
|
+
getAuthToken,
|
|
65
|
+
onSuccess: onCheckoutFlowSuccess,
|
|
66
|
+
});
|
|
67
|
+
|
|
46
68
|
useTrackPageView({
|
|
47
69
|
page: TrackingPage.CHECKOUT,
|
|
48
70
|
country,
|
|
@@ -51,18 +73,16 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
51
73
|
});
|
|
52
74
|
|
|
53
75
|
const navigate = useNavigate();
|
|
54
|
-
const basePath = useBasePath();
|
|
55
|
-
|
|
56
76
|
const trackPressContinue = useTrackPressContinue({
|
|
57
77
|
page: TrackingPage.CHECKOUT,
|
|
58
78
|
country,
|
|
59
79
|
segment,
|
|
60
80
|
checkoutId: checkout?.id,
|
|
61
81
|
});
|
|
62
|
-
const handleOnSubmit = useCallback(() => {
|
|
82
|
+
const handleOnSubmit = useCallback(async () => {
|
|
63
83
|
trackPressContinue();
|
|
64
|
-
|
|
65
|
-
}, [
|
|
84
|
+
await checkoutFlow();
|
|
85
|
+
}, [checkoutFlow, trackPressContinue]);
|
|
66
86
|
|
|
67
87
|
const checkoutItemsKept = useMemo(
|
|
68
88
|
() =>
|
|
@@ -116,6 +136,12 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
116
136
|
>
|
|
117
137
|
<Box size={{ L: "2/3" }} style={screen.L && style.desktopListSpacing}>
|
|
118
138
|
<View style={[style.contentWrapper, screen.L && style.desktopContentWrapper]}>
|
|
139
|
+
{country === Country.NL && (
|
|
140
|
+
<View style={style.paymentSelectorNL}>
|
|
141
|
+
<PaymentInstrument useRedirect={useRedirect} />
|
|
142
|
+
</View>
|
|
143
|
+
)}
|
|
144
|
+
|
|
119
145
|
<Text level={3} style={style.title} heading>
|
|
120
146
|
{titleText}
|
|
121
147
|
</Text>
|
|
@@ -139,9 +165,11 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
139
165
|
</View>
|
|
140
166
|
))}
|
|
141
167
|
|
|
142
|
-
|
|
143
|
-
<
|
|
144
|
-
|
|
168
|
+
{country !== Country.NL && (
|
|
169
|
+
<View style={style.paymentSelector}>
|
|
170
|
+
<PaymentInstrument useRedirect={useRedirect} />
|
|
171
|
+
</View>
|
|
172
|
+
)}
|
|
145
173
|
</View>
|
|
146
174
|
</Box>
|
|
147
175
|
|
|
@@ -151,7 +179,11 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
151
179
|
<Pricing pricing={pricing} totalCheckoutItemsKept={checkoutItemsKept?.length || 0} />
|
|
152
180
|
|
|
153
181
|
{screen.L ? (
|
|
154
|
-
<Button
|
|
182
|
+
<Button
|
|
183
|
+
busy={checkoutFlowStatus === "loading"}
|
|
184
|
+
testID="confirm-checkout-button"
|
|
185
|
+
onPress={handleOnSubmit}
|
|
186
|
+
>
|
|
155
187
|
{submitButtonText}
|
|
156
188
|
</Button>
|
|
157
189
|
) : null}
|
|
@@ -164,14 +196,19 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
164
196
|
{pricing && !screen.L ? (
|
|
165
197
|
<Sticky style={style.sticky} onLayout={Platform.OS !== "web" ? handleOnPricingLayout : undefined}>
|
|
166
198
|
<Body>
|
|
167
|
-
<Button
|
|
199
|
+
<Button
|
|
200
|
+
busy={checkoutFlowStatus === "loading"}
|
|
201
|
+
testID="confirm-checkout-button"
|
|
202
|
+
small
|
|
203
|
+
onPress={handleOnSubmit}
|
|
204
|
+
>
|
|
168
205
|
{submitButtonText}
|
|
169
206
|
</Button>
|
|
170
207
|
</Body>
|
|
171
208
|
</Sticky>
|
|
172
209
|
) : null}
|
|
173
210
|
|
|
174
|
-
{
|
|
211
|
+
{paymentFlowComponent}
|
|
175
212
|
</Layout>
|
|
176
213
|
);
|
|
177
214
|
};
|
|
@@ -1,131 +1,126 @@
|
|
|
1
|
-
import { waitFor } from "@testing-library/react-native";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
-
import { Country } from "@lookiero/sty-psp-locale";
|
|
5
|
-
import { Segment } from "@lookiero/sty-psp-segment";
|
|
6
|
-
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
|
-
import { checkout } from "../../../../../projection/checkout/checkout.mock";
|
|
8
|
-
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
9
|
-
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
10
|
-
import { paymentFlowPayload as mockPaymentFlowPayload } from "../../../../../projection/payment/paymentFlowPayload.mock";
|
|
11
|
-
import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
12
|
-
import { pricing } from "../../../../../projection/pricing/pricing.mock";
|
|
13
|
-
import { useViewPricingByCheckoutId } from "../../../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
14
|
-
import {
|
|
15
|
-
import { Routes } from "../../../../routing/routes";
|
|
16
|
-
import { render } from "../../../../test/render";
|
|
17
|
-
import { CheckoutPaymentModal } from "./CheckoutPaymentModal";
|
|
1
|
+
// import { waitFor } from "@testing-library/react-native";
|
|
2
|
+
// import React from "react";
|
|
3
|
+
// import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
+
// import { Country } from "@lookiero/sty-psp-locale";
|
|
5
|
+
// import { Segment } from "@lookiero/sty-psp-segment";
|
|
6
|
+
// import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
|
+
// import { checkout } from "../../../../../projection/checkout/checkout.mock";
|
|
8
|
+
// import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
9
|
+
// import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
10
|
+
// import { paymentFlowPayload as mockPaymentFlowPayload } from "../../../../../projection/payment/paymentFlowPayload.mock";
|
|
11
|
+
// import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
12
|
+
// import { pricing } from "../../../../../projection/pricing/pricing.mock";
|
|
13
|
+
// import { useViewPricingByCheckoutId } from "../../../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
14
|
+
// import { useCheckoutFlow } from "../../../../hooks/useCheckoutFlow";
|
|
15
|
+
// import { Routes } from "../../../../routing/routes";
|
|
16
|
+
// import { render } from "../../../../test/render";
|
|
18
17
|
|
|
19
|
-
const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
|
|
20
|
-
const country = Country.ES;
|
|
21
|
-
const segment = Segment.WOMEN;
|
|
22
|
-
const orderNumber = 3691625;
|
|
23
|
-
const isFirstOrder = false;
|
|
24
|
-
const getAuthToken = () => Promise.resolve("token");
|
|
25
|
-
const mockCheckout = checkout({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
const mockPricing = pricing();
|
|
18
|
+
// const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
|
|
19
|
+
// const country = Country.ES;
|
|
20
|
+
// const segment = Segment.WOMEN;
|
|
21
|
+
// const orderNumber = 3691625;
|
|
22
|
+
// const isFirstOrder = false;
|
|
23
|
+
// const getAuthToken = () => Promise.resolve("token");
|
|
24
|
+
// const mockCheckout = checkout({
|
|
25
|
+
// items: [
|
|
26
|
+
// { status: CheckoutItemStatus.RETURNED },
|
|
27
|
+
// { status: CheckoutItemStatus.KEPT },
|
|
28
|
+
// { status: CheckoutItemStatus.KEPT },
|
|
29
|
+
// { status: CheckoutItemStatus.KEPT },
|
|
30
|
+
// { status: CheckoutItemStatus.REPLACED },
|
|
31
|
+
// ],
|
|
32
|
+
// });
|
|
33
|
+
// const mockPricing = pricing();
|
|
35
34
|
|
|
36
|
-
jest.mock("../../../../hooks/useStaticInfo", () => ({
|
|
37
|
-
|
|
38
|
-
}));
|
|
35
|
+
// jest.mock("../../../../hooks/useStaticInfo", () => ({
|
|
36
|
+
// useStaticInfo: () => ({ customer: { customerId, country, segment } }),
|
|
37
|
+
// }));
|
|
39
38
|
|
|
40
|
-
jest.mock("../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId");
|
|
41
|
-
jest.mock("../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId");
|
|
42
|
-
jest.mock("../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId");
|
|
43
|
-
jest.mock("../../../../../projection/pricing/react/useViewPricingByCheckoutId");
|
|
44
|
-
jest.mock("../../../../hooks/useSubmitCheckout");
|
|
45
|
-
jest.mock("../../../../../tracking/useTrackCheckout");
|
|
39
|
+
// jest.mock("../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId");
|
|
40
|
+
// jest.mock("../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId");
|
|
41
|
+
// jest.mock("../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId");
|
|
42
|
+
// jest.mock("../../../../../projection/pricing/react/useViewPricingByCheckoutId");
|
|
43
|
+
// jest.mock("../../../../hooks/useSubmitCheckout");
|
|
44
|
+
// jest.mock("../../../../../tracking/useTrackCheckout");
|
|
46
45
|
|
|
47
|
-
const mockStartLegacyBoxCheckout = jest.fn();
|
|
48
|
-
jest.mock("@lookiero/payments-front", () => {
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
// const mockStartLegacyBoxCheckout = jest.fn();
|
|
47
|
+
// jest.mock("@lookiero/payments-front", () => {
|
|
48
|
+
// // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
49
|
+
// const { useImperativeHandle, forwardRef } = require("react");
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
// return {
|
|
52
|
+
// CheckoutStatus: {
|
|
53
|
+
// REJECTED: "REJECTED",
|
|
54
|
+
// ERROR: "ERROR",
|
|
55
|
+
// FULFILLED: "FULFILLED",
|
|
56
|
+
// },
|
|
57
|
+
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
58
|
+
// // @ts-ignore
|
|
59
|
+
// // eslint-disable-next-line @typescript-eslint/naming-convention, react/display-name
|
|
60
|
+
// PaymentFlow: forwardRef((params, ref) => {
|
|
61
|
+
// useImperativeHandle(ref, () => ({
|
|
62
|
+
// startLegacyBoxCheckout: mockStartLegacyBoxCheckout,
|
|
63
|
+
// }));
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
65
|
+
// return null;
|
|
66
|
+
// }),
|
|
67
|
+
// PaymentMethod: {
|
|
68
|
+
// ["GOOGLE_PAY"]: "google_pay",
|
|
69
|
+
// },
|
|
70
|
+
// Section: {
|
|
71
|
+
// ["BOX_CHECKOUT"]: "box-checkout",
|
|
72
|
+
// },
|
|
73
|
+
// PaymentInstrumentSelect: jest.fn(() => <></>),
|
|
74
|
+
// };
|
|
75
|
+
// });
|
|
77
76
|
|
|
78
|
-
const mockUseNavigate = jest.fn();
|
|
79
|
-
jest.mock("react-router-native", () => ({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}));
|
|
77
|
+
// const mockUseNavigate = jest.fn();
|
|
78
|
+
// jest.mock("react-router-native", () => ({
|
|
79
|
+
// ...jest.requireActual("react-router-native"),
|
|
80
|
+
// useNavigate: () => mockUseNavigate,
|
|
81
|
+
// }));
|
|
83
82
|
|
|
84
83
|
describe("CheckoutPaymentModal component", () => {
|
|
85
|
-
it("renders correctly", async () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
128
|
-
expect(mockUseNavigate).toHaveBeenCalledWith(`/${Routes.CHECKOUT}`, { replace: true });
|
|
129
|
-
});
|
|
130
|
-
});
|
|
84
|
+
// it("renders correctly", async () => {
|
|
85
|
+
// const mockSubmitCheckout = jest.fn();
|
|
86
|
+
// (useViewFirstAvailableCheckoutByCustomerId as jest.Mock).mockReturnValue([mockCheckout, QueryStatus.SUCCESS]);
|
|
87
|
+
// (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
88
|
+
// (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
89
|
+
// (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
90
|
+
// (useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
|
|
91
|
+
// await waitFor(() => {
|
|
92
|
+
// render(
|
|
93
|
+
// <CheckoutPaymentModal
|
|
94
|
+
// coupon={null}
|
|
95
|
+
// getAuthToken={getAuthToken}
|
|
96
|
+
// isFirstOrder={isFirstOrder}
|
|
97
|
+
// orderNumber={orderNumber}
|
|
98
|
+
// subscription="b"
|
|
99
|
+
// />,
|
|
100
|
+
// );
|
|
101
|
+
// expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
102
|
+
// });
|
|
103
|
+
// });
|
|
104
|
+
// it("navigates back to /checkout when checkout-flow fails", async () => {
|
|
105
|
+
// (useViewFirstAvailableCheckoutByCustomerId as jest.Mock).mockReturnValue([mockCheckout, QueryStatus.SUCCESS]);
|
|
106
|
+
// (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
107
|
+
// (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
108
|
+
// (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
109
|
+
// (useSubmitCheckout as jest.Mock).mockImplementation(({ onError }) => {
|
|
110
|
+
// const submitCheckout = () => onError();
|
|
111
|
+
// return [submitCheckout, "error"];
|
|
112
|
+
// });
|
|
113
|
+
// await waitFor(() => {
|
|
114
|
+
// render(
|
|
115
|
+
// <CheckoutPaymentModal
|
|
116
|
+
// coupon={null}
|
|
117
|
+
// getAuthToken={getAuthToken}
|
|
118
|
+
// isFirstOrder={isFirstOrder}
|
|
119
|
+
// orderNumber={orderNumber}
|
|
120
|
+
// subscription="b"
|
|
121
|
+
// />,
|
|
122
|
+
// );
|
|
123
|
+
// expect(mockUseNavigate).toHaveBeenCalledWith(`/${Routes.CHECKOUT}`, { replace: true });
|
|
124
|
+
// });
|
|
125
|
+
// });
|
|
131
126
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
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 {
|
|
4
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
5
5
|
|
|
6
6
|
const DeliveryBanner = () => {
|
|
7
7
|
const { screen } = useDevice();
|
|
@@ -10,7 +10,7 @@ const DeliveryBanner = () => {
|
|
|
10
10
|
<InfoBox
|
|
11
11
|
contentAlign={screen.L ? ALIGN.CENTER : undefined}
|
|
12
12
|
testID="delivery-banner"
|
|
13
|
-
text={useI18nMessage({
|
|
13
|
+
text={useI18nMessage({ id: I18nMessages.CHECKOUT_DELIVERY_BANNER })}
|
|
14
14
|
type={INFOBOX_TYPE.SQUARED}
|
|
15
15
|
/>
|
|
16
16
|
);
|
package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import React, { FC
|
|
1
|
+
import React, { FC } from "react";
|
|
2
2
|
import { PaymentInstrumentSelect, Section } from "@lookiero/payments-front";
|
|
3
|
-
import {
|
|
4
|
-
import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
|
|
3
|
+
import { useStaticInfo } from "../../../../hooks/useStaticInfo";
|
|
5
4
|
|
|
6
5
|
interface PaymentInstrumentProps {
|
|
7
6
|
readonly useRedirect: () => Record<string, string>;
|
|
8
7
|
}
|
|
9
8
|
const PaymentInstrument: FC<PaymentInstrumentProps> = ({ useRedirect }) => {
|
|
10
|
-
const paymentInstrumentSelectRef = useRef(null);
|
|
11
9
|
const { returnUrl } = useRedirect();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
usePaymentInstrumentEvents({ logger });
|
|
10
|
+
const { customer } = useStaticInfo();
|
|
15
11
|
|
|
16
12
|
return (
|
|
17
13
|
<PaymentInstrumentSelect
|
|
18
|
-
ref={paymentInstrumentSelectRef}
|
|
19
14
|
beforeRedirect={returnUrl ? () => Promise.resolve(returnUrl) : undefined}
|
|
20
15
|
hasError={false}
|
|
21
16
|
section={Section.BOX_CHECKOUT}
|
|
17
|
+
userInformation={{
|
|
18
|
+
email: customer.email,
|
|
19
|
+
name: customer.name,
|
|
20
|
+
}}
|
|
21
|
+
showSingleUsePaymentMethods
|
|
22
22
|
/>
|
|
23
23
|
);
|
|
24
24
|
};
|
|
@@ -18,7 +18,7 @@ import { HostDefaultCheckoutQuestionItem } from "../../../../components/organism
|
|
|
18
18
|
import { HostSelectCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem";
|
|
19
19
|
import { IconCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem";
|
|
20
20
|
import { TextareaCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem";
|
|
21
|
-
import {
|
|
21
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
22
22
|
|
|
23
23
|
const checkoutQuestionItems: CheckoutQuestionItems = {
|
|
24
24
|
[CheckoutQuestionType.HOST_DEFAULT]: HostDefaultCheckoutQuestionItem,
|
|
@@ -39,7 +39,7 @@ const CheckoutQuestionsForm: FC<CheckoutQuestionsFormProps> = ({
|
|
|
39
39
|
submitButtonDisabled,
|
|
40
40
|
onSubmit,
|
|
41
41
|
}) => {
|
|
42
|
-
const buttonText = useI18nMessage({
|
|
42
|
+
const buttonText = useI18nMessage({ id: I18nMessages.FEEDBACK_BUTTON });
|
|
43
43
|
|
|
44
44
|
const feedback = useCheckoutQuestionFeedback();
|
|
45
45
|
const handlePress = useCallback(() => onSubmit(feedback), [feedback, onSubmit]);
|
|
@@ -28,7 +28,6 @@ import { ItemDetailHeader } from "../../components/templates/header/itemDetailHe
|
|
|
28
28
|
import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
|
|
29
29
|
import { useStaticInfo } from "../../hooks/useStaticInfo";
|
|
30
30
|
import { Routes } from "../../routing/routes";
|
|
31
|
-
import { useBasePath } from "../../routing/useBasePath";
|
|
32
31
|
import { style } from "./Item.style";
|
|
33
32
|
import {
|
|
34
33
|
CheckoutItemWithCustomerDecission,
|
|
@@ -62,9 +61,9 @@ const Item: FC<ItemProps> = ({ layout: Layout }) => {
|
|
|
62
61
|
const logger = useLogger();
|
|
63
62
|
const screenSize = useScreenSize();
|
|
64
63
|
const navigate = useNavigate();
|
|
65
|
-
const basePath = useBasePath();
|
|
66
64
|
const {
|
|
67
65
|
customer: { customerId, country, segment },
|
|
66
|
+
basePath,
|
|
68
67
|
} = useStaticInfo();
|
|
69
68
|
const isDesktopScreen = screenSize !== "S";
|
|
70
69
|
|
|
@@ -4,7 +4,7 @@ import { InfoBox, Text } from "@lookiero/aurora";
|
|
|
4
4
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
5
5
|
import { useScreenSize } from "@lookiero/sty-psp-ui";
|
|
6
6
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
|
-
import {
|
|
7
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
8
|
import { style } from "./CustomerDecissionBanner.style";
|
|
9
9
|
|
|
10
10
|
type CustomerDecissionBannerStatus = Exclude<CheckoutItemStatus, CheckoutItemStatus.INITIAL>;
|
|
@@ -20,8 +20,8 @@ interface CustomerDecissionBannerProps {
|
|
|
20
20
|
readonly onPress: () => void;
|
|
21
21
|
}
|
|
22
22
|
const CustomerDecissionBanner: FC<CustomerDecissionBannerProps> = ({ checkoutItemStatus, onPress }) => {
|
|
23
|
-
const decissionText = useI18nMessage({
|
|
24
|
-
const bannerButtonText = useI18nMessage({
|
|
23
|
+
const decissionText = useI18nMessage({ id: i18nMessageForCheckoutItemStatus[checkoutItemStatus] });
|
|
24
|
+
const bannerButtonText = useI18nMessage({ id: I18nMessages.ITEM_BANNER_BUTTON });
|
|
25
25
|
const screenSize = useScreenSize();
|
|
26
26
|
const isSmallScreen = screenSize === "S";
|
|
27
27
|
|
|
@@ -89,7 +89,7 @@ exports[`CustomerDecissionBanner component matches the snapshot for a KEPT check
|
|
|
89
89
|
"paddingBottom": 0,
|
|
90
90
|
"paddingLeft": 0,
|
|
91
91
|
"paddingRight": 0,
|
|
92
|
-
"paddingTop":
|
|
92
|
+
"paddingTop": 5,
|
|
93
93
|
},
|
|
94
94
|
]
|
|
95
95
|
}
|
|
@@ -258,7 +258,7 @@ exports[`CustomerDecissionBanner component matches the snapshot for a REPLACED c
|
|
|
258
258
|
"paddingBottom": 0,
|
|
259
259
|
"paddingLeft": 0,
|
|
260
260
|
"paddingRight": 0,
|
|
261
|
-
"paddingTop":
|
|
261
|
+
"paddingTop": 5,
|
|
262
262
|
},
|
|
263
263
|
]
|
|
264
264
|
}
|
|
@@ -427,7 +427,7 @@ exports[`CustomerDecissionBanner component matches the snapshot for a RETURNED c
|
|
|
427
427
|
"paddingBottom": 0,
|
|
428
428
|
"paddingLeft": 0,
|
|
429
429
|
"paddingRight": 0,
|
|
430
|
-
"paddingTop":
|
|
430
|
+
"paddingTop": 5,
|
|
431
431
|
},
|
|
432
432
|
]
|
|
433
433
|
}
|