@lookiero/checkout 9.14.0 → 10.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpGet } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { httpIsSizeChangeEnabledByCheckoutIdView } from "./httpIsSizeChangeEnabledByCheckoutIdView";
|
|
11
|
+
|
|
12
|
+
const provider = new PactV3({
|
|
13
|
+
...DEFAULT_PACT_OPTIONS,
|
|
14
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
15
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId",
|
|
16
|
+
});
|
|
17
|
+
const checkoutId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
18
|
+
const isSizeChangeEnabledResponse = true;
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
const EXPECTED_BODY = MatchersV3.like(isSizeChangeEnabledResponse);
|
|
22
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId API", () => {
|
|
23
|
+
it("returns is size-change enabled for the given checkout id", () => {
|
|
24
|
+
provider
|
|
25
|
+
.given("is size-change enabled for the given checkout id")
|
|
26
|
+
.uponReceiving("is size-change enabled")
|
|
27
|
+
.withRequest({
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: `/api/is-size-change-enabled-by-checkout-id/${checkoutId}`,
|
|
30
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
31
|
+
})
|
|
32
|
+
.willRespondWith({
|
|
33
|
+
status: 200,
|
|
34
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
35
|
+
body: EXPECTED_BODY,
|
|
36
|
+
});
|
|
37
|
+
return provider.executeTest(async (mockserver) => {
|
|
38
|
+
const httpGet = fetchHttpGet({
|
|
39
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
40
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
41
|
+
device: "web",
|
|
42
|
+
version: "1.0.0",
|
|
43
|
+
});
|
|
44
|
+
const response = await httpIsSizeChangeEnabledByCheckoutIdView({ httpGet })({
|
|
45
|
+
checkoutId,
|
|
46
|
+
signal: undefined,
|
|
47
|
+
});
|
|
48
|
+
expect(response).toStrictEqual(isSizeChangeEnabledResponse);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
+
import { IsCheckoutAccessibleByCustomerIdProjection } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
3
|
+
|
|
4
|
+
interface UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs {
|
|
5
|
+
readonly customerId: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface UseViewIsCheckoutAccessibleByCustomerIdFunction {
|
|
8
|
+
(
|
|
9
|
+
args: UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs,
|
|
10
|
+
): UseQueryFunctionResult<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
11
|
+
}
|
|
12
|
+
declare const useViewIsCheckoutAccessibleByCustomerId: UseViewIsCheckoutAccessibleByCustomerIdFunction;
|
|
13
|
+
export { useViewIsCheckoutAccessibleByCustomerId };
|
package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
+
import { isCheckoutFeedbackGiven } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
3
|
+
import { viewIsCheckoutAccessibleByCustomerId } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
|
|
6
|
+
const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) =>
|
|
7
|
+
useQuery({
|
|
8
|
+
query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
|
|
9
|
+
contextId: MESSAGING_CONTEXT_ID,
|
|
10
|
+
invalidation: isCheckoutFeedbackGiven,
|
|
11
|
+
options: {
|
|
12
|
+
refetchOnMount: "always",
|
|
13
|
+
staleTime: Infinity,
|
|
14
|
+
retry: false,
|
|
15
|
+
refetchOnWindowFocus: false,
|
|
16
|
+
cacheTime: 0,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export { useViewIsCheckoutAccessibleByCustomerId };
|
package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { checkoutBooking as checkoutBookingMock } from "./checkoutBooking.mock";
|
|
11
|
+
import { httpCheckoutBookingByIdView } from "./httpCheckoutBookingByIdView";
|
|
12
|
+
|
|
13
|
+
const provider = new PactV3({
|
|
14
|
+
...DEFAULT_PACT_OPTIONS,
|
|
15
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
16
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById",
|
|
17
|
+
});
|
|
18
|
+
const checkoutBookingProjection = checkoutBookingMock;
|
|
19
|
+
const checkoutBookingId = checkoutBookingProjection.id;
|
|
20
|
+
const checkoutBookingResponse = {
|
|
21
|
+
result: checkoutBookingProjection,
|
|
22
|
+
};
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const EXPECTED_BODY = MatchersV3.like(checkoutBookingResponse);
|
|
26
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById API", () => {
|
|
27
|
+
it("returns a valid checkout booking for the given id", () => {
|
|
28
|
+
provider
|
|
29
|
+
.given("a valid checkout booking for the given id")
|
|
30
|
+
.uponReceiving("checkout booking projection")
|
|
31
|
+
.withRequest({
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/api/view-checkout-booking-by-id",
|
|
34
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
35
|
+
body: { checkoutBookingId },
|
|
36
|
+
})
|
|
37
|
+
.willRespondWith({
|
|
38
|
+
status: 200,
|
|
39
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
40
|
+
body: EXPECTED_BODY,
|
|
41
|
+
});
|
|
42
|
+
return provider.executeTest(async (mockserver) => {
|
|
43
|
+
const httpPost = fetchHttpPost({
|
|
44
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
45
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
46
|
+
device: "web",
|
|
47
|
+
version: "1.0.0",
|
|
48
|
+
});
|
|
49
|
+
const response = await httpCheckoutBookingByIdView({ httpPost })({
|
|
50
|
+
checkoutBookingId,
|
|
51
|
+
signal: undefined,
|
|
52
|
+
});
|
|
53
|
+
expect(response).toStrictEqual(checkoutBookingResponse.result);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
11
|
+
import { checkoutItem } from "./checkoutItem.mock";
|
|
12
|
+
import { httpCheckoutItemByIdView } from "./httpCheckoutItemByIdView";
|
|
13
|
+
|
|
14
|
+
const provider = new PactV3({
|
|
15
|
+
...DEFAULT_PACT_OPTIONS,
|
|
16
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
17
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById",
|
|
18
|
+
});
|
|
19
|
+
const checkoutItemProjection = checkoutItem({ status: CheckoutItemStatus.INITIAL });
|
|
20
|
+
const checkoutItemId = checkoutItemProjection.id;
|
|
21
|
+
const checkoutItemResponse = {
|
|
22
|
+
result: checkoutItemProjection,
|
|
23
|
+
};
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
const EXPECTED_BODY = MatchersV3.like(checkoutItemResponse);
|
|
27
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById API", () => {
|
|
28
|
+
it("returns a valid checkout item for the given id", () => {
|
|
29
|
+
provider
|
|
30
|
+
.given("a valid checkout item for the given id")
|
|
31
|
+
.uponReceiving("checkout item projection")
|
|
32
|
+
.withRequest({
|
|
33
|
+
method: "POST",
|
|
34
|
+
path: "/api/view-checkout-item-by-id",
|
|
35
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
36
|
+
body: { checkoutItemId },
|
|
37
|
+
})
|
|
38
|
+
.willRespondWith({
|
|
39
|
+
status: 200,
|
|
40
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
41
|
+
body: EXPECTED_BODY,
|
|
42
|
+
});
|
|
43
|
+
return provider.executeTest(async (mockserver) => {
|
|
44
|
+
const httpPost = fetchHttpPost({
|
|
45
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
46
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
47
|
+
device: "web",
|
|
48
|
+
version: "1.0.0",
|
|
49
|
+
});
|
|
50
|
+
const response = await httpCheckoutItemByIdView({ httpPost })({
|
|
51
|
+
checkoutItemId,
|
|
52
|
+
signal: undefined,
|
|
53
|
+
});
|
|
54
|
+
expect(response).toStrictEqual(checkoutItemResponse.result);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { checkoutQuestions } from "./checkoutQuestions.mock";
|
|
11
|
+
import { httpCheckoutQuestionsByCheckoutIdView } from "./httpCheckoutQuestionsByCheckoutIdView";
|
|
12
|
+
|
|
13
|
+
const provider = new PactV3({
|
|
14
|
+
...DEFAULT_PACT_OPTIONS,
|
|
15
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
16
|
+
provider: "STY-BOX_CHECKOUT-BACK_ListCheckoutQuestionsByCheckoutId",
|
|
17
|
+
});
|
|
18
|
+
const checkoutId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
|
|
19
|
+
const checkoutQuestionsResponse = {
|
|
20
|
+
result: checkoutQuestions,
|
|
21
|
+
};
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const EXPECTED_BODY = MatchersV3.like(checkoutQuestionsResponse);
|
|
25
|
+
describe("STY-BOX_CHECKOUT-BACK_ListCheckoutQuestionsByCheckoutId API", () => {
|
|
26
|
+
it("returns a valid checkout questions for the given checkout id", () => {
|
|
27
|
+
provider
|
|
28
|
+
.given("a valid checkout questions for the given checkout id")
|
|
29
|
+
.uponReceiving("checkout questions projection")
|
|
30
|
+
.withRequest({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/api/list-checkout-questions-by-checkout-id",
|
|
33
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
34
|
+
body: { checkoutId },
|
|
35
|
+
})
|
|
36
|
+
.willRespondWith({
|
|
37
|
+
status: 200,
|
|
38
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
39
|
+
body: EXPECTED_BODY,
|
|
40
|
+
});
|
|
41
|
+
return provider.executeTest(async (mockserver) => {
|
|
42
|
+
const httpPost = fetchHttpPost({
|
|
43
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
44
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
45
|
+
device: "web",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
});
|
|
48
|
+
const response = await httpCheckoutQuestionsByCheckoutIdView({ httpPost })({
|
|
49
|
+
checkoutId,
|
|
50
|
+
signal: undefined,
|
|
51
|
+
});
|
|
52
|
+
expect(response).toStrictEqual(checkoutQuestionsResponse.result);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { httpPaymentFlowPayloadByCheckoutIdView } from "./httpPaymentFlowPayloadByCheckoutIdView";
|
|
11
|
+
import {
|
|
12
|
+
paymentFlowPayloadForKeptItems,
|
|
13
|
+
paymentFlowPayloadForReturnedItems,
|
|
14
|
+
paymentFlowPayloadForReplacedItems,
|
|
15
|
+
} from "./paymentFlowPayload.mock";
|
|
16
|
+
|
|
17
|
+
const provider = new PactV3({
|
|
18
|
+
...DEFAULT_PACT_OPTIONS,
|
|
19
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
20
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewPaymentFlowPayloadByCheckoutId",
|
|
21
|
+
});
|
|
22
|
+
const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
|
|
23
|
+
const paymentFlowPayloadForKeptItemsResponse = {
|
|
24
|
+
result: paymentFlowPayloadForKeptItems,
|
|
25
|
+
};
|
|
26
|
+
const paymentFlowPayloadForReturnedItemsResponse = {
|
|
27
|
+
result: paymentFlowPayloadForReturnedItems,
|
|
28
|
+
};
|
|
29
|
+
const paymentFlowPayloadForReplacedItemsResponse = {
|
|
30
|
+
result: paymentFlowPayloadForReplacedItems,
|
|
31
|
+
};
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const EXPECTED_BODY_FOR_KEPT_ITEMS = MatchersV3.like(paymentFlowPayloadForKeptItemsResponse);
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
const EXPECTED_BODY_FOR_RETURNED_ITEMS = MatchersV3.like(paymentFlowPayloadForReturnedItemsResponse);
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
const EXPECTED_BODY_FOR_REPLACED_ITEMS = MatchersV3.like(paymentFlowPayloadForReplacedItemsResponse);
|
|
41
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewPaymentFlowPayloadByCheckoutId API", () => {
|
|
42
|
+
it("returns a valid payment-flow payload for the given checkout id [KEPT items] ", () => {
|
|
43
|
+
provider
|
|
44
|
+
.given("a valid payment-flow payload for the given checkout id [KEPT items] ")
|
|
45
|
+
.uponReceiving("payment-flow payload projection")
|
|
46
|
+
.withRequest({
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: "/api/view-payment-flow-payload-by-checkout-id",
|
|
49
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
50
|
+
body: { checkoutId },
|
|
51
|
+
})
|
|
52
|
+
.willRespondWith({
|
|
53
|
+
status: 200,
|
|
54
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
55
|
+
body: EXPECTED_BODY_FOR_KEPT_ITEMS,
|
|
56
|
+
});
|
|
57
|
+
return provider.executeTest(async (mockserver) => {
|
|
58
|
+
const httpPost = fetchHttpPost({
|
|
59
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
60
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
61
|
+
device: "web",
|
|
62
|
+
version: "1.0.0",
|
|
63
|
+
});
|
|
64
|
+
const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
65
|
+
expect(response).toStrictEqual(paymentFlowPayloadForKeptItemsResponse.result);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
it("returns a valid payment-flow payload for the given checkout id [RETURNED items] ", () => {
|
|
69
|
+
provider
|
|
70
|
+
.given("a valid payment-flow payload for the given checkout id [RETURNED items] ")
|
|
71
|
+
.uponReceiving("payment-flow payload projection")
|
|
72
|
+
.withRequest({
|
|
73
|
+
method: "POST",
|
|
74
|
+
path: "/api/view-payment-flow-payload-by-checkout-id",
|
|
75
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
76
|
+
body: { checkoutId },
|
|
77
|
+
})
|
|
78
|
+
.willRespondWith({
|
|
79
|
+
status: 200,
|
|
80
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
81
|
+
body: EXPECTED_BODY_FOR_RETURNED_ITEMS,
|
|
82
|
+
});
|
|
83
|
+
return provider.executeTest(async (mockserver) => {
|
|
84
|
+
const httpPost = fetchHttpPost({
|
|
85
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
86
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
87
|
+
device: "web",
|
|
88
|
+
version: "1.0.0",
|
|
89
|
+
});
|
|
90
|
+
const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
91
|
+
expect(response).toStrictEqual(paymentFlowPayloadForReturnedItemsResponse.result);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
it("returns a valid payment-flow payload for the given checkout id [REPLACED items] ", () => {
|
|
95
|
+
provider
|
|
96
|
+
.given("a valid payment-flow payload for the given checkout id [REPLACED items] ")
|
|
97
|
+
.uponReceiving("payment-flow payload projection")
|
|
98
|
+
.withRequest({
|
|
99
|
+
method: "POST",
|
|
100
|
+
path: "/api/view-payment-flow-payload-by-checkout-id",
|
|
101
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
102
|
+
body: { checkoutId },
|
|
103
|
+
})
|
|
104
|
+
.willRespondWith({
|
|
105
|
+
status: 200,
|
|
106
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
107
|
+
body: EXPECTED_BODY_FOR_REPLACED_ITEMS,
|
|
108
|
+
});
|
|
109
|
+
return provider.executeTest(async (mockserver) => {
|
|
110
|
+
const httpPost = fetchHttpPost({
|
|
111
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
112
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
113
|
+
device: "web",
|
|
114
|
+
version: "1.0.0",
|
|
115
|
+
});
|
|
116
|
+
const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
117
|
+
expect(response).toStrictEqual(paymentFlowPayloadForReplacedItemsResponse.result);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { httpPricingByCheckoutIdView } from "./httpPricingByCheckoutIdView";
|
|
11
|
+
import { pricing } from "./pricing.mock";
|
|
12
|
+
|
|
13
|
+
const provider = new PactV3({
|
|
14
|
+
...DEFAULT_PACT_OPTIONS,
|
|
15
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
16
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewPricingByCheckoutId",
|
|
17
|
+
});
|
|
18
|
+
const checkoutId = "6f720954-8039-4bed-9596-34fc5a02131b";
|
|
19
|
+
const pricingResponse = {
|
|
20
|
+
result: pricing(),
|
|
21
|
+
};
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const EXPECTED_BODY = MatchersV3.like(pricingResponse);
|
|
25
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewPricingByCheckoutId API", () => {
|
|
26
|
+
it("returns a valid pricing for the given checkout", () => {
|
|
27
|
+
provider
|
|
28
|
+
.given("a valid pricing for the given checkout")
|
|
29
|
+
.uponReceiving("pricing projection")
|
|
30
|
+
.withRequest({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/api/view-pricing-by-checkout-id",
|
|
33
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
34
|
+
body: { checkoutId },
|
|
35
|
+
})
|
|
36
|
+
.willRespondWith({
|
|
37
|
+
status: 200,
|
|
38
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
39
|
+
body: EXPECTED_BODY,
|
|
40
|
+
});
|
|
41
|
+
return provider.executeTest(async (mockserver) => {
|
|
42
|
+
const httpPost = fetchHttpPost({
|
|
43
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
44
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
45
|
+
device: "web",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
});
|
|
48
|
+
const response = await httpPricingByCheckoutIdView({ httpPost })({
|
|
49
|
+
checkoutId,
|
|
50
|
+
signal: undefined,
|
|
51
|
+
});
|
|
52
|
+
expect(response).toStrictEqual(pricingResponse.result);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -4,7 +4,7 @@ interface QueryOptions {
|
|
|
4
4
|
readonly refetchOnMount?: boolean | "always";
|
|
5
5
|
}
|
|
6
6
|
interface UseViewPricingByCheckoutIdFunctionArgs {
|
|
7
|
-
readonly checkoutId: string;
|
|
7
|
+
readonly checkoutId: string | undefined;
|
|
8
8
|
readonly queryOptions?: QueryOptions;
|
|
9
9
|
}
|
|
10
10
|
interface UseViewPricingByCheckoutIdFunction {
|
|
@@ -13,7 +13,7 @@ const DEFAULT_QUERY_OPTIONS = {
|
|
|
13
13
|
refetchOnMount: "always",
|
|
14
14
|
};
|
|
15
15
|
const useViewPricingByCheckoutId = ({ checkoutId, queryOptions = DEFAULT_QUERY_OPTIONS, }) => useQuery({
|
|
16
|
-
query: viewPricingByCheckoutId({ checkoutId }),
|
|
16
|
+
query: viewPricingByCheckoutId({ checkoutId: checkoutId }),
|
|
17
17
|
contextId: MESSAGING_CONTEXT_ID,
|
|
18
18
|
invalidation: shouldInvalidate,
|
|
19
19
|
options: {
|
|
@@ -21,6 +21,7 @@ const useViewPricingByCheckoutId = ({ checkoutId, queryOptions = DEFAULT_QUERY_O
|
|
|
21
21
|
staleTime: Infinity,
|
|
22
22
|
retry: false,
|
|
23
23
|
refetchOnWindowFocus: false,
|
|
24
|
+
enabled: Boolean(checkoutId),
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
27
|
export { useViewPricingByCheckoutId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
+
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
+
import {
|
|
4
|
+
AUTH_TOKEN,
|
|
5
|
+
DEFAULT_PACT_OPTIONS,
|
|
6
|
+
DEFAULT_REQUEST_HEADERS,
|
|
7
|
+
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
+
fromMockServerUrlToApiUrl,
|
|
9
|
+
} from "../../../../pact.config";
|
|
10
|
+
import { httpReturnQuestionsByCheckoutItemIdView } from "./httpReturnQuestionsByCheckoutItemIdView";
|
|
11
|
+
import { returnQuestions } from "./returnQuestions.mock";
|
|
12
|
+
|
|
13
|
+
const provider = new PactV3({
|
|
14
|
+
...DEFAULT_PACT_OPTIONS,
|
|
15
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
16
|
+
provider: "STY-BOX_CHECKOUT-BACK_ListReturnQuestionsByCheckoutItemId",
|
|
17
|
+
});
|
|
18
|
+
const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
|
|
19
|
+
const returnQuestionsResponse = {
|
|
20
|
+
result: returnQuestions,
|
|
21
|
+
};
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const EXPECTED_BODY = MatchersV3.like(returnQuestionsResponse);
|
|
25
|
+
describe("STY-BOX_CHECKOUT-BACK_ListReturnQuestionsByCheckoutItemId API", () => {
|
|
26
|
+
it("returns a valid return questions for the given checkout item id", () => {
|
|
27
|
+
provider
|
|
28
|
+
.given("a valid return questions for the given checkout item id")
|
|
29
|
+
.uponReceiving("return questions projection")
|
|
30
|
+
.withRequest({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/api/list-return-questions-by-checkout-item-id",
|
|
33
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
34
|
+
body: { checkoutItemId },
|
|
35
|
+
})
|
|
36
|
+
.willRespondWith({
|
|
37
|
+
status: 200,
|
|
38
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
39
|
+
body: EXPECTED_BODY,
|
|
40
|
+
});
|
|
41
|
+
return provider.executeTest(async (mockserver) => {
|
|
42
|
+
const httpPost = fetchHttpPost({
|
|
43
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
44
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
45
|
+
device: "web",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
});
|
|
48
|
+
const response = await httpReturnQuestionsByCheckoutItemIdView({ httpPost })({
|
|
49
|
+
checkoutItemId,
|
|
50
|
+
signal: undefined,
|
|
51
|
+
});
|
|
52
|
+
expect(response).toStrictEqual(returnQuestionsResponse.result);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -2,7 +2,7 @@ import { BaseTrackingEvent, TrackingEventCategory } from "@lookiero/sty-psp-trac
|
|
|
2
2
|
import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
|
|
3
3
|
import { Currency } from "../../domain/checkoutItem/model/currency";
|
|
4
4
|
import { MediaPerspective } from "../../projection/checkoutItem/checkoutItem";
|
|
5
|
-
import {
|
|
5
|
+
import { SubscriptionProjection } from "../../projection/subscription/subscription";
|
|
6
6
|
declare const PROJECT = "checkout";
|
|
7
7
|
declare enum TrackingPage {
|
|
8
8
|
ITEM = "item",
|
|
@@ -96,7 +96,7 @@ interface CheckoutTrackingEvent extends CheckoutBaseTrackingEvent<TrackingEventN
|
|
|
96
96
|
readonly actionField: {
|
|
97
97
|
readonly items: number;
|
|
98
98
|
readonly currencyCode: Currency;
|
|
99
|
-
readonly subscription:
|
|
99
|
+
readonly subscription: SubscriptionProjection;
|
|
100
100
|
readonly coupon: string | null;
|
|
101
101
|
readonly orderId: number;
|
|
102
102
|
readonly value: number;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
import { Country } from "@lookiero/sty-psp-locale";
|
|
2
2
|
import { Segment } from "@lookiero/sty-psp-segment";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
readonly userId: string;
|
|
8
|
-
readonly totalReplacedFor: number;
|
|
9
|
-
readonly isFirstOrder: boolean;
|
|
10
|
-
readonly totalCheckoutItemsKept: number;
|
|
11
|
-
readonly currencyCode: Currency;
|
|
12
|
-
readonly subscription: Subscription;
|
|
13
|
-
readonly coupon: string | null;
|
|
14
|
-
readonly orderNumber: number;
|
|
15
|
-
readonly pendingToPay: number;
|
|
16
|
-
}
|
|
3
|
+
import { CheckoutProjection } from "../../projection/checkout/checkout";
|
|
4
|
+
import { OrderProjection } from "../../projection/order/order";
|
|
5
|
+
import { PricingProjection } from "../../projection/pricing/pricing";
|
|
6
|
+
import { SubscriptionProjection } from "../../projection/subscription/subscription";
|
|
17
7
|
interface TrackCheckoutFunction {
|
|
18
|
-
(
|
|
8
|
+
(): void;
|
|
19
9
|
}
|
|
20
10
|
interface UseTrackCheckoutFunctionArgs {
|
|
21
|
-
readonly
|
|
11
|
+
readonly order: OrderProjection;
|
|
12
|
+
readonly checkout: CheckoutProjection | undefined;
|
|
13
|
+
readonly pricing: PricingProjection | undefined;
|
|
14
|
+
readonly subscription: SubscriptionProjection;
|
|
15
|
+
readonly userId: string;
|
|
22
16
|
readonly country: Country;
|
|
23
|
-
readonly checkoutId: string | undefined;
|
|
24
17
|
readonly segment: Segment;
|
|
25
18
|
}
|
|
26
19
|
interface UseTrackCheckoutFunction {
|
|
@@ -1,38 +1,53 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
+
import invariant from "tiny-invariant";
|
|
2
3
|
import { useEmitUserEvent } from "@lookiero/sty-psp-tracking";
|
|
3
|
-
import {
|
|
4
|
+
import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
|
|
5
|
+
import { PROJECT, TrackingPage } from "./tracking";
|
|
4
6
|
import { TrackingEventName, TrackingEventCategory } from "./tracking";
|
|
5
|
-
const useTrackCheckout = ({
|
|
7
|
+
const useTrackCheckout = ({ order, checkout, pricing, subscription, segment, country, userId, }) => {
|
|
6
8
|
const emitUserEvent = useEmitUserEvent();
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const { coupon, isFirstOrder, orderNumber } = order;
|
|
10
|
+
const trackCheckout = useCallback(() => {
|
|
11
|
+
invariant(checkout, "Checkout must be defined to track checkout");
|
|
12
|
+
const checkoutItemsKept = checkout.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED);
|
|
13
|
+
const totalReplacedFor = checkoutItemsKept?.filter(({ replacedFor }) => Boolean(replacedFor)).length || 0;
|
|
11
14
|
const checkoutTrackingEvent = {
|
|
12
15
|
event: TrackingEventName.CHECKOUT,
|
|
13
16
|
eventCategory: TrackingEventCategory.ECOMMERCE,
|
|
14
|
-
section: `${PROJECT}_${
|
|
17
|
+
section: `${PROJECT}_${TrackingPage.CHECKOUT}`,
|
|
15
18
|
store: country,
|
|
16
19
|
segment,
|
|
17
|
-
checkoutId,
|
|
20
|
+
checkoutId: checkout.id,
|
|
18
21
|
userId,
|
|
19
22
|
sizeChanges: totalReplacedFor,
|
|
20
23
|
isFirstOrder,
|
|
21
24
|
ecommerce: {
|
|
22
25
|
checkout: {
|
|
23
26
|
actionField: {
|
|
24
|
-
items:
|
|
25
|
-
currencyCode,
|
|
27
|
+
items: checkoutItemsKept.length || 0,
|
|
28
|
+
currencyCode: pricing?.pendingToPay.currency,
|
|
26
29
|
subscription,
|
|
27
30
|
coupon,
|
|
28
31
|
orderId: orderNumber,
|
|
29
|
-
value: pendingToPay,
|
|
32
|
+
value: pricing?.pendingToPay.amount / 100,
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
},
|
|
33
36
|
};
|
|
34
37
|
emitUserEvent(checkoutTrackingEvent);
|
|
35
|
-
}, [
|
|
38
|
+
}, [
|
|
39
|
+
checkout,
|
|
40
|
+
country,
|
|
41
|
+
coupon,
|
|
42
|
+
emitUserEvent,
|
|
43
|
+
isFirstOrder,
|
|
44
|
+
orderNumber,
|
|
45
|
+
pricing?.pendingToPay.amount,
|
|
46
|
+
pricing?.pendingToPay.currency,
|
|
47
|
+
segment,
|
|
48
|
+
subscription,
|
|
49
|
+
userId,
|
|
50
|
+
]);
|
|
36
51
|
return trackCheckout;
|
|
37
52
|
};
|
|
38
53
|
export { useTrackCheckout };
|