@lookiero/checkout 8.14.0-beta.102 → 8.14.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/pact.config.d.ts +4 -12
- package/dist/pact.config.js +4 -11
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +24 -24
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +6 -6
- package/dist/src/infrastructure/projection/checkout/checkout.mock.js +12 -15
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +82 -89
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +31 -38
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +31 -38
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +31 -38
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +2 -5
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +8 -10
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +3 -3
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +6 -10
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +38 -39
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +96 -97
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +83 -94
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +1 -7
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +173 -178
- package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +2 -3
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +34 -35
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +377 -378
- package/dist/src/infrastructure/ui/Root.d.ts +2 -1
- package/dist/src/infrastructure/ui/Root.js +4 -2
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +13 -14
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +14 -15
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +7 -32
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +9 -9
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +9 -10
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +3 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -2
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +1 -2
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +2 -12
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +5 -5
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +5 -6
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +3 -4
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +32 -47
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +2 -3
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +5 -13
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +6 -7
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +14 -20
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +4 -5
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +15 -21
- package/dist/src/infrastructure/ui/test/render.js +3 -1
- package/dist/src/infrastructure/ui/views/App.js +12 -9
- package/dist/src/infrastructure/ui/views/App.style.d.ts +3 -3
- package/dist/src/infrastructure/ui/views/App.style.js +3 -4
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +4 -4
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +4 -5
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +3 -2
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +4 -5
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +19 -43
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +9 -9
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +9 -10
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +2 -9
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +6 -5
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
- package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +3 -2
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +37 -37
- package/dist/src/infrastructure/ui/views/return/Return.style.js +37 -38
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +2 -3
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +6 -7
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +3 -22
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +4 -4
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +4 -5
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +8 -17
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +4 -12
- package/dist/src/projection/shared/country.d.ts +11 -11
- package/dist/src/projection/shared/country.js +11 -11
- package/dist/src/projection/shared/customer.d.ts +3 -4
- package/dist/src/projection/shared/locale.d.ts +9 -9
- package/dist/src/projection/shared/locale.js +9 -9
- package/dist/src/projection/shared/order.d.ts +3 -3
- package/dist/src/projection/shared/price.d.ts +5 -6
- package/dist/src/projection/shared/size.d.ts +10 -11
- package/dist/src/projection/shared/size.js +0 -1
- package/dist/src/shared/ui/components/atoms/error/Error.d.ts +2 -3
- package/dist/src/shared/ui/components/atoms/error/Error.js +1 -3
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/jest.setup.js +20 -0
- package/package.json +4 -3
- package/pact.config.ts +31 -0
- package/pact.publish.js +32 -0
- package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +62 -0
- package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +128 -0
- package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +63 -0
- package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +57 -0
- package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +57 -0
- package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +57 -0
- package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +63 -0
- package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +64 -0
- package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +62 -0
- package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +136 -0
- package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
- package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +62 -0
- package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +62 -0
- package/src/infrastructure/ui/Root.tsx +21 -17
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +3 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +3 -2
- package/src/infrastructure/ui/test/render.tsx +4 -1
- package/src/infrastructure/ui/views/App.style.ts +9 -0
- package/src/infrastructure/ui/views/App.tsx +23 -19
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +3 -2
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +6 -3
- package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +1 -0
- package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
- package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +10 -21
- package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +5 -8
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -2
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +6 -3
- package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +2 -2
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +3 -9
package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpGet } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { httpIsCheckoutEnabledByCustomerIdView } from "./httpIsCheckoutEnabledByCustomerIdView";
|
|
11
|
-
|
|
12
5
|
const provider = new PactV3({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
...DEFAULT_PACT_OPTIONS,
|
|
7
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
8
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId",
|
|
16
9
|
});
|
|
17
10
|
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
18
11
|
const isCheckoutEnabledResponse = true;
|
|
@@ -20,32 +13,32 @@ const isCheckoutEnabledResponse = true;
|
|
|
20
13
|
// @ts-ignore
|
|
21
14
|
const EXPECTED_BODY = MatchersV3.boolean(isCheckoutEnabledResponse);
|
|
22
15
|
describe("STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId API", () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
it("returns is new checkout enabled for the given customer id", () => {
|
|
17
|
+
provider
|
|
18
|
+
.given("is new checkout enabled for the given customer id")
|
|
19
|
+
.uponReceiving("is new checkout enabled")
|
|
20
|
+
.withRequest({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: `/api/is-new-checkout-enabled/${customerId}`,
|
|
23
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
24
|
+
})
|
|
25
|
+
.willRespondWith({
|
|
26
|
+
status: 200,
|
|
27
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
28
|
+
body: EXPECTED_BODY,
|
|
29
|
+
});
|
|
30
|
+
return provider.executeTest(async (mockserver) => {
|
|
31
|
+
const httpGet = fetchHttpGet({
|
|
32
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
33
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
34
|
+
device: "web",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
});
|
|
37
|
+
const response = await httpIsCheckoutEnabledByCustomerIdView({ httpGet })({
|
|
38
|
+
customerId,
|
|
39
|
+
signal: undefined,
|
|
40
|
+
});
|
|
41
|
+
expect(response).toStrictEqual(isCheckoutEnabledResponse);
|
|
42
|
+
});
|
|
49
43
|
});
|
|
50
|
-
});
|
|
51
44
|
});
|
package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpGet } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { httpIsSizeChangeEnabledByCheckoutIdView } from "./httpIsSizeChangeEnabledByCheckoutIdView";
|
|
11
|
-
|
|
12
5
|
const provider = new PactV3({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
...DEFAULT_PACT_OPTIONS,
|
|
7
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
8
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId",
|
|
16
9
|
});
|
|
17
10
|
const checkoutId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
18
11
|
const isSizeChangeEnabledResponse = true;
|
|
@@ -20,32 +13,32 @@ const isSizeChangeEnabledResponse = true;
|
|
|
20
13
|
// @ts-ignore
|
|
21
14
|
const EXPECTED_BODY = MatchersV3.like(isSizeChangeEnabledResponse);
|
|
22
15
|
describe("STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId API", () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
it("returns is size-change enabled for the given checkout id", () => {
|
|
17
|
+
provider
|
|
18
|
+
.given("is size-change enabled for the given checkout id")
|
|
19
|
+
.uponReceiving("is size-change enabled")
|
|
20
|
+
.withRequest({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: `/api/is-size-change-enabled-by-checkout-id/${checkoutId}`,
|
|
23
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
24
|
+
})
|
|
25
|
+
.willRespondWith({
|
|
26
|
+
status: 200,
|
|
27
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
28
|
+
body: EXPECTED_BODY,
|
|
29
|
+
});
|
|
30
|
+
return provider.executeTest(async (mockserver) => {
|
|
31
|
+
const httpGet = fetchHttpGet({
|
|
32
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
33
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
34
|
+
device: "web",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
});
|
|
37
|
+
const response = await httpIsSizeChangeEnabledByCheckoutIdView({ httpGet })({
|
|
38
|
+
checkoutId,
|
|
39
|
+
signal: undefined,
|
|
40
|
+
});
|
|
41
|
+
expect(response).toStrictEqual(isSizeChangeEnabledResponse);
|
|
42
|
+
});
|
|
49
43
|
});
|
|
50
|
-
});
|
|
51
44
|
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
2
|
import { IsCheckoutAccessibleByCustomerIdProjection } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
3
|
-
|
|
4
3
|
interface UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs {
|
|
5
|
-
|
|
4
|
+
readonly customerId: string | undefined;
|
|
6
5
|
}
|
|
7
6
|
interface UseViewIsCheckoutAccessibleByCustomerIdFunction {
|
|
8
|
-
|
|
9
|
-
args: UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs,
|
|
10
|
-
): UseQueryFunctionResult<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
7
|
+
(args: UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs): UseQueryFunctionResult<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
11
8
|
}
|
|
12
9
|
declare const useViewIsCheckoutAccessibleByCustomerId: UseViewIsCheckoutAccessibleByCustomerIdFunction;
|
|
13
10
|
export { useViewIsCheckoutAccessibleByCustomerId };
|
package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
2
|
import { isCheckoutFeedbackGiven } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
3
|
-
import { viewIsCheckoutAccessibleByCustomerId } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
3
|
+
import { viewIsCheckoutAccessibleByCustomerId, } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
4
4
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
-
|
|
6
|
-
const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) =>
|
|
7
|
-
useQuery({
|
|
5
|
+
const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
|
|
8
6
|
query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
|
|
9
7
|
contextId: MESSAGING_CONTEXT_ID,
|
|
10
8
|
invalidation: isCheckoutFeedbackGiven,
|
|
11
9
|
options: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
refetchOnMount: "always",
|
|
11
|
+
staleTime: Infinity,
|
|
12
|
+
retry: false,
|
|
13
|
+
refetchOnWindowFocus: false,
|
|
14
|
+
cacheTime: 0,
|
|
17
15
|
},
|
|
18
|
-
|
|
16
|
+
});
|
|
19
17
|
export { useViewIsCheckoutAccessibleByCustomerId };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const checkoutBooking = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
id: "e38f6e6d-a729-493b-aa4a-b1b325aa3092",
|
|
3
|
+
checkoutItemIds: ["3bcf99f9-9f5f-43c0-bc01-706549eb84dc"],
|
|
4
|
+
isExpired: false,
|
|
5
5
|
};
|
|
6
6
|
export { checkoutBooking };
|
package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js
CHANGED
|
@@ -1,56 +1,49 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { checkoutBooking as checkoutBookingMock } from "./checkoutBooking.mock";
|
|
11
5
|
import { httpCheckoutBookingByIdView } from "./httpCheckoutBookingByIdView";
|
|
12
|
-
|
|
13
6
|
const provider = new PactV3({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
...DEFAULT_PACT_OPTIONS,
|
|
8
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
9
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById",
|
|
17
10
|
});
|
|
18
11
|
const checkoutBookingProjection = checkoutBookingMock;
|
|
19
12
|
const checkoutBookingId = checkoutBookingProjection.id;
|
|
20
13
|
const checkoutBookingResponse = {
|
|
21
|
-
|
|
14
|
+
result: checkoutBookingProjection,
|
|
22
15
|
};
|
|
23
16
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
17
|
// @ts-ignore
|
|
25
18
|
const EXPECTED_BODY = MatchersV3.like(checkoutBookingResponse);
|
|
26
19
|
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById API", () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
it("returns a valid checkout booking for the given id", () => {
|
|
21
|
+
provider
|
|
22
|
+
.given("a valid checkout booking for the given id")
|
|
23
|
+
.uponReceiving("checkout booking projection")
|
|
24
|
+
.withRequest({
|
|
25
|
+
method: "POST",
|
|
26
|
+
path: "/api/view-checkout-booking-by-id",
|
|
27
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
28
|
+
body: { checkoutBookingId },
|
|
29
|
+
})
|
|
30
|
+
.willRespondWith({
|
|
31
|
+
status: 200,
|
|
32
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
33
|
+
body: EXPECTED_BODY,
|
|
34
|
+
});
|
|
35
|
+
return provider.executeTest(async (mockserver) => {
|
|
36
|
+
const httpPost = fetchHttpPost({
|
|
37
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
38
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
39
|
+
device: "web",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
});
|
|
42
|
+
const response = await httpCheckoutBookingByIdView({ httpPost })({
|
|
43
|
+
checkoutBookingId,
|
|
44
|
+
signal: undefined,
|
|
45
|
+
});
|
|
46
|
+
expect(response).toStrictEqual(checkoutBookingResponse.result);
|
|
47
|
+
});
|
|
54
48
|
});
|
|
55
|
-
});
|
|
56
49
|
});
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
2
|
-
import {
|
|
3
|
-
CheckoutItemProductVariantProjection,
|
|
4
|
-
CheckoutItemProjection,
|
|
5
|
-
} from "../../../projection/checkoutItem/checkoutItem";
|
|
2
|
+
import { CheckoutItemProductVariantProjection, CheckoutItemProjection } from "../../../projection/checkoutItem/checkoutItem";
|
|
6
3
|
import { FeedbackProjection } from "../../../projection/feedback/feedback";
|
|
7
|
-
|
|
8
4
|
interface CheckoutItemFunctionArgs {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
readonly id?: string;
|
|
6
|
+
readonly status: CheckoutItemStatus;
|
|
7
|
+
readonly feedbacks?: FeedbackProjection;
|
|
8
|
+
readonly replacedFor?: CheckoutItemProductVariantProjection;
|
|
13
9
|
}
|
|
14
10
|
interface CheckoutItemFunction {
|
|
15
|
-
|
|
11
|
+
(args: CheckoutItemFunctionArgs): CheckoutItemProjection;
|
|
16
12
|
}
|
|
17
13
|
declare const checkoutItem: CheckoutItemFunction;
|
|
18
14
|
export type { CheckoutItemFunctionArgs };
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
import { Currency } from "../../../domain/checkoutItem/model/currency";
|
|
2
|
-
import { MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
currency: Currency.EUR,
|
|
10
|
-
},
|
|
11
|
-
feedbacks,
|
|
12
|
-
productVariant: {
|
|
13
|
-
id: "7b389d69-f157-4234-8531-c1a1eb17dccb",
|
|
14
|
-
media: [
|
|
15
|
-
{
|
|
16
|
-
id: "d7ec731b-4123-4394-829b-297b952e73e5",
|
|
17
|
-
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
|
|
18
|
-
perspective: MediaPerspective.MAIN,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
|
|
22
|
-
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
|
|
23
|
-
perspective: MediaPerspective.DETAIL,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
brand: "CKS",
|
|
27
|
-
name: "Sari Tshirt lines",
|
|
28
|
-
size: {
|
|
29
|
-
id: "b26f7190-d505-4d24-aeb9-ad36e5e6ec4b",
|
|
30
|
-
lookiero: "M",
|
|
31
|
-
uk: "M",
|
|
32
|
-
it: "M",
|
|
33
|
-
europe: "M",
|
|
34
|
-
unique: false,
|
|
2
|
+
import { MediaPerspective, } from "../../../projection/checkoutItem/checkoutItem";
|
|
3
|
+
const checkoutItem = ({ id = "7b389d69-f157-4234-8531-c1a1eb17dccb", status, feedbacks = {}, replacedFor = null, }) => ({
|
|
4
|
+
id,
|
|
5
|
+
status,
|
|
6
|
+
price: {
|
|
7
|
+
amount: 3999,
|
|
8
|
+
currency: Currency.EUR,
|
|
35
9
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
10
|
+
feedbacks,
|
|
11
|
+
productVariant: {
|
|
12
|
+
id: "7b389d69-f157-4234-8531-c1a1eb17dccb",
|
|
13
|
+
media: [
|
|
14
|
+
{
|
|
15
|
+
id: "d7ec731b-4123-4394-829b-297b952e73e5",
|
|
16
|
+
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
|
|
17
|
+
perspective: MediaPerspective.MAIN,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
|
|
21
|
+
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
|
|
22
|
+
perspective: MediaPerspective.DETAIL,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
brand: "CKS",
|
|
26
|
+
name: "Sari Tshirt lines",
|
|
27
|
+
size: {
|
|
28
|
+
id: "b26f7190-d505-4d24-aeb9-ad36e5e6ec4b",
|
|
29
|
+
lookiero: "M",
|
|
30
|
+
uk: "M",
|
|
31
|
+
it: "M",
|
|
32
|
+
europe: "M",
|
|
33
|
+
unique: false,
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
|
|
37
|
+
name: "black",
|
|
38
|
+
label: "black_C2",
|
|
39
|
+
},
|
|
40
40
|
},
|
|
41
|
-
|
|
42
|
-
replacedFor,
|
|
41
|
+
replacedFor,
|
|
43
42
|
});
|
|
44
43
|
export { checkoutItem };
|
|
@@ -1,57 +1,50 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
11
5
|
import { checkoutItem } from "./checkoutItem.mock";
|
|
12
6
|
import { httpCheckoutItemByIdView } from "./httpCheckoutItemByIdView";
|
|
13
|
-
|
|
14
7
|
const provider = new PactV3({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
...DEFAULT_PACT_OPTIONS,
|
|
9
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
10
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById",
|
|
18
11
|
});
|
|
19
12
|
const checkoutItemProjection = checkoutItem({ status: CheckoutItemStatus.INITIAL });
|
|
20
13
|
const checkoutItemId = checkoutItemProjection.id;
|
|
21
14
|
const checkoutItemResponse = {
|
|
22
|
-
|
|
15
|
+
result: checkoutItemProjection,
|
|
23
16
|
};
|
|
24
17
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
25
18
|
// @ts-ignore
|
|
26
19
|
const EXPECTED_BODY = MatchersV3.like(checkoutItemResponse);
|
|
27
20
|
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById API", () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
21
|
+
it("returns a valid checkout item for the given id", () => {
|
|
22
|
+
provider
|
|
23
|
+
.given("a valid checkout item for the given id")
|
|
24
|
+
.uponReceiving("checkout item projection")
|
|
25
|
+
.withRequest({
|
|
26
|
+
method: "POST",
|
|
27
|
+
path: "/api/view-checkout-item-by-id",
|
|
28
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
29
|
+
body: { checkoutItemId },
|
|
30
|
+
})
|
|
31
|
+
.willRespondWith({
|
|
32
|
+
status: 200,
|
|
33
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
34
|
+
body: EXPECTED_BODY,
|
|
35
|
+
});
|
|
36
|
+
return provider.executeTest(async (mockserver) => {
|
|
37
|
+
const httpPost = fetchHttpPost({
|
|
38
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
39
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
40
|
+
device: "web",
|
|
41
|
+
version: "1.0.0",
|
|
42
|
+
});
|
|
43
|
+
const response = await httpCheckoutItemByIdView({ httpPost })({
|
|
44
|
+
checkoutItemId,
|
|
45
|
+
signal: undefined,
|
|
46
|
+
});
|
|
47
|
+
expect(response).toStrictEqual(checkoutItemResponse.result);
|
|
48
|
+
});
|
|
55
49
|
});
|
|
56
|
-
});
|
|
57
50
|
});
|