@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.
Files changed (137) hide show
  1. package/dist/pact.config.d.ts +4 -12
  2. package/dist/pact.config.js +4 -11
  3. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -1
  4. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +24 -24
  5. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +33 -40
  6. package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +6 -6
  7. package/dist/src/infrastructure/projection/checkout/checkout.mock.js +12 -15
  8. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +82 -89
  9. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +33 -40
  10. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +31 -38
  11. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +31 -38
  12. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +31 -38
  13. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +2 -5
  14. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +8 -10
  15. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -1
  16. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +3 -3
  17. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +33 -40
  18. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +6 -10
  19. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +38 -39
  20. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +33 -40
  21. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -1
  22. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +96 -97
  23. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +33 -40
  24. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +83 -94
  25. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +1 -7
  26. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +173 -178
  27. package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
  28. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +33 -40
  29. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +2 -3
  30. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +34 -35
  31. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +33 -40
  32. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -1
  33. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +377 -378
  34. package/dist/src/infrastructure/ui/Root.d.ts +2 -1
  35. package/dist/src/infrastructure/ui/Root.js +4 -2
  36. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +13 -14
  37. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +1 -2
  38. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -1
  39. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +1 -2
  40. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -1
  41. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +1 -1
  42. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +14 -15
  43. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -1
  44. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +7 -32
  45. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +9 -9
  46. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +9 -10
  47. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +3 -2
  48. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
  49. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
  50. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -2
  51. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +1 -2
  52. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +2 -12
  53. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +5 -5
  54. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +5 -6
  55. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +3 -4
  56. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +32 -47
  57. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +2 -3
  58. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +5 -13
  59. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +6 -7
  60. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +14 -20
  61. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +4 -5
  62. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +15 -21
  63. package/dist/src/infrastructure/ui/test/render.js +3 -1
  64. package/dist/src/infrastructure/ui/views/App.js +12 -9
  65. package/dist/src/infrastructure/ui/views/App.style.d.ts +3 -3
  66. package/dist/src/infrastructure/ui/views/App.style.js +3 -4
  67. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +4 -4
  68. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +4 -5
  69. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +3 -2
  70. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
  71. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
  72. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +4 -5
  73. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +19 -43
  74. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +9 -9
  75. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +9 -10
  76. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +2 -9
  77. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +6 -5
  78. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
  79. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
  80. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +3 -2
  81. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +37 -37
  82. package/dist/src/infrastructure/ui/views/return/Return.style.js +37 -38
  83. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +2 -3
  84. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +6 -7
  85. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +3 -22
  86. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +4 -4
  87. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +4 -5
  88. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +8 -17
  89. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +4 -12
  90. package/dist/src/projection/shared/country.d.ts +11 -11
  91. package/dist/src/projection/shared/country.js +11 -11
  92. package/dist/src/projection/shared/customer.d.ts +3 -4
  93. package/dist/src/projection/shared/locale.d.ts +9 -9
  94. package/dist/src/projection/shared/locale.js +9 -9
  95. package/dist/src/projection/shared/order.d.ts +3 -3
  96. package/dist/src/projection/shared/price.d.ts +5 -6
  97. package/dist/src/projection/shared/size.d.ts +10 -11
  98. package/dist/src/projection/shared/size.js +0 -1
  99. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +2 -3
  100. package/dist/src/shared/ui/components/atoms/error/Error.js +1 -3
  101. package/dist/src/version.d.ts +1 -1
  102. package/dist/src/version.js +1 -1
  103. package/jest.setup.js +20 -0
  104. package/package.json +4 -3
  105. package/pact.config.ts +31 -0
  106. package/pact.publish.js +32 -0
  107. package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +62 -0
  108. package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +128 -0
  109. package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +63 -0
  110. package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +57 -0
  111. package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +57 -0
  112. package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +57 -0
  113. package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +63 -0
  114. package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +64 -0
  115. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +62 -0
  116. package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +136 -0
  117. package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
  118. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +62 -0
  119. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +62 -0
  120. package/src/infrastructure/ui/Root.tsx +21 -17
  121. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
  122. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +3 -2
  123. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +3 -2
  124. package/src/infrastructure/ui/test/render.tsx +4 -1
  125. package/src/infrastructure/ui/views/App.style.ts +9 -0
  126. package/src/infrastructure/ui/views/App.tsx +23 -19
  127. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
  128. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +3 -2
  129. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +6 -3
  130. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +1 -0
  131. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
  132. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +10 -21
  133. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +5 -8
  134. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -2
  135. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +6 -3
  136. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +2 -2
  137. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +3 -9
@@ -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
- ...DEFAULT_PACT_OPTIONS,
14
- consumer: "STY-BOX_CHECKOUT-FRONT",
15
- provider: "STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId",
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
- it("returns is new checkout enabled for the given customer id", () => {
24
- provider
25
- .given("is new checkout enabled for the given customer id")
26
- .uponReceiving("is new checkout enabled")
27
- .withRequest({
28
- method: "GET",
29
- path: `/api/is-new-checkout-enabled/${customerId}`,
30
- headers: DEFAULT_REQUEST_HEADERS,
31
- })
32
- .willRespondWith({
33
- status: 200,
34
- headers: DEFAULT_RESPONSE_HEADERS,
35
- body: EXPECTED_BODY,
36
- });
37
- return provider.executeTest(async (mockserver) => {
38
- const httpGet = fetchHttpGet({
39
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
40
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
41
- device: "web",
42
- version: "1.0.0",
43
- });
44
- const response = await httpIsCheckoutEnabledByCustomerIdView({ httpGet })({
45
- customerId,
46
- signal: undefined,
47
- });
48
- expect(response).toStrictEqual(isCheckoutEnabledResponse);
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
  });
@@ -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
- ...DEFAULT_PACT_OPTIONS,
14
- consumer: "STY-BOX_CHECKOUT-FRONT",
15
- provider: "STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId",
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
- it("returns is size-change enabled for the given checkout id", () => {
24
- provider
25
- .given("is size-change enabled for the given checkout id")
26
- .uponReceiving("is size-change enabled")
27
- .withRequest({
28
- method: "GET",
29
- path: `/api/is-size-change-enabled-by-checkout-id/${checkoutId}`,
30
- headers: DEFAULT_REQUEST_HEADERS,
31
- })
32
- .willRespondWith({
33
- status: 200,
34
- headers: DEFAULT_RESPONSE_HEADERS,
35
- body: EXPECTED_BODY,
36
- });
37
- return provider.executeTest(async (mockserver) => {
38
- const httpGet = fetchHttpGet({
39
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
40
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
41
- device: "web",
42
- version: "1.0.0",
43
- });
44
- const response = await httpIsSizeChangeEnabledByCheckoutIdView({ httpGet })({
45
- checkoutId,
46
- signal: undefined,
47
- });
48
- expect(response).toStrictEqual(isSizeChangeEnabledResponse);
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
- readonly customerId: string | undefined;
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 };
@@ -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
- refetchOnMount: "always",
13
- staleTime: Infinity,
14
- retry: false,
15
- refetchOnWindowFocus: false,
16
- cacheTime: 0,
10
+ refetchOnMount: "always",
11
+ staleTime: Infinity,
12
+ retry: false,
13
+ refetchOnWindowFocus: false,
14
+ cacheTime: 0,
17
15
  },
18
- });
16
+ });
19
17
  export { useViewIsCheckoutAccessibleByCustomerId };
@@ -1,4 +1,3 @@
1
1
  import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
2
-
3
2
  declare const checkoutBooking: CheckoutBookingProjection;
4
3
  export { checkoutBooking };
@@ -1,6 +1,6 @@
1
1
  const checkoutBooking = {
2
- id: "e38f6e6d-a729-493b-aa4a-b1b325aa3092",
3
- checkoutItemIds: ["3bcf99f9-9f5f-43c0-bc01-706549eb84dc"],
4
- isExpired: false,
2
+ id: "e38f6e6d-a729-493b-aa4a-b1b325aa3092",
3
+ checkoutItemIds: ["3bcf99f9-9f5f-43c0-bc01-706549eb84dc"],
4
+ isExpired: false,
5
5
  };
6
6
  export { checkoutBooking };
@@ -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
- ...DEFAULT_PACT_OPTIONS,
15
- consumer: "STY-BOX_CHECKOUT-FRONT",
16
- provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById",
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
- result: checkoutBookingProjection,
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
- it("returns a valid checkout booking for the given id", () => {
28
- provider
29
- .given("a valid checkout booking for the given id")
30
- .uponReceiving("checkout booking projection")
31
- .withRequest({
32
- method: "POST",
33
- path: "/api/view-checkout-booking-by-id",
34
- headers: DEFAULT_REQUEST_HEADERS,
35
- body: { checkoutBookingId },
36
- })
37
- .willRespondWith({
38
- status: 200,
39
- headers: DEFAULT_RESPONSE_HEADERS,
40
- body: EXPECTED_BODY,
41
- });
42
- return provider.executeTest(async (mockserver) => {
43
- const httpPost = fetchHttpPost({
44
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
45
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
46
- device: "web",
47
- version: "1.0.0",
48
- });
49
- const response = await httpCheckoutBookingByIdView({ httpPost })({
50
- checkoutBookingId,
51
- signal: undefined,
52
- });
53
- expect(response).toStrictEqual(checkoutBookingResponse.result);
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
- readonly id?: string;
10
- readonly status: CheckoutItemStatus;
11
- readonly feedbacks?: FeedbackProjection;
12
- readonly replacedFor?: CheckoutItemProductVariantProjection;
5
+ readonly id?: string;
6
+ readonly status: CheckoutItemStatus;
7
+ readonly feedbacks?: FeedbackProjection;
8
+ readonly replacedFor?: CheckoutItemProductVariantProjection;
13
9
  }
14
10
  interface CheckoutItemFunction {
15
- (args: CheckoutItemFunctionArgs): CheckoutItemProjection;
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
- const checkoutItem = ({ id = "7b389d69-f157-4234-8531-c1a1eb17dccb", status, feedbacks = {}, replacedFor = null }) => ({
5
- id,
6
- status,
7
- price: {
8
- amount: 3999,
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
- color: {
37
- id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
38
- name: "black",
39
- label: "black_C2",
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
- ...DEFAULT_PACT_OPTIONS,
16
- consumer: "STY-BOX_CHECKOUT-FRONT",
17
- provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById",
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
- result: checkoutItemProjection,
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
- it("returns a valid checkout item for the given id", () => {
29
- provider
30
- .given("a valid checkout item for the given id")
31
- .uponReceiving("checkout item projection")
32
- .withRequest({
33
- method: "POST",
34
- path: "/api/view-checkout-item-by-id",
35
- headers: DEFAULT_REQUEST_HEADERS,
36
- body: { checkoutItemId },
37
- })
38
- .willRespondWith({
39
- status: 200,
40
- headers: DEFAULT_RESPONSE_HEADERS,
41
- body: EXPECTED_BODY,
42
- });
43
- return provider.executeTest(async (mockserver) => {
44
- const httpPost = fetchHttpPost({
45
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
46
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
47
- device: "web",
48
- version: "1.0.0",
49
- });
50
- const response = await httpCheckoutItemByIdView({ httpPost })({
51
- checkoutItemId,
52
- signal: undefined,
53
- });
54
- expect(response).toStrictEqual(checkoutItemResponse.result);
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
  });
@@ -1,4 +1,3 @@
1
1
  import { CheckoutQuestionProjection } from "../../../projection/checkoutQuestion/checkoutQuestion";
2
-
3
2
  declare const checkoutQuestions: CheckoutQuestionProjection[];
4
3
  export { checkoutQuestions };