@lookiero/checkout 9.14.0 → 10.0.0-beta.1
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/Expo.js +0 -2
- 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 +9 -9
- package/src/Expo.tsx +0 -3
- 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,169 +0,0 @@
|
|
|
1
|
-
import { RefObject, useCallback, useMemo, useState } from "react";
|
|
2
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
3
|
-
import { PaymentFlowRef } from "@lookiero/payments-front";
|
|
4
|
-
import { Logger } from "@lookiero/sty-psp-logging";
|
|
5
|
-
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
6
|
-
import {
|
|
7
|
-
ViewCheckoutBookingById,
|
|
8
|
-
viewCheckoutBookingById,
|
|
9
|
-
ViewCheckoutBookingByIdResult,
|
|
10
|
-
} from "../../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
11
|
-
import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
|
|
12
|
-
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
13
|
-
import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/checkout/react/useSubmitCheckout";
|
|
14
|
-
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
15
|
-
import { I18nMessages } from "../i18n/i18n";
|
|
16
|
-
import { useQueryBus } from "./useQueryBus";
|
|
17
|
-
|
|
18
|
-
enum ChargeStatus {
|
|
19
|
-
EXECUTED = "EXECUTED",
|
|
20
|
-
REQUIRES_ACTION = "REQUIRES_ACTION",
|
|
21
|
-
REQUIRED_ACTION_CANCELLED = "REQUIRED_ACTION_CANCELLED",
|
|
22
|
-
REJECTED = "REJECTED",
|
|
23
|
-
CANCELLED = "CANCELLED",
|
|
24
|
-
TO_CONFIRM = "TO_CONFIRM",
|
|
25
|
-
ERROR = "ERROR",
|
|
26
|
-
UNKNOWN = "UNKNOWN",
|
|
27
|
-
}
|
|
28
|
-
interface LegacyBoxCheckout {
|
|
29
|
-
readonly status: ChargeStatus;
|
|
30
|
-
readonly toaster: {
|
|
31
|
-
id: string;
|
|
32
|
-
} | null;
|
|
33
|
-
readonly final: boolean;
|
|
34
|
-
readonly id?: string;
|
|
35
|
-
readonly translation?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type Status = "idle" | "loading" | "success" | "error";
|
|
39
|
-
|
|
40
|
-
interface SubmitCheckoutFunctionArgs {
|
|
41
|
-
readonly paymentFlowPayload: PaymentFlowPayloadProjection;
|
|
42
|
-
readonly sizeChangeEnabled: boolean;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface SubmitCheckoutFunction {
|
|
46
|
-
(args: SubmitCheckoutFunctionArgs): Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
type UseSubmitCheckoutResult = [submitCheckout: SubmitCheckoutFunction, status: Status];
|
|
50
|
-
|
|
51
|
-
interface UseSubmitCheckoutFunctionArgs {
|
|
52
|
-
readonly checkoutId: string;
|
|
53
|
-
readonly checkoutBookingId: string;
|
|
54
|
-
readonly paymentFlowRef: RefObject<PaymentFlowRef>;
|
|
55
|
-
readonly onError: () => void;
|
|
56
|
-
readonly onSuccess?: () => void;
|
|
57
|
-
readonly logger: Logger;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
interface UseSubmitCheckoutFunction {
|
|
61
|
-
(args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckoutResult;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const useSubmitCheckout: UseSubmitCheckoutFunction = ({
|
|
65
|
-
checkoutId,
|
|
66
|
-
checkoutBookingId,
|
|
67
|
-
paymentFlowRef,
|
|
68
|
-
onError,
|
|
69
|
-
onSuccess,
|
|
70
|
-
logger,
|
|
71
|
-
}) => {
|
|
72
|
-
const queryBus = useQueryBus();
|
|
73
|
-
const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId, logger });
|
|
74
|
-
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId, logger });
|
|
75
|
-
const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
76
|
-
const [checkoutBookingExpired, setCheckoutBookingExpired] = useState(false);
|
|
77
|
-
|
|
78
|
-
const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState<Status>("idle");
|
|
79
|
-
|
|
80
|
-
const submitCheckout: SubmitCheckoutFunction = useCallback(
|
|
81
|
-
async ({ paymentFlowPayload, sizeChangeEnabled }) => {
|
|
82
|
-
try {
|
|
83
|
-
sizeChangeEnabled && (await blockCheckoutBooking());
|
|
84
|
-
} catch (error) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const checkoutBooking = await queryBus<ViewCheckoutBookingById, ViewCheckoutBookingByIdResult>(
|
|
89
|
-
viewCheckoutBookingById({ checkoutBookingId }),
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
if (checkoutBooking?.isExpired) {
|
|
93
|
-
setCheckoutBookingExpired(true);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
paymentFlowRef.current?.startLegacyBoxCheckout(
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
paymentFlowPayload,
|
|
101
|
-
async ({ status, toaster, final }: LegacyBoxCheckout) => {
|
|
102
|
-
setStartLegacyBoxCheckoutStatus("loading");
|
|
103
|
-
|
|
104
|
-
if (final) {
|
|
105
|
-
if (status === ChargeStatus.EXECUTED) {
|
|
106
|
-
setStartLegacyBoxCheckoutStatus("success");
|
|
107
|
-
await submitCheckoutCommand();
|
|
108
|
-
onSuccess?.();
|
|
109
|
-
} else {
|
|
110
|
-
createNotification({
|
|
111
|
-
level: NotificationLevel.ERROR,
|
|
112
|
-
bodyI18nKey: toaster?.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
113
|
-
});
|
|
114
|
-
setStartLegacyBoxCheckoutStatus("error");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
);
|
|
119
|
-
},
|
|
120
|
-
[
|
|
121
|
-
queryBus,
|
|
122
|
-
checkoutBookingId,
|
|
123
|
-
paymentFlowRef,
|
|
124
|
-
blockCheckoutBooking,
|
|
125
|
-
submitCheckoutCommand,
|
|
126
|
-
onSuccess,
|
|
127
|
-
createNotification,
|
|
128
|
-
],
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const status: Status = useMemo(() => {
|
|
132
|
-
if (
|
|
133
|
-
blockCheckoutBookingStatus === CommandStatus.LOADING ||
|
|
134
|
-
startLegacyBoxCheckoutStatus === "loading" ||
|
|
135
|
-
submitCheckoutCommandStatus === CommandStatus.LOADING
|
|
136
|
-
) {
|
|
137
|
-
return "loading";
|
|
138
|
-
}
|
|
139
|
-
if (
|
|
140
|
-
blockCheckoutBookingStatus === CommandStatus.SUCCESS &&
|
|
141
|
-
startLegacyBoxCheckoutStatus === "success" &&
|
|
142
|
-
submitCheckoutCommandStatus === CommandStatus.SUCCESS
|
|
143
|
-
) {
|
|
144
|
-
return "success";
|
|
145
|
-
}
|
|
146
|
-
if (
|
|
147
|
-
blockCheckoutBookingStatus === CommandStatus.ERROR ||
|
|
148
|
-
startLegacyBoxCheckoutStatus === "error" ||
|
|
149
|
-
submitCheckoutCommandStatus === CommandStatus.ERROR ||
|
|
150
|
-
checkoutBookingExpired
|
|
151
|
-
) {
|
|
152
|
-
onError();
|
|
153
|
-
return "error";
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return "idle";
|
|
157
|
-
}, [
|
|
158
|
-
blockCheckoutBookingStatus,
|
|
159
|
-
startLegacyBoxCheckoutStatus,
|
|
160
|
-
submitCheckoutCommandStatus,
|
|
161
|
-
checkoutBookingExpired,
|
|
162
|
-
onError,
|
|
163
|
-
]);
|
|
164
|
-
|
|
165
|
-
return [submitCheckout, status];
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export type { Status, SubmitCheckoutFunction };
|
|
169
|
-
export { useSubmitCheckout };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { renderHook, waitFor } from "@testing-library/react-native";
|
|
2
|
-
import React, { FC } from "react";
|
|
3
|
-
import { BasePathProvider, useBasePath as sut } from "./useBasePath";
|
|
4
|
-
|
|
5
|
-
const basePath = "/checkout";
|
|
6
|
-
|
|
7
|
-
interface WrapperProps {
|
|
8
|
-
readonly children: JSX.Element;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const Wrapper: FC<WrapperProps> = ({ children }) => <BasePathProvider basePath={basePath}>{children}</BasePathProvider>;
|
|
12
|
-
|
|
13
|
-
describe("useBasePath hook", () => {
|
|
14
|
-
it("returns the BasePathProvider provided basePath", async () => {
|
|
15
|
-
const { result } = renderHook(() => sut(), { wrapper: Wrapper });
|
|
16
|
-
|
|
17
|
-
await waitFor(() => expect(result.current).toStrictEqual(basePath));
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { createContext, FC, useContext } from "react";
|
|
2
|
-
import invariant from "tiny-invariant";
|
|
3
|
-
|
|
4
|
-
const BasePathContext = createContext<string>(null as unknown as string);
|
|
5
|
-
|
|
6
|
-
interface BasePathProviderProps {
|
|
7
|
-
readonly children: JSX.Element;
|
|
8
|
-
readonly basePath: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const BasePathProvider: FC<BasePathProviderProps> = ({ basePath, children }) => (
|
|
12
|
-
<BasePathContext.Provider value={basePath}>{children}</BasePathContext.Provider>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export const useBasePath = () => {
|
|
16
|
-
const basePath = useContext(BasePathContext);
|
|
17
|
-
|
|
18
|
-
invariant(
|
|
19
|
-
basePath !== null,
|
|
20
|
-
"Your are trying to use the useBasePath hook without wrapping your app with the <BasePathProvider>.",
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return basePath;
|
|
24
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import React, { FC, useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-native";
|
|
3
|
-
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
-
import { PaymentFlow, PaymentFlowRef } from "@lookiero/payments-front";
|
|
5
|
-
import { useLogger } from "@lookiero/sty-psp-logging";
|
|
6
|
-
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
|
-
import { Currency } from "../../../../../../domain/checkoutItem/model/currency";
|
|
8
|
-
import { Subscription } from "../../../../../../projection/subscription/subscription";
|
|
9
|
-
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
10
|
-
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
11
|
-
import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
12
|
-
import { useViewPricingByCheckoutId } from "../../../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
13
|
-
import { TrackingPage } from "../../../../../tracking/tracking";
|
|
14
|
-
import { useTrackCheckout } from "../../../../../tracking/useTrackCheckout";
|
|
15
|
-
import { useStaticInfo } from "../../../../hooks/useStaticInfo";
|
|
16
|
-
import { useSubmitCheckout } from "../../../../hooks/useSubmitCheckout";
|
|
17
|
-
import { Routes } from "../../../../routing/routes";
|
|
18
|
-
import { useBasePath } from "../../../../routing/useBasePath";
|
|
19
|
-
|
|
20
|
-
interface CheckoutPaymentModalProps {
|
|
21
|
-
readonly coupon: string | null;
|
|
22
|
-
readonly orderNumber: number;
|
|
23
|
-
readonly isFirstOrder: boolean;
|
|
24
|
-
readonly subscription: Subscription;
|
|
25
|
-
readonly getAuthToken: () => Promise<string>;
|
|
26
|
-
readonly onCheckoutSubmitted?: () => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const CheckoutPaymentModal: FC<CheckoutPaymentModalProps> = ({
|
|
30
|
-
coupon,
|
|
31
|
-
isFirstOrder,
|
|
32
|
-
subscription,
|
|
33
|
-
orderNumber,
|
|
34
|
-
getAuthToken,
|
|
35
|
-
onCheckoutSubmitted,
|
|
36
|
-
}) => {
|
|
37
|
-
const paymentFlowRef = useRef<PaymentFlowRef>(null);
|
|
38
|
-
const logger = useLogger();
|
|
39
|
-
const {
|
|
40
|
-
customer: { customerId, country, segment },
|
|
41
|
-
} = useStaticInfo();
|
|
42
|
-
|
|
43
|
-
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
44
|
-
const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
|
|
45
|
-
checkoutId: checkout?.id as string,
|
|
46
|
-
});
|
|
47
|
-
const [sizeChangeEnabled] = useViewIsSizeChangeEnabledByCheckoutId({ checkoutId: checkout?.id as string });
|
|
48
|
-
const [pricing] = useViewPricingByCheckoutId({
|
|
49
|
-
checkoutId: checkout?.id as string,
|
|
50
|
-
queryOptions: { refetchOnMount: true },
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const [authToken, setAuthToken] = useState<string>();
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
const loadAuthToken = async () => setAuthToken(await getAuthToken());
|
|
56
|
-
loadAuthToken();
|
|
57
|
-
}, [getAuthToken]);
|
|
58
|
-
|
|
59
|
-
const basePath = useBasePath();
|
|
60
|
-
const navigate = useNavigate();
|
|
61
|
-
const trackCheckout = useTrackCheckout({
|
|
62
|
-
page: TrackingPage.CHECKOUT,
|
|
63
|
-
checkoutId: checkout?.id as string,
|
|
64
|
-
country,
|
|
65
|
-
segment,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const handleOnSubmitCheckoutError = useCallback(
|
|
69
|
-
() => navigate(`${basePath}/${Routes.CHECKOUT}`, { replace: true }),
|
|
70
|
-
[basePath, navigate],
|
|
71
|
-
);
|
|
72
|
-
const handleOnSubmitCheckoutSuccess = useCallback(() => {
|
|
73
|
-
const checkoutItemsKept = checkout?.items.filter(
|
|
74
|
-
(checkoutItem) =>
|
|
75
|
-
checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED,
|
|
76
|
-
);
|
|
77
|
-
const totalReplacedFor = checkoutItemsKept?.filter(({ replacedFor }) => Boolean(replacedFor)).length || 0;
|
|
78
|
-
|
|
79
|
-
trackCheckout({
|
|
80
|
-
totalCheckoutItemsKept: checkoutItemsKept?.length || 0,
|
|
81
|
-
pendingToPay: (pricing?.pendingToPay.amount as number) / 100,
|
|
82
|
-
coupon,
|
|
83
|
-
currencyCode: pricing?.pendingToPay.currency as Currency,
|
|
84
|
-
isFirstOrder,
|
|
85
|
-
orderNumber,
|
|
86
|
-
totalReplacedFor,
|
|
87
|
-
subscription,
|
|
88
|
-
userId: customerId,
|
|
89
|
-
});
|
|
90
|
-
onCheckoutSubmitted?.();
|
|
91
|
-
}, [
|
|
92
|
-
checkout?.items,
|
|
93
|
-
coupon,
|
|
94
|
-
customerId,
|
|
95
|
-
isFirstOrder,
|
|
96
|
-
onCheckoutSubmitted,
|
|
97
|
-
orderNumber,
|
|
98
|
-
pricing?.pendingToPay.amount,
|
|
99
|
-
pricing?.pendingToPay.currency,
|
|
100
|
-
subscription,
|
|
101
|
-
trackCheckout,
|
|
102
|
-
]);
|
|
103
|
-
const [submitCheckout] = useSubmitCheckout({
|
|
104
|
-
checkoutId: checkout?.id as string,
|
|
105
|
-
checkoutBookingId: checkout?.checkoutBookingId as string,
|
|
106
|
-
paymentFlowRef,
|
|
107
|
-
onError: handleOnSubmitCheckoutError,
|
|
108
|
-
onSuccess: handleOnSubmitCheckoutSuccess,
|
|
109
|
-
logger,
|
|
110
|
-
});
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (paymentFlowPayload && sizeChangeEnabled !== undefined && pricing !== undefined) {
|
|
113
|
-
submitCheckout({ paymentFlowPayload, sizeChangeEnabled });
|
|
114
|
-
}
|
|
115
|
-
}, [paymentFlowPayload, pricing, sizeChangeEnabled, submitCheckout]);
|
|
116
|
-
|
|
117
|
-
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
118
|
-
const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) && authToken;
|
|
119
|
-
|
|
120
|
-
if (!dependenciesLoaded) return null;
|
|
121
|
-
|
|
122
|
-
return <PaymentFlow ref={paymentFlowRef} token={authToken} />;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export { CheckoutPaymentModal };
|