@lookiero/checkout 2.4.1 → 3.0.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 (107) hide show
  1. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.d.ts +6 -0
  2. package/dist/domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired.js +13 -0
  3. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +10 -0
  4. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +11 -0
  5. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +6 -0
  6. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +7 -0
  7. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +6 -0
  8. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +9 -0
  9. package/dist/infrastructure/ui/Root.d.ts +2 -1
  10. package/dist/infrastructure/ui/Root.js +2 -2
  11. package/dist/infrastructure/ui/components/layouts/layout/Layout.d.ts +11 -0
  12. package/dist/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
  13. package/dist/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +6 -0
  14. package/dist/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +4 -0
  15. package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +6 -0
  16. package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.js +5 -0
  17. package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +45 -0
  18. package/dist/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +31 -0
  19. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +3 -0
  20. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +15 -0
  21. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +6 -0
  22. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +7 -0
  23. package/dist/infrastructure/ui/components/templates/footer/Footer.d.ts +3 -0
  24. package/dist/infrastructure/ui/components/templates/footer/Footer.js +13 -0
  25. package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.d.ts +3 -0
  26. package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.js +5 -0
  27. package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.style.d.ts +9 -0
  28. package/dist/infrastructure/ui/components/templates/header/buttonIconPlaceholder/ButtonIconPlaceholder.style.js +12 -0
  29. package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.d.ts +6 -0
  30. package/dist/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +23 -0
  31. package/dist/infrastructure/ui/components/templates/header/header/Header.d.ts +3 -0
  32. package/dist/infrastructure/ui/components/templates/header/header/Header.js +10 -0
  33. package/dist/infrastructure/ui/components/templates/header/header/Header.style.d.ts +9 -0
  34. package/dist/infrastructure/ui/components/templates/header/header/Header.style.js +12 -0
  35. package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.d.ts +6 -0
  36. package/dist/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +20 -0
  37. package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.d.ts +26 -0
  38. package/dist/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.js +34 -0
  39. package/dist/infrastructure/ui/components/templates/header/logo/Logo.d.ts +7 -0
  40. package/dist/infrastructure/ui/components/templates/header/logo/Logo.js +11 -0
  41. package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.d.ts +7 -0
  42. package/dist/infrastructure/ui/components/templates/header/logo/Logo.style.js +8 -0
  43. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.d.ts +2 -0
  44. package/dist/infrastructure/ui/hooks/usePaymentInstrumentUpdateEvents.js +28 -0
  45. package/dist/infrastructure/ui/hooks/useToast.d.ts +11 -0
  46. package/dist/infrastructure/ui/hooks/useToast.js +49 -0
  47. package/dist/infrastructure/ui/routing/Routing.d.ts +2 -1
  48. package/dist/infrastructure/ui/routing/Routing.js +7 -7
  49. package/dist/infrastructure/ui/views/App.d.ts +0 -4
  50. package/dist/infrastructure/ui/views/App.js +2 -4
  51. package/dist/infrastructure/ui/views/checkout/Checkout.d.ts +2 -0
  52. package/dist/infrastructure/ui/views/checkout/Checkout.js +12 -6
  53. package/dist/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
  54. package/dist/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
  55. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.d.ts +7 -0
  56. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.js +25 -0
  57. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.d.ts +16 -0
  58. package/dist/infrastructure/ui/views/checkout/components/checkoutSuccessModal/CheckoutSuccessModal.style.js +19 -0
  59. package/dist/infrastructure/ui/views/feedback/Feedback.d.ts +2 -0
  60. package/dist/infrastructure/ui/views/feedback/Feedback.js +6 -6
  61. package/dist/infrastructure/ui/views/feedback/Feedback.style.d.ts +3 -0
  62. package/dist/infrastructure/ui/views/feedback/Feedback.style.js +4 -1
  63. package/dist/infrastructure/ui/views/intro/Intro.d.ts +6 -0
  64. package/dist/infrastructure/ui/views/intro/Intro.js +52 -0
  65. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +52 -0
  66. package/dist/infrastructure/ui/views/intro/Intro.style.js +55 -0
  67. package/dist/infrastructure/ui/views/item/Item.d.ts +2 -0
  68. package/dist/infrastructure/ui/views/item/Item.js +37 -4
  69. package/dist/infrastructure/ui/views/item/Item.style.d.ts +15 -0
  70. package/dist/infrastructure/ui/views/item/Item.style.js +18 -0
  71. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.d.ts +26 -0
  72. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.js +44 -0
  73. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.d.ts +45 -0
  74. package/dist/infrastructure/ui/views/item/components/productVariant/ProductVariant.style.js +53 -0
  75. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.d.ts +7 -0
  76. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.js +25 -0
  77. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.d.ts +16 -0
  78. package/dist/infrastructure/ui/views/item/components/sizeChangeModal/SizeChangeModal.style.js +19 -0
  79. package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -4
  80. package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.style.d.ts +3 -0
  81. package/dist/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.style.js +4 -1
  82. package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +5 -5
  83. package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.d.ts +6 -0
  84. package/dist/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.js +9 -0
  85. package/dist/infrastructure/ui/views/notFound/NotFound.d.ts +2 -0
  86. package/dist/infrastructure/ui/views/notFound/NotFound.js +9 -10
  87. package/dist/infrastructure/ui/views/notFound/NotFound.style.d.ts +1 -0
  88. package/dist/infrastructure/ui/views/notFound/NotFound.style.js +2 -1
  89. package/dist/infrastructure/ui/views/summary/Summary.d.ts +2 -0
  90. package/dist/infrastructure/ui/views/summary/Summary.js +11 -11
  91. package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +3 -0
  92. package/dist/infrastructure/ui/views/summary/Summary.style.js +4 -1
  93. package/dist/shared/notifications/domain/notification/command/createNotification.d.ts +17 -0
  94. package/dist/shared/notifications/domain/notification/command/createNotification.js +7 -0
  95. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.d.ts +21 -0
  96. package/dist/shared/notifications/infrastructure/domain/notification/react/useCreateNotification.js +22 -0
  97. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.d.ts +12 -0
  98. package/dist/shared/notifications/infrastructure/ui/components/NotificationItem.js +24 -0
  99. package/dist/shared/notifications/infrastructure/ui/components/Notifications.d.ts +9 -0
  100. package/dist/shared/notifications/infrastructure/ui/components/Notifications.js +20 -0
  101. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.d.ts +36 -0
  102. package/dist/shared/notifications/infrastructure/ui/components/Notifications.style.js +31 -0
  103. package/dist/shared/tracking/infrastructure/usePageView.d.ts +13 -0
  104. package/dist/shared/tracking/infrastructure/usePageView.js +27 -0
  105. package/dist/shared/ui/components/atoms/error/Error.style.d.ts +6 -0
  106. package/dist/shared/ui/components/atoms/error/Error.style.js +9 -0
  107. package/package.json +1 -1
@@ -0,0 +1,49 @@
1
+ import { Notification, useStack } from "@lookiero/aurora";
2
+ import { useIntl } from "@lookiero/i18n-react";
3
+ import { useCallback } from "react";
4
+ import { StyleSheet } from "react-native";
5
+ import { v4 as uuid } from "uuid";
6
+ import { theme } from "../theme/theme";
7
+ const { layoutXXS, elevationColor, elevationOffset, elevationOpacityM, elevationRadius } = theme();
8
+ const style = StyleSheet.create({
9
+ container: {
10
+ marginHorizontal: layoutXXS,
11
+ marginTop: layoutXXS,
12
+ shadowColor: elevationColor,
13
+ shadowOffset: elevationOffset,
14
+ shadowOpacity: elevationOpacityM,
15
+ shadowRadius: elevationRadius,
16
+ },
17
+ inAppContainer: {
18
+ top: 75,
19
+ },
20
+ });
21
+ const NOTIFICATION_DEFAULTS = {
22
+ motion: "top",
23
+ timeoutClose: 10000,
24
+ style: style.container,
25
+ };
26
+ const IN_APP_NOTIFICATION_DEFAULTS = {
27
+ ...NOTIFICATION_DEFAULTS,
28
+ style: [style.container, style.inAppContainer],
29
+ };
30
+ const iOSInAppBrowser = window.screen?.height > 667 && /FBIOS/.test(navigator.userAgent);
31
+ const getNotificationDefaults = () => (iOSInAppBrowser ? IN_APP_NOTIFICATION_DEFAULTS : NOTIFICATION_DEFAULTS);
32
+ const useToast = () => {
33
+ const Stack = useStack();
34
+ const intl = useIntl();
35
+ const translate = useCallback((message) => intl.formatMessage({ id: message, defaultMessage: message }), [intl]);
36
+ const showError = useCallback(({ message }) => Stack.alert(uuid(),
37
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
38
+ // @ts-ignore
39
+ Notification, { ...getNotificationDefaults(), text: translate(message) }), [Stack, translate]);
40
+ const showSuccess = useCallback(({ message }) => Stack.success(uuid(),
41
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
+ // @ts-ignore
43
+ Notification, { ...getNotificationDefaults(), text: translate(message) }), [Stack, translate]);
44
+ return {
45
+ showError,
46
+ showSuccess,
47
+ };
48
+ };
49
+ export { useToast };
@@ -2,14 +2,15 @@ import { I18n } from "@lookiero/i18n-react";
2
2
  import React from "react";
3
3
  import { useRoutes as reactRouterUseRoutes } from "react-router-native";
4
4
  import { Customer } from "../../../projection/shared/customer";
5
+ import { Layout } from "../components/layouts/layout/Layout";
5
6
  interface RoutingProps {
6
7
  readonly basePath?: string;
7
8
  readonly customer: Customer | undefined;
8
9
  readonly locale: string;
9
10
  readonly I18n: I18n;
11
+ readonly layout: Layout;
10
12
  readonly getAuthToken: () => Promise<string>;
11
13
  readonly onNotAccessible: () => void;
12
- readonly onOpenMenu: () => void;
13
14
  readonly onI18nError?: (err: Error) => void;
14
15
  readonly useRedirect: () => Record<string, string>;
15
16
  readonly useRoutes: typeof reactRouterUseRoutes;
@@ -11,7 +11,7 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
11
11
  const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
12
12
  const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
13
13
  const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
14
- const Routing = ({ basePath = "", customer, locale, I18n, getAuthToken, onI18nError, onNotAccessible, onOpenMenu, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
14
+ const Routing = ({ basePath = "", customer, locale, I18n, layout, getAuthToken, onI18nError, onNotAccessible, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
15
15
  return useRoutes([
16
16
  {
17
17
  path: "",
@@ -19,28 +19,28 @@ const Routing = ({ basePath = "", customer, locale, I18n, getAuthToken, onI18nEr
19
19
  React.createElement(CheckoutAccessibilityMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
20
20
  React.createElement(I18n, { loader: React.createElement(Spinner, null), locale: locale, onError: onI18nError },
21
21
  React.createElement(CheckoutMiddleware, { customerId: customer?.customerId, onNotAccessible: onNotAccessible },
22
- React.createElement(App, { country: customer?.country, customerId: customer?.customerId, onOpenMenu: onOpenMenu },
22
+ React.createElement(App, null,
23
23
  React.createElement(Outlet, null))))))),
24
24
  children: [
25
25
  {
26
26
  path: Routes.ITEM,
27
27
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
28
- React.createElement(Item, { country: customer?.country, customerId: customer?.customerId }))),
28
+ React.createElement(Item, { country: customer?.country, customerId: customer?.customerId, layout: layout }))),
29
29
  },
30
30
  {
31
31
  path: Routes.ITEM_DETAIL,
32
32
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
33
- React.createElement(Item, { country: customer?.country, customerId: customer?.customerId }))),
33
+ React.createElement(Item, { country: customer?.country, customerId: customer?.customerId, layout: layout }))),
34
34
  },
35
35
  {
36
36
  path: Routes.SUMMARY,
37
37
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
38
- React.createElement(Summary, { country: customer?.country, customerId: customer?.customerId }))),
38
+ React.createElement(Summary, { country: customer?.country, customerId: customer?.customerId, layout: layout }))),
39
39
  },
40
40
  {
41
41
  path: Routes.CHECKOUT,
42
42
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
43
- React.createElement(Checkout, { country: customer?.country, customerId: customer?.customerId, useRedirect: useRedirect },
43
+ React.createElement(Checkout, { country: customer?.country, customerId: customer?.customerId, layout: layout, useRedirect: useRedirect },
44
44
  React.createElement(Outlet, null)))),
45
45
  children: [
46
46
  {
@@ -52,7 +52,7 @@ const Routing = ({ basePath = "", customer, locale, I18n, getAuthToken, onI18nEr
52
52
  {
53
53
  path: Routes.FEEDBACK,
54
54
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
55
- React.createElement(Feedback, { country: customer?.country, customerId: customer?.customerId }))),
55
+ React.createElement(Feedback, { country: customer?.country, customerId: customer?.customerId, layout: layout }))),
56
56
  },
57
57
  {
58
58
  path: "*",
@@ -1,10 +1,6 @@
1
1
  import { FC } from "react";
2
- import { Country } from "../../../projection/shared/country";
3
2
  interface AppProps {
4
3
  readonly children: JSX.Element;
5
- readonly customerId: string;
6
- readonly country: Country;
7
- readonly onOpenMenu: () => void;
8
4
  }
9
5
  declare const App: FC<AppProps>;
10
6
  export { App };
@@ -6,12 +6,10 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
6
6
  import { Notifications } from "../../../shared/notifications/infrastructure/ui/views/Notifications";
7
7
  import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
8
8
  import { theme } from "../theme/theme";
9
- import { Navigation } from "./navigation/Navigation";
10
9
  const { colorBase } = theme();
11
- const App = ({ children, customerId, country, onOpenMenu }) => (React.createElement(SafeAreaProvider, null,
10
+ const App = ({ children }) => (React.createElement(SafeAreaProvider, null,
12
11
  React.createElement(PortalProvider, null,
13
12
  React.createElement(StatusBar, { backgroundColor: colorBase, barStyle: "dark-content", translucent: true }),
14
13
  React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
15
- React.createElement(Navigation, { country: country, customerId: customerId, onOpenMenu: onOpenMenu },
16
- React.createElement(AuroraPortalProvider, null, children)))));
14
+ React.createElement(AuroraPortalProvider, null, children))));
17
15
  export { App };
@@ -1,9 +1,11 @@
1
1
  import { FC, ReactNode } from "react";
2
2
  import { Country } from "../../../../projection/shared/country";
3
+ import { Layout } from "../../components/layouts/layout/Layout";
3
4
  interface CheckoutProps {
4
5
  readonly children?: ReactNode;
5
6
  readonly customerId: string;
6
7
  readonly country: Country;
8
+ readonly layout: Layout;
7
9
  readonly useRedirect: () => Record<string, string>;
8
10
  }
9
11
  declare const Checkout: FC<CheckoutProps>;
@@ -2,27 +2,27 @@ import { Text } from "@lookiero/aurora";
2
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
3
  import { QueryStatus } from "@lookiero/messaging-react";
4
4
  import React, { useCallback, useMemo } from "react";
5
- import { View } from "react-native";
5
+ import { ScrollView, View } from "react-native";
6
6
  import { useNavigate } from "react-router-native";
7
7
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
8
8
  import { useTrackPageView } from "../../../../shared/tracking/infrastructure/useTrackPageView";
9
+ import { useTrackPressBack } from "../../../../shared/tracking/infrastructure/useTrackPressBack";
9
10
  import { useTrackPressContinue } from "../../../../shared/tracking/infrastructure/useTrackPressContinue";
10
11
  import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
11
12
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
12
13
  import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
13
14
  import { TrackingPage } from "../../../tracking/tracking";
14
15
  import { Body } from "../../components/layouts/body/Body";
15
- import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
16
+ import { CheckoutHeader } from "../../components/templates/header/checkoutHeader/CheckoutHeader";
16
17
  import { I18nMessages } from "../../i18n/i18n";
17
18
  import { Routes } from "../../routing/routes";
18
19
  import { useBasePath } from "../../routing/useBasePath";
19
- import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
20
20
  import { ProductVariant } from "../shared/components/productVariant/ProductVariant";
21
21
  import { Pricing } from "../summary/components/pricing/Pricing";
22
22
  import { style } from "./Checkout.style";
23
23
  import { DeliveryBanner } from "./components/deliveryBanner/DeliveryBanner";
24
24
  import { PaymentInstrument } from "./components/paymentInstrument/PaymentInstrument";
25
- const Checkout = ({ children, customerId, country, useRedirect }) => {
25
+ const Checkout = ({ children, customerId, country, layout: Layout, useRedirect }) => {
26
26
  const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_TITLE });
27
27
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
28
28
  const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id });
@@ -44,13 +44,19 @@ const Checkout = ({ children, customerId, country, useRedirect }) => {
44
44
  }, [basePath, navigate, trackPressContinue]);
45
45
  const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
46
46
  const hasReplacedCheckoutItem = useMemo(() => checkout?.items.some((checkoutItem) => checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
47
+ const trackPressBack = useTrackPressBack();
48
+ const handleOnBack = useCallback(() => trackPressBack({
49
+ page: TrackingPage.CHECKOUT,
50
+ country,
51
+ checkoutId: checkout?.id,
52
+ }), [checkout?.id, country, trackPressBack]);
47
53
  const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
48
54
  const dependenciesLoaded = (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout) &&
49
55
  dependenciesLoadedStatuses.includes(pricingStatus);
50
56
  if (!dependenciesLoaded)
51
57
  return React.createElement(Spinner, null);
52
- return (React.createElement(React.Fragment, null,
53
- React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT },
58
+ return (React.createElement(Layout, { header: React.createElement(CheckoutHeader, { onBack: handleOnBack }) },
59
+ React.createElement(ScrollView, { contentContainerStyle: style.container, showsVerticalScrollIndicator: false },
54
60
  React.createElement(Body, { style: { column: style.bodyColumn } },
55
61
  hasReplacedCheckoutItem && (React.createElement(View, { style: style.deliveryBannerContainer },
56
62
  React.createElement(DeliveryBanner, null))),
@@ -5,6 +5,9 @@ declare const style: {
5
5
  checkoutItemKept: {
6
6
  paddingVertical: number;
7
7
  };
8
+ container: {
9
+ paddingBottom: number;
10
+ };
8
11
  deliveryBannerContainer: {
9
12
  marginBottom: number;
10
13
  };
@@ -8,6 +8,9 @@ const style = StyleSheet.create({
8
8
  checkoutItemKept: {
9
9
  paddingVertical: spaceM,
10
10
  },
11
+ container: {
12
+ paddingBottom: spaceXXL,
13
+ },
11
14
  deliveryBannerContainer: {
12
15
  marginBottom: spaceXXL,
13
16
  },
@@ -0,0 +1,7 @@
1
+ import { FC } from "react";
2
+ interface CheckoutSuccessModalProps {
3
+ readonly visible: boolean;
4
+ readonly onDismiss: () => void;
5
+ }
6
+ declare const CheckoutSuccessModal: FC<CheckoutSuccessModalProps>;
7
+ export { CheckoutSuccessModal };
@@ -0,0 +1,25 @@
1
+ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
3
+ import { useI18nMessage } from "@lookiero/i18n-react";
4
+ import React from "react";
5
+ import { View } from "react-native";
6
+ import { Modal } from "../../../../../../shared/ui/components/layouts/modal/Modal";
7
+ import { I18nMessages } from "../../../../i18n/i18n";
8
+ import { style } from "./CheckoutSuccessModal.style";
9
+ const CheckoutSuccessModal = ({ visible, onDismiss }) => {
10
+ const titleText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_TITLE });
11
+ const descriptionText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_DESCRIPTION });
12
+ const buttonText = useI18nMessage({ id: I18nMessages.CHECKOUT_SUCCESS_MODAL_BUTTON });
13
+ return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
14
+ React.createElement(View, { style: style.modal },
15
+ React.createElement(Text, { level: 1, style: style.modalTitle, body: true }, titleText),
16
+ React.createElement(Text, { level: 3, style: style.modalDescription, body: true }, descriptionText),
17
+ React.createElement(Button
18
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
19
+ // @ts-ignore
20
+ , {
21
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
+ // @ts-ignore
23
+ style: style.button, onPress: onDismiss }, buttonText))));
24
+ };
25
+ export { CheckoutSuccessModal };
@@ -0,0 +1,16 @@
1
+ declare const style: {
2
+ button: {
3
+ flex: number;
4
+ };
5
+ modal: {
6
+ padding: number;
7
+ };
8
+ modalDescription: {
9
+ marginVertical: number;
10
+ textAlign: "center";
11
+ };
12
+ modalTitle: {
13
+ textAlign: "center";
14
+ };
15
+ };
16
+ export { style };
@@ -0,0 +1,19 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../theme/theme";
3
+ const { spaceXL } = theme();
4
+ const style = StyleSheet.create({
5
+ button: {
6
+ flex: 0,
7
+ },
8
+ modal: {
9
+ padding: spaceXL,
10
+ },
11
+ modalDescription: {
12
+ marginVertical: spaceXL,
13
+ textAlign: "center",
14
+ },
15
+ modalTitle: {
16
+ textAlign: "center",
17
+ },
18
+ });
19
+ export { style };
@@ -1,8 +1,10 @@
1
1
  import { FC } from "react";
2
2
  import { Country } from "../../../../projection/shared/country";
3
+ import { Layout } from "../../components/layouts/layout/Layout";
3
4
  interface FeedbackProps {
4
5
  readonly customerId: string;
5
6
  readonly country: Country;
7
+ readonly layout: Layout;
6
8
  }
7
9
  declare const Feedback: FC<FeedbackProps>;
8
10
  export { Feedback };
@@ -1,5 +1,6 @@
1
1
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
2
2
  import React, { useCallback, useEffect, useRef } from "react";
3
+ import { ScrollView } from "react-native";
3
4
  import { CheckoutQuestionType } from "../../../../projection/checkoutQuestion/checkoutQuestion";
4
5
  import { useLogger } from "../../../../shared/logging/useLogger";
5
6
  import { useTrackChangeFeedback } from "../../../../shared/tracking/infrastructure/useTrackChangeFeedback";
@@ -12,11 +13,9 @@ import { useListCheckoutQuestionsByCheckoutId } from "../../../projection/checko
12
13
  import { TrackingPage } from "../../../tracking/tracking";
13
14
  import { Body } from "../../components/layouts/body/Body";
14
15
  import { CheckoutQuestionFeedbackProvider } from "../../components/organisms/checkoutQuestions/behaviors/useCheckoutQuestionFeedback";
15
- import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
16
- import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
17
16
  import { style } from "./Feedback.style";
18
17
  import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
19
- const Feedback = ({ customerId, country }) => {
18
+ const Feedback = ({ customerId, country, layout: Layout }) => {
20
19
  const logger = useLogger();
21
20
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
22
21
  const [checkoutQuestions, checkoutQuestionsStatus] = useListCheckoutQuestionsByCheckoutId({
@@ -75,8 +74,9 @@ const Feedback = ({ customerId, country }) => {
75
74
  if (!dependenciesLoaded)
76
75
  return React.createElement(Spinner, null);
77
76
  return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {}, onChanged: handleOnChangedFeedback },
78
- React.createElement(SafeAreaScrollView, { scrollerPaddingTop: HEADER_HEIGHT },
79
- React.createElement(Body, { style: { column: style.bodyColumn } },
80
- React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
77
+ React.createElement(Layout, null,
78
+ React.createElement(ScrollView, { contentContainerStyle: style.container, showsVerticalScrollIndicator: false },
79
+ React.createElement(Body, { style: { column: style.bodyColumn } },
80
+ React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit }))))));
81
81
  };
82
82
  export { Feedback };
@@ -2,5 +2,8 @@ declare const style: {
2
2
  bodyColumn: {
3
3
  paddingHorizontal: number;
4
4
  };
5
+ container: {
6
+ paddingBottom: number;
7
+ };
5
8
  };
6
9
  export { style };
@@ -1,9 +1,12 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../theme/theme";
3
- const { spaceXL } = theme();
3
+ const { spaceXL, spaceXXL } = theme();
4
4
  const style = StyleSheet.create({
5
5
  bodyColumn: {
6
6
  paddingHorizontal: spaceXL,
7
7
  },
8
+ container: {
9
+ paddingBottom: spaceXXL,
10
+ },
8
11
  });
9
12
  export { style };
@@ -0,0 +1,6 @@
1
+ import { FC } from "react";
2
+ type IntroProps = {
3
+ readonly customerId: string;
4
+ };
5
+ declare const Intro: FC<IntroProps>;
6
+ export { Intro };
@@ -0,0 +1,52 @@
1
+ import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
+ import { Icon } from "@lookiero/aurora-next/build/components/primitives/Icon/Icon";
3
+ import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
4
+ import { useI18nMessage } from "@lookiero/i18n-react";
5
+ import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
6
+ import React from "react";
7
+ import { Platform, View } from "react-native";
8
+ import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
9
+ import { useIncrementIntroShownCount } from "../../../domain/uiSetting/react/useIncrementIntroShownCount";
10
+ import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
11
+ import { Body } from "../../components/layouts/body/Body";
12
+ import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
13
+ import { I18nMessages } from "../../i18n/i18n";
14
+ import { HEADER_HEIGHT } from "../navigation/components/header/Header.style";
15
+ import { style } from "./Intro.style";
16
+ const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
17
+ React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
18
+ React.createElement(Text, { level: 2, detail: true }, text)));
19
+ const Intro = ({ customerId }) => {
20
+ const titleText = useI18nMessage({ id: I18nMessages.INTRO_TITLE });
21
+ const subTitleText = useI18nMessage({ id: I18nMessages.INTRO_SUBTITLE });
22
+ const discountText = useI18nMessage({ id: I18nMessages.INTRO_DISCOUNT });
23
+ const bulletOneText = useI18nMessage({ id: I18nMessages.INTRO_BULLET_ONE });
24
+ const bulletTwoText = useI18nMessage({ id: I18nMessages.INTRO_BULLET_TWO });
25
+ const bulletThreeText = useI18nMessage({ id: I18nMessages.INTRO_BULLET_THREE });
26
+ const buttonText = useI18nMessage({ id: I18nMessages.INTRO_BUTTON });
27
+ const [fiveItemsDiscount, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({
28
+ customerId,
29
+ });
30
+ const [incrementIntroShownCount, incrementIntroShownCountStatus] = useIncrementIntroShownCount();
31
+ if (fiveItemsDiscountStatus === QueryStatus.LOADING)
32
+ return React.createElement(Spinner, null);
33
+ return (React.createElement(SafeAreaScrollView, { scrollerPaddingTop: Platform.OS === "web" || Platform.OS === "android" ? HEADER_HEIGHT : 0 },
34
+ React.createElement(Body, { style: { column: style.bodyColumn } },
35
+ React.createElement(View, { style: style.intro },
36
+ React.createElement(View, { style: style.content },
37
+ React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
38
+ React.createElement(Text, { level: 3, style: style.subtitle, body: true }, subTitleText),
39
+ fiveItemsDiscount !== 0 && (React.createElement(View, { style: style.discountContainer },
40
+ React.createElement(View, { style: style.discount },
41
+ React.createElement(Text, { level: 2, heading: true },
42
+ "- ",
43
+ fiveItemsDiscount),
44
+ React.createElement(Text, { level: 3, style: style.percentage, heading: true }, "%")),
45
+ React.createElement(Text, { level: 3, body: true }, discountText))),
46
+ React.createElement(View, { style: style.description },
47
+ React.createElement(Bullet, { text: bulletOneText }),
48
+ React.createElement(Bullet, { text: bulletTwoText }),
49
+ React.createElement(Bullet, { text: bulletThreeText }))),
50
+ React.createElement(Button, { disabled: incrementIntroShownCountStatus === CommandStatus.LOADING, onPress: incrementIntroShownCount }, buttonText)))));
51
+ };
52
+ export { Intro };
@@ -0,0 +1,52 @@
1
+ declare const style: {
2
+ bodyColumn: {
3
+ paddingHorizontal: number;
4
+ };
5
+ bullet: {
6
+ alignItems: "center";
7
+ flexDirection: "row";
8
+ marginVertical: number;
9
+ };
10
+ content: {
11
+ alignItems: "center";
12
+ };
13
+ description: {
14
+ borderWidth: number;
15
+ marginBottom: number;
16
+ padding: number;
17
+ width: string;
18
+ };
19
+ discount: {
20
+ alignItems: "flex-end";
21
+ flexDirection: "row";
22
+ justifyContent: "center";
23
+ marginBottom: number;
24
+ };
25
+ discountContainer: {
26
+ alignItems: "center";
27
+ backgroundColor: string;
28
+ marginBottom: number;
29
+ padding: number;
30
+ textAlign: "center";
31
+ width: string;
32
+ };
33
+ intro: {
34
+ flex: number;
35
+ justifyContent: "space-between";
36
+ };
37
+ percentage: {
38
+ marginLeft: number;
39
+ };
40
+ subtitle: {
41
+ marginBottom: number;
42
+ textAlign: "center";
43
+ };
44
+ tickIcon: {
45
+ marginRight: number;
46
+ };
47
+ title: {
48
+ marginBottom: number;
49
+ textAlign: "center";
50
+ };
51
+ };
52
+ export { style };
@@ -0,0 +1,55 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../theme/theme";
3
+ const { borderSize, colorAccent, spaceXS, spaceS, spaceM, spaceL, spaceXL } = theme();
4
+ const style = StyleSheet.create({
5
+ bodyColumn: {
6
+ paddingHorizontal: spaceXL,
7
+ },
8
+ bullet: {
9
+ alignItems: "center",
10
+ flexDirection: "row",
11
+ marginVertical: spaceS,
12
+ },
13
+ content: {
14
+ alignItems: "center",
15
+ },
16
+ description: {
17
+ borderWidth: borderSize,
18
+ marginBottom: spaceXL,
19
+ padding: spaceM,
20
+ width: "100%",
21
+ },
22
+ discount: {
23
+ alignItems: "flex-end",
24
+ flexDirection: "row",
25
+ justifyContent: "center",
26
+ marginBottom: spaceS,
27
+ },
28
+ discountContainer: {
29
+ alignItems: "center",
30
+ backgroundColor: colorAccent,
31
+ marginBottom: spaceL,
32
+ padding: spaceM,
33
+ textAlign: "center",
34
+ width: "100%",
35
+ },
36
+ intro: {
37
+ flex: 1,
38
+ justifyContent: "space-between",
39
+ },
40
+ percentage: {
41
+ marginLeft: spaceXS,
42
+ },
43
+ subtitle: {
44
+ marginBottom: spaceXL,
45
+ textAlign: "center",
46
+ },
47
+ tickIcon: {
48
+ marginRight: spaceS,
49
+ },
50
+ title: {
51
+ marginBottom: spaceM,
52
+ textAlign: "center",
53
+ },
54
+ });
55
+ export { style };
@@ -1,8 +1,10 @@
1
1
  import { FC } from "react";
2
2
  import { Country } from "../../../../projection/shared/country";
3
+ import { Layout } from "../../components/layouts/layout/Layout";
3
4
  interface ItemProps {
4
5
  readonly customerId: string;
5
6
  readonly country: Country;
7
+ readonly layout: Layout;
6
8
  }
7
9
  declare const Item: FC<ItemProps>;
8
10
  export { Item };
@@ -1,9 +1,12 @@
1
1
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
2
2
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
- import { useParams } from "react-router-native";
3
+ import { useMatch, useParams } from "react-router-native";
4
4
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
5
5
  import { useLogger } from "../../../../shared/logging/useLogger";
6
6
  import { useTrackItemPageView } from "../../../../shared/tracking/infrastructure/useTrackItemPageView";
7
+ import { useTrackPressBack } from "../../../../shared/tracking/infrastructure/useTrackPressBack";
8
+ import { useTrackPressNext } from "../../../../shared/tracking/infrastructure/useTrackPressNext";
9
+ import { useTrackPressPrevious } from "../../../../shared/tracking/infrastructure/useTrackPressPrevious";
7
10
  import { useTrackReturnItem } from "../../../../shared/tracking/infrastructure/useTrackReturnItem";
8
11
  import { Spinner } from "../../../../shared/ui/components/atoms/spinner/Spinner";
9
12
  import { useBookCheckoutBookingForCheckoutItem } from "../../../domain/checkoutBooking/react/useBookCheckoutBookingForCheckoutItem";
@@ -14,10 +17,14 @@ import { useViewIsSizeChangeEnabledByCheckoutId } from "../../../projection/chec
14
17
  import { useListReturnQuestionsByCheckoutItemId } from "../../../projection/returnQuestion/react/useListReturnQuestionsByCheckoutItemId";
15
18
  import { TrackingPage } from "../../../tracking/tracking";
16
19
  import { ReturnQuestionFeedbackProvider } from "../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
20
+ import { ItemDetailHeader } from "../../components/templates/header/itemDetailHeader/ItemDetailHeader";
21
+ import { ItemHeader } from "../../components/templates/header/itemHeader/ItemHeader";
22
+ import { Routes } from "../../routing/routes";
23
+ import { useBasePath } from "../../routing/useBasePath";
17
24
  import { ReturnQuestionsForm } from "./components/returnQuestionsForm/ReturnQuestionsForm";
18
25
  import { ItemWithCustomerDecission, } from "./views/itemWithCustomerDecission/ItemWithCustomerDecission";
19
26
  import { ItemWithoutCustomerDecission, } from "./views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission";
20
- const Item = ({ customerId, country }) => {
27
+ const Item = ({ customerId, country, layout: Layout }) => {
21
28
  const logger = useLogger();
22
29
  const { id } = useParams();
23
30
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -90,6 +97,31 @@ const Item = ({ customerId, country }) => {
90
97
  replaceableFor,
91
98
  unique: checkoutItem.productVariant.size.unique,
92
99
  });
100
+ const trackPressNext = useTrackPressNext();
101
+ const handleOnNext = useCallback(({ from, to }) => trackPressNext({
102
+ page: TrackingPage.ITEM,
103
+ country,
104
+ checkoutId: checkout?.id,
105
+ from,
106
+ to,
107
+ }), [checkout?.id, country, trackPressNext]);
108
+ const trackPressPrevious = useTrackPressPrevious();
109
+ const handleOnPrevious = useCallback(({ from, to }) => trackPressPrevious({
110
+ page: TrackingPage.ITEM,
111
+ country,
112
+ checkoutId: checkout?.id,
113
+ from,
114
+ to,
115
+ }), [checkout?.id, country, trackPressPrevious]);
116
+ const trackPressBack = useTrackPressBack();
117
+ const handleOnBack = useCallback(() => trackPressBack({
118
+ page: TrackingPage.ITEM,
119
+ country,
120
+ checkoutId: checkout?.id,
121
+ }), [checkout?.id, country, trackPressBack]);
122
+ const basePath = useBasePath();
123
+ const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
124
+ const header = useMemo(() => itemDetailRouteMatch ? (React.createElement(ItemDetailHeader, { onBack: handleOnBack })) : (React.createElement(ItemHeader, { item: checkoutItem, items: checkout?.items, onNext: handleOnNext, onPrevious: handleOnPrevious })), [checkout?.items, checkoutItem, handleOnBack, handleOnNext, handleOnPrevious, itemDetailRouteMatch]);
93
125
  const dependenciesLoaded = checkoutStatus !== QueryStatus.LOADING &&
94
126
  checkout &&
95
127
  checkoutItem &&
@@ -103,7 +135,8 @@ const Item = ({ customerId, country }) => {
103
135
  return React.createElement(Spinner, null);
104
136
  }
105
137
  return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: checkoutItem.feedbacks || {} },
106
- checkoutItem.status === CheckoutItemStatus.INITIAL ? (React.createElement(ItemWithoutCustomerDecission, { bookedProductsVariants: bookedProductsVariants, checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, onReturn: showReturnQuestions })) : (React.createElement(ItemWithCustomerDecission, { checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, returnQuestions: returnQuestions, onEditFeedback: showReturnQuestions })),
107
- React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem })));
138
+ React.createElement(Layout, { header: header },
139
+ checkoutItem.status === CheckoutItemStatus.INITIAL ? (React.createElement(ItemWithoutCustomerDecission, { bookedProductsVariants: bookedProductsVariants, checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, onReturn: showReturnQuestions })) : (React.createElement(ItemWithCustomerDecission, { checkoutId: checkout.id, checkoutItem: checkoutItem, country: country, currentProductVariant: currentProductVariant, returnQuestions: returnQuestions, onEditFeedback: showReturnQuestions })),
140
+ React.createElement(ReturnQuestionsForm, { returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: hideReturnQuestions, onSubmit: returnItem }))));
108
141
  };
109
142
  export { Item };