@lookiero/checkout 0.7.1 → 0.8.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 (27) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +2 -2
  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/hooks/useSubmitCheckout.js +9 -16
  10. package/dist/infrastructure/ui/i18n/fetchTranslations.d.ts +9 -0
  11. package/dist/infrastructure/ui/i18n/fetchTranslations.js +9 -0
  12. package/dist/infrastructure/ui/i18n/i18n.d.ts +7 -0
  13. package/dist/infrastructure/ui/i18n/i18n.js +7 -0
  14. package/dist/infrastructure/ui/i18n/translationEndpoint.d.ts +10 -0
  15. package/dist/infrastructure/ui/i18n/translationEndpoint.js +2 -0
  16. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +29 -13
  17. package/dist/infrastructure/ui/routing/Routing.js +6 -0
  18. package/dist/infrastructure/ui/routing/routes.d.ts +1 -0
  19. package/dist/infrastructure/ui/routing/routes.js +1 -0
  20. package/dist/infrastructure/ui/settings/UISettings.d.ts +1 -0
  21. package/dist/infrastructure/ui/settings/UISettings.js +1 -0
  22. package/dist/infrastructure/ui/views/intro/Intro.d.ts +6 -0
  23. package/dist/infrastructure/ui/views/intro/Intro.js +52 -0
  24. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +52 -0
  25. package/dist/infrastructure/ui/views/intro/Intro.style.js +55 -0
  26. package/dist/projection/payment/paymentFlowPayload.d.ts +1 -1
  27. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -20,8 +20,8 @@ interface FirstAvailableCheckoutByCustomerIdFunction {
20
20
  interface BootstrapFunctionArgs {
21
21
  readonly getAuthToken: () => Promise<string>;
22
22
  readonly apiUrl: string;
23
- readonly translations: EndpointFunction;
24
23
  readonly sentry: SentryLoggerFunctionArgs;
24
+ readonly translations: EndpointFunction[];
25
25
  }
26
26
  interface BootstrapFunctionReturn {
27
27
  readonly Root: ComponentType<RootProps>;
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { fetchFetchTranslation } from "@lookiero/i18n";
2
1
  import { i18n } from "@lookiero/i18n-react";
3
2
  import { CheckoutStatus } from "./domain/checkout/model/checkout";
4
3
  import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
5
4
  import { root } from "./infrastructure/ui/Root";
5
+ import { fetchTranslations } from "./infrastructure/ui/i18n/fetchTranslations";
6
6
  import { viewFirstAvailableCheckoutByCustomerId } from "./projection/checkout/viewFirstAvailableCheckoutByCustomerId";
7
7
  import { viewIsCheckoutAccessibleByCustomerId, } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
8
8
  const bootstrap = ({ apiUrl, getAuthToken, translations, sentry }) => {
9
9
  const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
10
10
  const I18n = i18n({
11
- fetchTranslation: fetchFetchTranslation({ endpoint: translations }),
11
+ fetchTranslation: fetchTranslations({ translations }),
12
12
  contextId: "CheckoutI18n",
13
13
  });
14
14
  const Root = root({ Messaging, I18n, getAuthToken, sentry });
@@ -0,0 +1,10 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ interface IncrementIntroShownCountFunction {
3
+ (): Promise<void>;
4
+ }
5
+ type UseIncrementIntroShownCount = [incrementIntroShownCount: IncrementIntroShownCountFunction, status: CommandStatus];
6
+ interface UseIncrementIntroShownCountFunction {
7
+ (): UseIncrementIntroShownCount;
8
+ }
9
+ declare const useIncrementIntroShownCount: UseIncrementIntroShownCountFunction;
10
+ export { useIncrementIntroShownCount };
@@ -0,0 +1,11 @@
1
+ import { useCallback } from "react";
2
+ import { useViewIntroShownCount } from "../../../projection/uiSetting/react/useViewIntroShownCount";
3
+ import { UISettings } from "../../../ui/settings/UISettings";
4
+ import { useUpdateUiSetting } from "./useUpdateUiSetting";
5
+ const useIncrementIntroShownCount = () => {
6
+ const [update, status] = useUpdateUiSetting();
7
+ const [introShownCount] = useViewIntroShownCount();
8
+ const incrementIntroShownCount = useCallback(() => update({ key: UISettings.INTRO_SHOWN_COUNT, value: introShownCount + 1 }), [introShownCount, update]);
9
+ return [incrementIntroShownCount, status];
10
+ };
11
+ export { useIncrementIntroShownCount };
@@ -0,0 +1,6 @@
1
+ import { QueryStatus } from "@lookiero/messaging-react";
2
+ interface UseShouldIntroBeShownFunction {
3
+ (): [boolean, QueryStatus];
4
+ }
5
+ declare const useShouldIntroBeShown: UseShouldIntroBeShownFunction;
6
+ export { useShouldIntroBeShown };
@@ -0,0 +1,7 @@
1
+ import { useViewIntroShownCount } from "./useViewIntroShownCount";
2
+ const MAX_INTRO_SHOWN_COUNT = 2;
3
+ const useShouldIntroBeShown = () => {
4
+ const [introShownCount, introShownCountStatus] = useViewIntroShownCount();
5
+ return [introShownCount < MAX_INTRO_SHOWN_COUNT, introShownCountStatus];
6
+ };
7
+ export { useShouldIntroBeShown };
@@ -0,0 +1,6 @@
1
+ import { QueryStatus } from "@lookiero/messaging-react";
2
+ interface UseViewIntroShownCountFunction {
3
+ (): [number, QueryStatus];
4
+ }
5
+ declare const useViewIntroShownCount: UseViewIntroShownCountFunction;
6
+ export { useViewIntroShownCount };
@@ -0,0 +1,9 @@
1
+ import { UISettings } from "../../../ui/settings/UISettings";
2
+ import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
3
+ const useViewIntroShownCount = () => {
4
+ const [introShownCount, introShownCountStatus] = useViewUiSettingByKey({
5
+ key: UISettings.INTRO_SHOWN_COUNT,
6
+ });
7
+ return [introShownCount?.value || 0, introShownCountStatus];
8
+ };
9
+ export { useViewIntroShownCount };
@@ -20,29 +20,22 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
20
20
  paymentFlowRef.current?.startLegacyBoxCheckout(
21
21
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
22
  // @ts-ignore
23
- paymentFlowPayload, async ({ status }) => {
23
+ paymentFlowPayload, async ({ status, toaster }) => {
24
24
  setStartLegacyBoxCheckoutStatus("loading");
25
- if (status === ChargeStatus.REJECTED) {
26
- createNotification({
27
- level: NotificationLevel.ERROR,
28
- bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_REJECTED,
29
- });
30
- setStartLegacyBoxCheckoutStatus("error");
31
- }
32
- else if (status === ChargeStatus.ERROR) {
33
- createNotification({
34
- level: NotificationLevel.ERROR,
35
- bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
36
- });
37
- setStartLegacyBoxCheckoutStatus("error");
38
- }
39
- else if (status === ChargeStatus.EXECUTED) {
25
+ if (status === ChargeStatus.EXECUTED) {
40
26
  setStartLegacyBoxCheckoutStatus("success");
41
27
  try {
42
28
  await submitCheckoutCommand();
43
29
  }
44
30
  catch (error) { }
45
31
  }
32
+ else {
33
+ createNotification({
34
+ level: NotificationLevel.ERROR,
35
+ bodyI18nKey: toaster?.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
36
+ });
37
+ setStartLegacyBoxCheckoutStatus("error");
38
+ }
46
39
  });
47
40
  }, [blockCheckoutBooking, createNotification, submitCheckoutCommand, paymentFlowRef]);
48
41
  const status = useMemo(() => {
@@ -0,0 +1,9 @@
1
+ import { EndpointFunction, FetchTranslationFuction } from "@lookiero/i18n";
2
+ interface FetchTranslationsFuntionArgs {
3
+ readonly translations: EndpointFunction[];
4
+ }
5
+ interface FetchTranslationsFuntion {
6
+ (args: FetchTranslationsFuntionArgs): FetchTranslationFuction;
7
+ }
8
+ declare const fetchTranslations: FetchTranslationsFuntion;
9
+ export { fetchTranslations };
@@ -0,0 +1,9 @@
1
+ import { fetchFetchTranslation } from "@lookiero/i18n";
2
+ const fetchTranslations = ({ translations }) => async ({ locale }) => {
3
+ const translationsMessages = await Promise.all(translations.map((endpoint) => fetchFetchTranslation({ endpoint })({ locale })));
4
+ return translationsMessages.reduce((acc, translationMessages) => ({
5
+ ...acc,
6
+ ...translationMessages,
7
+ }), {});
8
+ };
9
+ export { fetchTranslations };
@@ -1,5 +1,12 @@
1
1
  declare const COLOR_I18N_PREFIX = "color.";
2
2
  declare enum I18nMessages {
3
+ INTRO_TITLE = "intro.title",
4
+ INTRO_SUBTITLE = "intro.subtitle",
5
+ INTRO_DISCOUNT = "intro.discount",
6
+ INTRO_BULLET_ONE = "intro.bullet_one",
7
+ INTRO_BULLET_TWO = "intro.bullet_two",
8
+ INTRO_BULLET_THREE = "intro.bullet_three",
9
+ INTRO_BUTTON = "intro.button",
3
10
  ITEM_SIZE = "item.size",
4
11
  ITEM_COLOR = "item.color",
5
12
  ITEM_UNIQUE = "item.unique",
@@ -1,6 +1,13 @@
1
1
  const COLOR_I18N_PREFIX = "color.";
2
2
  var I18nMessages;
3
3
  (function (I18nMessages) {
4
+ I18nMessages["INTRO_TITLE"] = "intro.title";
5
+ I18nMessages["INTRO_SUBTITLE"] = "intro.subtitle";
6
+ I18nMessages["INTRO_DISCOUNT"] = "intro.discount";
7
+ I18nMessages["INTRO_BULLET_ONE"] = "intro.bullet_one";
8
+ I18nMessages["INTRO_BULLET_TWO"] = "intro.bullet_two";
9
+ I18nMessages["INTRO_BULLET_THREE"] = "intro.bullet_three";
10
+ I18nMessages["INTRO_BUTTON"] = "intro.button";
4
11
  I18nMessages["ITEM_SIZE"] = "item.size";
5
12
  I18nMessages["ITEM_COLOR"] = "item.color";
6
13
  I18nMessages["ITEM_UNIQUE"] = "item.unique";
@@ -0,0 +1,10 @@
1
+ import { EndpointFunction } from "@lookiero/i18n";
2
+ interface TranslationEndpointFunctionArgs {
3
+ readonly translationsUrl: string;
4
+ readonly translationsApiKey: string;
5
+ }
6
+ interface TranslationEndpointFunction {
7
+ (args: TranslationEndpointFunctionArgs): EndpointFunction;
8
+ }
9
+ declare const translationEndpoint: TranslationEndpointFunction;
10
+ export { translationEndpoint };
@@ -0,0 +1,2 @@
1
+ const translationEndpoint = ({ translationsUrl, translationsApiKey }) => (locale) => `${translationsUrl}/${locale}?key=${translationsApiKey}&no-folding=true`;
2
+ export { translationEndpoint };
@@ -6,10 +6,13 @@ import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutI
6
6
  import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
7
7
  import { useStartCheckout } from "../../domain/checkout/react/useStartCheckout";
8
8
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
9
+ import { useShouldIntroBeShown } from "../../projection/uiSetting/react/useShouldIntroBeShown";
9
10
  import { Routes } from "./routes";
10
11
  import { useBasePath } from "./useBasePath";
11
12
  const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
12
13
  const basePath = useBasePath();
14
+ const introShown = useRef(false);
15
+ const [shouldIntroBeShown, shouldIntroBeShownStatus] = useShouldIntroBeShown();
13
16
  const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
14
17
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
15
18
  const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
@@ -19,6 +22,7 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
19
22
  startCheckout();
20
23
  }
21
24
  }, [checkout?.id, startCheckout]);
25
+ const introRouteMatch = useMatch(`${basePath}/${Routes.INTRO}`);
22
26
  const itemRouteMatch = useMatch(`${basePath}/${Routes.ITEM}`);
23
27
  const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
24
28
  const summaryRouteMatch = useMatch(`${basePath}/${Routes.SUMMARY}`);
@@ -28,7 +32,8 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
28
32
  const checkoutShown = useRef(false);
29
33
  checkoutShown.current = checkoutShown.current || (Boolean(checkoutRouteMatch) && !Boolean(checkoutPaymentRouteMatch));
30
34
  const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
31
- const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) || checkout;
35
+ const dependenciesLoaded = dependenciesLoadedStatuses.includes(shouldIntroBeShownStatus) &&
36
+ (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout);
32
37
  if (!dependenciesLoaded) {
33
38
  return loader;
34
39
  }
@@ -49,20 +54,31 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
49
54
  !(summaryRouteMatch || itemDetailRouteMatch || checkoutRouteMatch || checkoutPaymentRouteMatch)) {
50
55
  return React.createElement(Navigate, { to: `${basePath}/${Routes.SUMMARY}`, replace: true });
51
56
  }
52
- /* Item/ItemDetail 404 - Not found */
53
- if (itemRouteMatch || itemDetailRouteMatch) {
54
- const checkoutItem = checkout?.items.find((item) => item.id === itemRouteMatch?.params.id || itemDetailRouteMatch?.params.id);
55
- if (!checkoutItem) {
56
- return React.createElement(Navigate, { to: `${basePath}/${Routes.HOME}`, replace: true });
57
+ /* Navigate to the Intro if required */
58
+ if (shouldIntroBeShown && !introShown.current && firstItemWithoutCustomerDecision !== undefined) {
59
+ if (introRouteMatch) {
60
+ introShown.current = true;
61
+ }
62
+ else {
63
+ return React.createElement(Navigate, { to: `${basePath}/${Routes.INTRO}`, replace: true });
57
64
  }
58
65
  }
59
- /* Navigate to the first item without customer's decission */
60
- navigatedToFirstItemWithoutCustomerDecision.current =
61
- navigatedToFirstItemWithoutCustomerDecision.current ||
62
- Boolean(itemRouteMatch && itemRouteMatch.params.id === firstItemWithoutCustomerDecision?.id);
63
- if (firstItemWithoutCustomerDecision && !navigatedToFirstItemWithoutCustomerDecision.current) {
64
- navigatedToFirstItemWithoutCustomerDecision.current = true;
65
- return (React.createElement(Navigate, { to: generatePath(`${basePath}/${Routes.ITEM}`, { id: firstItemWithoutCustomerDecision.id }), replace: true }));
66
+ else {
67
+ /* Item/ItemDetail 404 - Not found */
68
+ if (itemRouteMatch || itemDetailRouteMatch) {
69
+ const checkoutItem = checkout?.items.find((item) => item.id === itemRouteMatch?.params.id || itemDetailRouteMatch?.params.id);
70
+ if (!checkoutItem) {
71
+ return React.createElement(Navigate, { to: `${basePath}/${Routes.HOME}`, replace: true });
72
+ }
73
+ }
74
+ /* Navigate to the first item without customer's decission */
75
+ navigatedToFirstItemWithoutCustomerDecision.current =
76
+ navigatedToFirstItemWithoutCustomerDecision.current ||
77
+ Boolean(itemRouteMatch && itemRouteMatch.params.id === firstItemWithoutCustomerDecision?.id);
78
+ if (firstItemWithoutCustomerDecision && !navigatedToFirstItemWithoutCustomerDecision.current) {
79
+ navigatedToFirstItemWithoutCustomerDecision.current = true;
80
+ return (React.createElement(Navigate, { to: generatePath(`${basePath}/${Routes.ITEM}`, { id: firstItemWithoutCustomerDecision.id }), replace: true }));
81
+ }
66
82
  }
67
83
  return children;
68
84
  };
@@ -7,6 +7,7 @@ import { CheckoutAccessibilityMiddleware } from "./CheckoutAccessibilityMiddlewa
7
7
  import { CheckoutMiddleware } from "./CheckoutMiddleware";
8
8
  import { Routes } from "./routes";
9
9
  import { BasePathProvider } from "./useBasePath";
10
+ const Intro = lazy(() => import("../views/intro/Intro").then((module) => ({ default: module.Intro })));
10
11
  const Item = lazy(() => import("../views/item/Item").then((module) => ({ default: module.Item })));
11
12
  const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
12
13
  const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
@@ -23,6 +24,11 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
23
24
  React.createElement(App, { customerId: customer?.customerId, menu: menu, tabBar: tabBar },
24
25
  React.createElement(Outlet, null))))))),
25
26
  children: [
27
+ {
28
+ path: Routes.INTRO,
29
+ element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
30
+ React.createElement(Intro, { customerId: customer?.customerId }))),
31
+ },
26
32
  {
27
33
  path: Routes.ITEM,
28
34
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
@@ -1,5 +1,6 @@
1
1
  export declare enum Routes {
2
2
  HOME = "",
3
+ INTRO = "intro",
3
4
  ITEM_DETAIL = "item/:id/detail",
4
5
  ITEM = "item/:id",
5
6
  SUMMARY = "summary",
@@ -1,6 +1,7 @@
1
1
  export var Routes;
2
2
  (function (Routes) {
3
3
  Routes["HOME"] = "";
4
+ Routes["INTRO"] = "intro";
4
5
  Routes["ITEM_DETAIL"] = "item/:id/detail";
5
6
  Routes["ITEM"] = "item/:id";
6
7
  Routes["SUMMARY"] = "summary";
@@ -1,3 +1,4 @@
1
1
  declare enum UISettings {
2
+ INTRO_SHOWN_COUNT = "INTRO_SHOWN_COUNT"
2
3
  }
3
4
  export { UISettings };
@@ -1,4 +1,5 @@
1
1
  var UISettings;
2
2
  (function (UISettings) {
3
+ UISettings["INTRO_SHOWN_COUNT"] = "INTRO_SHOWN_COUNT";
3
4
  })(UISettings || (UISettings = {}));
4
5
  export { UISettings };
@@ -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 };
@@ -29,7 +29,7 @@ interface PaymentFlowPayloadReplacedItem extends PaymentFlowPayloadItem {
29
29
  interface PaymentFlowPayloadKeptItem extends PaymentFlowPayloadItem {
30
30
  }
31
31
  interface PaymentFlowPayloadProjection {
32
- readonly bookingId: string;
32
+ readonly bookingId: string | undefined;
33
33
  readonly orderId: string;
34
34
  readonly comment: string;
35
35
  readonly items: (PaymentFlowPayloadKeptItem | PaymentFlowPayloadReplacedItem | PaymentFlowPayloadReturnedItem)[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.7.1",
3
+ "version": "0.8.0-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [