@lookiero/checkout 8.14.0-beta.101 → 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 (88) hide show
  1. package/dist/src/infrastructure/ui/Root.d.ts +2 -0
  2. package/dist/src/infrastructure/ui/Root.js +2 -2
  3. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.d.ts +5 -0
  4. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -3
  5. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.d.ts +5 -0
  6. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.js +1 -1
  7. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +5 -0
  8. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
  9. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
  10. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
  11. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +1 -1
  12. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +2 -2
  13. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.d.ts +3 -1
  14. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -3
  15. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +4 -4
  16. package/dist/src/infrastructure/ui/routing/Routing.d.ts +7 -0
  17. package/dist/src/infrastructure/ui/routing/Routing.js +5 -5
  18. package/dist/src/infrastructure/ui/views/App.d.ts +8 -0
  19. package/dist/src/infrastructure/ui/views/App.js +8 -6
  20. package/dist/src/infrastructure/ui/views/item/Item.d.ts +5 -0
  21. package/dist/src/infrastructure/ui/views/item/Item.js +3 -3
  22. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.d.ts +2 -0
  23. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +2 -2
  24. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
  25. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
  26. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.d.ts +5 -1
  27. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -2
  28. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.d.ts +5 -0
  29. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
  30. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +3 -3
  31. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +2 -2
  32. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
  33. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
  34. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.d.ts +2 -0
  35. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +2 -2
  36. package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.d.ts +5 -0
  37. package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -2
  38. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.d.ts +5 -0
  39. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +2 -2
  40. package/dist/src/infrastructure/ui/views/return/Return.d.ts +5 -0
  41. package/dist/src/infrastructure/ui/views/return/Return.js +2 -2
  42. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +5 -0
  43. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +12 -14
  44. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +2 -6
  45. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -6
  46. package/dist/src/version.d.ts +1 -1
  47. package/dist/src/version.js +1 -1
  48. package/package.json +4 -3
  49. package/pact.config.ts +31 -0
  50. package/pact.publish.js +32 -0
  51. package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +62 -0
  52. package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +128 -0
  53. package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +63 -0
  54. package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +57 -0
  55. package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +57 -0
  56. package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +57 -0
  57. package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +63 -0
  58. package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +64 -0
  59. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +62 -0
  60. package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +136 -0
  61. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +62 -0
  62. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +62 -0
  63. package/src/infrastructure/ui/Root.tsx +4 -1
  64. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +14 -1
  65. package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.tsx +8 -1
  66. package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +6 -0
  67. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
  68. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +2 -1
  69. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +2 -0
  70. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +2 -0
  71. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +5 -2
  72. package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +3 -2
  73. package/src/infrastructure/ui/routing/Routing.tsx +13 -5
  74. package/src/infrastructure/ui/views/App.style.ts +9 -0
  75. package/src/infrastructure/ui/views/App.tsx +21 -11
  76. package/src/infrastructure/ui/views/item/Item.tsx +8 -2
  77. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
  78. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +9 -3
  79. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +8 -1
  80. package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +12 -3
  81. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
  82. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +6 -6
  83. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -3
  84. package/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.tsx +12 -2
  85. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +14 -4
  86. package/src/infrastructure/ui/views/return/Return.tsx +8 -1
  87. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +2 -6
  88. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +33 -38
@@ -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-aware-scroll-view";
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, { extraScrollHeight: 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.101";
1
+ export declare const VERSION = "8.14.0-beta.2";
@@ -1 +1 @@
1
- export const VERSION = "8.14.0-beta.101";
1
+ export const VERSION = "8.14.0-beta.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "8.14.0-beta.101",
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,7 +21,7 @@
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",
@@ -32,7 +32,6 @@
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-aware-scroll-view": "^0.9.5",
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
+ });
@@ -0,0 +1,57 @@
1
+ import { MatchersV3, PactV3 } from "@pact-foundation/pact";
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";
10
+ import { httpFiveItemsDiscountByCustomerIdView } from "./httpFiveItemsDiscountByCustomerIdView";
11
+
12
+ const provider = new PactV3({
13
+ ...DEFAULT_PACT_OPTIONS,
14
+ consumer: "STY-BOX_CHECKOUT-FRONT",
15
+ provider: "STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId",
16
+ });
17
+
18
+ const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
19
+ const fiveItemsDiscountResponse = 25;
20
+
21
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
+ // @ts-ignore
23
+ const EXPECTED_BODY = MatchersV3.number(fiveItemsDiscountResponse);
24
+
25
+ describe("STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId API", () => {
26
+ it("returns a five items discount for the given customer id", () => {
27
+ provider
28
+ .given("a five items discount for the given customer id")
29
+ .uponReceiving("five items discount")
30
+ .withRequest({
31
+ method: "GET",
32
+ path: `/api/view-five-items-discount-by-customer-id/${customerId}`,
33
+ headers: DEFAULT_REQUEST_HEADERS,
34
+ })
35
+ .willRespondWith({
36
+ status: 200,
37
+ headers: DEFAULT_RESPONSE_HEADERS,
38
+ body: EXPECTED_BODY,
39
+ });
40
+
41
+ return provider.executeTest(async (mockserver) => {
42
+ const httpGet = fetchHttpGet({
43
+ apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
44
+ getAuthToken: () => Promise.resolve(AUTH_TOKEN),
45
+ device: "web",
46
+ version: "1.0.0",
47
+ });
48
+
49
+ const response = await httpFiveItemsDiscountByCustomerIdView({ httpGet })({
50
+ customerId,
51
+ signal: undefined,
52
+ });
53
+
54
+ expect(response).toStrictEqual(fiveItemsDiscountResponse);
55
+ });
56
+ });
57
+ });