@lookiero/checkout 6.4.0 → 6.5.0-beta.1
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.
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/ExpoRoot.js +1 -1
- package/dist/src/infrastructure/ui/Root.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/templates/header/Header.js +3 -6
- package/dist/src/infrastructure/ui/components/templates/header/Header.style.d.ts +3 -2
- package/dist/src/infrastructure/ui/components/templates/header/Header.style.js +4 -3
- package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.js +6 -7
- package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.style.d.ts +2 -1
- package/dist/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.style.js +2 -1
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +2 -1
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +11 -0
- package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.js +2 -1
- package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.style.d.ts +8 -0
- package/dist/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.style.js +11 -0
- package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.style.js +1 -0
- package/dist/src/infrastructure/ui/routing/Routing.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +9 -9
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +5 -18
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +7 -21
- package/dist/src/infrastructure/ui/views/feedback/Feedback.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/feedback/Feedback.js +1 -1
- package/dist/src/infrastructure/ui/views/feedback/Feedback.style.d.ts +0 -3
- package/dist/src/infrastructure/ui/views/feedback/Feedback.style.js +0 -4
- package/dist/src/infrastructure/ui/views/item/Item.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/item/Item.js +4 -4
- package/dist/src/infrastructure/ui/views/item/Item.style.d.ts +4 -4
- package/dist/src/infrastructure/ui/views/item/Item.style.js +5 -6
- package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +3 -4
- package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.js +1 -0
- package/dist/src/infrastructure/ui/views/return/Return.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/return/Return.js +0 -1
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -3
- package/dist/src/infrastructure/ui/views/return/Return.style.js +1 -5
- package/dist/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.style.js +2 -2
- package/dist/src/infrastructure/ui/views/summary/Summary.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/summary/Summary.js +19 -18
- package/dist/src/infrastructure/ui/views/summary/Summary.style.d.ts +4 -4
- package/dist/src/infrastructure/ui/views/summary/Summary.style.js +7 -8
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.d.ts +13 -0
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +33 -0
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.style.d.ts +18 -0
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.style.js +21 -0
- package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.d.ts +2 -14
- package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.js +15 -28
- package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +0 -15
- package/dist/src/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +1 -16
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -1
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +2 -2
- package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +6 -2
- package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.style.d.ts +10 -1
- package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.style.js +13 -4
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/src/ExpoRoot.tsx +1 -1
- package/src/infrastructure/ui/Root.tsx +1 -1
- package/src/infrastructure/ui/components/templates/header/Header.style.ts +4 -3
- package/src/infrastructure/ui/components/templates/header/Header.tsx +7 -11
- package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.style.ts +2 -1
- package/src/infrastructure/ui/components/templates/header/checkoutHeader/CheckoutHeader.tsx +10 -11
- package/src/infrastructure/ui/{views/summary/components/stickyPricing/StickyPricing.style.ts → components/templates/header/itemDetailHeader/ItemDetailHeader.style.ts} +5 -4
- package/src/infrastructure/ui/components/templates/header/itemDetailHeader/ItemDetailHeader.tsx +2 -1
- package/src/infrastructure/ui/components/templates/header/itemHeader/ItemHeader.style.ts +1 -0
- package/src/infrastructure/ui/routing/Routing.tsx +1 -1
- package/src/infrastructure/ui/views/checkout/Checkout.style.ts +7 -21
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +13 -22
- package/src/infrastructure/ui/views/feedback/Feedback.style.ts +0 -4
- package/src/infrastructure/ui/views/feedback/Feedback.tsx +2 -2
- package/src/infrastructure/ui/views/item/Item.style.ts +5 -6
- package/src/infrastructure/ui/views/item/Item.tsx +21 -21
- package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.style.ts +1 -0
- package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +11 -13
- package/src/infrastructure/ui/views/return/Return.style.ts +1 -5
- package/src/infrastructure/ui/views/return/Return.tsx +1 -2
- package/src/infrastructure/ui/views/shared/components/productVariant/ProductVariant.style.ts +2 -1
- package/src/infrastructure/ui/views/summary/Summary.style.ts +8 -7
- package/src/infrastructure/ui/views/summary/Summary.tsx +50 -55
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.style.ts +24 -0
- package/src/infrastructure/ui/views/summary/components/{pricing/Pricing.test.tsx → collapsiblePricing/CollapsiblePricing.test.tsx} +2 -7
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +81 -0
- package/src/infrastructure/ui/views/summary/components/pricing/Pricing.style.ts +1 -16
- package/src/infrastructure/ui/views/summary/components/pricing/Pricing.tsx +34 -94
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.style.ts +13 -4
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +6 -2
- package/src/infrastructure/ui/components/layouts/layout/Layout.ts +0 -25
- package/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.test.tsx +0 -40
- package/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.tsx +0 -9
- package/src/infrastructure/ui/components/layouts/layout/components/footer/__snapshots__/Footer.test.tsx.snap +0 -36
- package/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.ts +0 -21
- package/src/infrastructure/ui/components/layouts/layout/components/header/Header.test.tsx +0 -26
- package/src/infrastructure/ui/components/layouts/layout/components/header/Header.tsx +0 -10
- package/src/infrastructure/ui/components/layouts/layout/components/header/__snapshots__/Header.test.tsx.snap +0 -45
- package/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.ts +0 -15
- package/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.test.tsx +0 -66
- package/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.tsx +0 -45
- package/src/infrastructure/ui/components/layouts/layout/dummyLayout/__snapshots__/DummyLayout.test.tsx.snap +0 -1349
- package/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.test.tsx +0 -23
- package/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.tsx +0 -18
- package/src/infrastructure/ui/components/templates/header/defaultHeader/__snapshots__/DefaultHeader.test.tsx.snap +0 -195
- package/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.tsx +0 -46
- /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,
|
|
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,13 @@ 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 {
|
|
17
|
+
import { Body } from "../../components/layouts/body/Body";
|
|
17
18
|
import { useStaticInfo } from "../../hooks/useStaticInfo";
|
|
18
19
|
import { I18nMessages } from "../../i18n/i18n";
|
|
19
20
|
import { Routes } from "../../routing/routes";
|
|
20
21
|
import { useBasePath } from "../../routing/useBasePath";
|
|
21
22
|
import { style } from "./Summary.style";
|
|
22
|
-
import {
|
|
23
|
-
import { StickyPricing } from "./components/stickyPricing/StickyPricing";
|
|
23
|
+
import { CollapsiblePricing } from "./components/collapsiblePricing/CollapsiblePricing";
|
|
24
24
|
|
|
25
25
|
interface SummaryProps {
|
|
26
26
|
readonly layout: LocalLayout;
|
|
@@ -111,64 +111,59 @@ const Summary: FC<SummaryProps> = ({ layout: LocalLayout, children }) => {
|
|
|
111
111
|
|
|
112
112
|
return (
|
|
113
113
|
<LocalLayout
|
|
114
|
-
scrollEnabled={false}
|
|
115
114
|
style={{
|
|
116
|
-
header: style.header,
|
|
117
115
|
scrollView: style.scrollView,
|
|
118
116
|
}}
|
|
119
117
|
>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
>
|
|
127
|
-
<
|
|
128
|
-
<View style={
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
{fiveItemsDiscount !== 0 && <FiveItemsDiscountBanner fiveItemsDiscount={fiveItemsDiscount} />}
|
|
119
|
+
|
|
120
|
+
<Layout
|
|
121
|
+
fullWidth={!screen.L}
|
|
122
|
+
style={[screen.L && style.desktopLayoutSpacing, !screen.L && { paddingBottom: pricingHeight }]}
|
|
123
|
+
>
|
|
124
|
+
<Box size={{ L: "2/3" }} style={screen.L && style.desktopListSpacing}>
|
|
125
|
+
<View style={[style.contentWrapper, screen.L && style.desktopContentWrapper]}>
|
|
126
|
+
<View style={!screen.L && style.mobileInfo}>
|
|
127
|
+
<Text level={3} style={style.title} heading>
|
|
128
|
+
{titleText}
|
|
129
|
+
</Text>
|
|
130
|
+
<Text level={3} style={style.description}>
|
|
131
|
+
{descriptionText}
|
|
132
|
+
</Text>
|
|
133
|
+
</View>
|
|
134
|
+
|
|
135
|
+
{children}
|
|
136
|
+
</View>
|
|
137
|
+
</Box>
|
|
138
|
+
{pricing && screen.L ? (
|
|
139
|
+
<Box size={{ L: "1/3" }} style={[style.resume, screen.L ? style.desktopResume : style.mobileResume]}>
|
|
140
|
+
<View style={style.princingWrapper}>
|
|
141
|
+
<CollapsiblePricing
|
|
142
|
+
collapsed={false}
|
|
143
|
+
collapsible={false}
|
|
144
|
+
pricing={pricing}
|
|
145
|
+
submitButtonText={submitButtonText}
|
|
146
|
+
totalCheckoutItemsKept={totalCheckoutItemsKept}
|
|
147
|
+
onSubmit={handleOnSubmit}
|
|
148
|
+
/>
|
|
139
149
|
</View>
|
|
140
150
|
</Box>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<Pricing
|
|
145
|
-
balanceDiscount={pricing.balanceDiscount}
|
|
146
|
-
collapsed={false}
|
|
147
|
-
collapsible={false}
|
|
148
|
-
discount={pricing.discount}
|
|
149
|
-
discountPercentage={pricing.discountPercentage}
|
|
150
|
-
pendingToPay={pricing.pendingToPay}
|
|
151
|
-
service={pricing.service}
|
|
152
|
-
submitButtonText={submitButtonText}
|
|
153
|
-
subtotal={pricing.subtotal}
|
|
154
|
-
totalCheckoutItemsKept={totalCheckoutItemsKept}
|
|
155
|
-
onSubmit={handleOnSubmit}
|
|
156
|
-
/>
|
|
157
|
-
</View>
|
|
158
|
-
</Box>
|
|
159
|
-
) : null}
|
|
160
|
-
</Layout>
|
|
161
|
-
</ScrollView>
|
|
151
|
+
) : null}
|
|
152
|
+
</Layout>
|
|
153
|
+
|
|
162
154
|
{pricing && !screen.L ? (
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
155
|
+
<Sticky style={style.sticky} onLayout={Platform.OS !== "web" ? handleOnPricingLayout : undefined}>
|
|
156
|
+
<Body>
|
|
157
|
+
<CollapsiblePricing
|
|
158
|
+
collapsed={pricingCollapsed}
|
|
159
|
+
pricing={pricing}
|
|
160
|
+
submitButtonText={submitButtonText}
|
|
161
|
+
totalCheckoutItemsKept={totalCheckoutItemsKept}
|
|
162
|
+
onPress={handleOnPressPricing}
|
|
163
|
+
onSubmit={handleOnSubmit}
|
|
164
|
+
/>
|
|
165
|
+
</Body>
|
|
166
|
+
</Sticky>
|
|
172
167
|
) : null}
|
|
173
168
|
</LocalLayout>
|
|
174
169
|
);
|
|
@@ -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 "./
|
|
7
|
+
import { Pricing } from "./CollapsiblePricing";
|
|
8
8
|
|
|
9
9
|
const mockOnPress = jest.fn();
|
|
10
10
|
const mockOnSubmit = jest.fn();
|
|
@@ -26,15 +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
|
-
|
|
33
|
-
discountPercentage={pricing.discountPercentage}
|
|
34
|
-
pendingToPay={pricing.pendingToPay}
|
|
35
|
-
service={pricing.service}
|
|
31
|
+
pricing={pricing}
|
|
36
32
|
submitButtonText={I18nMessages.SUMMARY_SUBMIT_BUTTON}
|
|
37
|
-
subtotal={pricing.subtotal}
|
|
38
33
|
totalCheckoutItemsKept={3}
|
|
39
34
|
onPress={mockOnPress}
|
|
40
35
|
onSubmit={mockOnSubmit}
|
package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx
ADDED
|
@@ -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 {
|
|
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 {
|
|
4
|
-
import {
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { Text } from "@lookiero/aurora";
|
|
5
4
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
|
-
import {
|
|
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,35 +23,13 @@ const Row: FC<RowProps> = ({ action = false, text, level = 3, children }) => (
|
|
|
25
23
|
);
|
|
26
24
|
|
|
27
25
|
interface PricingProps {
|
|
28
|
-
readonly
|
|
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 submitButtonText: string;
|
|
39
|
-
readonly onPress?: () => void;
|
|
40
|
-
readonly onSubmit: () => void;
|
|
41
28
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
subtotal,
|
|
45
|
-
|
|
46
|
-
discount,
|
|
47
|
-
discountPercentage = 0,
|
|
48
|
-
totalCheckoutItemsKept,
|
|
49
|
-
service,
|
|
50
|
-
collapsible = true,
|
|
51
|
-
collapsed = false,
|
|
52
|
-
busy = false,
|
|
53
|
-
submitButtonText,
|
|
54
|
-
onPress = () => void 0,
|
|
55
|
-
onSubmit,
|
|
56
|
-
}) => {
|
|
29
|
+
|
|
30
|
+
const Pricing: FC<PricingProps> = ({ pricing, totalCheckoutItemsKept }) => {
|
|
31
|
+
const { pendingToPay, subtotal, balanceDiscount, discount, discountPercentage = 0, service } = pricing;
|
|
32
|
+
|
|
57
33
|
const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL });
|
|
58
34
|
const totalCheckoutItemsKeptText = useI18nMessage({
|
|
59
35
|
id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
|
|
@@ -68,74 +44,38 @@ const Pricing: FC<PricingProps> = ({
|
|
|
68
44
|
const creditText = useI18nMessage({ id: I18nMessages.SUMMARY_CREDIT });
|
|
69
45
|
const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE });
|
|
70
46
|
|
|
71
|
-
const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
|
|
72
|
-
const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
|
|
73
|
-
|
|
74
47
|
return (
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
<Icon name="arrow_up_small" testID="arrow-up" />
|
|
80
|
-
) : (
|
|
81
|
-
<Icon name="arrow_down_small" testID="arrow-down" />
|
|
82
|
-
)}
|
|
83
|
-
</Pressable>
|
|
84
|
-
)}
|
|
85
|
-
|
|
86
|
-
{collapsed && collapsible ? (
|
|
87
|
-
<animated.View style={[style.collapsed, { opacity: collapsedStyle.opacitiy }]}>
|
|
88
|
-
<View style={style.collapsedContent}>
|
|
89
|
-
<Text level={1} style={style.totalCollapsed} detail>
|
|
90
|
-
{totalText} {totalCheckoutItemsKeptText}
|
|
91
|
-
</Text>
|
|
92
|
-
<Price price={pendingToPay} variant="detail" />
|
|
93
|
-
</View>
|
|
48
|
+
<View>
|
|
49
|
+
<Row text={`${subtotalText} ${totalCheckoutItemsKeptText}`}>
|
|
50
|
+
<Price price={subtotal} variant="subtotal" />
|
|
51
|
+
</Row>
|
|
94
52
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</animated.View>
|
|
101
|
-
) : (
|
|
102
|
-
<animated.View style={{ opacity: notCollapsedStyle.opacitiy }}>
|
|
103
|
-
<Row text={`${subtotalText} ${totalCheckoutItemsKeptText}`}>
|
|
104
|
-
<Price price={subtotal} variant="subtotal" />
|
|
105
|
-
</Row>
|
|
106
|
-
|
|
107
|
-
{discount && discount.amount !== 0 && (
|
|
108
|
-
<Row text={discountText}>
|
|
109
|
-
<Price price={discount} variant="subtotal" />
|
|
110
|
-
</Row>
|
|
111
|
-
)}
|
|
112
|
-
|
|
113
|
-
{balanceDiscount && balanceDiscount.amount !== 0 && (
|
|
114
|
-
<Row text={creditText}>
|
|
115
|
-
<Price price={balanceDiscount} variant="subtotal" />
|
|
116
|
-
</Row>
|
|
117
|
-
)}
|
|
53
|
+
{discount && discount.amount !== 0 && (
|
|
54
|
+
<Row text={discountText}>
|
|
55
|
+
<Price price={discount} variant="subtotal" />
|
|
56
|
+
</Row>
|
|
57
|
+
)}
|
|
118
58
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
)}
|
|
125
|
-
</Row>
|
|
59
|
+
{balanceDiscount && balanceDiscount.amount !== 0 && (
|
|
60
|
+
<Row text={creditText}>
|
|
61
|
+
<Price price={balanceDiscount} variant="subtotal" />
|
|
62
|
+
</Row>
|
|
63
|
+
)}
|
|
126
64
|
|
|
127
|
-
|
|
65
|
+
<Row text={feeText}>
|
|
66
|
+
{service.paidWithPromocode ? (
|
|
67
|
+
<Text level={3}>{freeText}</Text>
|
|
68
|
+
) : (
|
|
69
|
+
<Price price={service.finalPrice} variant="subtotal" />
|
|
70
|
+
)}
|
|
71
|
+
</Row>
|
|
128
72
|
|
|
129
|
-
|
|
130
|
-
<Price price={pendingToPay} variant="total" />
|
|
131
|
-
</Row>
|
|
73
|
+
<View style={style.divider} />
|
|
132
74
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
)}
|
|
138
|
-
</>
|
|
75
|
+
<Row level={2} text={totalText} action>
|
|
76
|
+
<Price price={pendingToPay} variant="total" />
|
|
77
|
+
</Row>
|
|
78
|
+
</View>
|
|
139
79
|
);
|
|
140
80
|
};
|
|
141
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,
|
|
4
|
+
const { space2, space4, space6, colorBorderInput, fontDetailSize1, fontDetailHeight1 } = theme();
|
|
5
5
|
|
|
6
6
|
const style = StyleSheet.create({
|
|
7
7
|
carousel: {
|
|
8
|
-
|
|
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:
|
|
20
|
-
lineHeight:
|
|
28
|
+
fontSize: fontDetailSize1,
|
|
29
|
+
lineHeight: fontDetailHeight1,
|
|
21
30
|
},
|
|
22
31
|
});
|
|
23
32
|
|
package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx
CHANGED
|
@@ -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
|
-
`;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Platform, StyleSheet } from "react-native";
|
|
2
|
-
import { HEADER_HEIGHT } from "../../../../templates/header/Header.style";
|
|
3
|
-
|
|
4
|
-
const style = StyleSheet.create({
|
|
5
|
-
header: {
|
|
6
|
-
...Platform.select({
|
|
7
|
-
web: {
|
|
8
|
-
position: "sticky",
|
|
9
|
-
top: 0,
|
|
10
|
-
zIndex: 10,
|
|
11
|
-
height: HEADER_HEIGHT,
|
|
12
|
-
},
|
|
13
|
-
native: {
|
|
14
|
-
position: "relative",
|
|
15
|
-
height: HEADER_HEIGHT,
|
|
16
|
-
},
|
|
17
|
-
}),
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { style };
|