@lookiero/checkout 10.0.0-beta.2 → 10.0.0-beta.4
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/Expo.js +2 -0
- 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 +9 -9
- package/src/Expo.tsx +3 -0
- 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,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import React, { useCallback, useEffect, useState } from "react";
|
|
3
3
|
import { View, Option, OPTION_VARIANT, SIZE } from "@lookiero/aurora";
|
|
4
|
-
import {
|
|
4
|
+
import { useI18n } from "@lookiero/i18n-react";
|
|
5
5
|
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
6
|
+
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
6
7
|
import {
|
|
7
8
|
useReturnQuestionFeedback,
|
|
8
9
|
useReturnQuestionFeedbackForReturnQuestion,
|
|
@@ -21,7 +22,7 @@ const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = (
|
|
|
21
22
|
testID,
|
|
22
23
|
portalHostName,
|
|
23
24
|
}) => {
|
|
24
|
-
const
|
|
25
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
25
26
|
const [modalVisible, setModalVisible] = useState(false);
|
|
26
27
|
const {
|
|
27
28
|
feedback: feedbackId,
|
|
@@ -30,12 +31,12 @@ const RadioReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.OPTION> = (
|
|
|
30
31
|
} = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
|
|
31
32
|
const feedback = useReturnQuestionFeedback();
|
|
32
33
|
const translate = useCallback(
|
|
33
|
-
(returnQuestionName: string) =>
|
|
34
|
-
[
|
|
34
|
+
(returnQuestionName: string) => formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
|
|
35
|
+
[formatMessage],
|
|
35
36
|
);
|
|
36
37
|
|
|
37
38
|
const inputValue = feedbackForReturnQuestion({ feedback, returnQuestion, translate }).join(" / ");
|
|
38
|
-
const optionText =
|
|
39
|
+
const optionText = formatMessage({ id: returnQuestion.translationKey });
|
|
39
40
|
|
|
40
41
|
const hasChildren = Boolean(returnQuestion.children && returnQuestion.children.length > 0);
|
|
41
42
|
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { Text } from "@lookiero/aurora";
|
|
5
|
-
import { useI18nMessage,
|
|
5
|
+
import { useI18nMessage, useI18n } from "@lookiero/i18n-react";
|
|
6
6
|
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
|
-
import { I18nMessages } from "../../../../../i18n/i18n";
|
|
7
|
+
import { DOMAIN, I18nMessages } from "../../../../../i18n/i18n";
|
|
8
8
|
import { useReturnQuestionFeedback } from "../../behaviors/useReturnQuestionFeedback";
|
|
9
9
|
import { feedbackForReturnQuestion } from "../../util/returnQuestionFeedback";
|
|
10
10
|
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
11
11
|
import { style } from "./ReturnQuestionFeedbackItem.style";
|
|
12
12
|
|
|
13
13
|
const ReturnQuestionFeedbackItem: ReturnQuestionItem<ReturnQuestionType.HOST_DEFAULT> = ({ returnQuestion }) => {
|
|
14
|
-
const titleText = useI18nMessage({ id: returnQuestion.translationKey });
|
|
15
|
-
const unansweredText = useI18nMessage({ id: I18nMessages.FEEDBACK_UNANSWERED });
|
|
14
|
+
const titleText = useI18nMessage({ domain: DOMAIN, id: returnQuestion.translationKey });
|
|
15
|
+
const unansweredText = useI18nMessage({ domain: DOMAIN, id: I18nMessages.FEEDBACK_UNANSWERED });
|
|
16
16
|
|
|
17
17
|
const returnQuestionFeedback = useReturnQuestionFeedback();
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
20
20
|
const translate = useCallback(
|
|
21
|
-
(returnQuestionName: string) =>
|
|
22
|
-
[
|
|
21
|
+
(returnQuestionName: string) => formatMessage({ id: returnQuestionName, defaultMessage: returnQuestionName }),
|
|
22
|
+
[formatMessage],
|
|
23
23
|
);
|
|
24
24
|
const feedback = feedbackForReturnQuestion({ feedback: returnQuestionFeedback, returnQuestion, translate }).join(
|
|
25
25
|
" / ",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import React, { useCallback, useMemo } from "react";
|
|
3
3
|
import { View } from "@lookiero/aurora";
|
|
4
|
-
import {
|
|
4
|
+
import { useI18n } from "@lookiero/i18n-react";
|
|
5
5
|
import { InputField, TextInput } from "@lookiero/sty-psp-ui";
|
|
6
6
|
import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
|
|
7
|
+
import { DOMAIN } from "../../../../../i18n/i18n";
|
|
7
8
|
import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
|
|
8
9
|
import { ReturnQuestionItem } from "../ReturnQuestionItem";
|
|
9
10
|
import { style } from "./TextareaReturnQuestionItem.style";
|
|
@@ -13,7 +14,7 @@ const TextareaReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.TEXTAREA
|
|
|
13
14
|
returnQuestionParent,
|
|
14
15
|
testID,
|
|
15
16
|
}) => {
|
|
16
|
-
const { formatMessage } =
|
|
17
|
+
const { formatMessage } = useI18n({ domain: DOMAIN });
|
|
17
18
|
|
|
18
19
|
const placeholderText = useMemo(
|
|
19
20
|
() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""),
|
|
@@ -37,6 +38,7 @@ const TextareaReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.TEXTAREA
|
|
|
37
38
|
placeholder={placeholderText}
|
|
38
39
|
style={style}
|
|
39
40
|
testID={testID}
|
|
41
|
+
textAlignVertical="top"
|
|
40
42
|
value={feedback}
|
|
41
43
|
multiline
|
|
42
44
|
onBlur={onBlur}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC } from "react";
|
|
2
2
|
import { ButtonIcon, Text } from "@lookiero/aurora";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
|
-
import { I18nMessages } from "../../../../i18n/i18n";
|
|
4
|
+
import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
|
|
5
5
|
import { Header } from "../Header";
|
|
6
6
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
7
7
|
import { style } from "./CheckoutHeader.style";
|
|
@@ -11,7 +11,7 @@ interface CheckoutHeaderProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const CheckoutHeader: FC<CheckoutHeaderProps> = ({ onBack }) => {
|
|
14
|
-
const title = useI18nMessage({ id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
|
|
14
|
+
const title = useI18nMessage({ domain: DOMAIN, id: I18nMessages.HEADER_COMPLETE_CHECKOUT_TITLE });
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Header testID="checkout-header">
|
package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC } from "react";
|
|
2
2
|
import { ButtonIcon, Text } from "@lookiero/aurora";
|
|
3
3
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
4
|
-
import { I18nMessages } from "../../../../i18n/i18n";
|
|
4
|
+
import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
|
|
5
5
|
import { Header } from "../Header";
|
|
6
6
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
7
7
|
import { style } from "./ItemDetailHeader.style";
|
|
@@ -10,7 +10,7 @@ interface ItemDetailHeaderProps {
|
|
|
10
10
|
readonly onBack: () => void;
|
|
11
11
|
}
|
|
12
12
|
const ItemDetailHeader: FC<ItemDetailHeaderProps> = ({ onBack }) => {
|
|
13
|
-
const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
13
|
+
const title = useI18nMessage({ domain: DOMAIN, id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<Header testID="item-detail-header">
|
|
@@ -5,7 +5,7 @@ import { ButtonIcon, Text } from "@lookiero/aurora";
|
|
|
5
5
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
6
|
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
7
7
|
import { useStaticInfo } from "../../../../hooks/useStaticInfo";
|
|
8
|
-
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
|
+
import { DOMAIN, I18nMessages } from "../../../../i18n/i18n";
|
|
9
9
|
import { Routes } from "../../../../routing/routes";
|
|
10
10
|
import { Header } from "../Header";
|
|
11
11
|
import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
|
|
@@ -35,7 +35,7 @@ interface ItemHeaderProps {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const ItemHeader: FC<ItemHeaderProps> = ({ items, item, onNext, onPrevious }) => {
|
|
38
|
-
const title = useI18nMessage({ id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
38
|
+
const title = useI18nMessage({ domain: DOMAIN, id: I18nMessages.HEADER_CHECKOUT_TITLE });
|
|
39
39
|
const itemIndex = items.indexOf(item);
|
|
40
40
|
const isFirstItem = itemIndex === 0;
|
|
41
41
|
const isLastItem = itemIndex === items.length - 1;
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { act, render, renderHook, waitFor } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
+
import { Country } from "@lookiero/sty-psp-locale";
|
|
5
|
+
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
6
|
+
import { Segment } from "@lookiero/sty-psp-segment";
|
|
7
|
+
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
8
|
+
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
9
|
+
import { OrderProjection } from "../../../projection/order/order";
|
|
10
|
+
import { SubscriptionProjection } from "../../../projection/subscription/subscription";
|
|
11
|
+
import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
|
|
12
|
+
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
13
|
+
import { checkout } from "../../projection/checkout/checkout.mock";
|
|
14
|
+
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
15
|
+
import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
|
|
16
|
+
import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
17
|
+
import { pricing } from "../../projection/pricing/pricing.mock";
|
|
18
|
+
import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
19
|
+
import { I18nMessages } from "../i18n/i18n";
|
|
20
|
+
import { Routes } from "../routing/routes";
|
|
21
|
+
import { useCheckoutFlow as sut } from "./useCheckoutFlow";
|
|
22
|
+
import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
|
|
23
|
+
import { useQueryBus } from "./useQueryBus";
|
|
24
|
+
|
|
25
|
+
const getAuthToken = () => Promise.resolve("token");
|
|
26
|
+
const mockCheckout = checkout({
|
|
27
|
+
items: [
|
|
28
|
+
{ status: CheckoutItemStatus.KEPT },
|
|
29
|
+
{ status: CheckoutItemStatus.KEPT },
|
|
30
|
+
{ status: CheckoutItemStatus.KEPT },
|
|
31
|
+
{ status: CheckoutItemStatus.KEPT },
|
|
32
|
+
{ status: CheckoutItemStatus.RETURNED },
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
const order: OrderProjection = {
|
|
36
|
+
orderNumber: 12345,
|
|
37
|
+
isFirstOrder: false,
|
|
38
|
+
coupon: null,
|
|
39
|
+
};
|
|
40
|
+
const mockPricing = pricing();
|
|
41
|
+
const subscription: SubscriptionProjection = "o";
|
|
42
|
+
const customerId = "a8fff6d7-708c-41a7-b42a-58c5706d33df";
|
|
43
|
+
const basePath = "/checkout";
|
|
44
|
+
const country = Country.ES;
|
|
45
|
+
const email = "email@example.com";
|
|
46
|
+
const name = "Adèle Léonce Émilie";
|
|
47
|
+
const segment = Segment.WOMEN;
|
|
48
|
+
jest.mock("./useStaticInfo", () => ({
|
|
49
|
+
useStaticInfo: () => ({ customer: { customerId, country, segment, name, email }, basePath }),
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
// const errorChargeStatuses = Object.values(ChargeStatus).filter((status) => status !== ChargeStatus.EXECUTED);
|
|
53
|
+
const mockStartLegacyBoxCheckout = jest.fn();
|
|
54
|
+
jest.mock("@lookiero/payments-front", () => {
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
56
|
+
const { useImperativeHandle, forwardRef } = require("react");
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, react/display-name
|
|
62
|
+
PaymentFlow: forwardRef((params, ref) => {
|
|
63
|
+
useImperativeHandle(ref, () => ({
|
|
64
|
+
startLegacyBoxCheckout: mockStartLegacyBoxCheckout,
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
return null;
|
|
68
|
+
}),
|
|
69
|
+
Section: {
|
|
70
|
+
["BOX_CHECKOUT"]: "box-checkout",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
jest.mock("@lookiero/sty-psp-logging", () => ({
|
|
76
|
+
useLogger: () => jest.fn(),
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
jest.mock("@lookiero/sty-psp-notifications");
|
|
80
|
+
jest.mock("./useQueryBus");
|
|
81
|
+
jest.mock("../../domain/checkout/react/useSubmitCheckout");
|
|
82
|
+
jest.mock("../../domain/checkoutBooking/react/useBlockCheckoutBooking");
|
|
83
|
+
jest.mock("../../domain/checkout/react/useSubmitCheckout");
|
|
84
|
+
jest.mock("../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId");
|
|
85
|
+
jest.mock("../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId");
|
|
86
|
+
jest.mock("../../projection/pricing/react/useViewPricingByCheckoutId");
|
|
87
|
+
jest.mock("./usePaymentInstrumentEvents");
|
|
88
|
+
|
|
89
|
+
beforeEach(() => {
|
|
90
|
+
mockStartLegacyBoxCheckout.mockClear();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("useCheckoutFlow custom hook", () => {
|
|
94
|
+
test("successfully executes 'checkoutFlow'", async () => {
|
|
95
|
+
const mockBlockCheckoutBooking = jest.fn();
|
|
96
|
+
const mockSubmitCheckout = jest.fn();
|
|
97
|
+
const mockCreateToastNotification = jest.fn();
|
|
98
|
+
const mockOnSuccess = jest.fn();
|
|
99
|
+
|
|
100
|
+
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
101
|
+
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
102
|
+
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
103
|
+
(useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
104
|
+
(useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
105
|
+
(useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
106
|
+
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
|
|
107
|
+
(usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onSuccess }) => {
|
|
108
|
+
setTimeout(() => onSuccess(), 1000);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const { result } = renderHook(() =>
|
|
112
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
116
|
+
|
|
117
|
+
await waitFor(() => {
|
|
118
|
+
[checkoutFlow, , paymentFlowComponent] = result.current;
|
|
119
|
+
|
|
120
|
+
expect(paymentFlowComponent).not.toBeNull();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
render(<>{paymentFlowComponent}</>);
|
|
124
|
+
|
|
125
|
+
await act(async () => {
|
|
126
|
+
await checkoutFlow();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
await waitFor(() => {
|
|
130
|
+
[, status] = result.current;
|
|
131
|
+
|
|
132
|
+
expect(status).toBe("success");
|
|
133
|
+
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
134
|
+
expect(mockStartLegacyBoxCheckout).toHaveBeenCalledWith(
|
|
135
|
+
expect.objectContaining({
|
|
136
|
+
...mockPaymentFlowPayload,
|
|
137
|
+
userInformation: { email, name },
|
|
138
|
+
returnUrl: `${basePath}/${Routes.CHECKOUT}`,
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
142
|
+
expect(mockCreateToastNotification).toHaveBeenCalledWith({
|
|
143
|
+
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
|
|
144
|
+
level: NotificationLevel.SUCCESS,
|
|
145
|
+
});
|
|
146
|
+
expect(mockOnSuccess).toHaveBeenCalled();
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test("does not call blockCheckoutBooking if sizeChange is not enabled", async () => {
|
|
151
|
+
const mockBlockCheckoutBooking = jest.fn();
|
|
152
|
+
const mockSubmitCheckout = jest.fn();
|
|
153
|
+
const mockCreateToastNotification = jest.fn();
|
|
154
|
+
const mockOnSuccess = jest.fn();
|
|
155
|
+
|
|
156
|
+
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
157
|
+
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
158
|
+
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
159
|
+
(useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
160
|
+
(useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([false, QueryStatus.SUCCESS]);
|
|
161
|
+
(useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
162
|
+
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
|
|
163
|
+
(usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onSuccess }) => {
|
|
164
|
+
setTimeout(() => onSuccess(), 1000);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const { result } = renderHook(() =>
|
|
168
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
172
|
+
|
|
173
|
+
await waitFor(() => {
|
|
174
|
+
[checkoutFlow, , paymentFlowComponent] = result.current;
|
|
175
|
+
|
|
176
|
+
expect(paymentFlowComponent).not.toBeNull();
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
render(<>{paymentFlowComponent}</>);
|
|
180
|
+
|
|
181
|
+
await act(async () => {
|
|
182
|
+
await checkoutFlow();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
await waitFor(() => {
|
|
186
|
+
[, status] = result.current;
|
|
187
|
+
|
|
188
|
+
expect(status).toBe("success");
|
|
189
|
+
expect(mockBlockCheckoutBooking).not.toHaveBeenCalled();
|
|
190
|
+
expect(mockStartLegacyBoxCheckout).toHaveBeenCalledWith(
|
|
191
|
+
expect.objectContaining({
|
|
192
|
+
...mockPaymentFlowPayload,
|
|
193
|
+
userInformation: { email, name },
|
|
194
|
+
returnUrl: `${basePath}/${Routes.CHECKOUT}`,
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
198
|
+
expect(mockCreateToastNotification).toHaveBeenCalledWith({
|
|
199
|
+
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
|
|
200
|
+
level: NotificationLevel.SUCCESS,
|
|
201
|
+
});
|
|
202
|
+
expect(mockOnSuccess).toHaveBeenCalled();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test("breaks execution and returns error as the status when blockCheckoutBooking fails", async () => {
|
|
207
|
+
const mockBlockCheckoutBooking = jest.fn().mockRejectedValue("error");
|
|
208
|
+
const mockSubmitCheckout = jest.fn();
|
|
209
|
+
const mockCreateToastNotification = jest.fn();
|
|
210
|
+
const mockOnSuccess = jest.fn();
|
|
211
|
+
|
|
212
|
+
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
213
|
+
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.ERROR]);
|
|
214
|
+
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
215
|
+
(useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
216
|
+
(useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
217
|
+
(useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
218
|
+
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
|
|
219
|
+
(usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onSuccess }) => {
|
|
220
|
+
setTimeout(() => onSuccess(), 1000);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const { result } = renderHook(() =>
|
|
224
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
228
|
+
|
|
229
|
+
await waitFor(() => {
|
|
230
|
+
[checkoutFlow, , paymentFlowComponent] = result.current;
|
|
231
|
+
|
|
232
|
+
expect(paymentFlowComponent).not.toBeNull();
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
render(<>{paymentFlowComponent}</>);
|
|
236
|
+
|
|
237
|
+
await act(async () => {
|
|
238
|
+
await checkoutFlow();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
await waitFor(() => {
|
|
242
|
+
[, status] = result.current;
|
|
243
|
+
|
|
244
|
+
expect(status).toBe("error");
|
|
245
|
+
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
246
|
+
expect(mockStartLegacyBoxCheckout).not.toHaveBeenCalled();
|
|
247
|
+
expect(mockSubmitCheckout).not.toHaveBeenCalled();
|
|
248
|
+
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
249
|
+
expect(mockOnSuccess).not.toHaveBeenCalled();
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test("shows a notification and returns error as the status when payment fails", async () => {
|
|
254
|
+
const mockBlockCheckoutBooking = jest.fn();
|
|
255
|
+
const mockSubmitCheckout = jest.fn();
|
|
256
|
+
const mockCreateToastNotification = jest.fn();
|
|
257
|
+
const mockOnSuccess = jest.fn();
|
|
258
|
+
|
|
259
|
+
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
260
|
+
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
261
|
+
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
262
|
+
(useViewPaymentFlowPayloadByCheckoutId as jest.Mock).mockReturnValue([mockPaymentFlowPayload, QueryStatus.SUCCESS]);
|
|
263
|
+
(useViewIsSizeChangeEnabledByCheckoutId as jest.Mock).mockReturnValue([true, QueryStatus.SUCCESS]);
|
|
264
|
+
(useViewPricingByCheckoutId as jest.Mock).mockReturnValue([mockPricing, QueryStatus.SUCCESS]);
|
|
265
|
+
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, "success"]);
|
|
266
|
+
(usePaymentInstrumentEvents as jest.Mock).mockImplementation(({ onError }) => {
|
|
267
|
+
setTimeout(() => onError({ metadata: null }), 1000);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
const { result } = renderHook(() =>
|
|
271
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
275
|
+
|
|
276
|
+
await waitFor(() => {
|
|
277
|
+
[checkoutFlow, , paymentFlowComponent] = result.current;
|
|
278
|
+
|
|
279
|
+
expect(paymentFlowComponent).not.toBeNull();
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
render(<>{paymentFlowComponent}</>);
|
|
283
|
+
|
|
284
|
+
await act(async () => {
|
|
285
|
+
await checkoutFlow();
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
await waitFor(() => {
|
|
289
|
+
[, status] = result.current;
|
|
290
|
+
|
|
291
|
+
expect(status).toBe("error");
|
|
292
|
+
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
293
|
+
expect(mockStartLegacyBoxCheckout).toHaveBeenCalled();
|
|
294
|
+
expect(mockSubmitCheckout).not.toHaveBeenCalled();
|
|
295
|
+
expect(mockCreateToastNotification).toHaveBeenCalledWith({
|
|
296
|
+
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
297
|
+
level: NotificationLevel.ERROR,
|
|
298
|
+
});
|
|
299
|
+
expect(mockOnSuccess).not.toHaveBeenCalled();
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
});
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { OrderProjection } from "../../../projection/order/order";
|
|
14
14
|
import { SubscriptionProjection } from "../../../projection/subscription/subscription";
|
|
15
15
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
16
|
-
import { useSubmitCheckout
|
|
16
|
+
import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
|
|
17
17
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
18
18
|
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
19
19
|
import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/react/useViewPaymentFlowPayloadByCheckoutId";
|
|
@@ -71,7 +71,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
71
71
|
checkoutId: checkoutProjection?.id,
|
|
72
72
|
queryOptions: { refetchOnMount: true },
|
|
73
73
|
});
|
|
74
|
-
const [
|
|
74
|
+
const [submitCheckout, submitCheckoutStatus] = useSubmitCheckout({
|
|
75
75
|
checkoutId: checkoutProjection?.id,
|
|
76
76
|
logger,
|
|
77
77
|
});
|
|
@@ -120,7 +120,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
120
120
|
paymentFlowRef.current?.startLegacyBoxCheckout({
|
|
121
121
|
...paymentFlowPayload,
|
|
122
122
|
userInformation: { email, name },
|
|
123
|
-
returnUrl: `${basePath}/${Routes.CHECKOUT}
|
|
123
|
+
returnUrl: `${basePath}/${Routes.CHECKOUT}`,
|
|
124
124
|
} as unknown as LegacyBoxCheckoutStrategyPayload);
|
|
125
125
|
}, [
|
|
126
126
|
checkoutProjection?.checkoutBookingId,
|
|
@@ -136,7 +136,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
136
136
|
const onPaymentSuccess = useCallback(async () => {
|
|
137
137
|
setStartLegacyBoxCheckoutStatus("success");
|
|
138
138
|
|
|
139
|
-
await
|
|
139
|
+
await submitCheckout();
|
|
140
140
|
|
|
141
141
|
createNotification({
|
|
142
142
|
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
|
|
@@ -145,7 +145,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
145
145
|
|
|
146
146
|
trackCheckout();
|
|
147
147
|
onSuccess();
|
|
148
|
-
}, [createNotification, onSuccess,
|
|
148
|
+
}, [createNotification, onSuccess, submitCheckout, trackCheckout]);
|
|
149
149
|
const onPaymentError = useCallback(
|
|
150
150
|
(payload: PaymentPayload) => {
|
|
151
151
|
setStartLegacyBoxCheckoutStatus("error");
|
|
@@ -163,7 +163,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
163
163
|
if (
|
|
164
164
|
blockCheckoutBookingStatus === CommandStatus.LOADING ||
|
|
165
165
|
startLegacyBoxCheckoutStatus === "loading" ||
|
|
166
|
-
|
|
166
|
+
submitCheckoutStatus === CommandStatus.LOADING
|
|
167
167
|
) {
|
|
168
168
|
return "loading";
|
|
169
169
|
}
|
|
@@ -171,7 +171,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
171
171
|
if (
|
|
172
172
|
blockCheckoutBookingStatus === CommandStatus.SUCCESS &&
|
|
173
173
|
startLegacyBoxCheckoutStatus === "success" &&
|
|
174
|
-
|
|
174
|
+
submitCheckoutStatus === CommandStatus.SUCCESS
|
|
175
175
|
) {
|
|
176
176
|
return "success";
|
|
177
177
|
}
|
|
@@ -179,14 +179,14 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
|
|
|
179
179
|
if (
|
|
180
180
|
blockCheckoutBookingStatus === CommandStatus.ERROR ||
|
|
181
181
|
startLegacyBoxCheckoutStatus === "error" ||
|
|
182
|
-
|
|
182
|
+
submitCheckoutStatus === CommandStatus.ERROR ||
|
|
183
183
|
checkoutBookingExpired
|
|
184
184
|
) {
|
|
185
185
|
return "error";
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
return "idle";
|
|
189
|
-
}, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus,
|
|
189
|
+
}, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus, submitCheckoutStatus, checkoutBookingExpired]);
|
|
190
190
|
|
|
191
191
|
const paymentFlow = useMemo(
|
|
192
192
|
() => (authToken ? <PaymentFlow ref={paymentFlowRef} section={Section.BOX_CHECKOUT} token={authToken} /> : null),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const DOMAIN = "CheckoutI18n";
|
|
2
|
+
|
|
1
3
|
// TODO: deprecated?
|
|
2
4
|
const COLOR_I18N_PREFIX = "catalog.color.";
|
|
3
5
|
|
|
@@ -59,4 +61,4 @@ enum I18nMessages {
|
|
|
59
61
|
CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired",
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
export { I18nMessages, COLOR_I18N_PREFIX };
|
|
64
|
+
export { DOMAIN, I18nMessages, COLOR_I18N_PREFIX };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { render, RenderAPI } from "@testing-library/react-native";
|
|
2
2
|
import { mock } from "jest-mock-extended";
|
|
3
3
|
import React, { FC, Fragment, ReactElement } from "react";
|
|
4
|
-
import { IntlProvider } from "react-intl";
|
|
5
4
|
import { Aurora } from "@lookiero/aurora";
|
|
5
|
+
import { createI18nProvider } from "@lookiero/i18n-react";
|
|
6
6
|
import { TranslationMessages } from "@lookiero/i18n/domain/translation/model/translationMessages";
|
|
7
7
|
import { Logger, LoggerProvider } from "@lookiero/sty-psp-logging";
|
|
8
|
+
import { DOMAIN } from "../i18n/i18n";
|
|
9
|
+
|
|
10
|
+
const I18nProvider = createI18nProvider({ domain: DOMAIN });
|
|
8
11
|
|
|
9
12
|
interface RenderArgs {
|
|
10
13
|
readonly locale?: string;
|
|
@@ -23,11 +26,11 @@ const renderWrapper: RenderWrapperFunction =
|
|
|
23
26
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
24
27
|
({ children }) => (
|
|
25
28
|
<Aurora>
|
|
26
|
-
<
|
|
29
|
+
<I18nProvider locale={locale as string} messages={messages} onError={() => void 0}>
|
|
27
30
|
<LoggerProvider logger={logger}>
|
|
28
31
|
<Wrapper>{children}</Wrapper>
|
|
29
32
|
</LoggerProvider>
|
|
30
|
-
</
|
|
33
|
+
</I18nProvider>
|
|
31
34
|
</Aurora>
|
|
32
35
|
);
|
|
33
36
|
|
|
@@ -5,6 +5,7 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
5
5
|
import { Notifications } from "@lookiero/sty-psp-notifications";
|
|
6
6
|
import { theme } from "@lookiero/sty-psp-ui";
|
|
7
7
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
8
|
+
import { DOMAIN } from "../i18n/i18n";
|
|
8
9
|
|
|
9
10
|
const { colorBgBase } = theme();
|
|
10
11
|
|
|
@@ -15,7 +16,7 @@ interface AppProps {
|
|
|
15
16
|
const App: FC<AppProps> = ({ children }) => (
|
|
16
17
|
<SafeAreaProvider>
|
|
17
18
|
<StatusBar backgroundColor={colorBgBase} barStyle="dark-content" translucent />
|
|
18
|
-
<Notifications contextId={MESSAGING_CONTEXT_ID} portalHostName="Checkout" />
|
|
19
|
+
<Notifications contextId={MESSAGING_CONTEXT_ID} domain={DOMAIN} portalHostName="Checkout" />
|
|
19
20
|
<PortalHost name="Checkout" />
|
|
20
21
|
{children}
|
|
21
22
|
</SafeAreaProvider>
|