@lookiero/checkout 6.3.0 → 6.5.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/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/ExpoRoot.js +1 -1
  7. package/dist/src/infrastructure/ui/Root.d.ts +1 -1
  8. package/dist/src/infrastructure/ui/components/templates/header/Header.js +3 -6
  9. package/dist/src/infrastructure/ui/components/templates/header/Header.style.d.ts +3 -2
  10. package/dist/src/infrastructure/ui/components/templates/header/Header.style.js +4 -3
  11. package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +6 -7
  12. package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.style.d.ts +2 -1
  13. package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.style.js +2 -1
  14. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +2 -1
  15. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
  16. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +11 -0
  17. package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -1
  18. package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.style.d.ts +8 -0
  19. package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.style.js +11 -0
  20. package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.style.d.ts +1 -0
  21. package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.style.js +1 -0
  22. package/dist/src/infrastructure/ui/routing/Routing.d.ts +1 -1
  23. package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +1 -1
  24. package/dist/src/infrastructure/ui/views/checkout/Checkout.js +10 -9
  25. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +5 -18
  26. package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +7 -21
  27. package/dist/src/infrastructure/ui/views/feedback/Feedback.d.ts +1 -1
  28. package/dist/src/infrastructure/ui/views/feedback/Feedback.js +2 -1
  29. package/dist/src/infrastructure/ui/views/feedback/Feedback.style.d.ts +0 -3
  30. package/dist/src/infrastructure/ui/views/feedback/Feedback.style.js +0 -4
  31. package/dist/src/infrastructure/ui/views/item/Item.d.ts +1 -1
  32. package/dist/src/infrastructure/ui/views/item/Item.js +4 -4
  33. package/dist/src/infrastructure/ui/views/item/Item.style.d.ts +4 -4
  34. package/dist/src/infrastructure/ui/views/item/Item.style.js +5 -6
  35. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +3 -4
  36. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.d.ts +1 -0
  37. package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.js +1 -0
  38. package/dist/src/infrastructure/ui/views/return/Return.d.ts +1 -1
  39. package/dist/src/infrastructure/ui/views/return/Return.js +0 -1
  40. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -3
  41. package/dist/src/infrastructure/ui/views/return/Return.style.js +1 -5
  42. package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.style.js +2 -2
  43. package/dist/src/infrastructure/ui/views/summary/Summary.d.ts +1 -1
  44. package/dist/src/infrastructure/ui/views/summary/Summary.js +21 -18
  45. package/dist/src/infrastructure/ui/views/summary/Summary.style.d.ts +4 -4
  46. package/dist/src/infrastructure/ui/views/summary/Summary.style.js +7 -8
  47. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.d.ts +13 -0
  48. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +33 -0
  49. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.style.d.ts +18 -0
  50. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.style.js +21 -0
  51. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.d.ts +2 -13
  52. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +15 -29
  53. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +0 -15
  54. package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +1 -16
  55. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +6 -2
  56. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +10 -1
  57. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +13 -4
  58. package/dist/src/version.d.ts +1 -1
  59. package/dist/src/version.js +1 -1
  60. package/package.json +1 -1
  61. package/src/ExpoRoot.tsx +1 -1
  62. package/src/infrastructure/ui/Root.tsx +1 -1
  63. package/src/infrastructure/ui/components/templates/header/Header.style.ts +4 -3
  64. package/src/infrastructure/ui/components/templates/header/Header.tsx +7 -11
  65. package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.style.ts +2 -1
  66. package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.tsx +10 -11
  67. package/src/infrastructure/ui/{views/summary/components/stickyPricing/StickyPricing.style.ts → components/templates/header/defaultHeader/DefaultHeader.style.ts} +5 -4
  68. package/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.tsx +2 -1
  69. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.style.ts +14 -0
  70. package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx +2 -1
  71. package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.style.ts +1 -0
  72. package/src/infrastructure/ui/routing/Routing.tsx +1 -1
  73. package/src/infrastructure/ui/views/checkout/Checkout.style.ts +7 -21
  74. package/src/infrastructure/ui/views/checkout/Checkout.test.tsx +2 -2
  75. package/src/infrastructure/ui/views/checkout/Checkout.tsx +14 -21
  76. package/src/infrastructure/ui/views/feedback/Feedback.style.ts +0 -4
  77. package/src/infrastructure/ui/views/feedback/Feedback.tsx +3 -2
  78. package/src/infrastructure/ui/views/item/Item.style.ts +5 -6
  79. package/src/infrastructure/ui/views/item/Item.tsx +21 -21
  80. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.ts +1 -0
  81. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +11 -13
  82. package/src/infrastructure/ui/views/return/Return.style.ts +1 -5
  83. package/src/infrastructure/ui/views/return/Return.tsx +1 -2
  84. package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.style.ts +2 -1
  85. package/src/infrastructure/ui/views/summary/Summary.style.ts +8 -7
  86. package/src/infrastructure/ui/views/summary/Summary.tsx +53 -53
  87. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.style.ts +24 -0
  88. package/src/infrastructure/ui/views/summary/components/{pricing/Pricing.test.tsx → collapsiblePricing/CollapsiblePricing.test.tsx} +3 -7
  89. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +81 -0
  90. package/src/infrastructure/ui/views/summary/components/pricing/Pricing.style.ts +1 -16
  91. package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +34 -93
  92. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.style.ts +13 -4
  93. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +6 -2
  94. package/src/infrastructure/ui/components/layouts/layout/Layout.ts +0 -25
  95. package/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.test.tsx +0 -40
  96. package/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.tsx +0 -9
  97. package/src/infrastructure/ui/components/layouts/layout/components/footer/__snapshots__/Footer.test.tsx.snap +0 -36
  98. package/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.ts +0 -21
  99. package/src/infrastructure/ui/components/layouts/layout/components/header/Header.test.tsx +0 -26
  100. package/src/infrastructure/ui/components/layouts/layout/components/header/Header.tsx +0 -10
  101. package/src/infrastructure/ui/components/layouts/layout/components/header/__snapshots__/Header.test.tsx.snap +0 -45
  102. package/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.ts +0 -15
  103. package/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.test.tsx +0 -66
  104. package/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.tsx +0 -45
  105. package/src/infrastructure/ui/components/layouts/layout/dummyLayout/__snapshots__/DummyLayout.test.tsx.snap +0 -1349
  106. package/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.tsx +0 -43
  107. /package/src/infrastructure/ui/views/summary/components/{pricing → collapsiblePricing}/__snapshots__/Pricing.test.tsx.snap +0 -0
@@ -1,9 +1,10 @@
1
1
  import React, { FC, ReactNode, useCallback, useEffect, useMemo, useState } from "react";
2
- import { LayoutRectangle, Platform, ScrollView, View } from "react-native";
2
+ import { LayoutRectangle, Platform, View } from "react-native";
3
3
  import { generatePath, useMatch, useNavigate } from "react-router-native";
4
4
  import { Box, Text, Layout, useDevice, Spinner } from "@lookiero/aurora";
5
5
  import { useI18nMessage } from "@lookiero/i18n-react";
6
6
  import { QueryStatus } from "@lookiero/messaging-react";
7
+ import { Layout as LocalLayout, Sticky } from "@lookiero/sty-psp-ui";
7
8
  import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
8
9
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
9
10
  import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
@@ -13,14 +14,14 @@ import { useTrackPageView } from "../../../tracking/useTrackPageView";
13
14
  import { useTrackPressContinue } from "../../../tracking/useTrackPressContinue";
14
15
  import { useTrackPressPricing } from "../../../tracking/useTrackPressPricing";
15
16
  import { FiveItemsDiscountBanner } from "../../components/atoms/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
16
- import { Layout as LocalLayout } from "../../components/layouts/layout/Layout";
17
+ import { Body } from "../../components/layouts/body/Body";
18
+ import { DefaultHeader } from "../../components/templates/header/defaultHeader/DefaultHeader";
17
19
  import { useStaticInfo } from "../../hooks/useStaticInfo";
18
20
  import { I18nMessages } from "../../i18n/i18n";
19
21
  import { Routes } from "../../routing/routes";
20
22
  import { useBasePath } from "../../routing/useBasePath";
21
23
  import { style } from "./Summary.style";
22
- import { Pricing } from "./components/pricing/Pricing";
23
- import { StickyPricing } from "./components/stickyPricing/StickyPricing";
24
+ import { CollapsiblePricing } from "./components/collapsiblePricing/CollapsiblePricing";
24
25
 
25
26
  interface SummaryProps {
26
27
  readonly layout: LocalLayout;
@@ -35,6 +36,7 @@ const Summary: FC<SummaryProps> = ({ layout: LocalLayout, children }) => {
35
36
  const [pricingHeight, setPricingHeight] = useState(0);
36
37
  const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
37
38
  const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
39
+ const submitButtonText = useI18nMessage({ id: I18nMessages.SUMMARY_SUBMIT_BUTTON });
38
40
  const { screen } = useDevice();
39
41
 
40
42
  const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
@@ -110,62 +112,60 @@ const Summary: FC<SummaryProps> = ({ layout: LocalLayout, children }) => {
110
112
 
111
113
  return (
112
114
  <LocalLayout
113
- scrollEnabled={false}
115
+ header={<DefaultHeader />}
114
116
  style={{
115
- header: style.header,
116
117
  scrollView: style.scrollView,
117
118
  }}
118
119
  >
119
- <ScrollView showsVerticalScrollIndicator={false}>
120
- {fiveItemsDiscount !== 0 && <FiveItemsDiscountBanner fiveItemsDiscount={fiveItemsDiscount} />}
121
-
122
- <Layout
123
- fullWidth={!screen.L}
124
- style={[screen.L ? style.desktopLayoutSpacing : undefined, { paddingBottom: pricingHeight }]}
125
- >
126
- <Box size={{ L: "2/3" }} style={screen.L ? style.desktopListSpacing : undefined}>
127
- <View style={[style.contentWrapper, screen.L ? style.desktopContentWrapper : undefined]}>
128
- <View style={!screen.L ? style.mobileInfo : undefined}>
129
- <Text level={3} style={style.title} heading>
130
- {titleText}
131
- </Text>
132
- <Text level={3} style={style.description}>
133
- {descriptionText}
134
- </Text>
135
- </View>
136
-
137
- {children}
120
+ {fiveItemsDiscount !== 0 && <FiveItemsDiscountBanner fiveItemsDiscount={fiveItemsDiscount} />}
121
+
122
+ <Layout
123
+ fullWidth={!screen.L}
124
+ style={[screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }]}
125
+ >
126
+ <Box size={{ L: "2/3" }} style={screen.L && style.desktopListSpacing}>
127
+ <View style={[style.contentWrapper, screen.L && style.desktopContentWrapper]}>
128
+ <View style={!screen.L && style.mobileInfo}>
129
+ <Text level={3} style={style.title} heading>
130
+ {titleText}
131
+ </Text>
132
+ <Text level={3} style={style.description}>
133
+ {descriptionText}
134
+ </Text>
135
+ </View>
136
+
137
+ {children}
138
+ </View>
139
+ </Box>
140
+ {pricing && screen.L ? (
141
+ <Box size={{ L: "1/3" }} style={[style.resume, screen.L ? style.desktopResume : style.mobileResume]}>
142
+ <View style={style.princingWrapper}>
143
+ <CollapsiblePricing
144
+ collapsed={false}
145
+ collapsible={false}
146
+ pricing={pricing}
147
+ submitButtonText={submitButtonText}
148
+ totalCheckoutItemsKept={totalCheckoutItemsKept}
149
+ onSubmit={handleOnSubmit}
150
+ />
138
151
  </View>
139
152
  </Box>
140
- {pricing && screen.L ? (
141
- <Box size={{ L: "1/3" }} style={[style.resume, screen.L ? style.desktopResume : style.mobileResume]}>
142
- <View style={style.princingWrapper}>
143
- <Pricing
144
- balanceDiscount={pricing.balanceDiscount}
145
- collapsed={false}
146
- collapsible={false}
147
- discount={pricing.discount}
148
- discountPercentage={pricing.discountPercentage}
149
- pendingToPay={pricing.pendingToPay}
150
- service={pricing.service}
151
- subtotal={pricing.subtotal}
152
- totalCheckoutItemsKept={totalCheckoutItemsKept}
153
- onSubmit={handleOnSubmit}
154
- />
155
- </View>
156
- </Box>
157
- ) : null}
158
- </Layout>
159
- </ScrollView>
153
+ ) : null}
154
+ </Layout>
155
+
160
156
  {pricing && !screen.L ? (
161
- <StickyPricing
162
- collapsed={pricingCollapsed}
163
- pricing={pricing}
164
- totalCheckoutItemsKept={totalCheckoutItemsKept}
165
- onLayout={Platform.OS !== "web" ? handleOnPricingLayout : undefined}
166
- onPress={handleOnPressPricing}
167
- onSubmit={handleOnSubmit}
168
- />
157
+ <Sticky style={style.sticky} onLayout={Platform.OS !== "web" ? handleOnPricingLayout : undefined}>
158
+ <Body>
159
+ <CollapsiblePricing
160
+ collapsed={pricingCollapsed}
161
+ pricing={pricing}
162
+ submitButtonText={submitButtonText}
163
+ totalCheckoutItemsKept={totalCheckoutItemsKept}
164
+ onPress={handleOnPressPricing}
165
+ onSubmit={handleOnSubmit}
166
+ />
167
+ </Body>
168
+ </Sticky>
169
169
  ) : null}
170
170
  </LocalLayout>
171
171
  );
@@ -0,0 +1,24 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space1, space3 } = theme();
5
+
6
+ const style = StyleSheet.create({
7
+ collapsed: {
8
+ flexDirection: "row",
9
+ justifyContent: "space-between",
10
+ },
11
+ collapsedContent: {
12
+ flex: 1,
13
+ marginBottom: space1,
14
+ },
15
+ iconContainer: {
16
+ alignItems: "center",
17
+ marginBottom: space3,
18
+ },
19
+ totalCollapsed: {
20
+ marginBottom: space1,
21
+ },
22
+ });
23
+
24
+ export { style };
@@ -4,7 +4,7 @@ import { PricingProjection } from "../../../../../../projection/pricing/pricing"
4
4
  import { pricing as pricingFunction } from "../../../../../projection/pricing/pricing.mock";
5
5
  import { I18nMessages } from "../../../../i18n/i18n";
6
6
  import { render } from "../../../../test/render";
7
- import { Pricing } from "./Pricing";
7
+ import { Pricing } from "./CollapsiblePricing";
8
8
 
9
9
  const mockOnPress = jest.fn();
10
10
  const mockOnSubmit = jest.fn();
@@ -26,14 +26,10 @@ const renderPricing: RenderPricingFunction = ({
26
26
  } = {}) =>
27
27
  render(
28
28
  <Pricing
29
- balanceDiscount={pricing.balanceDiscount}
30
29
  collapsed={collapsed}
31
30
  collapsible={collapsible}
32
- discount={pricing.discount}
33
- discountPercentage={pricing.discountPercentage}
34
- pendingToPay={pricing.pendingToPay}
35
- service={pricing.service}
36
- subtotal={pricing.subtotal}
31
+ pricing={pricing}
32
+ submitButtonText={I18nMessages.SUMMARY_SUBMIT_BUTTON}
37
33
  totalCheckoutItemsKept={3}
38
34
  onPress={mockOnPress}
39
35
  onSubmit={mockOnSubmit}
@@ -0,0 +1,81 @@
1
+ import { animated, useSpring } from "@react-spring/native";
2
+ import React, { FC } from "react";
3
+ import { Pressable, View } from "react-native";
4
+ import { Button, Icon, Text } from "@lookiero/aurora";
5
+ import { useI18nMessage } from "@lookiero/i18n-react";
6
+ import { PricingProjection } from "../../../../../../projection/pricing/pricing";
7
+ import { Price } from "../../../../components/atoms/price/Price";
8
+ import { I18nMessages } from "../../../../i18n/i18n";
9
+ import { Pricing } from "../pricing/Pricing";
10
+ import { style } from "./CollapsiblePricing.style";
11
+
12
+ interface CollapsiblePricingProps {
13
+ readonly pricing: PricingProjection;
14
+ readonly totalCheckoutItemsKept: number;
15
+ readonly collapsible?: boolean;
16
+ readonly collapsed?: boolean;
17
+ readonly submitButtonText: string;
18
+ readonly onPress?: () => void;
19
+ readonly onSubmit: () => void;
20
+ }
21
+ const CollapsiblePricing: FC<CollapsiblePricingProps> = ({
22
+ pricing,
23
+ totalCheckoutItemsKept,
24
+ collapsible = true,
25
+ collapsed = false,
26
+ submitButtonText,
27
+ onPress = () => void 0,
28
+ onSubmit,
29
+ }) => {
30
+ const { pendingToPay } = pricing;
31
+
32
+ const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL });
33
+ const totalCheckoutItemsKeptText = useI18nMessage({
34
+ id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
35
+ values: { items: totalCheckoutItemsKept.toString() },
36
+ });
37
+
38
+ const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
39
+ const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
40
+
41
+ return (
42
+ <>
43
+ {collapsible && (
44
+ <Pressable style={style.iconContainer} testID="pricing-collapsed" onPress={onPress}>
45
+ {collapsed ? (
46
+ <Icon name="arrow_up_small" testID="arrow-up" />
47
+ ) : (
48
+ <Icon name="arrow_down_small" testID="arrow-down" />
49
+ )}
50
+ </Pressable>
51
+ )}
52
+
53
+ {collapsed && collapsible ? (
54
+ <animated.View style={[style.collapsed, { opacity: collapsedStyle.opacitiy }]}>
55
+ <View style={style.collapsedContent}>
56
+ <Text level={1} style={style.totalCollapsed} detail>
57
+ {totalText} {totalCheckoutItemsKeptText}
58
+ </Text>
59
+ <Price price={pendingToPay} variant="detail" />
60
+ </View>
61
+
62
+ <View style={style.collapsedContent}>
63
+ <Button testID="confirm-checkout-collpased-button" small onPress={onSubmit}>
64
+ {submitButtonText}
65
+ </Button>
66
+ </View>
67
+ </animated.View>
68
+ ) : (
69
+ <animated.View style={{ opacity: notCollapsedStyle.opacitiy }}>
70
+ <Pricing pricing={pricing} totalCheckoutItemsKept={totalCheckoutItemsKept} />
71
+
72
+ <Button testID="confirm-checkout-button" onPress={onSubmit}>
73
+ {submitButtonText}
74
+ </Button>
75
+ </animated.View>
76
+ )}
77
+ </>
78
+ );
79
+ };
80
+
81
+ export { CollapsiblePricing };
@@ -1,34 +1,19 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
3
 
4
- const { colorBgPrimary, space1, space3, space4 } = theme();
4
+ const { space4, colorBgPrimary } = theme();
5
5
 
6
6
  const style = StyleSheet.create({
7
- collapsed: {
8
- flexDirection: "row",
9
- justifyContent: "space-between",
10
- },
11
- collapsedContent: {
12
- flex: 1,
13
- marginBottom: space1,
14
- },
15
7
  divider: {
16
8
  backgroundColor: colorBgPrimary,
17
9
  height: 1,
18
10
  marginBottom: space4,
19
11
  },
20
- iconContainer: {
21
- alignItems: "center",
22
- marginBottom: space3,
23
- },
24
12
  row: {
25
13
  flexDirection: "row",
26
14
  justifyContent: "space-between",
27
15
  marginBottom: space4,
28
16
  },
29
- totalCollapsed: {
30
- marginBottom: space1,
31
- },
32
17
  });
33
18
 
34
19
  export { style };
@@ -1,10 +1,8 @@
1
- import { animated, useSpring } from "@react-spring/native";
2
1
  import React, { FC, ReactNode } from "react";
3
- import { Pressable, View } from "react-native";
4
- import { Button, Icon, Text } from "@lookiero/aurora";
2
+ import { View } from "react-native";
3
+ import { Text } from "@lookiero/aurora";
5
4
  import { useI18nMessage } from "@lookiero/i18n-react";
6
- import { ServiceProjection } from "../../../../../../projection/pricing/pricing";
7
- import { PriceProjection } from "../../../../../../projection/shared/price";
5
+ import { PricingProjection } from "../../../../../../projection/pricing/pricing";
8
6
  import { Price } from "../../../../components/atoms/price/Price";
9
7
  import { I18nMessages } from "../../../../i18n/i18n";
10
8
  import { style } from "./Pricing.style";
@@ -25,40 +23,19 @@ const Row: FC<RowProps> = ({ action = false, text, level = 3, children }) => (
25
23
  );
26
24
 
27
25
  interface PricingProps {
28
- readonly pendingToPay: PriceProjection;
29
- readonly subtotal: PriceProjection;
30
- readonly balanceDiscount?: PriceProjection;
31
- readonly discount?: PriceProjection;
32
- readonly discountPercentage?: number;
26
+ readonly pricing: PricingProjection;
33
27
  readonly totalCheckoutItemsKept: number;
34
- readonly service: ServiceProjection;
35
- readonly collapsible?: boolean;
36
- readonly collapsed?: boolean;
37
- readonly busy?: boolean;
38
- readonly onPress?: () => void;
39
- readonly onSubmit: () => void;
40
28
  }
41
- const Pricing: FC<PricingProps> = ({
42
- pendingToPay,
43
- subtotal,
44
- balanceDiscount,
45
- discount,
46
- discountPercentage = 0,
47
- totalCheckoutItemsKept,
48
- service,
49
- collapsible = true,
50
- collapsed = false,
51
- busy = false,
52
- onPress = () => void 0,
53
- onSubmit,
54
- }) => {
29
+
30
+ const Pricing: FC<PricingProps> = ({ pricing, totalCheckoutItemsKept }) => {
31
+ const { pendingToPay, subtotal, balanceDiscount, discount, discountPercentage = 0, service } = pricing;
32
+
55
33
  const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL });
56
34
  const totalCheckoutItemsKeptText = useI18nMessage({
57
35
  id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
58
36
  values: { items: totalCheckoutItemsKept.toString() },
59
37
  });
60
38
  const subtotalText = useI18nMessage({ id: I18nMessages.SUMMARY_SUBTOTAL });
61
- const submitButtonText = useI18nMessage({ id: I18nMessages.SUMMARY_SUBMIT_BUTTON });
62
39
  const freeText = useI18nMessage({ id: I18nMessages.SUMMARY_FREE });
63
40
  const discountText = useI18nMessage({
64
41
  id: I18nMessages.SUMMARY_DISCOUNT,
@@ -67,74 +44,38 @@ const Pricing: FC<PricingProps> = ({
67
44
  const creditText = useI18nMessage({ id: I18nMessages.SUMMARY_CREDIT });
68
45
  const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE });
69
46
 
70
- const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
71
- const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
72
-
73
47
  return (
74
- <>
75
- {collapsible && (
76
- <Pressable style={style.iconContainer} testID="pricing-collapsed" onPress={onPress}>
77
- {collapsed ? (
78
- <Icon name="arrow_up_small" testID="arrow-up" />
79
- ) : (
80
- <Icon name="arrow_down_small" testID="arrow-down" />
81
- )}
82
- </Pressable>
83
- )}
84
-
85
- {collapsed && collapsible ? (
86
- <animated.View style={[style.collapsed, { opacity: collapsedStyle.opacitiy }]}>
87
- <View style={style.collapsedContent}>
88
- <Text level={1} style={style.totalCollapsed} detail>
89
- {totalText} {totalCheckoutItemsKeptText}
90
- </Text>
91
- <Price price={pendingToPay} variant="detail" />
92
- </View>
48
+ <View>
49
+ <Row text={`${subtotalText} ${totalCheckoutItemsKeptText}`}>
50
+ <Price price={subtotal} variant="subtotal" />
51
+ </Row>
93
52
 
94
- <View style={style.collapsedContent}>
95
- <Button busy={busy} testID="confirm-checkout-collpased-button" small onPress={onSubmit}>
96
- {submitButtonText}
97
- </Button>
98
- </View>
99
- </animated.View>
100
- ) : (
101
- <animated.View style={{ opacity: notCollapsedStyle.opacitiy }}>
102
- <Row text={`${subtotalText} ${totalCheckoutItemsKeptText}`}>
103
- <Price price={subtotal} variant="subtotal" />
104
- </Row>
105
-
106
- {discount && discount.amount !== 0 && (
107
- <Row text={discountText}>
108
- <Price price={discount} variant="subtotal" />
109
- </Row>
110
- )}
111
-
112
- {balanceDiscount && balanceDiscount.amount !== 0 && (
113
- <Row text={creditText}>
114
- <Price price={balanceDiscount} variant="subtotal" />
115
- </Row>
116
- )}
53
+ {discount && discount.amount !== 0 && (
54
+ <Row text={discountText}>
55
+ <Price price={discount} variant="subtotal" />
56
+ </Row>
57
+ )}
117
58
 
118
- <Row text={feeText}>
119
- {service.paidWithPromocode ? (
120
- <Text level={3}>{freeText}</Text>
121
- ) : (
122
- <Price price={service.finalPrice} variant="subtotal" />
123
- )}
124
- </Row>
59
+ {balanceDiscount && balanceDiscount.amount !== 0 && (
60
+ <Row text={creditText}>
61
+ <Price price={balanceDiscount} variant="subtotal" />
62
+ </Row>
63
+ )}
125
64
 
126
- <View style={style.divider} />
65
+ <Row text={feeText}>
66
+ {service.paidWithPromocode ? (
67
+ <Text level={3}>{freeText}</Text>
68
+ ) : (
69
+ <Price price={service.finalPrice} variant="subtotal" />
70
+ )}
71
+ </Row>
127
72
 
128
- <Row level={2} text={totalText} action>
129
- <Price price={pendingToPay} variant="total" />
130
- </Row>
73
+ <View style={style.divider} />
131
74
 
132
- <Button busy={busy} testID="confirm-checkout-button" onPress={onSubmit}>
133
- {submitButtonText}
134
- </Button>
135
- </animated.View>
136
- )}
137
- </>
75
+ <Row level={2} text={totalText} action>
76
+ <Price price={pendingToPay} variant="total" />
77
+ </Row>
78
+ </View>
138
79
  );
139
80
  };
140
81
 
@@ -1,23 +1,32 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
3
 
4
- const { space2, space4, space6, colorBorderInput, fontDetailSize2, fontDetailHeight2 } = theme();
4
+ const { space2, space4, space6, colorBorderInput, fontDetailSize1, fontDetailHeight1 } = theme();
5
5
 
6
6
  const style = StyleSheet.create({
7
7
  carousel: {
8
- padding: space6,
8
+ paddingBottom: space6,
9
+ paddingHorizontal: space6,
9
10
  paddingTop: space2,
10
11
  },
12
+ carouselDesktop: {
13
+ paddingHorizontal: 0,
14
+ },
11
15
  emptyText: {
12
16
  paddingTop: space4,
13
17
  },
14
18
  tabList: {
15
19
  borderBottomColor: colorBorderInput,
16
20
  borderBottomWidth: 1,
21
+ justifyContent: "flex-start",
22
+ paddingHorizontal: space4,
23
+ },
24
+ tabListDesktop: {
25
+ paddingHorizontal: 0,
17
26
  },
18
27
  tabText: {
19
- fontSize: fontDetailSize2,
20
- lineHeight: fontDetailHeight2,
28
+ fontSize: fontDetailSize1,
29
+ lineHeight: fontDetailHeight1,
21
30
  },
22
31
  });
23
32
 
@@ -1,6 +1,6 @@
1
1
  import React, { FC, useCallback, useMemo } from "react";
2
2
  import { View } from "react-native";
3
- import { Text } from "@lookiero/aurora";
3
+ import { Text, useDevice } from "@lookiero/aurora";
4
4
  import { useI18nMessage } from "@lookiero/i18n-react";
5
5
  import { RenderItemFunction, Tabs } from "@lookiero/sty-psp-ui";
6
6
  import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
@@ -64,6 +64,7 @@ const CheckoutItemsTabs: FC<CheckoutItemsTabsProps> = ({
64
64
  onPressItem,
65
65
  onChanged,
66
66
  }) => {
67
+ const { screen } = useDevice();
67
68
  const keepTabText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_TAB });
68
69
  const returnTabText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_TAB });
69
70
 
@@ -121,8 +122,11 @@ const CheckoutItemsTabs: FC<CheckoutItemsTabsProps> = ({
121
122
  <Tabs
122
123
  data={data}
123
124
  defaultIndex={tabIndex}
124
- style={{ carousel: style.carousel, tabList: { tabList: style.tabList, tab: { tabText: style.tabText } } }}
125
125
  tabLabels={[`${keepTabText} (${checkoutItemsKept.length})`, `${returnTabText} (${checkoutItemsReturned.length})`]}
126
+ style={{
127
+ carousel: [style.carousel, screen.L && style.carouselDesktop],
128
+ tabList: { tabList: [style.tabList, screen.L && style.tabListDesktop], tab: { tabText: style.tabText } },
129
+ }}
126
130
  onChanged={onChanged}
127
131
  >
128
132
  {renderItem}
@@ -1,25 +0,0 @@
1
- import { FC, ReactNode, RefObject } from "react";
2
- import { LayoutChangeEvent, ScrollView, StyleProp, ViewStyle } from "react-native";
3
-
4
- interface LayoutStyle {
5
- readonly safeAreaView: StyleProp<ViewStyle>;
6
- readonly scrollView: StyleProp<ViewStyle>;
7
- readonly header: StyleProp<ViewStyle>;
8
- }
9
-
10
- interface LayoutProps {
11
- readonly children: ReactNode;
12
- readonly header?: JSX.Element | null;
13
- readonly footer?: JSX.Element | null;
14
- readonly panel?: JSX.Element | null;
15
- readonly stickyHeader?: boolean;
16
- readonly stickyHeaderHiddenOnScroll?: boolean;
17
- readonly scrollRef?: RefObject<ScrollView>;
18
- readonly scrollEnabled?: boolean;
19
- readonly style?: Partial<LayoutStyle>;
20
- readonly onLayout?: (event: LayoutChangeEvent) => void;
21
- }
22
-
23
- type Layout = FC<LayoutProps>;
24
-
25
- export type { Layout };
@@ -1,40 +0,0 @@
1
- import React from "react";
2
- import { Text } from "react-native";
3
- import { render } from "../../../../../test/render";
4
- import { Footer } from "./Footer";
5
-
6
- describe("Footer component", () => {
7
- it("matches the snapshot", () => {
8
- const { toJSON } = render(
9
- <Footer>
10
- <Text>Footer content</Text>
11
- </Footer>,
12
- );
13
-
14
- expect(toJSON()).toMatchSnapshot();
15
- });
16
-
17
- it("renders correctly", () => {
18
- const { getByText } = render(
19
- <Footer>
20
- <Text>Footer content</Text>
21
- </Footer>,
22
- );
23
-
24
- expect(getByText("Footer content")).toBeTruthy();
25
- });
26
-
27
- it("renders correctly web", () => {
28
- jest.doMock("react-native/Libraries/Utilities/Platform", () => ({
29
- OS: "web",
30
- }));
31
-
32
- const { queryByText } = render(
33
- <Footer>
34
- <Text>Footer content</Text>
35
- </Footer>,
36
- );
37
-
38
- expect(queryByText("Footer content")).not.toBeTruthy();
39
- });
40
- });
@@ -1,9 +0,0 @@
1
- import React, { FC, ReactNode } from "react";
2
- import { Platform } from "react-native";
3
-
4
- interface FooterProps {
5
- readonly children: ReactNode;
6
- }
7
- const Footer: FC<FooterProps> = ({ children }) => (Platform.OS !== "web" ? <>{children}</> : null);
8
-
9
- export { Footer };
@@ -1,36 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Footer component matches the snapshot 1`] = `
4
- <View
5
- style={
6
- [
7
- {
8
- "backgroundColor": "#FFFFFF",
9
- "flex": 1,
10
- },
11
- ]
12
- }
13
- >
14
- <View
15
- style={
16
- [
17
- {
18
- "alignSelf": "center",
19
- "left": 0,
20
- "marginHorizontal": "auto",
21
- "position": "absolute",
22
- "right": 0,
23
- "top": 0,
24
- "width": "100%",
25
- "zIndex": 5,
26
- },
27
- ]
28
- }
29
- >
30
- <RCTSafeAreaView />
31
- </View>
32
- <Text>
33
- Footer content
34
- </Text>
35
- </View>
36
- `;