@lookiero/checkout 6.5.0 → 6.5.1-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 (35) hide show
  1. package/dist/public/public/assets/adaptive-icon.png +0 -0
  2. package/dist/public/public/assets/favicon.png +0 -0
  3. package/dist/public/public/assets/icon.png +0 -0
  4. package/dist/public/public/assets/splash.png +0 -0
  5. package/dist/public/public/images/not-found.png +0 -0
  6. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +21 -0
  7. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
  8. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +6 -0
  9. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +4 -0
  10. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +6 -0
  11. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +5 -0
  12. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
  13. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +19 -0
  14. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +3 -0
  15. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +18 -0
  16. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
  17. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +13 -0
  18. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +6 -0
  19. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +11 -0
  20. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
  21. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +11 -0
  22. package/dist/src/infrastructure/ui/views/feedback/Feedback.js +5 -2
  23. package/dist/src/infrastructure/ui/views/feedback/Feedback.style.d.ts +5 -4
  24. package/dist/src/infrastructure/ui/views/feedback/Feedback.style.js +7 -6
  25. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +1 -4
  26. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +13 -0
  27. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +9 -0
  28. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
  29. package/{src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.ts → dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js} +5 -8
  30. package/dist/src/version.d.ts +1 -1
  31. package/dist/src/version.js +1 -1
  32. package/package.json +1 -1
  33. package/src/infrastructure/ui/views/feedback/Feedback.style.ts +7 -6
  34. package/src/infrastructure/ui/views/feedback/Feedback.tsx +5 -3
  35. package/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.tsx +3 -7
@@ -0,0 +1,21 @@
1
+ import { FC, ReactNode, RefObject } from "react";
2
+ import { LayoutChangeEvent, ScrollView, StyleProp, ViewStyle } from "react-native";
3
+ interface LayoutStyle {
4
+ readonly safeAreaView: StyleProp<ViewStyle>;
5
+ readonly scrollView: StyleProp<ViewStyle>;
6
+ readonly header: StyleProp<ViewStyle>;
7
+ }
8
+ interface LayoutProps {
9
+ readonly children: ReactNode;
10
+ readonly header?: JSX.Element | null;
11
+ readonly footer?: JSX.Element | null;
12
+ readonly panel?: JSX.Element | null;
13
+ readonly stickyHeader?: boolean;
14
+ readonly stickyHeaderHiddenOnScroll?: boolean;
15
+ readonly scrollRef?: RefObject<ScrollView>;
16
+ readonly scrollEnabled?: boolean;
17
+ readonly style?: Partial<LayoutStyle>;
18
+ readonly onLayout?: (event: LayoutChangeEvent) => void;
19
+ }
20
+ type Layout = FC<LayoutProps>;
21
+ export type { Layout };
@@ -0,0 +1,6 @@
1
+ import { FC, ReactNode } from "react";
2
+ interface FooterProps {
3
+ readonly children: ReactNode;
4
+ }
5
+ declare const Footer: FC<FooterProps>;
6
+ export { Footer };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { Platform } from "react-native";
3
+ const Footer = ({ children }) => (Platform.OS !== "web" ? React.createElement(React.Fragment, null, children) : null);
4
+ export { Footer };
@@ -0,0 +1,6 @@
1
+ import { FC, ReactNode } from "react";
2
+ interface HeaderProps {
3
+ readonly children: ReactNode;
4
+ }
5
+ declare const Header: FC<HeaderProps>;
6
+ export { Header };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { style } from "./Header.style";
4
+ const Header = ({ children }) => React.createElement(View, { style: style.header }, children);
5
+ export { Header };
@@ -0,0 +1,4 @@
1
+ declare const style: {
2
+ header: {};
3
+ };
4
+ export { style };
@@ -0,0 +1,19 @@
1
+ import { Platform, StyleSheet } from "react-native";
2
+ import { HEADER_HEIGHT } from "../../../../templates/header/Header.style";
3
+ const style = StyleSheet.create({
4
+ header: {
5
+ ...Platform.select({
6
+ web: {
7
+ position: "sticky",
8
+ top: 0,
9
+ zIndex: 10,
10
+ height: HEADER_HEIGHT,
11
+ },
12
+ native: {
13
+ position: "relative",
14
+ height: HEADER_HEIGHT,
15
+ },
16
+ }),
17
+ },
18
+ });
19
+ export { style };
@@ -0,0 +1,3 @@
1
+ import { Layout } from "../Layout";
2
+ declare const DummyLayout: Layout;
3
+ export { DummyLayout };
@@ -0,0 +1,18 @@
1
+ /* eslint-disable react/prop-types */
2
+ import React from "react";
3
+ import { View } from "react-native";
4
+ import { GestureHandlerRootView, ScrollView as RNGHScrollView } from "react-native-gesture-handler";
5
+ import { SafeAreaView } from "react-native-safe-area-context";
6
+ import { Footer as DefaultFooter } from "../../../templates/footer/Footer";
7
+ import { DefaultHeader } from "../../../templates/header/defaultHeader/DefaultHeader";
8
+ import { Footer } from "../components/footer/Footer";
9
+ import { Header } from "../components/header/Header";
10
+ import { style } from "./DummyLayout.style";
11
+ const DummyLayout = ({ children, header = React.createElement(DefaultHeader, null), footer = React.createElement(DefaultFooter, null), panel, style: customStyle, scrollEnabled, onLayout, }) => (React.createElement(SafeAreaView, { style: [style.safeAreaView, customStyle?.safeAreaView] },
12
+ React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
13
+ React.createElement(RNGHScrollView, { contentContainerStyle: [style.scrollView, customStyle?.scrollView], scrollEnabled: scrollEnabled, scrollEventThrottle: 16, showsVerticalScrollIndicator: false, stickyHeaderIndices: [0] },
14
+ React.createElement(Header, null, header),
15
+ panel,
16
+ React.createElement(View, { style: style.children, onLayout: onLayout }, children))),
17
+ React.createElement(Footer, null, footer)));
18
+ export { DummyLayout };
@@ -0,0 +1,12 @@
1
+ declare const style: {
2
+ children: {
3
+ flex: number;
4
+ };
5
+ safeAreaView: {
6
+ flex: number;
7
+ };
8
+ scrollView: {
9
+ flexGrow: number;
10
+ };
11
+ };
12
+ export { style };
@@ -0,0 +1,13 @@
1
+ import { StyleSheet } from "react-native";
2
+ const style = StyleSheet.create({
3
+ children: {
4
+ flex: 1,
5
+ },
6
+ safeAreaView: {
7
+ flex: 1,
8
+ },
9
+ scrollView: {
10
+ flexGrow: 1,
11
+ },
12
+ });
13
+ export { style };
@@ -0,0 +1,6 @@
1
+ import { FC } from "react";
2
+ interface DefaultHeaderProps {
3
+ readonly onPressMenu?: () => void;
4
+ }
5
+ declare const DefaultHeader: FC<DefaultHeaderProps>;
6
+ export { DefaultHeader };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { ButtonIcon } from "@lookiero/aurora";
3
+ import { Header } from "../Header";
4
+ import { ButtonIconPlaceholder } from "../buttonIconPlaceholder/ButtonIconPlaceholder";
5
+ import { Logo } from "../logo/Logo";
6
+ import { style } from "./DefaultHeader.style";
7
+ const DefaultHeader = ({ onPressMenu }) => (React.createElement(Header, { testID: "default-header" },
8
+ React.createElement(Logo, null),
9
+ React.createElement(ButtonIconPlaceholder, null),
10
+ React.createElement(ButtonIcon, { name: "menu", style: style.button, testID: "menu-button-icon", onPress: onPressMenu })));
11
+ export { DefaultHeader };
@@ -0,0 +1,8 @@
1
+ declare const style: {
2
+ button: {
3
+ alignSelf: "auto";
4
+ height: number;
5
+ width: number;
6
+ };
7
+ };
8
+ export { style };
@@ -0,0 +1,11 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+ const { space10 } = theme();
4
+ const style = StyleSheet.create({
5
+ button: {
6
+ alignSelf: "auto",
7
+ height: space10,
8
+ width: space10,
9
+ },
10
+ });
11
+ export { style };
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useRef } from "react";
2
2
  import { Spinner } from "@lookiero/aurora";
3
3
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
4
4
  import { useLogger } from "@lookiero/sty-psp-logging";
5
+ import { useScreenSize } from "@lookiero/sty-psp-ui";
5
6
  import { CheckoutQuestionType } from "../../../../projection/checkoutQuestion/checkoutQuestion";
6
7
  import { useGiveCheckoutFeedback } from "../../../domain/checkoutFeedback/react/useGiveCheckoutFeedback";
7
8
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
@@ -17,6 +18,8 @@ import { style } from "./Feedback.style";
17
18
  import { CheckoutQuestionsForm } from "./components/checkoutQuestionsForm/CheckoutQuestionsForm";
18
19
  const Feedback = ({ layout: Layout }) => {
19
20
  const logger = useLogger();
21
+ const screenSize = useScreenSize();
22
+ const isDesktop = screenSize === "L";
20
23
  const { customer: { customerId, country, segment }, } = useStaticInfo();
21
24
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
22
25
  const [checkoutQuestions, checkoutQuestionsStatus] = useListCheckoutQuestionsByCheckoutId({
@@ -78,8 +81,8 @@ const Feedback = ({ layout: Layout }) => {
78
81
  if (!dependenciesLoaded)
79
82
  return React.createElement(Spinner, null);
80
83
  return (React.createElement(CheckoutQuestionFeedbackProvider, { feedback: {}, onChanged: handleOnChangedFeedback },
81
- React.createElement(Layout, { style: { scrollView: style.container } },
82
- React.createElement(Body, { style: { column: style.bodyColumn } },
84
+ React.createElement(Layout, null,
85
+ React.createElement(Body, { style: { row: [style.container, isDesktop && style.containerDesktop] } },
83
86
  React.createElement(CheckoutQuestionsForm, { checkoutQuestions: checkoutQuestions || [], submitButtonDisabled: giveCheckoutFeedbackStatus === CommandStatus.LOADING, onSubmit: handleOnSubmit })))));
84
87
  };
85
88
  export { Feedback };
@@ -1,10 +1,11 @@
1
1
  declare const style: {
2
- bodyColumn: {
3
- paddingBottom: number;
2
+ container: {
3
+ justifyContent: "flex-start";
4
4
  paddingHorizontal: number;
5
+ paddingVertical: number;
5
6
  };
6
- container: {
7
- paddingBottom: number;
7
+ containerDesktop: {
8
+ paddingHorizontal: number;
8
9
  };
9
10
  };
10
11
  export { style };
@@ -1,13 +1,14 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
- const { space8, space10 } = theme();
3
+ const { space3, space6, space8 } = theme();
4
4
  const style = StyleSheet.create({
5
- bodyColumn: {
6
- paddingBottom: space8,
7
- paddingHorizontal: space8,
8
- },
9
5
  container: {
10
- paddingBottom: space10,
6
+ justifyContent: "flex-start",
7
+ paddingHorizontal: space6,
8
+ paddingVertical: space8,
9
+ },
10
+ containerDesktop: {
11
+ paddingHorizontal: space3,
11
12
  },
12
13
  });
13
14
  export { style };
@@ -1,5 +1,4 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
- import { View } from "react-native";
3
2
  import { Button } from "@lookiero/aurora";
4
3
  import { useI18nMessage } from "@lookiero/i18n-react";
5
4
  import { CheckoutQuestionType, } from "../../../../../../projection/checkoutQuestion/checkoutQuestion";
@@ -12,7 +11,6 @@ import { HostSelectCheckoutQuestionItem } from "../../../../components/organisms
12
11
  import { IconCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem";
13
12
  import { TextareaCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem";
14
13
  import { I18nMessages } from "../../../../i18n/i18n";
15
- import { style } from "./CheckoutQuestionsForm.style";
16
14
  const checkoutQuestionItems = {
17
15
  [CheckoutQuestionType.HOST_DEFAULT]: HostDefaultCheckoutQuestionItem,
18
16
  [CheckoutQuestionType.HOST_TEXTAREA]: HostDefaultCheckoutQuestionItem,
@@ -33,7 +31,6 @@ const CheckoutQuestionsForm = ({ checkoutQuestions, submitButtonDisabled, onSubm
33
31
  return (React.createElement(React.Fragment, null,
34
32
  React.createElement(CheckoutQuestionItemProvider, { checkoutQuestionItems: checkoutQuestionItems },
35
33
  React.createElement(CheckoutQuestions, { checkoutQuestions: filteredCheckoutQuestions })),
36
- React.createElement(View, { style: style.buttonContainer },
37
- React.createElement(Button, { busy: submitButtonDisabled, testID: "checkout-feedback-button", onPress: handlePress }, buttonText))));
34
+ React.createElement(Button, { busy: submitButtonDisabled, testID: "checkout-feedback-button", onPress: handlePress }, buttonText)));
38
35
  };
39
36
  export { CheckoutQuestionsForm };
@@ -0,0 +1,13 @@
1
+ import { FC } from "react";
2
+ import { LayoutRectangle } from "react-native";
3
+ import { PricingProjection } from "../../../../../../projection/pricing/pricing";
4
+ interface StickyPricingProps {
5
+ readonly pricing: PricingProjection;
6
+ readonly totalCheckoutItemsKept: number;
7
+ readonly collapsed: boolean;
8
+ readonly onPress: () => void;
9
+ readonly onSubmit: () => void;
10
+ readonly onLayout?: ({ width, height }: LayoutRectangle) => void;
11
+ }
12
+ declare const StickyPricing: FC<StickyPricingProps>;
13
+ export { StickyPricing };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { Sticky } from "@lookiero/sty-psp-ui";
3
+ import { Body } from "../../../../components/layouts/body/Body";
4
+ import { Pricing } from "../pricing/Pricing";
5
+ import { style } from "./StickyPricing.style";
6
+ const StickyPricing = ({ pricing, totalCheckoutItemsKept, collapsed, onPress, onSubmit, onLayout, }) => (React.createElement(Sticky, { style: style.sticky, onLayout: onLayout },
7
+ React.createElement(Body, null,
8
+ React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsed: collapsed, discount: pricing.discount, discountPercentage: pricing.discountPercentage, pendingToPay: pricing.pendingToPay, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: totalCheckoutItemsKept, onPress: onPress, onSubmit: onSubmit }))));
9
+ export { StickyPricing };
@@ -0,0 +1,7 @@
1
+ declare const style: {
2
+ sticky: {
3
+ paddingBottom: number;
4
+ paddingTop: number;
5
+ };
6
+ };
7
+ export { style };
@@ -1,13 +1,10 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
-
4
- const { space6, space8 } = theme();
5
-
3
+ const { space3, space4 } = theme();
6
4
  const style = StyleSheet.create({
7
- buttonContainer: {
8
- paddingHorizontal: space6,
9
- paddingVertical: space8,
10
- },
5
+ sticky: {
6
+ paddingBottom: space4,
7
+ paddingTop: space3,
8
+ },
11
9
  });
12
-
13
10
  export { style };
@@ -1 +1 @@
1
- export declare const VERSION = "6.5.0";
1
+ export declare const VERSION = "6.5.1-beta.0";
@@ -1 +1 @@
1
- export const VERSION = "6.5.0";
1
+ export const VERSION = "6.5.1-beta.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "6.5.0",
3
+ "version": "6.5.1-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -1,15 +1,16 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
3
 
4
- const { space8, space10 } = theme();
4
+ const { space3, space6, space8 } = theme();
5
5
 
6
6
  const style = StyleSheet.create({
7
- bodyColumn: {
8
- paddingBottom: space8,
9
- paddingHorizontal: space8,
10
- },
11
7
  container: {
12
- paddingBottom: space10,
8
+ justifyContent: "flex-start",
9
+ paddingHorizontal: space6,
10
+ paddingVertical: space8,
11
+ },
12
+ containerDesktop: {
13
+ paddingHorizontal: space3,
13
14
  },
14
15
  });
15
16
 
@@ -2,7 +2,7 @@ import React, { FC, useCallback, useEffect, useRef } from "react";
2
2
  import { Spinner } from "@lookiero/aurora";
3
3
  import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
4
4
  import { useLogger } from "@lookiero/sty-psp-logging";
5
- import { Layout } from "@lookiero/sty-psp-ui";
5
+ import { Layout, useScreenSize } from "@lookiero/sty-psp-ui";
6
6
  import { CheckoutFeedbackProjection } from "../../../../projection/checkoutFeedback/checkoutFeedback";
7
7
  import { CheckoutQuestionType } from "../../../../projection/checkoutQuestion/checkoutQuestion";
8
8
  import { useGiveCheckoutFeedback } from "../../../domain/checkoutFeedback/react/useGiveCheckoutFeedback";
@@ -33,6 +33,8 @@ interface FeedbackProps {
33
33
 
34
34
  const Feedback: FC<FeedbackProps> = ({ layout: Layout }) => {
35
35
  const logger = useLogger();
36
+ const screenSize = useScreenSize();
37
+ const isDesktop = screenSize === "L";
36
38
  const {
37
39
  customer: { customerId, country, segment },
38
40
  } = useStaticInfo();
@@ -114,8 +116,8 @@ const Feedback: FC<FeedbackProps> = ({ layout: Layout }) => {
114
116
 
115
117
  return (
116
118
  <CheckoutQuestionFeedbackProvider feedback={{}} onChanged={handleOnChangedFeedback}>
117
- <Layout style={{ scrollView: style.container }}>
118
- <Body style={{ column: style.bodyColumn }}>
119
+ <Layout>
120
+ <Body style={{ row: [style.container, isDesktop && style.containerDesktop] }}>
119
121
  <CheckoutQuestionsForm
120
122
  checkoutQuestions={checkoutQuestions || []}
121
123
  submitButtonDisabled={giveCheckoutFeedbackStatus === CommandStatus.LOADING}
@@ -1,5 +1,4 @@
1
1
  import React, { FC, useCallback, useMemo } from "react";
2
- import { View } from "react-native";
3
2
  import { Button } from "@lookiero/aurora";
4
3
  import { useI18nMessage } from "@lookiero/i18n-react";
5
4
  import { CheckoutFeedbackProjection } from "../../../../../../projection/checkoutFeedback/checkoutFeedback";
@@ -19,7 +18,6 @@ import { HostSelectCheckoutQuestionItem } from "../../../../components/organisms
19
18
  import { IconCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem";
20
19
  import { TextareaCheckoutQuestionItem } from "../../../../components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem";
21
20
  import { I18nMessages } from "../../../../i18n/i18n";
22
- import { style } from "./CheckoutQuestionsForm.style";
23
21
 
24
22
  const checkoutQuestionItems: CheckoutQuestionItems = {
25
23
  [CheckoutQuestionType.HOST_DEFAULT]: HostDefaultCheckoutQuestionItem,
@@ -61,11 +59,9 @@ const CheckoutQuestionsForm: FC<CheckoutQuestionsFormProps> = ({
61
59
  <CheckoutQuestions checkoutQuestions={filteredCheckoutQuestions} />
62
60
  </CheckoutQuestionItemProvider>
63
61
 
64
- <View style={style.buttonContainer}>
65
- <Button busy={submitButtonDisabled} testID="checkout-feedback-button" onPress={handlePress}>
66
- {buttonText}
67
- </Button>
68
- </View>
62
+ <Button busy={submitButtonDisabled} testID="checkout-feedback-button" onPress={handlePress}>
63
+ {buttonText}
64
+ </Button>
69
65
  </>
70
66
  );
71
67
  };