@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,8 +1,12 @@
1
1
  import { FC } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
2
3
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
3
4
  import { ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
4
5
  import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
5
6
  import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
7
+ interface ItemWithCustomerDecissionStyle {
8
+ readonly modal: StyleProp<ViewStyle>;
9
+ }
6
10
  interface CheckoutItemWithCustomerDecission extends CheckoutItemProjection {
7
11
  readonly status: Exclude<CheckoutItemStatus, CheckoutItemStatus.INITIAL>;
8
12
  }
@@ -11,6 +15,7 @@ interface ItemWithCustomerDecissionProps {
11
15
  readonly checkoutItem: CheckoutItemWithCustomerDecission;
12
16
  readonly returnQuestions: ReturnQuestionProjection[];
13
17
  readonly currentProductVariant: ProductVariantProjection;
18
+ readonly style?: Partial<ItemWithCustomerDecissionStyle>;
14
19
  readonly onEditFeedback: () => void;
15
20
  }
16
21
  declare const ItemWithCustomerDecission: FC<ItemWithCustomerDecissionProps>;
@@ -14,7 +14,7 @@ import { CustomerDecissionBanner, } from "../../components/banner/CustomerDeciss
14
14
  import { ReturnQuestionsFeedback } from "../../components/returnQuestionsFeedback/ReturnQuestionsFeedback";
15
15
  import { ProductVariant } from "../../views/productVariant/ProductVariant";
16
16
  import { style } from "./ItemWithCustomerDecission.style";
17
- const ItemWithCustomerDecission = ({ checkoutId, checkoutItem, returnQuestions, currentProductVariant, onEditFeedback, }) => {
17
+ const ItemWithCustomerDecission = ({ checkoutId, checkoutItem, returnQuestions, currentProductVariant, style: customStyle, onEditFeedback, }) => {
18
18
  const screenSize = useScreenSize();
19
19
  const isMobile = screenSize === "S";
20
20
  const logger = useLogger();
@@ -42,6 +42,6 @@ const ItemWithCustomerDecission = ({ checkoutId, checkoutItem, returnQuestions,
42
42
  }
43
43
  return (React.createElement(Body, { style: { row: style.container } },
44
44
  React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, segment: segment, customerDecissionBanner: React.createElement(CustomerDecissionBanner, { checkoutItemStatus: checkoutItem.status, onPress: resetItem }) }, checkoutItem.status === CheckoutItemStatus.RETURNED && (React.createElement(View, { style: [style.feedbackContainer, isMobile ? style.feedbackContainerMobile : undefined] },
45
- React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions, onEditFeedback: onEditFeedback }))))));
45
+ React.createElement(ReturnQuestionsFeedback, { returnQuestions: returnQuestions, style: customStyle, onEditFeedback: onEditFeedback }))))));
46
46
  };
47
47
  export { ItemWithCustomerDecission };
@@ -1,8 +1,12 @@
1
1
  import { FC } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
2
3
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
3
4
  import { BookedProductsVariantsProjection, ProductVariantProjection } from "../../../../../../projection/bookedProductsVariants/bookedProductsVariants";
4
5
  import "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
5
6
  import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
7
+ interface ItemWithoutCustomerDecissionStyle {
8
+ readonly modal: StyleProp<ViewStyle>;
9
+ }
6
10
  interface CheckoutItemWithoutCustomerDecission extends CheckoutItemProjection {
7
11
  readonly status: CheckoutItemStatus.INITIAL;
8
12
  }
@@ -11,6 +15,7 @@ interface ItemWithoutCustomerDecissionProps {
11
15
  readonly checkoutItem: CheckoutItemWithoutCustomerDecission;
12
16
  readonly bookedProductsVariants: BookedProductsVariantsProjection;
13
17
  readonly currentProductVariant: ProductVariantProjection;
18
+ readonly style?: Partial<ItemWithoutCustomerDecissionStyle>;
14
19
  readonly onReturn: () => void;
15
20
  }
16
21
  declare const ItemWithoutCustomerDecission: FC<ItemWithoutCustomerDecissionProps>;
@@ -17,7 +17,7 @@ import { SizeWithoutStockModal } from "../../components/sizeWithoutStockModal/Si
17
17
  import { ProductVariant } from "../productVariant/ProductVariant";
18
18
  import { style } from "./ItemWithoutCustomerDecission.style";
19
19
  const { space6 } = theme();
20
- const ItemWithoutCustomerDecission = ({ checkoutId, checkoutItem, bookedProductsVariants, currentProductVariant, onReturn, }) => {
20
+ const ItemWithoutCustomerDecission = ({ checkoutId, checkoutItem, bookedProductsVariants, currentProductVariant, style: customStyle, onReturn, }) => {
21
21
  const logger = useLogger();
22
22
  const { customer: { country, segment }, } = useStaticInfo();
23
23
  /* KeepCheckoutItem */
@@ -62,7 +62,7 @@ const ItemWithoutCustomerDecission = ({ checkoutId, checkoutItem, bookedProducts
62
62
  return React.createElement(Spinner, { testID: "spinner" });
63
63
  }
64
64
  return (React.createElement(React.Fragment, null,
65
- React.createElement(SizeWithoutStockModal, { visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
65
+ React.createElement(SizeWithoutStockModal, { style: customStyle?.modal, visible: sizeWithoutStockModalVisible, onDismiss: handleOnHideSizeWithoutStockModal }),
66
66
  React.createElement(ScrollView, { showsVerticalScrollIndicator: false },
67
67
  React.createElement(Body, { style: { row: style.container } },
68
68
  React.createElement(ProductVariant, { checkoutId: checkoutId, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, segment: segment, style: { content: { paddingBottom: Platform.OS === "web" ? space6 : stickyHeight } } }))),
@@ -1,7 +1,12 @@
1
1
  import { FC } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
2
3
  import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
4
+ interface ReturnStyle {
5
+ readonly modal: StyleProp<ViewStyle>;
6
+ }
3
7
  interface ReturnProps {
4
8
  readonly layout: UiLayout;
9
+ readonly style?: Partial<ReturnStyle>;
5
10
  }
6
11
  declare const Return: FC<ReturnProps>;
7
12
  export { Return };
@@ -6,7 +6,7 @@ import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/c
6
6
  import { ReturnQuestionFeedbackProvider } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
7
7
  import { useStaticInfo } from "../../hooks/useStaticInfo";
8
8
  import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
9
- const Return = ({ layout }) => {
9
+ const Return = ({ layout, style: customStyle }) => {
10
10
  const { id } = useParams();
11
11
  const { customer: { customerId, country, segment }, } = useStaticInfo();
12
12
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -16,6 +16,6 @@ const Return = ({ layout }) => {
16
16
  return React.createElement(Spinner, null);
17
17
  }
18
18
  return (React.createElement(ReturnQuestionFeedbackProvider, { key: checkoutItem.id, feedback: checkoutItem.feedbacks || {} },
19
- React.createElement(ReturnQuestionsForm, { checkout: checkout, checkoutItem: checkoutItem, country: country, layout: layout, segment: segment })));
19
+ React.createElement(ReturnQuestionsForm, { checkout: checkout, checkoutItem: checkoutItem, country: country, layout: layout, segment: segment, style: customStyle })));
20
20
  };
21
21
  export { Return };
@@ -1,15 +1,20 @@
1
1
  import { FC } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
2
3
  import { Country } from "@lookiero/sty-psp-locale";
3
4
  import { Segment } from "@lookiero/sty-psp-segment";
4
5
  import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
5
6
  import { CheckoutProjection } from "../../../../../../projection/checkout/checkout";
6
7
  import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
8
+ interface ReturnQuestionsFormStyle {
9
+ readonly modal: StyleProp<ViewStyle>;
10
+ }
7
11
  interface ReturnQuestionsFormProps {
8
12
  readonly checkout: CheckoutProjection;
9
13
  readonly checkoutItem: CheckoutItemProjection;
10
14
  readonly country: Country;
11
15
  readonly layout: UiLayout;
12
16
  readonly segment: Segment;
17
+ readonly style?: Partial<ReturnQuestionsFormStyle>;
13
18
  }
14
19
  declare const ReturnQuestionsForm: FC<ReturnQuestionsFormProps>;
15
20
  export { ReturnQuestionsForm };
@@ -1,7 +1,6 @@
1
1
  import { PortalHost } from "@gorhom/portal";
2
2
  import React, { useCallback, useMemo } from "react";
3
- import { Platform } from "react-native";
4
- import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
3
+ import { ScrollView } from "react-native";
5
4
  import { generatePath, useNavigate } from "react-router-native";
6
5
  import { Box, Button, Layout as AuroraLayout, Spinner, Text, View, useDevice } from "@lookiero/aurora";
7
6
  import { useI18nMessage } from "@lookiero/i18n-react";
@@ -38,7 +37,7 @@ const returnQuestionItems = {
38
37
  [ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
39
38
  [ReturnQuestionType.OPTION]: RadioReturnQuestionItem,
40
39
  };
41
- const ReturnQuestionsForm = ({ checkout, checkoutItem, country, layout: Layout, segment, }) => {
40
+ const ReturnQuestionsForm = ({ checkout, checkoutItem, country, layout: Layout, segment, style: customStyle, }) => {
42
41
  const navigate = useNavigate();
43
42
  const basePath = useBasePath();
44
43
  const logger = useLogger();
@@ -95,21 +94,20 @@ const ReturnQuestionsForm = ({ checkout, checkoutItem, country, layout: Layout,
95
94
  }
96
95
  return (React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
97
96
  React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
98
- React.createElement(Layout, { footer: null, header: header, scrollEnabled: false, style: {
97
+ React.createElement(Layout, { header: header, scrollEnabled: false, style: {
99
98
  safeAreaView: style.safeAreaView,
100
99
  scrollView: style.scrollView,
101
100
  header: style.header,
102
101
  } },
103
102
  React.createElement(ProductVariantPreview, { country: country, item: checkoutItem }),
104
- React.createElement(KeyboardAwareScrollView, { extraKeyboardSpace: Platform.OS === "android" ? 10 : 120, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, testID: "return-questions-form" },
105
- React.createElement(View, { style: style.background },
106
- React.createElement(AuroraLayout, { fullWidth: !screen.L, style: [style.layout, screen.L ? style.desktopLayoutSpacing : undefined] },
107
- React.createElement(Box, { size: { L: "2/3" } },
108
- React.createElement(View, { style: [style.info, !screen.S && style.desktopInfo] },
109
- React.createElement(Text, { level: 3, heading: true }, titleText),
110
- React.createElement(Text, { level: 1, style: style.description, detail: true }, descriptionText)),
111
- React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }),
112
- React.createElement(View, { style: [style.submit, !screen.S && style.submitDesktop] },
113
- React.createElement(Button, { testID: "return-questions-button", onPress: handleOnSubmit }, submitButtonText)))))))));
103
+ React.createElement(ScrollView, { showsVerticalScrollIndicator: false, testID: "return-questions-form" },
104
+ React.createElement(AuroraLayout, { fullWidth: !screen.L, style: [style.layout, screen.L ? style.desktopLayoutSpacing : undefined] },
105
+ React.createElement(Box, { size: { L: "2/3" } },
106
+ React.createElement(View, { style: [style.info, !screen.S && style.desktopInfo] },
107
+ React.createElement(Text, { level: 3, heading: true }, titleText),
108
+ React.createElement(Text, { level: 1, style: style.description, detail: true }, descriptionText)),
109
+ React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions, style: customStyle }),
110
+ React.createElement(View, { style: style.submit },
111
+ React.createElement(Button, { testID: "return-questions-button", onPress: handleOnSubmit }, submitButtonText))))))));
114
112
  };
115
113
  export { ReturnQuestionsForm };
@@ -1,7 +1,4 @@
1
1
  declare const style: {
2
- background: {
3
- backgroundColor: string;
4
- };
5
2
  description: {
6
3
  color: string;
7
4
  };
@@ -30,6 +27,7 @@ declare const style: {
30
27
  justifyContent: "center";
31
28
  };
32
29
  safeAreaView: {
30
+ backgroundColor: string;
33
31
  flex: number;
34
32
  };
35
33
  scrollView: {
@@ -37,11 +35,9 @@ declare const style: {
37
35
  };
38
36
  submit: {
39
37
  backgroundColor: string;
40
- padding: number;
41
- };
42
- submitDesktop: {
43
38
  borderBottomLeftRadius: number;
44
39
  borderBottomRightRadius: number;
40
+ padding: number;
45
41
  };
46
42
  };
47
43
  export { style };
@@ -3,9 +3,6 @@ import { theme } from "@lookiero/sty-psp-ui";
3
3
  import { HEADER_HEIGHT } from "../../../../components/templates/header/Header.style";
4
4
  const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space4, space6, space8 } = theme();
5
5
  const style = StyleSheet.create({
6
- background: {
7
- backgroundColor: colorBgPrimaryLight,
8
- },
9
6
  description: {
10
7
  color: colorTextMedium,
11
8
  },
@@ -34,6 +31,7 @@ const style = StyleSheet.create({
34
31
  justifyContent: "center",
35
32
  },
36
33
  safeAreaView: {
34
+ backgroundColor: colorBgPrimaryLight,
37
35
  flex: 1,
38
36
  },
39
37
  scrollView: {
@@ -41,11 +39,9 @@ const style = StyleSheet.create({
41
39
  },
42
40
  submit: {
43
41
  backgroundColor: colorBgBase,
44
- padding: space6,
45
- },
46
- submitDesktop: {
47
42
  borderBottomLeftRadius: borderRadius5,
48
43
  borderBottomRightRadius: borderRadius5,
44
+ padding: space6,
49
45
  },
50
46
  });
51
47
  export { style };
@@ -1 +1 @@
1
- export declare const VERSION = "8.14.0-beta.102";
1
+ export declare const VERSION = "8.14.0-beta.2";
@@ -1 +1 @@
1
- export const VERSION = "8.14.0-beta.102";
1
+ export const VERSION = "8.14.0-beta.2";
package/jest.setup.js CHANGED
@@ -11,6 +11,26 @@ jest.mock("@react-native-async-storage/async-storage", () => mockAsyncStorage);
11
11
  * Without these, jest will break or pollute the log warnings.
12
12
  */
13
13
  jest.mock("expo-linear-gradient", () => ({ LinearGradient: require("react-native").View }));
14
+ jest.mock("expo-image-picker", () => ({
15
+ PermissionStatus: {
16
+ GRANTED: "granted",
17
+ UNDETERMINED: "undetermined",
18
+ DENIED: "denied",
19
+ },
20
+ MediaTypeOptions: {
21
+ Images: "Images",
22
+ },
23
+ requestMediaLibraryPermissionsAsync: jest.fn(),
24
+ requestCameraPermissionsAsync: jest.fn(),
25
+ launchImageLibraryAsync: jest.fn(),
26
+ launchCameraAsync: jest.fn(),
27
+ }));
28
+ jest.mock("expo-image-manipulator", () => ({
29
+ manipulateAsync: jest.fn(),
30
+ SaveFormat: {
31
+ JPEG: "jpeg",
32
+ },
33
+ }));
14
34
 
15
35
  jest.mock("react-native-safe-area-context", () => ({
16
36
  SafeAreaProvider: ({ children }) => children,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "8.14.0-beta.102",
3
+ "version": "8.14.0-beta.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -21,18 +21,17 @@
21
21
  "@lookiero/sty-psp-i18n": "^0.2",
22
22
  "@lookiero/sty-psp-locale": "^0.4",
23
23
  "@lookiero/sty-psp-logging": "^0.3",
24
- "@lookiero/sty-psp-notifications": "^0.5",
24
+ "@lookiero/sty-psp-notifications": "^0.5.16-beta.2",
25
25
  "@lookiero/sty-psp-react-native": "^0.2",
26
26
  "@lookiero/sty-psp-segment": "^0.1",
27
27
  "@lookiero/sty-psp-storage": "^0.1",
28
28
  "@lookiero/sty-psp-tracking": "^0.1",
29
- "@lookiero/sty-psp-ui": "^0.6",
29
+ "@lookiero/sty-psp-ui": "^0.5",
30
30
  "@lookiero/sty-psp-ui-settings": "^0.1",
31
31
  "@lookiero/sty-psp-units": "^0.1",
32
32
  "@lookiero/sty-psp-uuid": "^0.1",
33
33
  "@react-native-async-storage/async-storage": "^1.22.3",
34
34
  "@react-spring/native": "9.6.1",
35
- "react-native-keyboard-controller": "^1.14.2",
36
35
  "react-native-svg": "^13.4.0",
37
36
  "tiny-invariant": "^1.3.1"
38
37
  },
@@ -45,6 +44,8 @@
45
44
  "@lookiero/sty-psp-scripts": "*",
46
45
  "@lookiero/sty-psp-typescript": "*",
47
46
  "@lookiero/testing-library-e2e-native": "1.0.41",
47
+ "@pact-foundation/pact": "^10.1.4",
48
+ "@pact-foundation/pact-node": "^10.17.6",
48
49
  "@remix-run/router": ">=1.10",
49
50
  "@testing-library/react-native": ">=12",
50
51
  "@types/jest-when": ">=3",
package/pact.config.ts ADDED
@@ -0,0 +1,31 @@
1
+ import { V3MockServer } from "@pact-foundation/pact";
2
+
3
+ interface StringObject {
4
+ readonly [k: string]: string;
5
+ }
6
+
7
+ const DEFAULT_PACT_OPTIONS: StringObject = { dir: ".contracts", logDir: ".pact/logs" };
8
+
9
+ const AUTH_TOKEN =
10
+ "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
11
+
12
+ const DEFAULT_REQUEST_HEADERS: StringObject = {
13
+ Authorization: `Bearer ${AUTH_TOKEN}`,
14
+ ["Content-Type"]: "application/json",
15
+ };
16
+
17
+ const DEFAULT_RESPONSE_HEADERS: StringObject = { ["Content-Type"]: "application/json" };
18
+
19
+ interface FromMockServerUrlToApiUrlFunction {
20
+ (mockServer: V3MockServer): string;
21
+ }
22
+
23
+ const fromMockServerUrlToApiUrl: FromMockServerUrlToApiUrlFunction = (mockServer) => mockServer.url.concat("/api");
24
+
25
+ export {
26
+ fromMockServerUrlToApiUrl,
27
+ AUTH_TOKEN,
28
+ DEFAULT_PACT_OPTIONS,
29
+ DEFAULT_REQUEST_HEADERS,
30
+ DEFAULT_RESPONSE_HEADERS,
31
+ };
@@ -0,0 +1,32 @@
1
+ const pact = require("@pact-foundation/pact-node");
2
+
3
+ const path = require("path");
4
+ const pwd = process.cwd();
5
+
6
+ const pjson = require(`${pwd}/package.json`);
7
+
8
+ const projectName = "checkout-front";
9
+
10
+ const branchName =
11
+ process.env.BRANCH_NAME ||
12
+ (() => {
13
+ throw "There is no defined branch";
14
+ })();
15
+
16
+ const options = {
17
+ pactFilesOrDirs: [path.resolve(pwd, ".contracts")],
18
+ pactBroker: "https://pact.dev.envs.lookiero.tech",
19
+ consumerVersion: pjson.version,
20
+ tags: [branchName, projectName],
21
+ };
22
+
23
+ console.log("Publishing contracts with options:", options);
24
+
25
+ pact
26
+ .publishPacts(options)
27
+ .then(() => {
28
+ console.log("Pact contract publishing complete!");
29
+ })
30
+ .catch((exception) => {
31
+ console.log("Pact contract publishing failed: ", exception);
32
+ });
@@ -0,0 +1,62 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
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";
10
+ import { BookedProductsVariantsProjection } from "../../../projection/bookedProductsVariants/bookedProductsVariants";
11
+ import { bookedProductsVariants } from "./bookedProductsVariants.mock";
12
+ import { httpBookedProductsVariantsForCheckoutItemView } from "./httpBookedProductsVariantsForCheckoutItemView";
13
+
14
+ const provider = new PactV3({
15
+ ...DEFAULT_PACT_OPTIONS,
16
+ consumer: "STY-BOX_CHECKOUT-FRONT",
17
+ provider: "STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem",
18
+ });
19
+
20
+ const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
21
+
22
+ const bookedProductsVariantsResponse: { result: BookedProductsVariantsProjection } = {
23
+ result: bookedProductsVariants,
24
+ };
25
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
+ // @ts-ignore
27
+ const EXPECTED_BODY = MatchersV3.like(bookedProductsVariantsResponse);
28
+
29
+ describe("STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem API", () => {
30
+ it("returns a valid booked size change product variants for the given checkout item", () => {
31
+ provider
32
+ .given("a valid booked size change product variants for the given checkout item")
33
+ .uponReceiving("booked size change product variants projection")
34
+ .withRequest({
35
+ method: "POST",
36
+ path: "/api/view-booked-product-variants-for-checkout-item",
37
+ headers: DEFAULT_REQUEST_HEADERS,
38
+ body: { checkoutItemId },
39
+ })
40
+ .willRespondWith({
41
+ status: 200,
42
+ headers: DEFAULT_RESPONSE_HEADERS,
43
+ body: EXPECTED_BODY,
44
+ });
45
+
46
+ return provider.executeTest(async (mockserver) => {
47
+ const httpPost = fetchHttpPost({
48
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
49
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
50
+ device: "web",
51
+ version: "1.0.0",
52
+ });
53
+
54
+ const response = await httpBookedProductsVariantsForCheckoutItemView({ httpPost })({
55
+ checkoutItemId,
56
+ signal: undefined,
57
+ });
58
+
59
+ expect(response).toStrictEqual(bookedProductsVariantsResponse.result);
60
+ });
61
+ });
62
+ });
@@ -0,0 +1,128 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
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";
10
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
11
+ import { CheckoutProjection } from "../../../projection/checkout/checkout";
12
+ import { CheckoutItemProductVariantProjection, MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
13
+ import { checkout } from "./checkout.mock";
14
+ import { httpCheckoutByIdView } from "./httpCheckoutByIdView";
15
+
16
+ const provider = new PactV3({
17
+ ...DEFAULT_PACT_OPTIONS,
18
+ consumer: "STY-BOX_CHECKOUT-FRONT",
19
+ provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutById",
20
+ });
21
+
22
+ const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
23
+ const replacedFor: CheckoutItemProductVariantProjection = {
24
+ id: "2bf7fb8f-a283-4f53-bc27-0e7fc9466a33",
25
+ media: [
26
+ {
27
+ id: "d7ec731b-4123-4394-829b-297b952e73e5",
28
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
29
+ perspective: MediaPerspective.MAIN,
30
+ },
31
+ {
32
+ id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
33
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
34
+ perspective: MediaPerspective.DETAIL,
35
+ },
36
+ ],
37
+ brand: "CKS",
38
+ name: "Sari Tshirt lines",
39
+ size: {
40
+ id: "b3a76aea-ce7a-4ecb-82a4-6637d0ac2afd",
41
+ lookiero: "S",
42
+ uk: "S",
43
+ it: "S",
44
+ europe: "S",
45
+ unique: false,
46
+ },
47
+ color: {
48
+ id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
49
+ label: "black_C2",
50
+ name: "black",
51
+ },
52
+ };
53
+
54
+ const checkoutResponseWithReplacedFor: { result: CheckoutProjection } = {
55
+ result: checkout({ items: [{ status: CheckoutItemStatus.KEPT, replacedFor }] }),
56
+ };
57
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
58
+ // @ts-ignore
59
+ const EXPECTED_BODY_WITH_REPLACED_FOR = MatchersV3.like(checkoutResponseWithReplacedFor);
60
+
61
+ const checkoutResponseWithoutReplacedFor: { result: CheckoutProjection } = {
62
+ result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
63
+ };
64
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
65
+ // @ts-ignore
66
+ const EXPECTED_BODY_WITHOUT_REPLACED_FOR = MatchersV3.like(checkoutResponseWithoutReplacedFor);
67
+
68
+ describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutById API", () => {
69
+ it("returns a valid checkout with replacedFor for the given id", () => {
70
+ provider
71
+ .given("a valid checkout with replacedFor for the given id")
72
+ .uponReceiving("checkout projection")
73
+ .withRequest({
74
+ method: "POST",
75
+ path: "/api/view-checkout-by-id",
76
+ headers: DEFAULT_REQUEST_HEADERS,
77
+ body: { checkoutId },
78
+ })
79
+ .willRespondWith({
80
+ status: 200,
81
+ headers: DEFAULT_RESPONSE_HEADERS,
82
+ body: EXPECTED_BODY_WITH_REPLACED_FOR,
83
+ });
84
+
85
+ return provider.executeTest(async (mockserver) => {
86
+ const httpPost = fetchHttpPost({
87
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
88
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
89
+ device: "web",
90
+ version: "1.0.0",
91
+ });
92
+
93
+ const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
94
+
95
+ expect(response).toStrictEqual(checkoutResponseWithReplacedFor.result);
96
+ });
97
+ });
98
+
99
+ it("returns a valid checkout without replacedFor for the given id", () => {
100
+ provider
101
+ .given("a valid checkout without replacedFor for the given id")
102
+ .uponReceiving("checkout projection")
103
+ .withRequest({
104
+ method: "POST",
105
+ path: "/api/view-checkout-by-id",
106
+ headers: DEFAULT_REQUEST_HEADERS,
107
+ body: { checkoutId },
108
+ })
109
+ .willRespondWith({
110
+ status: 200,
111
+ headers: DEFAULT_RESPONSE_HEADERS,
112
+ body: EXPECTED_BODY_WITHOUT_REPLACED_FOR,
113
+ });
114
+
115
+ return provider.executeTest(async (mockserver) => {
116
+ const httpPost = fetchHttpPost({
117
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
118
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
119
+ device: "web",
120
+ version: "1.0.0",
121
+ });
122
+
123
+ const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
124
+
125
+ expect(response).toStrictEqual(checkoutResponseWithoutReplacedFor.result);
126
+ });
127
+ });
128
+ });
@@ -0,0 +1,63 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
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";
10
+ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
11
+ import { CheckoutProjection } from "../../../projection/checkout/checkout";
12
+ import { checkout } from "./checkout.mock";
13
+ import { httpFirstAvailableCheckoutByCustomerIdView } from "./httpFirstAvailableCheckoutByCustomerIdView";
14
+
15
+ const provider = new PactV3({
16
+ ...DEFAULT_PACT_OPTIONS,
17
+ consumer: "STY-BOX_CHECKOUT-FRONT",
18
+ provider: "STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId",
19
+ });
20
+
21
+ const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
22
+
23
+ const checkoutResponse: { result: CheckoutProjection } = {
24
+ result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
25
+ };
26
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
27
+ // @ts-ignore
28
+ const EXPECTED_BODY = MatchersV3.like(checkoutResponse);
29
+
30
+ describe("STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId API", () => {
31
+ it("returns a first available checkout for the given customer id", () => {
32
+ provider
33
+ .given("a first available checkout for the given customer id")
34
+ .uponReceiving("checkout projection")
35
+ .withRequest({
36
+ method: "POST",
37
+ path: "/api/view-first-available-checkout-by-customer-id",
38
+ headers: DEFAULT_REQUEST_HEADERS,
39
+ body: { customerId },
40
+ })
41
+ .willRespondWith({
42
+ status: 200,
43
+ headers: DEFAULT_RESPONSE_HEADERS,
44
+ body: EXPECTED_BODY,
45
+ });
46
+
47
+ return provider.executeTest(async (mockserver) => {
48
+ const httpPost = fetchHttpPost({
49
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
50
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
51
+ device: "web",
52
+ version: "1.0.0",
53
+ });
54
+
55
+ const response = await httpFirstAvailableCheckoutByCustomerIdView({ httpPost })({
56
+ customerId,
57
+ signal: undefined,
58
+ });
59
+
60
+ expect(response).toStrictEqual(checkoutResponse.result);
61
+ });
62
+ });
63
+ });