@lookiero/checkout 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/infrastructure/ui/i18n/i18n.d.ts +0 -7
  2. package/dist/infrastructure/ui/i18n/i18n.js +0 -7
  3. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +13 -29
  4. package/dist/infrastructure/ui/routing/Routing.js +0 -6
  5. package/dist/infrastructure/ui/routing/routes.d.ts +0 -1
  6. package/dist/infrastructure/ui/routing/routes.js +0 -1
  7. package/dist/infrastructure/ui/settings/UISettings.d.ts +0 -1
  8. package/dist/infrastructure/ui/settings/UISettings.js +0 -1
  9. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +3 -4
  10. package/dist/shared/ui/components/molecules/selectField/SelectField.d.ts +1 -0
  11. package/dist/shared/ui/components/molecules/selectField/SelectField.js +6 -4
  12. package/dist/shared/ui/components/molecules/selectField/SelectField.style.d.ts +7 -0
  13. package/dist/shared/ui/components/molecules/selectField/SelectField.style.js +8 -1
  14. package/package.json +1 -1
  15. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.d.ts +0 -10
  16. package/dist/infrastructure/domain/uiSetting/react/useIncrementIntroShownCount.js +0 -11
  17. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.d.ts +0 -6
  18. package/dist/infrastructure/projection/uiSetting/react/useShouldIntroBeShown.js +0 -7
  19. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.d.ts +0 -6
  20. package/dist/infrastructure/projection/uiSetting/react/useViewIntroShownCount.js +0 -9
  21. package/dist/infrastructure/ui/views/intro/Intro.d.ts +0 -6
  22. package/dist/infrastructure/ui/views/intro/Intro.js +0 -52
  23. package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +0 -52
  24. package/dist/infrastructure/ui/views/intro/Intro.style.js +0 -55
@@ -1,12 +1,5 @@
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",
10
3
  ITEM_SIZE = "item.size",
11
4
  ITEM_COLOR = "item.color",
12
5
  ITEM_UNIQUE = "item.unique",
@@ -1,13 +1,6 @@
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";
11
4
  I18nMessages["ITEM_SIZE"] = "item.size";
12
5
  I18nMessages["ITEM_COLOR"] = "item.color";
13
6
  I18nMessages["ITEM_UNIQUE"] = "item.unique";
@@ -6,13 +6,10 @@ 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";
10
9
  import { Routes } from "./routes";
11
10
  import { useBasePath } from "./useBasePath";
12
11
  const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner, null), children }) => {
13
12
  const basePath = useBasePath();
14
- const introShown = useRef(false);
15
- const [shouldIntroBeShown, shouldIntroBeShownStatus] = useShouldIntroBeShown();
16
13
  const navigatedToFirstItemWithoutCustomerDecision = useRef(false);
17
14
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
18
15
  const firstItemWithoutCustomerDecision = checkout?.items.find((item) => item.status === CheckoutItemStatus.INITIAL);
@@ -22,7 +19,6 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
22
19
  startCheckout();
23
20
  }
24
21
  }, [checkout?.id, startCheckout]);
25
- const introRouteMatch = useMatch(`${basePath}/${Routes.INTRO}`);
26
22
  const itemRouteMatch = useMatch(`${basePath}/${Routes.ITEM}`);
27
23
  const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
28
24
  const summaryRouteMatch = useMatch(`${basePath}/${Routes.SUMMARY}`);
@@ -32,8 +28,7 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
32
28
  const checkoutShown = useRef(false);
33
29
  checkoutShown.current = checkoutShown.current || (Boolean(checkoutRouteMatch) && !Boolean(checkoutPaymentRouteMatch));
34
30
  const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
35
- const dependenciesLoaded = dependenciesLoadedStatuses.includes(shouldIntroBeShownStatus) &&
36
- (dependenciesLoadedStatuses.includes(checkoutStatus) || checkout);
31
+ const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) || checkout;
37
32
  if (!dependenciesLoaded) {
38
33
  return loader;
39
34
  }
@@ -54,31 +49,20 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
54
49
  !(summaryRouteMatch || itemDetailRouteMatch || checkoutRouteMatch || checkoutPaymentRouteMatch)) {
55
50
  return React.createElement(Navigate, { to: `${basePath}/${Routes.SUMMARY}`, replace: true });
56
51
  }
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 });
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 });
64
57
  }
65
58
  }
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
- }
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 }));
82
66
  }
83
67
  return children;
84
68
  };
@@ -7,7 +7,6 @@ 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 })));
11
10
  const Item = lazy(() => import("../views/item/Item").then((module) => ({ default: module.Item })));
12
11
  const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
13
12
  const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
@@ -24,11 +23,6 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
24
23
  React.createElement(App, { customerId: customer?.customerId, menu: menu, tabBar: tabBar },
25
24
  React.createElement(Outlet, null))))))),
26
25
  children: [
27
- {
28
- path: Routes.INTRO,
29
- element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
30
- React.createElement(Intro, { customerId: customer?.customerId }))),
31
- },
32
26
  {
33
27
  path: Routes.ITEM,
34
28
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
@@ -1,6 +1,5 @@
1
1
  export declare enum Routes {
2
2
  HOME = "",
3
- INTRO = "intro",
4
3
  ITEM_DETAIL = "item/:id/detail",
5
4
  ITEM = "item/:id",
6
5
  SUMMARY = "summary",
@@ -1,7 +1,6 @@
1
1
  export var Routes;
2
2
  (function (Routes) {
3
3
  Routes["HOME"] = "";
4
- Routes["INTRO"] = "intro";
5
4
  Routes["ITEM_DETAIL"] = "item/:id/detail";
6
5
  Routes["ITEM"] = "item/:id";
7
6
  Routes["SUMMARY"] = "summary";
@@ -1,4 +1,3 @@
1
1
  declare enum UISettings {
2
- INTRO_SHOWN_COUNT = "INTRO_SHOWN_COUNT"
3
2
  }
4
3
  export { UISettings };
@@ -1,5 +1,4 @@
1
1
  var UISettings;
2
2
  (function (UISettings) {
3
- UISettings["INTRO_SHOWN_COUNT"] = "INTRO_SHOWN_COUNT";
4
3
  })(UISettings || (UISettings = {}));
5
4
  export { UISettings };
@@ -1,7 +1,7 @@
1
1
  import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
2
  import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
- import React, { useCallback, useMemo } from "react";
4
+ import React, { useMemo } from "react";
5
5
  import { View } from "react-native";
6
6
  import { size } from "../../../../../../projection/shared/size";
7
7
  import { Sticky } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
@@ -18,14 +18,13 @@ const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoadin
18
18
  value: productVariant.id,
19
19
  })), [country, productVariants]);
20
20
  const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === productVariantSelected.id, [sizeSelectorOptions, productVariantSelected.id]);
21
- const handleOnPressSizeSelector = useCallback(() => onSizeSelectorPress(), [onSizeSelectorPress]);
22
21
  return (React.createElement(Sticky, { onLayout: onLayout },
23
22
  React.createElement(Body, { style: { column: style.container } },
24
23
  React.createElement(Button, { busy: keepButtonLoading, onPress: onKeep }, keepButtonText),
25
24
  React.createElement(View, { style: style.row },
26
25
  !productVariantSelected.size.unique && (React.createElement(SelectField, { ...(disabledSizeSelector && {
27
- onPress: handleOnPressSizeSelector,
28
- }), disabled: sizeSelectorDisabled, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", testID: "size-selector", value: productVariantSelected.id, style: {
26
+ onPress: onSizeSelectorPress,
27
+ }), disabled: sizeSelectorDisabled, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", testID: "size-selector", title: sizeSelectorLabelText || "", value: productVariantSelected.id, style: {
29
28
  selectField: style.sizeSelector,
30
29
  inputField: { input: (disabledSizeSelector || sizeSelectorDisabled) && style.inputDisabled },
31
30
  }, onChange: onReplace })),
@@ -13,6 +13,7 @@ interface Option {
13
13
  readonly value: string;
14
14
  }
15
15
  interface SelectFieldBaseProps {
16
+ readonly title?: string;
16
17
  readonly placeholder: string;
17
18
  readonly value: string | undefined;
18
19
  readonly options: Option[];
@@ -6,7 +6,7 @@ import { Modal } from "../../layouts/modal/Modal";
6
6
  import { InputField } from "../inputField/InputField";
7
7
  import { style } from "./SelectField.style";
8
8
  const { colorGrayscaleS } = theme();
9
- const SelectField = ({ placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
9
+ const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
10
10
  const [modalVisible, setModalVisible] = useState(false);
11
11
  const handleOnPressSelectField = useCallback(() => setModalVisible(true), []);
12
12
  const handleOnModalClose = useCallback(() => setModalVisible(false), []);
@@ -19,8 +19,10 @@ const SelectField = ({ placeholder, value, options, style: customStyle, onChange
19
19
  React.createElement(TouchableHighlight, { style: customStyle?.selectField, underlayColor: colorGrayscaleS, onPress: handleOnPressSelectField, ...touchableRestProps },
20
20
  React.createElement(View, { pointerEvents: "none" },
21
21
  React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholder, style: customStyle?.inputField, value: selectedValue?.label }))),
22
- React.createElement(Modal, { visible: modalVisible, scroll: true, onClose: handleOnModalClose },
23
- React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] }, options.map(({ label, value }) => (React.createElement(TouchableHighlight, { key: value, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: () => handleOnPressOption(value) },
24
- React.createElement(Text, { level: 3, style: [style.optionText, customStyle?.optionText] }, label))))))));
22
+ React.createElement(Modal, { visible: modalVisible, scroll: true, showCloseButton: true, onClose: handleOnModalClose },
23
+ React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
24
+ title && (React.createElement(Text, { level: 2, style: style.modalTitle }, title)),
25
+ options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
26
+ React.createElement(Text, { level: 3, style: [style.optionText, value === optionValue && style.selectedOptionText, customStyle?.optionText] }, label))))))));
25
27
  };
26
28
  export { SelectField };
@@ -3,6 +3,10 @@ declare const style: {
3
3
  paddingBottom: number;
4
4
  paddingHorizontal: number;
5
5
  };
6
+ modalTitle: {
7
+ marginBottom: number;
8
+ textAlign: "center";
9
+ };
6
10
  option: {
7
11
  borderBottomColor: string;
8
12
  borderBottomWidth: number;
@@ -11,5 +15,8 @@ declare const style: {
11
15
  optionText: {
12
16
  lineHeight: number;
13
17
  };
18
+ selectedOptionText: {
19
+ color: string;
20
+ };
14
21
  };
15
22
  export { style };
@@ -1,11 +1,15 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
- const { borderSize, colorGrayscaleS, spaceM, spaceXL } = theme();
3
+ const { borderSize, colorGrayscaleS, colorGrayscaleM, spaceM, spaceL, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
5
  modalContent: {
6
6
  paddingBottom: spaceXL,
7
7
  paddingHorizontal: spaceXL,
8
8
  },
9
+ modalTitle: {
10
+ marginBottom: spaceL,
11
+ textAlign: "center",
12
+ },
9
13
  option: {
10
14
  borderBottomColor: colorGrayscaleS,
11
15
  borderBottomWidth: borderSize,
@@ -14,5 +18,8 @@ const style = StyleSheet.create({
14
18
  optionText: {
15
19
  lineHeight: 24,
16
20
  },
21
+ selectedOptionText: {
22
+ color: colorGrayscaleM,
23
+ },
17
24
  });
18
25
  export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,10 +0,0 @@
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 };
@@ -1,11 +0,0 @@
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 };
@@ -1,6 +0,0 @@
1
- import { QueryStatus } from "@lookiero/messaging-react";
2
- interface UseShouldIntroBeShownFunction {
3
- (): [boolean, QueryStatus];
4
- }
5
- declare const useShouldIntroBeShown: UseShouldIntroBeShownFunction;
6
- export { useShouldIntroBeShown };
@@ -1,7 +0,0 @@
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 };
@@ -1,6 +0,0 @@
1
- import { QueryStatus } from "@lookiero/messaging-react";
2
- interface UseViewIntroShownCountFunction {
3
- (): [number, QueryStatus];
4
- }
5
- declare const useViewIntroShownCount: UseViewIntroShownCountFunction;
6
- export { useViewIntroShownCount };
@@ -1,9 +0,0 @@
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 };
@@ -1,6 +0,0 @@
1
- import { FC } from "react";
2
- type IntroProps = {
3
- readonly customerId: string;
4
- };
5
- declare const Intro: FC<IntroProps>;
6
- export { Intro };
@@ -1,52 +0,0 @@
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 };
@@ -1,52 +0,0 @@
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 };
@@ -1,55 +0,0 @@
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 };