@lookiero/checkout 9.2.0 → 9.4.0-beta.0

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 (123) hide show
  1. package/dist/pact.config.d.ts +21 -0
  2. package/dist/pact.config.js +16 -0
  3. package/dist/public/public/assets/adaptive-icon.png +0 -0
  4. package/dist/public/public/assets/favicon.png +0 -0
  5. package/dist/public/public/assets/icon.png +0 -0
  6. package/dist/public/public/assets/splash.png +0 -0
  7. package/dist/public/public/images/not-found.png +0 -0
  8. package/dist/src/ExpoRoot.js +2 -2
  9. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +1 -0
  10. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +55 -0
  11. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +1 -0
  12. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +116 -0
  13. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +1 -0
  14. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +56 -0
  15. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +1 -0
  16. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +51 -0
  17. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +1 -0
  18. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +51 -0
  19. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +1 -0
  20. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +51 -0
  21. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +13 -0
  22. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +19 -0
  23. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +1 -0
  24. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +56 -0
  25. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +1 -0
  26. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +57 -0
  27. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +1 -0
  28. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +55 -0
  29. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +1 -0
  30. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +120 -0
  31. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +1 -0
  32. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +55 -0
  33. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +1 -0
  34. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +55 -0
  35. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +22 -0
  36. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
  37. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +7 -0
  38. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +5 -0
  39. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +7 -0
  40. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +6 -0
  41. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
  42. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +20 -0
  43. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +4 -0
  44. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +43 -0
  45. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
  46. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +14 -0
  47. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +8 -6
  48. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +7 -0
  49. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +21 -0
  50. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
  51. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
  52. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +12 -0
  53. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +64 -0
  54. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +10 -0
  55. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +17 -0
  56. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +20 -0
  57. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +27 -0
  58. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +10 -0
  59. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +27 -0
  60. package/dist/src/infrastructure/ui/views/App.js +2 -2
  61. package/dist/src/infrastructure/ui/views/App.style.d.ts +6 -0
  62. package/dist/src/infrastructure/ui/views/App.style.js +8 -0
  63. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
  64. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +11 -0
  65. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +1 -1
  66. package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +1 -1
  67. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +12 -0
  68. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +64 -0
  69. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
  70. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +16 -0
  71. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +3 -2
  72. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +2 -2
  73. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +1 -1
  74. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +40 -0
  75. package/dist/src/infrastructure/ui/views/return/Return.style.js +44 -0
  76. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +9 -5
  77. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +14 -0
  78. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +28 -0
  79. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
  80. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +11 -0
  81. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +26 -0
  82. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +21 -0
  83. package/dist/src/projection/shared/country.d.ts +14 -0
  84. package/dist/src/projection/shared/country.js +15 -0
  85. package/dist/src/projection/shared/customer.d.ts +9 -0
  86. package/dist/src/projection/shared/customer.js +1 -0
  87. package/dist/src/projection/shared/locale.d.ts +12 -0
  88. package/dist/src/projection/shared/locale.js +13 -0
  89. package/dist/src/projection/shared/order.d.ts +6 -0
  90. package/dist/src/projection/shared/order.js +1 -0
  91. package/dist/src/projection/shared/price.d.ts +11 -0
  92. package/dist/src/projection/shared/price.js +1 -0
  93. package/dist/src/projection/shared/size.d.ts +21 -0
  94. package/dist/src/projection/shared/size.js +4 -0
  95. package/dist/src/projection/shared/subscription.d.ts +2 -0
  96. package/dist/src/projection/shared/subscription.js +1 -0
  97. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +11 -0
  98. package/dist/src/shared/ui/components/atoms/error/Error.js +6 -0
  99. package/dist/src/shared/ui/components/atoms/field/Field.js +15 -12
  100. package/dist/src/version.d.ts +1 -1
  101. package/dist/src/version.js +1 -1
  102. package/package.json +1 -2
  103. package/src/ExpoRoot.tsx +2 -2
  104. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.test.tsx +1 -1
  105. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +10 -8
  106. package/src/infrastructure/ui/views/App.tsx +2 -2
  107. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +1 -1
  108. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +26 -2
  109. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +1 -0
  110. package/src/infrastructure/ui/views/item/components/itemActions/__snapshots__/ItemActions.test.tsx.snap +375 -0
  111. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +20 -0
  112. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +14 -5
  113. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +26 -2
  114. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.test.tsx +2 -2
  115. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +1 -1
  116. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +26 -2
  117. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +60 -0
  118. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +17 -7
  119. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +16 -0
  120. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +15 -8
  121. package/src/shared/ui/components/atoms/field/Field.tsx +18 -18
  122. package/src/shared/ui/components/atoms/field/__snapshots__/Field.test.tsx.snap +36 -0
  123. package/src/shared/ui/components/molecules/inputField/__snapshots__/InputField.test.tsx.snap +18 -0
@@ -0,0 +1,20 @@
1
+ import { EndpointFunction } from "@lookiero/i18n";
2
+
3
+ interface TranslationEndpointFunctionArgs {
4
+ readonly translationsUrl: string;
5
+ readonly translationsApiKey: string;
6
+ }
7
+ interface TranslationEndpointFunction {
8
+ (args: TranslationEndpointFunctionArgs): EndpointFunction;
9
+ }
10
+ declare const translationEndpoint: TranslationEndpointFunction;
11
+ type Project = "user-area-front" | "inventory-catalog" | "checkout";
12
+ interface TranslationExternalEndpointFunctionArgs {
13
+ readonly translationsUrl: string;
14
+ readonly projects: [project: Project, filter?: string][];
15
+ }
16
+ interface TranslationExternalEndpointFunction {
17
+ (args: TranslationExternalEndpointFunctionArgs): EndpointFunction;
18
+ }
19
+ declare const translationExternalEndpoint: TranslationExternalEndpointFunction;
20
+ export { translationEndpoint, translationExternalEndpoint };
@@ -0,0 +1,27 @@
1
+ import { Country } from "../../../projection/shared/country";
2
+ import { Locale } from "../../../projection/shared/locale";
3
+
4
+ const translationEndpoint =
5
+ ({ translationsUrl, translationsApiKey }) =>
6
+ (locale) =>
7
+ `${translationsUrl}/${locale}?key=${translationsApiKey}&no-folding=true`;
8
+ const COUNTRY = {
9
+ [Locale.ES]: Country.ES,
10
+ [Locale.FR]: Country.FR,
11
+ [Locale.EN]: Country.GB,
12
+ [Locale.IT]: Country.IT,
13
+ [Locale.PT]: Country.PT,
14
+ [Locale.DE]: Country.DE,
15
+ [Locale.AT]: Country.AT,
16
+ [Locale.NL]: Country.NL,
17
+ [Locale.SE]: Country.SE,
18
+ };
19
+ const translationExternalEndpoint =
20
+ ({ translationsUrl, projects }) =>
21
+ (locale) => {
22
+ const projectsQueryParam = projects
23
+ .map(([project, filter]) => `projectFilter=${project}${filter ? `:${filter}` : ""}`)
24
+ .join("&");
25
+ return `${translationsUrl}/${locale}/${COUNTRY[locale]}?${projectsQueryParam}`;
26
+ };
27
+ export { translationEndpoint, translationExternalEndpoint };
@@ -0,0 +1,10 @@
1
+ import { FC } from "react";
2
+
3
+ interface CheckoutAccessibilityMiddlewareProps {
4
+ readonly customerId: string | undefined;
5
+ readonly onNotAccessible: () => void;
6
+ readonly loader?: JSX.Element;
7
+ readonly children: JSX.Element;
8
+ }
9
+ declare const CheckoutAccessibilityMiddleware: FC<CheckoutAccessibilityMiddlewareProps>;
10
+ export { CheckoutAccessibilityMiddleware };
@@ -0,0 +1,27 @@
1
+ import React, { useEffect, useRef } from "react";
2
+ import { Spinner } from "@lookiero/aurora";
3
+ import { QueryStatus } from "@lookiero/messaging-react";
4
+ import { useViewIsCheckoutAccessibleByCustomerId } from "../../projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId";
5
+
6
+ const CheckoutAccessibilityMiddleware = ({
7
+ customerId,
8
+ onNotAccessible,
9
+ loader = React.createElement(Spinner, null),
10
+ children,
11
+ }) => {
12
+ const [accessible, status] = useViewIsCheckoutAccessibleByCustomerId({ customerId });
13
+ const onNotAccessibleRef = useRef(onNotAccessible);
14
+ onNotAccessibleRef.current = onNotAccessible;
15
+ const notAccessible = accessible === false || status === QueryStatus.ERROR;
16
+ useEffect(() => {
17
+ if (notAccessible) {
18
+ onNotAccessibleRef.current();
19
+ }
20
+ }, [notAccessible]);
21
+ return accessible === undefined && [QueryStatus.IDLE, QueryStatus.LOADING].includes(status)
22
+ ? loader
23
+ : accessible
24
+ ? children
25
+ : null;
26
+ };
27
+ export { CheckoutAccessibilityMiddleware };
@@ -8,8 +8,8 @@ import { theme } from "@lookiero/sty-psp-ui";
8
8
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
9
9
  const { colorBgBase } = theme();
10
10
  const App = ({ children }) => (React.createElement(SafeAreaProvider, null,
11
- React.createElement(PortalProvider, null,
11
+ React.createElement(PortalProvider, { rootHostName: "Checkout" },
12
12
  React.createElement(StatusBar, { backgroundColor: colorBgBase, barStyle: "dark-content", translucent: true }),
13
- React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
13
+ React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID, portalHostName: "Checkout" }),
14
14
  React.createElement(AuroraPortalProvider, null, children))));
15
15
  export { App };
@@ -0,0 +1,6 @@
1
+ declare const style: {
2
+ container: {
3
+ flex: number;
4
+ };
5
+ };
6
+ export { style };
@@ -0,0 +1,8 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ const style = StyleSheet.create({
4
+ container: {
5
+ flex: 1,
6
+ },
7
+ });
8
+ export { style };
@@ -0,0 +1,7 @@
1
+ declare const style: {
2
+ buttonContainer: {
3
+ paddingHorizontal: number;
4
+ paddingVertical: number;
5
+ };
6
+ };
7
+ export { style };
@@ -0,0 +1,11 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space6, space8 } = theme();
5
+ const style = StyleSheet.create({
6
+ buttonContainer: {
7
+ paddingHorizontal: space6,
8
+ paddingVertical: space8,
9
+ },
10
+ });
11
+ export { style };
@@ -10,7 +10,7 @@ const GetOutOfCheckoutModal = ({ visible, onDismiss, onConfirm }) => {
10
10
  const descriptionText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_DESCRIPTION });
11
11
  const dismissButtonText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_DISMISS_BUTTON });
12
12
  const confirmButtonText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON });
13
- return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
13
+ return (React.createElement(Modal, { portalHostName: "Checkout", visible: visible, onClose: onDismiss },
14
14
  React.createElement(View, { style: style.modalContent },
15
15
  React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
16
16
  React.createElement(Text, { level: 3, style: style.description }, descriptionText),
@@ -34,6 +34,6 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onShowSi
34
34
  !currentProductVariant.size.unique && productVariants ? (React.createElement(Button, { style: style.sizeSelector, testID: "size-selector", variant: BUTTON_VARIANT.SECONDARY, small: true, onPress: handleOnPressSelectField }, changeSizeButtonText)) : null,
35
35
  React.createElement(Button, { style: style.returnButton, testID: "return-button", variant: BUTTON_VARIANT.SECONDARY, small: true, onPress: onReturn }, returnButtonText)),
36
36
  React.createElement(Button, { testID: "keep-button", small: true, onPress: onKeep }, keepButtonText)),
37
- React.createElement(SelectModal, { modalVisible: modalVisible, options: sizeSelectorOptions, testID: "select-field-modal", title: changeSizeButtonText, value: currentProductVariant.id, onChange: onReplace, onClose: handleOnModalClose })));
37
+ React.createElement(SelectModal, { modalVisible: modalVisible, options: sizeSelectorOptions, portalHostName: "Checkout", testID: "select-field-modal", title: changeSizeButtonText, value: currentProductVariant.id, onChange: onReplace, onClose: handleOnModalClose })));
38
38
  };
39
39
  export { ItemActions };
@@ -0,0 +1,12 @@
1
+ import { FC } from "react";
2
+ import { FeedbackProjection } from "../../../../../../projection/feedback/feedback";
3
+ import { ReturnQuestionProjection } from "../../../../../../projection/returnQuestion/returnQuestion";
4
+
5
+ interface ReturnQuestionsFormProps {
6
+ readonly visible: boolean;
7
+ readonly returnQuestions: ReturnQuestionProjection[];
8
+ readonly onSubmit: (feedback: FeedbackProjection) => void;
9
+ readonly onClose: () => void;
10
+ }
11
+ declare const ReturnQuestionsForm: FC<ReturnQuestionsFormProps>;
12
+ export { ReturnQuestionsForm };
@@ -0,0 +1,64 @@
1
+ import { PortalHost } from "@gorhom/portal";
2
+ import React, { useCallback } from "react";
3
+ import { View } from "react-native";
4
+ import { Button, Text } from "@lookiero/aurora";
5
+ import { useI18nMessage } from "@lookiero/i18n-react";
6
+ import { Modal } from "@lookiero/sty-psp-ui";
7
+ import { ReturnQuestionType } from "../../../../../../projection/returnQuestion/returnQuestion";
8
+ import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
9
+ import { useReturnQuestionFeedback } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
10
+ import { ReturnQuestionItemProvider } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionItem";
11
+ import { HostDefaultReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostDefaultReturnQuestionItem/HostDefaultReturnQuestionItem";
12
+ import { HostSelectReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem";
13
+ import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem";
14
+ import { OptionReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem";
15
+ import { TextareaReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
16
+ import { I18nMessages } from "../../../../i18n/i18n";
17
+ import { style } from "./ReturnQuestionsForm.style";
18
+
19
+ const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
20
+ const returnQuestionItems = {
21
+ [ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
22
+ [ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
23
+ [ReturnQuestionType.HOST_SELECT]: HostSelectReturnQuestionItem,
24
+ [ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
25
+ [ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
26
+ [ReturnQuestionType.OPTION]: OptionReturnQuestionItem,
27
+ };
28
+ const ReturnQuestionsForm = ({ returnQuestions, visible, onSubmit, onClose }) => {
29
+ const titleText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_TITLE });
30
+ const submitButtonText = useI18nMessage({ id: I18nMessages.RETURN_QUESTIONS_SUBMIT_BUTTON });
31
+ const feedback = useReturnQuestionFeedback();
32
+ const handleOnSubmit = useCallback(() => onSubmit(feedback), [feedback, onSubmit]);
33
+ return React.createElement(
34
+ ReturnQuestionItemProvider,
35
+ { returnQuestionItems: returnQuestionItems },
36
+ React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
37
+ React.createElement(
38
+ Modal,
39
+ {
40
+ portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME,
41
+ testID: "return-questions-form-modal",
42
+ visible: visible,
43
+ scroll: true,
44
+ showCloseButton: true,
45
+ onClose: onClose,
46
+ },
47
+ React.createElement(
48
+ View,
49
+ { style: style.modalContent },
50
+ React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
51
+ React.createElement(ReturnQuestions, {
52
+ portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME,
53
+ returnQuestions: returnQuestions,
54
+ }),
55
+ React.createElement(
56
+ Button,
57
+ { style: style.submit, testID: "return-questions-button", onPress: handleOnSubmit },
58
+ submitButtonText,
59
+ ),
60
+ ),
61
+ ),
62
+ );
63
+ };
64
+ export { ReturnQuestionsForm };
@@ -0,0 +1,12 @@
1
+ declare const style: {
2
+ modalContent: {
3
+ paddingHorizontal: number;
4
+ };
5
+ submit: {
6
+ marginTop: number;
7
+ };
8
+ title: {
9
+ marginBottom: number;
10
+ };
11
+ };
12
+ export { style };
@@ -0,0 +1,16 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space6, space8 } = theme();
5
+ const style = StyleSheet.create({
6
+ modalContent: {
7
+ paddingHorizontal: space6,
8
+ },
9
+ submit: {
10
+ marginTop: space8,
11
+ },
12
+ title: {
13
+ marginBottom: space6,
14
+ },
15
+ });
16
+ export { style };
@@ -14,10 +14,11 @@ interface SelectModalProps {
14
14
  readonly value: string | undefined;
15
15
  readonly options: Option[];
16
16
  readonly style?: Partial<SelectModalStyle>;
17
- readonly onChange?: (value: string) => void;
18
- readonly onClose?: () => void;
19
17
  readonly modalVisible: boolean;
20
18
  readonly testID?: string;
19
+ readonly portalHostName?: string;
20
+ readonly onChange?: (value: string) => void;
21
+ readonly onClose?: () => void;
21
22
  }
22
23
  declare const SelectModal: FC<SelectModalProps>;
23
24
  export type { Option };
@@ -4,12 +4,12 @@ import { COLOR, Text } from "@lookiero/aurora";
4
4
  import { Modal, theme } from "@lookiero/sty-psp-ui";
5
5
  import { style } from "./SelectModal.style";
6
6
  const { colorBgPrimaryLight } = theme();
7
- const SelectModal = ({ modalVisible, onChange = () => void 0, onClose = () => void 0, options, style: customStyle, testID, title, value, }) => {
7
+ const SelectModal = ({ modalVisible, options, style: customStyle, testID, title, value, portalHostName, onChange = () => void 0, onClose = () => void 0, }) => {
8
8
  const handleOnPressOption = useCallback((value) => {
9
9
  onChange(value);
10
10
  onClose();
11
11
  }, [onClose, onChange]);
12
- return (React.createElement(Modal, { testID: testID, visible: modalVisible, scroll: true, showCloseButton: true, onClose: onClose },
12
+ return (React.createElement(Modal, { portalHostName: portalHostName, testID: testID, visible: modalVisible, scroll: true, showCloseButton: true, onClose: onClose },
13
13
  React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
14
14
  title && (React.createElement(Text, { level: 3, style: style.modalTitle, heading: true }, title)),
15
15
  options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, accessibilityLabel: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], testID: optionValue, underlayColor: colorBgPrimaryLight, accessible: true, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
@@ -9,7 +9,7 @@ const SizeWithoutStockModal = ({ visible, onDismiss }) => {
9
9
  const titleText = useI18nMessage({ id: I18nMessages.SIZE_WITHOUT_STOCK_MODAL_TITLE });
10
10
  const descriptionText = useI18nMessage({ id: I18nMessages.SIZE_WITHOUT_STOCK_MODAL_DESCRIPTION });
11
11
  const buttonText = useI18nMessage({ id: I18nMessages.SIZE_WITHOUT_STOCK_MODAL_BUTTON });
12
- return (React.createElement(Modal, { visible: visible, showCloseButton: true, onClose: onDismiss },
12
+ return (React.createElement(Modal, { portalHostName: "Checkout", visible: visible, showCloseButton: true, onClose: onDismiss },
13
13
  React.createElement(View, { style: style.modalContent },
14
14
  React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
15
15
  React.createElement(Text, { level: 3, style: style.description }, descriptionText),
@@ -0,0 +1,40 @@
1
+ declare const style: {
2
+ description: {
3
+ color: string;
4
+ };
5
+ desktopInfo: {
6
+ borderTopLeftRadius: number;
7
+ borderTopRightRadius: number;
8
+ };
9
+ desktopLayoutSpacing: {
10
+ paddingVertical: number;
11
+ };
12
+ headerWrapper: {
13
+ display: "flex";
14
+ flexDirection: "column";
15
+ };
16
+ info: {
17
+ backgroundColor: string;
18
+ paddingBottom: number;
19
+ paddingHorizontal: number;
20
+ paddingTop: number;
21
+ };
22
+ layout: {
23
+ flex: number;
24
+ justifyContent: "center";
25
+ };
26
+ safeAreaView: {
27
+ backgroundColor: string;
28
+ flex: number;
29
+ };
30
+ scrollView: {
31
+ flex: number;
32
+ };
33
+ submit: {
34
+ backgroundColor: string;
35
+ borderBottomLeftRadius: number;
36
+ borderBottomRightRadius: number;
37
+ padding: number;
38
+ };
39
+ };
40
+ export { style };
@@ -0,0 +1,44 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { borderRadius5, colorBgPrimaryLight, colorBgBase, colorTextMedium, space4, space6, space8 } = theme();
5
+ const style = StyleSheet.create({
6
+ description: {
7
+ color: colorTextMedium,
8
+ },
9
+ desktopInfo: {
10
+ borderTopLeftRadius: borderRadius5,
11
+ borderTopRightRadius: borderRadius5,
12
+ },
13
+ desktopLayoutSpacing: {
14
+ paddingVertical: space8,
15
+ },
16
+ headerWrapper: {
17
+ display: "flex",
18
+ flexDirection: "column",
19
+ },
20
+ info: {
21
+ backgroundColor: colorBgBase,
22
+ paddingBottom: space4,
23
+ paddingHorizontal: space6,
24
+ paddingTop: space8,
25
+ },
26
+ layout: {
27
+ flex: 1,
28
+ justifyContent: "center",
29
+ },
30
+ safeAreaView: {
31
+ backgroundColor: colorBgPrimaryLight,
32
+ flex: 1,
33
+ },
34
+ scrollView: {
35
+ flex: 1,
36
+ },
37
+ submit: {
38
+ backgroundColor: colorBgBase,
39
+ borderBottomLeftRadius: borderRadius5,
40
+ borderBottomRightRadius: borderRadius5,
41
+ padding: space6,
42
+ },
43
+ });
44
+ export { style };
@@ -1,6 +1,6 @@
1
- import { animated, useSpring } from "@react-spring/native";
2
1
  import React from "react";
3
2
  import { Pressable, View } from "react-native";
3
+ import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
4
4
  import { Button, Icon, Text } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { Price } from "../../../../components/atoms/price/Price";
@@ -14,11 +14,15 @@ const CollapsiblePricing = ({ pricing, totalCheckoutItemsKept, collapsible = tru
14
14
  id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
15
15
  values: { items: totalCheckoutItemsKept.toString() },
16
16
  });
17
- const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
18
- const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
17
+ const collapsedOpacity = useSharedValue(collapsed ? 1 : 0);
18
+ collapsedOpacity.value = collapsed ? 1 : 0;
19
+ const collapsedAnimatedStyle = useAnimatedStyle(() => ({ opacity: withTiming(collapsedOpacity.value) }), [collapsedOpacity.value]);
20
+ const notCollapsedOpacity = useSharedValue(collapsed ? 0 : 1);
21
+ notCollapsedOpacity.value = collapsed ? 0 : 1;
22
+ const notCollapsedAnimatedStyle = useAnimatedStyle(() => ({ opacity: withTiming(notCollapsedOpacity.value) }), [notCollapsedOpacity.value]);
19
23
  return (React.createElement(React.Fragment, null,
20
24
  collapsible && (React.createElement(Pressable, { style: style.iconContainer, testID: "pricing-collapsed", onPress: onPress }, collapsed ? (React.createElement(Icon, { name: "arrow_up_small", testID: "arrow-up" })) : (React.createElement(Icon, { name: "arrow_down_small", testID: "arrow-down" })))),
21
- collapsed && collapsible ? (React.createElement(animated.View, { style: [style.collapsed, { opacity: collapsedStyle.opacitiy }] },
25
+ collapsed && collapsible ? (React.createElement(Animated.View, { key: "collapsed", style: [style.collapsed, collapsedAnimatedStyle] },
22
26
  React.createElement(View, { style: style.collapsedContent },
23
27
  React.createElement(Text, { level: 1, style: style.totalCollapsed, detail: true },
24
28
  totalText,
@@ -26,7 +30,7 @@ const CollapsiblePricing = ({ pricing, totalCheckoutItemsKept, collapsible = tru
26
30
  totalCheckoutItemsKeptText),
27
31
  React.createElement(Price, { price: pendingToPay, variant: "detail" })),
28
32
  React.createElement(View, { style: style.collapsedContent },
29
- React.createElement(Button, { testID: "submit-checkout-collpased-button", small: true, onPress: onSubmit }, submitButtonText)))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
33
+ React.createElement(Button, { testID: "submit-checkout-collpased-button", small: true, onPress: onSubmit }, submitButtonText)))) : (React.createElement(Animated.View, { key: "not-collapsed", style: notCollapsedAnimatedStyle },
30
34
  React.createElement(Pricing, { pricing: pricing, totalCheckoutItemsKept: totalCheckoutItemsKept }),
31
35
  React.createElement(Button, { testID: "submit-checkout-button", onPress: onSubmit }, submitButtonText)))));
32
36
  };
@@ -0,0 +1,14 @@
1
+ import { FC } from "react";
2
+ import { LayoutRectangle } from "react-native";
3
+ import { PricingProjection } from "../../../../../../projection/pricing/pricing";
4
+
5
+ interface StickyPricingProps {
6
+ readonly pricing: PricingProjection;
7
+ readonly totalCheckoutItemsKept: number;
8
+ readonly collapsed: boolean;
9
+ readonly onPress: () => void;
10
+ readonly onSubmit: () => void;
11
+ readonly onLayout?: ({ width, height }: LayoutRectangle) => void;
12
+ }
13
+ declare const StickyPricing: FC<StickyPricingProps>;
14
+ export { StickyPricing };
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { Sticky } from "@lookiero/sty-psp-ui";
3
+ import { Body } from "../../../../components/layouts/body/Body";
4
+ import { Pricing } from "../pricing/Pricing";
5
+ import { style } from "./StickyPricing.style";
6
+
7
+ const StickyPricing = ({ pricing, totalCheckoutItemsKept, collapsed, onPress, onSubmit, onLayout }) =>
8
+ React.createElement(
9
+ Sticky,
10
+ { style: style.sticky, onLayout: onLayout },
11
+ React.createElement(
12
+ Body,
13
+ null,
14
+ React.createElement(Pricing, {
15
+ balanceDiscount: pricing.balanceDiscount,
16
+ collapsed: collapsed,
17
+ discount: pricing.discount,
18
+ discountPercentage: pricing.discountPercentage,
19
+ pendingToPay: pricing.pendingToPay,
20
+ service: pricing.service,
21
+ subtotal: pricing.subtotal,
22
+ totalCheckoutItemsKept: totalCheckoutItemsKept,
23
+ onPress: onPress,
24
+ onSubmit: onSubmit,
25
+ }),
26
+ ),
27
+ );
28
+ export { StickyPricing };
@@ -0,0 +1,7 @@
1
+ declare const style: {
2
+ sticky: {
3
+ paddingBottom: number;
4
+ paddingTop: number;
5
+ };
6
+ };
7
+ export { style };
@@ -0,0 +1,11 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space3, space4 } = theme();
5
+ const style = StyleSheet.create({
6
+ sticky: {
7
+ paddingBottom: space4,
8
+ paddingTop: space3,
9
+ },
10
+ });
11
+ export { style };
@@ -0,0 +1,26 @@
1
+ import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
2
+
3
+ type IsCheckoutAccessibleByCustomerIdProjection = boolean;
4
+ declare const VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID = "view_is_checkout_accessible_by_customer_id";
5
+ interface ViewIsCheckoutAccessibleByCustomerIdPayload {
6
+ readonly customerId: string | undefined;
7
+ }
8
+ interface ViewIsCheckoutAccessibleByCustomerId
9
+ extends Query<typeof VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID>,
10
+ ViewIsCheckoutAccessibleByCustomerIdPayload {}
11
+ interface ViewIsCheckoutAccessibleByCustomerIdFunction {
12
+ (payload: ViewIsCheckoutAccessibleByCustomerIdPayload): ViewIsCheckoutAccessibleByCustomerId;
13
+ }
14
+ declare const viewIsCheckoutAccessibleByCustomerId: ViewIsCheckoutAccessibleByCustomerIdFunction;
15
+ interface ViewIsCheckoutAccessibleByCustomerIdHandlerFunctionArgs extends QueryHandlerFunctionArgs {}
16
+ declare const viewIsCheckoutAccessibleByCustomerIdHandler: QueryHandlerFunction<
17
+ ViewIsCheckoutAccessibleByCustomerId,
18
+ IsCheckoutAccessibleByCustomerIdProjection,
19
+ ViewIsCheckoutAccessibleByCustomerIdHandlerFunctionArgs
20
+ >;
21
+ export type { IsCheckoutAccessibleByCustomerIdProjection };
22
+ export {
23
+ VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID,
24
+ viewIsCheckoutAccessibleByCustomerId,
25
+ viewIsCheckoutAccessibleByCustomerIdHandler,
26
+ };
@@ -0,0 +1,21 @@
1
+ import { query } from "@lookiero/messaging";
2
+ import { viewFirstAvailableCheckoutByCustomerId } from "./viewFirstAvailableCheckoutByCustomerId";
3
+ import { viewIsCheckoutEnabledByCustomerId } from "./viewIsCheckoutEnabledByCustomerId";
4
+
5
+ const VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID = "view_is_checkout_accessible_by_customer_id";
6
+ const viewIsCheckoutAccessibleByCustomerId = (payload) => ({
7
+ ...query({ name: VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID }),
8
+ ...payload,
9
+ });
10
+ const isNonEmptyCustomerId = (customerId) => Boolean(customerId);
11
+ const viewIsCheckoutAccessibleByCustomerIdHandler =
12
+ ({ queryBus }) =>
13
+ async ({ customerId }) =>
14
+ isNonEmptyCustomerId(customerId) &&
15
+ Boolean(await queryBus(viewFirstAvailableCheckoutByCustomerId({ customerId }))) &&
16
+ Boolean(await queryBus(viewIsCheckoutEnabledByCustomerId({ customerId })));
17
+ export {
18
+ VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID,
19
+ viewIsCheckoutAccessibleByCustomerId,
20
+ viewIsCheckoutAccessibleByCustomerIdHandler,
21
+ };
@@ -0,0 +1,14 @@
1
+ declare enum Country {
2
+ ES = "ES",
3
+ FR = "FR",
4
+ GB = "GB",
5
+ BE = "BE",
6
+ LU = "LU",
7
+ IT = "IT",
8
+ PT = "PT",
9
+ DE = "DE",
10
+ AT = "AT",
11
+ NL = "NL",
12
+ SE = "SE",
13
+ }
14
+ export { Country };
@@ -0,0 +1,15 @@
1
+ var Country;
2
+ (function (Country) {
3
+ Country["ES"] = "ES";
4
+ Country["FR"] = "FR";
5
+ Country["GB"] = "GB";
6
+ Country["BE"] = "BE";
7
+ Country["LU"] = "LU";
8
+ Country["IT"] = "IT";
9
+ Country["PT"] = "PT";
10
+ Country["DE"] = "DE";
11
+ Country["AT"] = "AT";
12
+ Country["NL"] = "NL";
13
+ Country["SE"] = "SE";
14
+ })(Country || (Country = {}));
15
+ export { Country };
@@ -0,0 +1,9 @@
1
+ import { Country } from "@lookiero/sty-psp-locale";
2
+ import { Segment } from "@lookiero/sty-psp-segment";
3
+
4
+ interface Customer {
5
+ readonly customerId: string;
6
+ readonly country: Country;
7
+ readonly segment: Segment;
8
+ }
9
+ export type { Customer };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ declare enum Locale {
2
+ ES = "es",
3
+ FR = "fr",
4
+ EN = "en",
5
+ IT = "it",
6
+ PT = "pt",
7
+ DE = "de",
8
+ AT = "at",
9
+ NL = "nl",
10
+ SE = "sv",
11
+ }
12
+ export { Locale };
@@ -0,0 +1,13 @@
1
+ var Locale;
2
+ (function (Locale) {
3
+ Locale["ES"] = "es";
4
+ Locale["FR"] = "fr";
5
+ Locale["EN"] = "en";
6
+ Locale["IT"] = "it";
7
+ Locale["PT"] = "pt";
8
+ Locale["DE"] = "de";
9
+ Locale["AT"] = "at";
10
+ Locale["NL"] = "nl";
11
+ Locale["SE"] = "sv";
12
+ })(Locale || (Locale = {}));
13
+ export { Locale };
@@ -0,0 +1,6 @@
1
+ interface Order {
2
+ readonly orderNumber: number;
3
+ readonly isFirstOrder: boolean;
4
+ readonly coupon: string | null;
5
+ }
6
+ export type { Order };
@@ -0,0 +1 @@
1
+ export {};