@lookiero/checkout 10.0.0-beta.2 → 10.0.0-beta.3
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/index.js +2 -1
- package/dist/src/ExpoRoot.js +3 -2
- package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +2 -1
- package/dist/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +3 -2
- package/dist/src/infrastructure/ui/components/atoms/price/Price.js +3 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +7 -3
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.d.ts +18 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.style.js +14 -2
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +4 -3
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +0 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +0 -1
- 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 +3 -2
- 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 +3 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +5 -4
- 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 +4 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +0 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +0 -1
- package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +2 -2
- package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -2
- package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +2 -2
- package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +9 -9
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +55 -22
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +2 -1
- package/dist/src/infrastructure/ui/i18n/i18n.js +2 -1
- package/dist/src/infrastructure/ui/test/render.js +4 -2
- package/dist/src/infrastructure/ui/views/App.js +2 -1
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +3 -3
- 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/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +2 -2
- package/dist/src/infrastructure/ui/views/item/components/banner/CustomerDecissionBanner.js +3 -3
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +11 -5
- 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 +1 -0
- package/dist/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +2 -1
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
- package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -4
- package/dist/src/infrastructure/ui/views/return/components/price/Price.js +3 -0
- package/dist/src/infrastructure/ui/views/return/components/productVariantPreview/ProductVariantPreview.js +3 -3
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +4 -4
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -1
- package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.js +4 -4
- package/dist/src/infrastructure/ui/views/summary/Summary.js +4 -4
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +3 -2
- package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +8 -6
- package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -5
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/index.ts +2 -1
- package/jest.config.js +2 -2
- package/package.json +7 -8
- package/src/ExpoRoot.tsx +3 -2
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.ts +3 -2
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner.tsx +3 -2
- package/src/infrastructure/ui/components/atoms/fiveItemsDiscountBanner/__snapshots__/FiveItemsDiscountBanner.test.tsx.snap +1 -1
- package/src/infrastructure/ui/components/atoms/price/Price.tsx +3 -0
- 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 +25 -4
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.tsx +13 -7
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostDefaultCheckoutQuestionItem/HostDefaultCheckoutQuestionItem.tsx +2 -1
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/hostSelectCheckoutQuestionItem/HostSelectCheckoutQuestionItem.tsx +2 -1
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +0 -1
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +4 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem.tsx +3 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostRadioGroupReturnQuestionItem/HostRadioGroupReturnQuestionItem.tsx +3 -2
- 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 +3 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +3 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.tsx +2 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +6 -5
- 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 +0 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +4 -2
- 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 +2 -2
- package/src/infrastructure/ui/components/templates/header/itemHeader/__snapshots__/ItemHeader.test.tsx.snap +1 -1
- package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +302 -0
- package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +9 -9
- package/src/infrastructure/ui/i18n/i18n.ts +3 -1
- package/src/infrastructure/ui/test/render.tsx +6 -3
- package/src/infrastructure/ui/views/App.tsx +2 -1
- package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +51 -40
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +3 -3
- 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/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +2 -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 +11 -5
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +160 -88
- 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 +244 -128
- package/src/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.ts +2 -1
- 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 +10 -8
- 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 +75 -41
- package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +105 -102
- package/src/infrastructure/ui/views/return/components/price/Price.tsx +3 -0
- 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 +2 -1
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +4 -4
- 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 +4 -4
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +3 -2
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +154 -82
- package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +8 -6
- 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/dist/pact.config.d.ts +0 -21
- package/dist/pact.config.js +0 -16
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -55
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -116
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -56
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -51
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -51
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -51
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -13
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -19
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -56
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -57
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -55
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -120
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -55
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -55
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -22
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +0 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -5
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -6
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +0 -20
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -43
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +0 -14
- package/dist/src/infrastructure/ui/components/templates/footer/Footer.d.ts +0 -3
- package/dist/src/infrastructure/ui/components/templates/footer/Footer.js +0 -13
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -21
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -8
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -12
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -12
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -64
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -10
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -17
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -20
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -27
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -10
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -27
- package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
- package/dist/src/infrastructure/ui/views/App.style.js +0 -8
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +0 -7
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +0 -11
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -64
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +0 -16
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
- package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -44
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -14
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -28
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -7
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -11
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -26
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -21
- package/dist/src/projection/shared/country.d.ts +0 -14
- package/dist/src/projection/shared/country.js +0 -15
- package/dist/src/projection/shared/customer.d.ts +0 -9
- package/dist/src/projection/shared/customer.js +0 -1
- package/dist/src/projection/shared/locale.d.ts +0 -12
- package/dist/src/projection/shared/locale.js +0 -13
- package/dist/src/projection/shared/order.d.ts +0 -6
- package/dist/src/projection/shared/order.js +0 -1
- package/dist/src/projection/shared/price.d.ts +0 -11
- package/dist/src/projection/shared/price.js +0 -1
- package/dist/src/projection/shared/size.d.ts +0 -21
- package/dist/src/projection/shared/size.js +0 -4
- package/dist/src/projection/shared/subscription.d.ts +0 -2
- package/dist/src/projection/shared/subscription.js +0 -1
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +0 -15
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +0 -16
- package/dist/src/shared/ui/components/atoms/error/Error.d.ts +0 -11
- package/dist/src/shared/ui/components/atoms/error/Error.js +0 -6
- package/dist/src/shared/ui/components/atoms/field/Field.d.ts +0 -14
- package/dist/src/shared/ui/components/atoms/field/Field.js +0 -29
- package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +0 -16
- package/dist/src/shared/ui/components/atoms/field/Field.style.js +0 -19
- package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +0 -24
- package/dist/src/shared/ui/components/molecules/inputField/InputField.js +0 -28
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +0 -29
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +0 -37
- package/src/infrastructure/ui/components/templates/footer/Footer.test.tsx +0 -15
- package/src/infrastructure/ui/components/templates/footer/Footer.tsx +0 -19
- package/src/infrastructure/ui/components/templates/footer/__snapshots__/Footer.test.tsx.snap +0 -1127
- package/src/infrastructure/ui/hooks/useCheckoutFlow.test.ts +0 -297
- package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.test.tsx +0 -126
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { act, renderHook, waitFor } from "@testing-library/react-native";
|
|
2
|
-
import { mock } from "jest-mock-extended";
|
|
3
|
-
import { RefObject } from "react";
|
|
4
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
5
|
-
import { PaymentFlowRef } from "@lookiero/payments-front";
|
|
6
|
-
import { ChargeStatus } from "@lookiero/payments-front/build/infrastructure/CheckoutAPI";
|
|
7
|
-
import { Logger } from "@lookiero/sty-psp-logging";
|
|
8
|
-
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
9
|
-
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
10
|
-
import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
|
|
11
|
-
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
12
|
-
import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
|
|
13
|
-
import { useQueryBus } from "./useQueryBus";
|
|
14
|
-
import { useSubmitCheckout as sut } from "./useCheckoutFlow";
|
|
15
|
-
|
|
16
|
-
const checkoutId = "9c450400-0cd7-44a4-b0e3-e0002a9bf8df";
|
|
17
|
-
const checkoutBookingId = "07c996bb-a0b4-45f9-ae21-6bb9c784d12b";
|
|
18
|
-
const errorChargeStatuses = Object.values(ChargeStatus).filter((status) => status !== ChargeStatus.EXECUTED);
|
|
19
|
-
|
|
20
|
-
const logger = mock<Logger>();
|
|
21
|
-
|
|
22
|
-
jest.mock("@lookiero/sty-psp-notifications");
|
|
23
|
-
jest.mock("./useQueryBus");
|
|
24
|
-
jest.mock("../../domain/checkout/react/useSubmitCheckout");
|
|
25
|
-
jest.mock("../../domain/checkoutBooking/react/useBlockCheckoutBooking");
|
|
26
|
-
|
|
27
|
-
describe("useSubmitCheckout custom hook", () => {
|
|
28
|
-
test("returns success as the status right after calling 'submitCheckout'", async () => {
|
|
29
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
30
|
-
const mockSubmitCheckout = jest.fn();
|
|
31
|
-
const mockCreateToastNotification = jest.fn();
|
|
32
|
-
const mockOnError = jest.fn();
|
|
33
|
-
const mockOnSuccess = jest.fn();
|
|
34
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
35
|
-
current: {
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
37
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
38
|
-
callback({ status: ChargeStatus.EXECUTED, final: true });
|
|
39
|
-
}),
|
|
40
|
-
startCheckout: jest.fn(),
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
45
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
46
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
47
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.SUCCESS]);
|
|
48
|
-
|
|
49
|
-
const { result } = renderHook(() =>
|
|
50
|
-
sut({
|
|
51
|
-
checkoutId,
|
|
52
|
-
checkoutBookingId,
|
|
53
|
-
paymentFlowRef: mockPaymentFlowRef,
|
|
54
|
-
onError: mockOnError,
|
|
55
|
-
onSuccess: mockOnSuccess,
|
|
56
|
-
logger,
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
await act(async () => {
|
|
61
|
-
const [submitCheckout] = result.current;
|
|
62
|
-
await submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: true });
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
await waitFor(() => {
|
|
66
|
-
const [, status] = result.current;
|
|
67
|
-
|
|
68
|
-
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
69
|
-
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
70
|
-
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
71
|
-
|
|
72
|
-
expect(status).toBe("success");
|
|
73
|
-
expect(mockOnSuccess).toHaveBeenCalled();
|
|
74
|
-
expect(mockOnError).not.toHaveBeenCalled();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("does not call blockCheckoutBooking if sizeChange is not enabled after calling 'submitCheckout'", async () => {
|
|
79
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
80
|
-
const mockSubmitCheckout = jest.fn();
|
|
81
|
-
const mockCreateToastNotification = jest.fn();
|
|
82
|
-
const mockOnError = jest.fn();
|
|
83
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
84
|
-
current: {
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
86
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
87
|
-
callback({ status: ChargeStatus.EXECUTED, final: true });
|
|
88
|
-
}),
|
|
89
|
-
startCheckout: jest.fn(),
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
94
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
95
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
96
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.SUCCESS]);
|
|
97
|
-
|
|
98
|
-
const { result } = renderHook(() =>
|
|
99
|
-
sut({ checkoutId, checkoutBookingId, paymentFlowRef: mockPaymentFlowRef, onError: mockOnError, logger }),
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
await act(async () => {
|
|
103
|
-
const [submitCheckout] = result.current;
|
|
104
|
-
await submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: false });
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
await waitFor(() => {
|
|
108
|
-
const [, status] = result.current;
|
|
109
|
-
|
|
110
|
-
expect(mockBlockCheckoutBooking).not.toHaveBeenCalled();
|
|
111
|
-
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
112
|
-
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
113
|
-
|
|
114
|
-
expect(status).toBe("success");
|
|
115
|
-
expect(mockOnError).not.toHaveBeenCalled();
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test("returns blockCheckoutBooking error as the status right after calling 'submitCheckout'", async () => {
|
|
120
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
121
|
-
const mockSubmitCheckout = jest.fn();
|
|
122
|
-
const mockCreateToastNotification = jest.fn();
|
|
123
|
-
const mockOnError = jest.fn();
|
|
124
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
125
|
-
current: {
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
127
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
128
|
-
callback({ status: ChargeStatus.EXECUTED, final: true });
|
|
129
|
-
}),
|
|
130
|
-
startCheckout: jest.fn(),
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
135
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.ERROR]);
|
|
136
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.IDLE]);
|
|
137
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.IDLE]);
|
|
138
|
-
|
|
139
|
-
const { result } = renderHook(() =>
|
|
140
|
-
sut({ checkoutId, checkoutBookingId, paymentFlowRef: mockPaymentFlowRef, onError: mockOnError, logger }),
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
await act(async () => {
|
|
144
|
-
const [submitCheckout] = result.current;
|
|
145
|
-
await submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: true });
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
await waitFor(() => {
|
|
149
|
-
const [, status] = result.current;
|
|
150
|
-
|
|
151
|
-
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
152
|
-
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
153
|
-
expect(status).toBe("error");
|
|
154
|
-
expect(mockOnError).toHaveBeenCalled();
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test.each(errorChargeStatuses)(
|
|
159
|
-
"shows an 'error' notification when the checkout-flow fails (status %s)",
|
|
160
|
-
async (chargeStatus) => {
|
|
161
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
162
|
-
const mockSubmitCheckout = jest.fn();
|
|
163
|
-
const mockCreateToastNotification = jest.fn();
|
|
164
|
-
const mockOnError = jest.fn();
|
|
165
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
166
|
-
current: {
|
|
167
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
168
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
169
|
-
callback({ status: chargeStatus, toaster: { id: `${chargeStatus}_toaster_id` }, final: true });
|
|
170
|
-
}),
|
|
171
|
-
startCheckout: jest.fn(),
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
176
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
177
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
178
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.IDLE]);
|
|
179
|
-
|
|
180
|
-
const { result } = renderHook(() =>
|
|
181
|
-
sut({ checkoutId, checkoutBookingId, paymentFlowRef: mockPaymentFlowRef, onError: mockOnError, logger }),
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
await act(async () => {
|
|
185
|
-
const [submitCheckout] = result.current;
|
|
186
|
-
await submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: true });
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
await waitFor(() => {
|
|
190
|
-
const [, status] = result.current;
|
|
191
|
-
|
|
192
|
-
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
193
|
-
expect(mockCreateToastNotification).toHaveBeenCalledWith(
|
|
194
|
-
expect.objectContaining({
|
|
195
|
-
level: NotificationLevel.ERROR,
|
|
196
|
-
bodyI18nKey: `${chargeStatus}_toaster_id`,
|
|
197
|
-
}),
|
|
198
|
-
);
|
|
199
|
-
expect(mockSubmitCheckout).not.toHaveBeenCalled();
|
|
200
|
-
|
|
201
|
-
expect(status).toBe("error");
|
|
202
|
-
expect(mockOnError).toHaveBeenCalled();
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
test("returns submitCheckout error as the status right after calling 'submitCheckout'", async () => {
|
|
208
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
209
|
-
const mockSubmitCheckout = jest.fn();
|
|
210
|
-
const mockCreateToastNotification = jest.fn();
|
|
211
|
-
const mockOnError = jest.fn();
|
|
212
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
213
|
-
current: {
|
|
214
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
215
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
216
|
-
callback({ status: ChargeStatus.EXECUTED, final: true });
|
|
217
|
-
}),
|
|
218
|
-
startCheckout: jest.fn(),
|
|
219
|
-
},
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
223
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
224
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.ERROR]);
|
|
225
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
226
|
-
|
|
227
|
-
const { result } = renderHook(() =>
|
|
228
|
-
sut({ checkoutId, checkoutBookingId, paymentFlowRef: mockPaymentFlowRef, onError: mockOnError, logger }),
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
await act(async () => {
|
|
232
|
-
const [submitCheckout] = result.current;
|
|
233
|
-
submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: true });
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
await waitFor(() => {
|
|
237
|
-
const [, status] = result.current;
|
|
238
|
-
|
|
239
|
-
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
240
|
-
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
241
|
-
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
242
|
-
|
|
243
|
-
expect(status).toBe("error");
|
|
244
|
-
expect(mockOnError).toHaveBeenCalled();
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
test("returns submitCheckout error as the status right after calling 'submitCheckout' if CheckoutBooking isExpired", async () => {
|
|
249
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
250
|
-
const mockSubmitCheckout = jest.fn();
|
|
251
|
-
const mockCreateToastNotification = jest.fn();
|
|
252
|
-
const mockOnError = jest.fn();
|
|
253
|
-
const mockOnSuccess = jest.fn();
|
|
254
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
255
|
-
current: {
|
|
256
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
257
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
258
|
-
callback({ status: ChargeStatus.EXECUTED, final: true });
|
|
259
|
-
}),
|
|
260
|
-
startCheckout: jest.fn(),
|
|
261
|
-
},
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: true }) as CheckoutBookingProjection);
|
|
265
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
266
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
267
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.SUCCESS]);
|
|
268
|
-
|
|
269
|
-
const { result } = renderHook(() =>
|
|
270
|
-
sut({
|
|
271
|
-
checkoutId,
|
|
272
|
-
checkoutBookingId,
|
|
273
|
-
paymentFlowRef: mockPaymentFlowRef,
|
|
274
|
-
onError: mockOnError,
|
|
275
|
-
onSuccess: mockOnSuccess,
|
|
276
|
-
logger,
|
|
277
|
-
}),
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
await act(async () => {
|
|
281
|
-
const [submitCheckout] = result.current;
|
|
282
|
-
await submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: true });
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
await waitFor(() => {
|
|
286
|
-
const [, status] = result.current;
|
|
287
|
-
|
|
288
|
-
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
289
|
-
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
290
|
-
expect(mockSubmitCheckout).not.toHaveBeenCalled();
|
|
291
|
-
|
|
292
|
-
expect(status).toBe("error");
|
|
293
|
-
expect(mockOnSuccess).not.toHaveBeenCalled();
|
|
294
|
-
expect(mockOnError).toHaveBeenCalled();
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
});
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// import { waitFor } from "@testing-library/react-native";
|
|
2
|
-
// import React from "react";
|
|
3
|
-
// import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
-
// import { Country } from "@lookiero/sty-psp-locale";
|
|
5
|
-
// import { Segment } from "@lookiero/sty-psp-segment";
|
|
6
|
-
// import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
|
-
// import { checkout } from "../../../../../projection/checkout/checkout.mock";
|
|
8
|
-
// import { useViewFirstAvailableCheckoutByCustomerId } from "../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
9
|
-
// import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
10
|
-
// import { paymentFlowPayload as mockPaymentFlowPayload } from "../../../../../projection/payment/paymentFlowPayload.mock";
|
|
11
|
-
// import { useViewPaymentFlowPayloadByCheckoutId } from "../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
12
|
-
// import { pricing } from "../../../../../projection/pricing/pricing.mock";
|
|
13
|
-
// import { useViewPricingByCheckoutId } from "../../../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
14
|
-
// import { useCheckoutFlow } from "../../../../hooks/useCheckoutFlow";
|
|
15
|
-
// import { Routes } from "../../../../routing/routes";
|
|
16
|
-
// import { render } from "../../../../test/render";
|
|
17
|
-
|
|
18
|
-
// const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
|
|
19
|
-
// const country = Country.ES;
|
|
20
|
-
// const segment = Segment.WOMEN;
|
|
21
|
-
// const orderNumber = 3691625;
|
|
22
|
-
// const isFirstOrder = false;
|
|
23
|
-
// const getAuthToken = () => Promise.resolve("token");
|
|
24
|
-
// const mockCheckout = checkout({
|
|
25
|
-
// items: [
|
|
26
|
-
// { status: CheckoutItemStatus.RETURNED },
|
|
27
|
-
// { status: CheckoutItemStatus.KEPT },
|
|
28
|
-
// { status: CheckoutItemStatus.KEPT },
|
|
29
|
-
// { status: CheckoutItemStatus.KEPT },
|
|
30
|
-
// { status: CheckoutItemStatus.REPLACED },
|
|
31
|
-
// ],
|
|
32
|
-
// });
|
|
33
|
-
// const mockPricing = pricing();
|
|
34
|
-
|
|
35
|
-
// jest.mock("../../../../hooks/useStaticInfo", () => ({
|
|
36
|
-
// useStaticInfo: () => ({ customer: { customerId, country, segment } }),
|
|
37
|
-
// }));
|
|
38
|
-
|
|
39
|
-
// jest.mock("../../../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId");
|
|
40
|
-
// jest.mock("../../../../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId");
|
|
41
|
-
// jest.mock("../../../../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId");
|
|
42
|
-
// jest.mock("../../../../../projection/pricing/react/useViewPricingByCheckoutId");
|
|
43
|
-
// jest.mock("../../../../hooks/useSubmitCheckout");
|
|
44
|
-
// jest.mock("../../../../../tracking/useTrackCheckout");
|
|
45
|
-
|
|
46
|
-
// const mockStartLegacyBoxCheckout = jest.fn();
|
|
47
|
-
// jest.mock("@lookiero/payments-front", () => {
|
|
48
|
-
// // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
49
|
-
// const { useImperativeHandle, forwardRef } = require("react");
|
|
50
|
-
|
|
51
|
-
// return {
|
|
52
|
-
// CheckoutStatus: {
|
|
53
|
-
// REJECTED: "REJECTED",
|
|
54
|
-
// ERROR: "ERROR",
|
|
55
|
-
// FULFILLED: "FULFILLED",
|
|
56
|
-
// },
|
|
57
|
-
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
58
|
-
// // @ts-ignore
|
|
59
|
-
// // eslint-disable-next-line @typescript-eslint/naming-convention, react/display-name
|
|
60
|
-
// PaymentFlow: forwardRef((params, ref) => {
|
|
61
|
-
// useImperativeHandle(ref, () => ({
|
|
62
|
-
// startLegacyBoxCheckout: mockStartLegacyBoxCheckout,
|
|
63
|
-
// }));
|
|
64
|
-
|
|
65
|
-
// return null;
|
|
66
|
-
// }),
|
|
67
|
-
// PaymentMethod: {
|
|
68
|
-
// ["GOOGLE_PAY"]: "google_pay",
|
|
69
|
-
// },
|
|
70
|
-
// Section: {
|
|
71
|
-
// ["BOX_CHECKOUT"]: "box-checkout",
|
|
72
|
-
// },
|
|
73
|
-
// PaymentInstrumentSelect: jest.fn(() => <></>),
|
|
74
|
-
// };
|
|
75
|
-
// });
|
|
76
|
-
|
|
77
|
-
// const mockUseNavigate = jest.fn();
|
|
78
|
-
// jest.mock("react-router-native", () => ({
|
|
79
|
-
// ...jest.requireActual("react-router-native"),
|
|
80
|
-
// useNavigate: () => mockUseNavigate,
|
|
81
|
-
// }));
|
|
82
|
-
|
|
83
|
-
describe("CheckoutPaymentModal component", () => {
|
|
84
|
-
// it("renders correctly", async () => {
|
|
85
|
-
// const mockSubmitCheckout = jest.fn();
|
|
86
|
-
// (useViewFirstAvailableCheckoutByCustomerId as jest.Mock).mockReturnValue([mockCheckout, QueryStatus.SUCCESS]);
|
|
87
|
-
// (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
88
|
-
// (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
89
|
-
// (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
90
|
-
// (useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
|
|
91
|
-
// await waitFor(() => {
|
|
92
|
-
// render(
|
|
93
|
-
// <CheckoutPaymentModal
|
|
94
|
-
// coupon={null}
|
|
95
|
-
// getAuthToken={getAuthToken}
|
|
96
|
-
// isFirstOrder={isFirstOrder}
|
|
97
|
-
// orderNumber={orderNumber}
|
|
98
|
-
// subscription="b"
|
|
99
|
-
// />,
|
|
100
|
-
// );
|
|
101
|
-
// expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
102
|
-
// });
|
|
103
|
-
// });
|
|
104
|
-
// it("navigates back to /checkout when checkout-flow fails", async () => {
|
|
105
|
-
// (useViewFirstAvailableCheckoutByCustomerId as jest.Mock).mockReturnValue([mockCheckout, QueryStatus.SUCCESS]);
|
|
106
|
-
// (useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
107
|
-
// (useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
108
|
-
// (useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
109
|
-
// (useSubmitCheckout as jest.Mock).mockImplementation(({ onError }) => {
|
|
110
|
-
// const submitCheckout = () => onError();
|
|
111
|
-
// return [submitCheckout, "error"];
|
|
112
|
-
// });
|
|
113
|
-
// await waitFor(() => {
|
|
114
|
-
// render(
|
|
115
|
-
// <CheckoutPaymentModal
|
|
116
|
-
// coupon={null}
|
|
117
|
-
// getAuthToken={getAuthToken}
|
|
118
|
-
// isFirstOrder={isFirstOrder}
|
|
119
|
-
// orderNumber={orderNumber}
|
|
120
|
-
// subscription="b"
|
|
121
|
-
// />,
|
|
122
|
-
// );
|
|
123
|
-
// expect(mockUseNavigate).toHaveBeenCalledWith(`/${Routes.CHECKOUT}`, { replace: true });
|
|
124
|
-
// });
|
|
125
|
-
// });
|
|
126
|
-
});
|