@lookiero/checkout 8.14.0-beta.102 → 8.14.0-beta.2

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 (178) 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/checkoutBooking/checkoutBooking.mock.d.ts +0 -1
  14. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +3 -3
  15. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +33 -40
  16. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +6 -10
  17. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +38 -39
  18. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +33 -40
  19. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -1
  20. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +96 -97
  21. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +33 -40
  22. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +83 -94
  23. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +1 -7
  24. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +173 -178
  25. package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
  26. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +33 -40
  27. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +2 -3
  28. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +34 -35
  29. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +33 -40
  30. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -1
  31. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +377 -378
  32. package/dist/src/infrastructure/ui/Root.d.ts +2 -0
  33. package/dist/src/infrastructure/ui/Root.js +2 -2
  34. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.d.ts +5 -0
  35. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -3
  36. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.d.ts +5 -0
  37. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.js +1 -1
  38. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +5 -0
  39. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
  40. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
  41. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
  42. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +1 -1
  43. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +2 -2
  44. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.d.ts +3 -1
  45. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -3
  46. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +4 -4
  47. package/dist/src/infrastructure/ui/routing/Routing.d.ts +7 -0
  48. package/dist/src/infrastructure/ui/routing/Routing.js +5 -5
  49. package/dist/src/infrastructure/ui/views/App.d.ts +8 -0
  50. package/dist/src/infrastructure/ui/views/App.js +4 -4
  51. package/dist/src/infrastructure/ui/views/App.style.d.ts +3 -3
  52. package/dist/src/infrastructure/ui/views/App.style.js +3 -4
  53. package/dist/src/infrastructure/ui/views/item/Item.d.ts +5 -0
  54. package/dist/src/infrastructure/ui/views/item/Item.js +3 -3
  55. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.d.ts +2 -0
  56. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +2 -2
  57. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
  58. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
  59. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +5 -1
  60. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -2
  61. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.d.ts +5 -0
  62. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
  63. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +3 -3
  64. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +2 -2
  65. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
  66. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
  67. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.d.ts +2 -0
  68. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +2 -2
  69. package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.d.ts +5 -0
  70. package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -2
  71. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.d.ts +5 -0
  72. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +2 -2
  73. package/dist/src/infrastructure/ui/views/return/Return.d.ts +5 -0
  74. package/dist/src/infrastructure/ui/views/return/Return.js +2 -2
  75. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +5 -0
  76. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +12 -14
  77. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +2 -6
  78. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -6
  79. package/dist/src/version.d.ts +1 -1
  80. package/dist/src/version.js +1 -1
  81. package/jest.setup.js +20 -0
  82. package/package.json +5 -4
  83. package/pact.config.ts +31 -0
  84. package/pact.publish.js +32 -0
  85. package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +62 -0
  86. package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +128 -0
  87. package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +63 -0
  88. package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +57 -0
  89. package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +57 -0
  90. package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +57 -0
  91. package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +63 -0
  92. package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +64 -0
  93. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +62 -0
  94. package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +136 -0
  95. package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
  96. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +62 -0
  97. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +62 -0
  98. package/src/infrastructure/ui/Root.tsx +4 -1
  99. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +14 -1
  100. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.tsx +8 -1
  101. package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +6 -0
  102. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
  103. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +2 -1
  104. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +2 -0
  105. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +2 -0
  106. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +5 -2
  107. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +3 -2
  108. package/src/infrastructure/ui/routing/Routing.tsx +13 -5
  109. package/{dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js → src/infrastructure/ui/views/App.style.ts} +2 -7
  110. package/src/infrastructure/ui/views/App.tsx +14 -7
  111. package/src/infrastructure/ui/views/item/Item.tsx +8 -2
  112. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
  113. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +9 -3
  114. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +8 -1
  115. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +12 -3
  116. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
  117. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +6 -6
  118. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -3
  119. package/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.tsx +12 -2
  120. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +14 -4
  121. package/src/infrastructure/ui/views/return/Return.tsx +8 -1
  122. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +2 -6
  123. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +33 -38
  124. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -13
  125. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -19
  126. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -22
  127. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +0 -1
  128. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +0 -7
  129. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -5
  130. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -7
  131. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -6
  132. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +0 -4
  133. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +0 -20
  134. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -4
  135. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -43
  136. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
  137. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -7
  138. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -21
  139. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -8
  140. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -12
  141. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -12
  142. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -64
  143. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -10
  144. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -17
  145. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -20
  146. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -27
  147. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -10
  148. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -27
  149. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +0 -7
  150. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +0 -11
  151. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -12
  152. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -64
  153. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -12
  154. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +0 -16
  155. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
  156. package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -44
  157. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -14
  158. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -28
  159. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -7
  160. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -11
  161. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -26
  162. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -21
  163. package/dist/src/projection/shared/country.d.ts +0 -14
  164. package/dist/src/projection/shared/country.js +0 -15
  165. package/dist/src/projection/shared/customer.d.ts +0 -9
  166. package/dist/src/projection/shared/customer.js +0 -1
  167. package/dist/src/projection/shared/locale.d.ts +0 -12
  168. package/dist/src/projection/shared/locale.js +0 -13
  169. package/dist/src/projection/shared/order.d.ts +0 -6
  170. package/dist/src/projection/shared/order.js +0 -1
  171. package/dist/src/projection/shared/price.d.ts +0 -11
  172. package/dist/src/projection/shared/price.js +0 -1
  173. package/dist/src/projection/shared/size.d.ts +0 -21
  174. package/dist/src/projection/shared/size.js +0 -4
  175. package/dist/src/projection/shared/subscription.d.ts +0 -2
  176. package/dist/src/projection/shared/subscription.js +0 -1
  177. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +0 -11
  178. package/dist/src/shared/ui/components/atoms/error/Error.js +0 -6
@@ -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,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 };