@lookiero/checkout 0.3.2 → 0.3.3
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/domain/checkout/command/markCheckoutAsPaid.d.ts +13 -0
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +4 -0
- package/dist/domain/checkout/model/checkout.d.ts +5 -2
- package/dist/domain/checkout/model/checkout.js +13 -1
- package/dist/domain/checkout/model/checkoutPaid.d.ts +13 -0
- package/dist/domain/checkout/model/checkoutPaid.js +4 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +3 -1
- package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +7 -1
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +5 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +13 -0
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.js +12 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +3 -0
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +9 -6
- package/dist/infrastructure/ui/i18n/i18n.d.ts +3 -0
- package/dist/infrastructure/ui/i18n/i18n.js +3 -0
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +4 -3
- package/dist/infrastructure/ui/routing/Routing.js +5 -0
- package/dist/infrastructure/ui/routing/routes.d.ts +1 -0
- package/dist/infrastructure/ui/routing/routes.js +1 -0
- package/dist/infrastructure/ui/shared/components/layouts/sticky/Sticky.js +2 -2
- package/dist/infrastructure/ui/shared/components/layouts/sticky/Sticky.style.js +2 -2
- package/dist/infrastructure/ui/views/summary/Summary.js +33 -9
- package/dist/infrastructure/ui/views/summary/Summary.style.d.ts +18 -0
- package/dist/infrastructure/ui/views/summary/Summary.style.js +21 -0
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts +2 -1
- package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js +5 -8
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.d.ts +6 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.js +15 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.d.ts +9 -0
- package/dist/infrastructure/ui/views/summary/components/fiveItemsDiscountBanner/FiveItemsDiscountBanner.style.js +12 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.d.ts +1 -1
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +9 -9
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +5 -5
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +6 -6
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowDown.d.ts +4 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowDown.js +5 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowUp.d.ts +4 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/icons/ArrowUp.js +5 -0
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +11 -0
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +9 -0
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +6 -0
- package/dist/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +9 -0
- package/package.json +2 -2
- package/dist/infrastructure/projection/pricing/pricing.mock.d.ts +0 -3
- package/dist/infrastructure/projection/pricing/pricing.mock.js +0 -37
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
|
|
3
|
+
interface MarkCheckoutAsPaidPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
|
|
7
|
+
}
|
|
8
|
+
interface MarkCheckoutAsPaidFunction {
|
|
9
|
+
(payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
|
|
10
|
+
}
|
|
11
|
+
declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
|
|
12
|
+
export type { MarkCheckoutAsPaid };
|
|
13
|
+
export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
+
import { MarkCheckoutAsPaid } from "../command/markCheckoutAsPaid";
|
|
2
3
|
import { StartCheckout } from "../command/startCheckout";
|
|
3
4
|
declare enum CheckoutStatus {
|
|
4
5
|
AVAILABLE = "AVAILABLE",
|
|
5
6
|
NOTIFIED = "NOTIFIED",
|
|
6
7
|
STARTED = "STARTED",
|
|
7
|
-
COMPLETED = "COMPLETED"
|
|
8
|
+
COMPLETED = "COMPLETED",
|
|
9
|
+
PAID = "PAID"
|
|
8
10
|
}
|
|
9
11
|
interface Checkout extends AggregateRoot {
|
|
10
12
|
readonly status: CheckoutStatus;
|
|
@@ -14,5 +16,6 @@ interface Checkout extends AggregateRoot {
|
|
|
14
16
|
readonly expiresOn: Date;
|
|
15
17
|
}
|
|
16
18
|
declare const startCheckoutHandler: CommandHandlerFunction<StartCheckout, Checkout>;
|
|
19
|
+
declare const markCheckoutAsPaidHandler: CommandHandlerFunction<MarkCheckoutAsPaid, Checkout>;
|
|
17
20
|
export type { Checkout };
|
|
18
|
-
export { CheckoutStatus, startCheckoutHandler };
|
|
21
|
+
export { CheckoutStatus, startCheckoutHandler, markCheckoutAsPaidHandler };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
|
+
import { checkoutPaid } from "./checkoutPaid";
|
|
2
3
|
import { checkoutStarted } from "./checkoutStarted";
|
|
3
4
|
var CheckoutStatus;
|
|
4
5
|
(function (CheckoutStatus) {
|
|
@@ -6,6 +7,7 @@ var CheckoutStatus;
|
|
|
6
7
|
CheckoutStatus["NOTIFIED"] = "NOTIFIED";
|
|
7
8
|
CheckoutStatus["STARTED"] = "STARTED";
|
|
8
9
|
CheckoutStatus["COMPLETED"] = "COMPLETED";
|
|
10
|
+
CheckoutStatus["PAID"] = "PAID";
|
|
9
11
|
})(CheckoutStatus || (CheckoutStatus = {}));
|
|
10
12
|
const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
11
13
|
const { aggregateId } = command;
|
|
@@ -17,4 +19,14 @@ const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
|
17
19
|
domainEvents: [checkoutStarted({ aggregateId })],
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
|
-
|
|
22
|
+
const markCheckoutAsPaidHandler = () => async ({ aggregateRoot, command }) => {
|
|
23
|
+
const { aggregateId } = command;
|
|
24
|
+
invariant(aggregateRoot.status !== CheckoutStatus.PAID, "Checkout is already paid");
|
|
25
|
+
invariant(aggregateRoot.status !== CheckoutStatus.COMPLETED, "Checkout is already completed");
|
|
26
|
+
return {
|
|
27
|
+
...aggregateRoot,
|
|
28
|
+
status: CheckoutStatus.PAID,
|
|
29
|
+
domainEvents: [checkoutPaid({ aggregateId })],
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export { CheckoutStatus, startCheckoutHandler, markCheckoutAsPaidHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_PAID = "checkout_paid";
|
|
3
|
+
interface CheckoutPaidPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutPaidFunction {
|
|
9
|
+
(payload: CheckoutPaidPayload): CheckoutPaid;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutPaid: CheckoutPaidFunction;
|
|
12
|
+
export type { CheckoutPaid };
|
|
13
|
+
export { CHECKOUT_PAID, checkoutPaid };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
2
|
+
import { MARK_CHECKOUT_AS_PAID } from "../../domain/checkout/command/markCheckoutAsPaid";
|
|
2
3
|
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
3
|
-
import { startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
4
|
+
import { markCheckoutAsPaidHandler, startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
4
5
|
import { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM } from "../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
5
6
|
import { bookCheckoutBookingForCheckoutItemHandler, } from "../../domain/checkoutBooking/model/checkoutBooking";
|
|
6
7
|
import { KEEP_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/keepCheckoutItem";
|
|
@@ -35,6 +36,7 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
35
36
|
})
|
|
36
37
|
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
37
38
|
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
39
|
+
.command(MARK_CHECKOUT_AS_PAID, markCheckoutAsPaidHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
38
40
|
.query(VIEW_CHECKOUT_ITEM_BY_ID, viewCheckoutItemByIdHandler, {
|
|
39
41
|
view: checkoutItemByIdView,
|
|
40
42
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
2
|
import { viewCheckoutById, } from "../../../../projection/checkout/viewCheckoutById";
|
|
3
|
+
import { httpCheckoutsMarkAsPaid } from "./httpCheckoutsMarkAsPaid";
|
|
3
4
|
import { httpCheckoutsStart } from "./httpCheckoutsStart";
|
|
4
5
|
const toDomain = (checkout) => {
|
|
5
6
|
invariant(checkout, "No checkout found!");
|
|
@@ -15,5 +16,10 @@ const toDomain = (checkout) => {
|
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
18
|
const getCheckout = ({ queryBus }) => async (aggregateId) => toDomain(await queryBus(viewCheckoutById({ checkoutId: aggregateId })));
|
|
18
|
-
const saveCheckout = ({ httpPost }) => async (aggregateRoot) =>
|
|
19
|
+
const saveCheckout = ({ httpPost }) => async (aggregateRoot) => {
|
|
20
|
+
await Promise.all([
|
|
21
|
+
httpCheckoutsStart({ httpPost })(aggregateRoot),
|
|
22
|
+
httpCheckoutsMarkAsPaid({ httpPost })(aggregateRoot),
|
|
23
|
+
]);
|
|
24
|
+
};
|
|
19
25
|
export { getCheckout, saveCheckout };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
|
|
2
|
+
const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
|
|
3
|
+
const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutPaid = domainEvents.find(isCheckoutPaid);
|
|
5
|
+
if (!checkoutPaid) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
await httpPost({
|
|
9
|
+
endpoint: "/mark-checkout-as-paid",
|
|
10
|
+
body: { checkoutId: aggregateId },
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { httpCheckoutsMarkAsPaid };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface MarkAsPaidFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
declare type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
|
|
6
|
+
interface UseMarkCheckoutAsPaidFunctionArgs {
|
|
7
|
+
readonly checkoutId: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseMarkCheckoutAsPaidFunction {
|
|
10
|
+
(args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
|
|
11
|
+
}
|
|
12
|
+
declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
|
|
13
|
+
export { useMarkCheckoutAsPaid };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCommand } from "@lookiero/messaging-react";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
|
|
4
|
+
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
+
const useMarkCheckoutAsPaid = ({ checkoutId }) => {
|
|
6
|
+
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
7
|
+
const markAsPaid = useCallback(() => commandBus(markCheckoutAsPaid({
|
|
8
|
+
aggregateId: checkoutId,
|
|
9
|
+
})), [checkoutId, commandBus]);
|
|
10
|
+
return [markAsPaid, status];
|
|
11
|
+
};
|
|
12
|
+
export { useMarkCheckoutAsPaid };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
import { Edge } from "react-native-safe-area-context";
|
|
4
|
+
declare type SafeAreaScrollViewStyle = "safeAreaView" | "scrollView";
|
|
3
5
|
interface SafeAreaScrollViewProps {
|
|
4
6
|
readonly children: ReactNode;
|
|
5
7
|
readonly edges?: Edge[];
|
|
8
|
+
readonly style?: Partial<Record<SafeAreaScrollViewStyle, StyleProp<ViewStyle>>>;
|
|
6
9
|
}
|
|
7
10
|
declare const SafeAreaScrollView: FC<SafeAreaScrollViewProps>;
|
|
8
11
|
export { SafeAreaScrollView };
|
|
@@ -3,12 +3,15 @@ import { ScrollView } from "react-native";
|
|
|
3
3
|
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import { theme } from "../../theme/theme";
|
|
5
5
|
const { spaceXL } = theme();
|
|
6
|
-
const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"] }) => {
|
|
6
|
+
const SafeAreaScrollView = ({ children, edges = ["top", "bottom", "left", "right"], style: customStyle, }) => {
|
|
7
7
|
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
8
|
-
return (React.createElement(SafeAreaView, { edges: edges },
|
|
9
|
-
React.createElement(ScrollView, { contentContainerStyle:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
return (React.createElement(SafeAreaView, { edges: edges, style: customStyle?.safeAreaView },
|
|
9
|
+
React.createElement(ScrollView, { contentContainerStyle: [
|
|
10
|
+
{
|
|
11
|
+
paddingTop: !safeAreaInsetTop ? spaceXL : 0,
|
|
12
|
+
paddingBottom: !safeAreaInsetBottom ? spaceXL : 0,
|
|
13
|
+
},
|
|
14
|
+
customStyle?.scrollView,
|
|
15
|
+
] }, children)));
|
|
13
16
|
};
|
|
14
17
|
export { SafeAreaScrollView };
|
|
@@ -33,6 +33,9 @@ declare enum I18nMessages {
|
|
|
33
33
|
FEEDBACK_UNANSWERED = "feedback.unanswered",
|
|
34
34
|
RETURN_QUESTIONS_TITLE = "return_questions.title",
|
|
35
35
|
RETURN_QUESTIONS_SUBMIT_BUTTON = "return_questions.submit_button",
|
|
36
|
+
SUMMARY_TITLE = "summary.title",
|
|
37
|
+
SUMMARY_DESCRIPTION = "summary.description",
|
|
38
|
+
SUMMARY_BANNER = "summary.banner",
|
|
36
39
|
SUMMARY_KEEP_TAB = "summary.keep_tab",
|
|
37
40
|
SUMMARY_RETURN_TAB = "summary.return_tab",
|
|
38
41
|
SUMMARY_KEEP_EMPTY = "summary.keep_empty",
|
|
@@ -34,6 +34,9 @@ var I18nMessages;
|
|
|
34
34
|
I18nMessages["FEEDBACK_UNANSWERED"] = "feedback.unanswered";
|
|
35
35
|
I18nMessages["RETURN_QUESTIONS_TITLE"] = "return_questions.title";
|
|
36
36
|
I18nMessages["RETURN_QUESTIONS_SUBMIT_BUTTON"] = "return_questions.submit_button";
|
|
37
|
+
I18nMessages["SUMMARY_TITLE"] = "summary.title";
|
|
38
|
+
I18nMessages["SUMMARY_DESCRIPTION"] = "summary.description";
|
|
39
|
+
I18nMessages["SUMMARY_BANNER"] = "summary.banner";
|
|
37
40
|
I18nMessages["SUMMARY_KEEP_TAB"] = "summary.keep_tab";
|
|
38
41
|
I18nMessages["SUMMARY_RETURN_TAB"] = "summary.return_tab";
|
|
39
42
|
I18nMessages["SUMMARY_KEEP_EMPTY"] = "summary.keep_empty";
|
|
@@ -13,6 +13,7 @@ const CheckoutMiddleware = ({ basePath, customerId, loader = React.createElement
|
|
|
13
13
|
const firstItemWithoutCustomerDecision = checkout?.items.find((item) => [CheckoutItemStatus.EXPIRED, CheckoutItemStatus.INITIAL].includes(item.status));
|
|
14
14
|
const introRouteMatch = useMatch(`${basePath}/${Routes.INTRO}`);
|
|
15
15
|
const itemRouteMatch = useMatch(`${basePath}/${Routes.ITEM}`);
|
|
16
|
+
const itemDetailRouteMatch = useMatch(`${basePath}/${Routes.ITEM_DETAIL}`);
|
|
16
17
|
const summaryRouteMatch = useMatch(`${basePath}/${Routes.SUMMARY}`);
|
|
17
18
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
18
19
|
const dependenciesLoaded = dependenciesLoadedStatuses.includes(shouldIntroBeShownStatus) &&
|
|
@@ -29,8 +30,8 @@ const CheckoutMiddleware = ({ basePath, customerId, loader = React.createElement
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
|
-
if (itemRouteMatch) {
|
|
33
|
-
const checkoutItem = checkout?.items.find((item) => item.id === itemRouteMatch.params.id);
|
|
33
|
+
if (itemRouteMatch || itemDetailRouteMatch) {
|
|
34
|
+
const checkoutItem = checkout?.items.find((item) => item.id === itemRouteMatch?.params.id || itemDetailRouteMatch?.params.id);
|
|
34
35
|
if (!checkoutItem) {
|
|
35
36
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.HOME}`, replace: true });
|
|
36
37
|
}
|
|
@@ -38,7 +39,7 @@ const CheckoutMiddleware = ({ basePath, customerId, loader = React.createElement
|
|
|
38
39
|
if (firstItemWithoutCustomerDecision && !itemRouteMatch) {
|
|
39
40
|
return (React.createElement(Navigate, { to: generatePath(`${basePath}/${Routes.ITEM}`, { id: firstItemWithoutCustomerDecision.id }), replace: true }));
|
|
40
41
|
}
|
|
41
|
-
if (firstItemWithoutCustomerDecision === undefined && !summaryRouteMatch) {
|
|
42
|
+
if (firstItemWithoutCustomerDecision === undefined && !summaryRouteMatch && !itemDetailRouteMatch) {
|
|
42
43
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.SUMMARY}`, replace: true });
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -28,6 +28,11 @@ const Routing = ({ basePath = "", onNotAccessible, customerId, locale, I18n, onI
|
|
|
28
28
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
29
29
|
React.createElement(Item, { customerId: customerId }))),
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
path: Routes.ITEM_DETAIL,
|
|
33
|
+
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
34
|
+
React.createElement(Item, { customerId: customerId }))),
|
|
35
|
+
},
|
|
31
36
|
{
|
|
32
37
|
path: Routes.SUMMARY,
|
|
33
38
|
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
@@ -3,10 +3,10 @@ import { View } from "react-native";
|
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import { theme } from "../../../../theme/theme";
|
|
5
5
|
import { style } from "./Sticky.style";
|
|
6
|
-
const {
|
|
6
|
+
const { spaceXL } = theme();
|
|
7
7
|
const Sticky = ({ children, style: customStyle, onLayout }) => {
|
|
8
8
|
const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
9
9
|
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => onLayout?.({ width, height }), [onLayout]);
|
|
10
|
-
return (React.createElement(View, { style: [style.sticky, { paddingBottom: safeAreaInsetBottom +
|
|
10
|
+
return (React.createElement(View, { style: [style.sticky, { paddingBottom: safeAreaInsetBottom + spaceXL }, customStyle], onLayout: handleOnLayout }, children));
|
|
11
11
|
};
|
|
12
12
|
export { Sticky };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Platform, StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { colorBase, elevationLayerL, elevationRadius,
|
|
3
|
+
const { colorBase, elevationLayerL, elevationRadius, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-ignore
|
|
@@ -8,7 +8,7 @@ const style = StyleSheet.create({
|
|
|
8
8
|
backgroundColor: colorBase,
|
|
9
9
|
bottom: 0,
|
|
10
10
|
elevation: elevationLayerL,
|
|
11
|
-
paddingTop:
|
|
11
|
+
paddingTop: spaceXL,
|
|
12
12
|
shadowColor: colorBase,
|
|
13
13
|
shadowOffset: {
|
|
14
14
|
height: -40,
|
|
@@ -1,25 +1,49 @@
|
|
|
1
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
1
3
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React, { useCallback, useState } from "react";
|
|
4
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
import { generatePath, useNavigate } from "react-router-native";
|
|
7
|
+
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
3
8
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
4
|
-
import {
|
|
9
|
+
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
10
|
+
import { useViewPricingByCheckoutId } from "../../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
5
11
|
import { Body } from "../../components/layouts/body/Body";
|
|
6
12
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
13
|
+
import { I18nMessages } from "../../i18n/i18n";
|
|
14
|
+
import { Routes } from "../../routing/routes";
|
|
7
15
|
import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
|
|
16
|
+
import { style } from "./Summary.style";
|
|
8
17
|
import { CheckoutItemsTabs } from "./components/checkoutItemsTabs/CheckoutItemsTabs";
|
|
9
|
-
import {
|
|
18
|
+
import { FiveItemsDiscountBanner } from "./components/fiveItemsDiscountBanner/FiveItemsDiscountBanner";
|
|
19
|
+
import { StickyPricing } from "./components/stickyPricing/StickyPricing";
|
|
10
20
|
const Summary = ({ customerId }) => {
|
|
21
|
+
const titleText = useI18nMessage({ id: I18nMessages.SUMMARY_TITLE });
|
|
22
|
+
const descriptionText = useI18nMessage({ id: I18nMessages.SUMMARY_DESCRIPTION });
|
|
11
23
|
const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
24
|
+
const [pricing, pricingStatus] = useViewPricingByCheckoutId({ checkoutId: checkout?.id });
|
|
25
|
+
const [fiveItemsDiscount = 0, fiveItemsDiscountStatus] = useViewFiveItemsDiscountByCustomerId({ customerId });
|
|
12
26
|
const [pricingCollapsed, setPricingCollapsed] = useState(true);
|
|
13
27
|
const handleOnPressPricing = useCallback(() => setPricingCollapsed(!pricingCollapsed), [pricingCollapsed]);
|
|
14
28
|
const handleOnSubmit = useCallback(() => void 0, []);
|
|
15
|
-
const
|
|
29
|
+
const navigate = useNavigate();
|
|
30
|
+
const handleOnPressItem = useCallback((checkoutItemId) => navigate(generatePath(Routes.ITEM_DETAIL, { id: checkoutItemId })), [navigate]);
|
|
31
|
+
const checkoutItemsKept = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
32
|
+
const checkoutItemsReturned = useMemo(() => checkout?.items.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.RETURNED || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkout?.items]);
|
|
16
33
|
const dependenciesLoadedStatuses = [QueryStatus.ERROR, QueryStatus.SUCCESS];
|
|
17
|
-
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus)
|
|
34
|
+
const dependenciesLoaded = dependenciesLoadedStatuses.includes(checkoutStatus) &&
|
|
35
|
+
dependenciesLoadedStatuses.includes(pricingStatus) &&
|
|
36
|
+
dependenciesLoadedStatuses.includes(fiveItemsDiscountStatus);
|
|
18
37
|
if (!dependenciesLoaded)
|
|
19
38
|
return React.createElement(Spinner, null);
|
|
20
|
-
return (React.createElement(
|
|
21
|
-
React.createElement(
|
|
22
|
-
React.createElement(
|
|
23
|
-
|
|
39
|
+
return (React.createElement(React.Fragment, null,
|
|
40
|
+
React.createElement(SafeAreaScrollView, { style: { safeAreaView: style.container } },
|
|
41
|
+
React.createElement(Body, null,
|
|
42
|
+
fiveItemsDiscount !== 0 && React.createElement(FiveItemsDiscountBanner, { fiveItemsDiscount: fiveItemsDiscount }),
|
|
43
|
+
React.createElement(View, { style: style.content },
|
|
44
|
+
React.createElement(Text, { level: 3, style: style.title, heading: true }, titleText),
|
|
45
|
+
React.createElement(Text, { level: 3, style: style.description, body: true }, descriptionText)),
|
|
46
|
+
React.createElement(CheckoutItemsTabs, { checkoutItemsKept: checkoutItemsKept || [], checkoutItemsReturned: checkoutItemsReturned || [], onPressItem: handleOnPressItem }))),
|
|
47
|
+
pricing && (React.createElement(StickyPricing, { collapsed: pricingCollapsed, pricing: pricing, totalCheckoutItemsKept: checkoutItemsKept?.length || 0, onPress: handleOnPressPricing, onSubmit: handleOnSubmit }))));
|
|
24
48
|
};
|
|
25
49
|
export { Summary };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
container: {
|
|
3
|
+
flex: number;
|
|
4
|
+
};
|
|
5
|
+
content: {
|
|
6
|
+
paddingHorizontal: number;
|
|
7
|
+
};
|
|
8
|
+
description: {
|
|
9
|
+
marginBottom: number;
|
|
10
|
+
marginTop: number;
|
|
11
|
+
textAlign: "center";
|
|
12
|
+
};
|
|
13
|
+
title: {
|
|
14
|
+
marginTop: number;
|
|
15
|
+
textAlign: "center";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export { style };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../theme/theme";
|
|
3
|
+
const { spaceM, spaceL, spaceXL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
},
|
|
8
|
+
content: {
|
|
9
|
+
paddingHorizontal: spaceXL,
|
|
10
|
+
},
|
|
11
|
+
description: {
|
|
12
|
+
marginBottom: spaceXL,
|
|
13
|
+
marginTop: spaceM,
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
marginTop: spaceL,
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export { style };
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { CheckoutItemProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
|
|
3
3
|
interface CheckoutItemsTabsProps {
|
|
4
|
-
readonly
|
|
4
|
+
readonly checkoutItemsKept: CheckoutItemProjection[];
|
|
5
|
+
readonly checkoutItemsReturned: CheckoutItemProjection[];
|
|
5
6
|
readonly onPressItem: (checkoutItemId: string) => void;
|
|
6
7
|
}
|
|
7
8
|
declare const CheckoutItemsTabs: FC<CheckoutItemsTabsProps>;
|
package/dist/infrastructure/ui/views/summary/components/checkoutItemsTabs/CheckoutItemsTabs.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
-
import React, { useCallback
|
|
3
|
+
import React, { useCallback } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
-
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
6
5
|
import { Tabs } from "../../../../components/layouts/tabs/Tabs";
|
|
7
6
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
8
7
|
import { ProductVariant } from "../../../item/components/productVariant/ProductVariant";
|
|
9
8
|
import { style } from "./CheckoutItemsTabs.style";
|
|
10
9
|
const CheckoutItem = ({ checkoutItem, discarded = false, testID, style: customStyle, onPress, }) => (React.createElement(View, { style: style.checkoutItem, testID: testID },
|
|
11
10
|
React.createElement(ProductVariant, { brand: checkoutItem.productVariant.brand, color: checkoutItem.productVariant.color, discarded: discarded, media: checkoutItem.productVariant.media, name: checkoutItem.productVariant.name, price: checkoutItem.price, size: checkoutItem.productVariant.size, status: checkoutItem.status, style: customStyle, onPress: onPress })));
|
|
12
|
-
const CheckoutItemsTabs = ({
|
|
11
|
+
const CheckoutItemsTabs = ({ checkoutItemsKept, checkoutItemsReturned, onPressItem }) => {
|
|
13
12
|
const keepTabText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_TAB });
|
|
14
13
|
const returnTabText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_TAB });
|
|
15
14
|
const keepEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_KEEP_EMPTY });
|
|
16
15
|
const returnEmptyText = useI18nMessage({ id: I18nMessages.SUMMARY_RETURN_EMPTY });
|
|
17
|
-
const keepCheckoutItems = useMemo(() => checkoutItems.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.KEPT || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkoutItems]);
|
|
18
|
-
const returnCheckoutItems = useMemo(() => checkoutItems.filter((checkoutItem) => checkoutItem.status === CheckoutItemStatus.RETURNED || checkoutItem.status === CheckoutItemStatus.REPLACED), [checkoutItems]);
|
|
19
16
|
const handleOnPressItem = useCallback((checkoutItemId) => onPressItem(checkoutItemId), [onPressItem]);
|
|
20
|
-
return (React.createElement(Tabs, { style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${
|
|
21
|
-
React.createElement(React.Fragment, null,
|
|
22
|
-
React.createElement(React.Fragment, null,
|
|
17
|
+
return (React.createElement(Tabs, { style: { sliderContainer: style.sliderContainer }, tabLabels: [`${keepTabText} (${checkoutItemsKept.length})`, `${returnTabText} (${checkoutItemsReturned.length})`] },
|
|
18
|
+
React.createElement(React.Fragment, null, checkoutItemsKept.length === 0 ? (React.createElement(Text, null, keepEmptyText)) : (checkoutItemsKept.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, testID: "keep-checkout-item", onPress: () => handleOnPressItem(checkoutItem.id) }))))),
|
|
19
|
+
React.createElement(React.Fragment, null, checkoutItemsReturned.length === 0 ? (React.createElement(Text, null, returnEmptyText)) : (checkoutItemsReturned.map((checkoutItem) => (React.createElement(CheckoutItem, { key: checkoutItem.id, checkoutItem: checkoutItem, style: { image: style.returnCheckoutItem }, testID: "return-checkout-item", discarded: true, onPress: () => handleOnPressItem(checkoutItem.id) })))))));
|
|
23
20
|
};
|
|
24
21
|
export { CheckoutItemsTabs };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
2
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
6
|
+
import { style } from "./FiveItemsDiscountBanner.style";
|
|
7
|
+
const FiveItemsDiscountBanner = ({ fiveItemsDiscount }) => {
|
|
8
|
+
const bannerText = useI18nMessage({
|
|
9
|
+
id: I18nMessages.SUMMARY_BANNER,
|
|
10
|
+
values: { discount: fiveItemsDiscount.toString() },
|
|
11
|
+
});
|
|
12
|
+
return (React.createElement(View, { style: style.container },
|
|
13
|
+
React.createElement(Text, { level: 3, body: true }, bannerText)));
|
|
14
|
+
};
|
|
15
|
+
export { FiveItemsDiscountBanner };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { colorAccent, spaceXL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
backgroundColor: colorAccent,
|
|
8
|
+
paddingHorizontal: spaceXL,
|
|
9
|
+
paddingVertical: 12,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export { style };
|
|
@@ -7,7 +7,7 @@ interface PricingProps {
|
|
|
7
7
|
readonly balanceDiscount?: PriceProjection;
|
|
8
8
|
readonly discount?: PriceProjection;
|
|
9
9
|
readonly discountPercentage?: number;
|
|
10
|
-
readonly
|
|
10
|
+
readonly totalCheckoutItemsKept: number;
|
|
11
11
|
readonly service: ServiceProjection;
|
|
12
12
|
readonly collapsible?: boolean;
|
|
13
13
|
readonly collapsed?: boolean;
|
|
@@ -6,17 +6,18 @@ import React from "react";
|
|
|
6
6
|
import { Pressable, View } from "react-native";
|
|
7
7
|
import { Price } from "../../../../components/atoms/price/Price";
|
|
8
8
|
import { I18nMessages } from "../../../../i18n/i18n";
|
|
9
|
-
import { Icon } from "../../../../shared/components/atoms/icon/Icon";
|
|
10
9
|
import { style } from "./Pricing.style";
|
|
10
|
+
import { ArrowDown } from "./icons/ArrowDown";
|
|
11
|
+
import { ArrowUp } from "./icons/ArrowUp";
|
|
11
12
|
const PS_SERVICE_FREE_INDICATOR = 100;
|
|
12
13
|
const Row = ({ text, level = 3, children }) => (React.createElement(View, { style: style.row },
|
|
13
14
|
React.createElement(Text, { level: level, style: style.uppercase, action: true }, text),
|
|
14
15
|
children));
|
|
15
|
-
const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPercentage = 0,
|
|
16
|
+
const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPercentage = 0, totalCheckoutItemsKept, service, collapsible = true, collapsed = false, onPress = () => void 0, onSubmit, }) => {
|
|
16
17
|
const totalText = useI18nMessage({ id: I18nMessages.SUMMARY_TOTAL }) || "";
|
|
17
|
-
const
|
|
18
|
+
const totalCheckoutItemsKeptText = useI18nMessage({
|
|
18
19
|
id: I18nMessages.SUMMARY_TOTAL_ITEMS_KEPT,
|
|
19
|
-
values: { items:
|
|
20
|
+
values: { items: totalCheckoutItemsKept.toString() },
|
|
20
21
|
});
|
|
21
22
|
const subtotalText = useI18nMessage({ id: I18nMessages.SUMMARY_SUBTOTAL });
|
|
22
23
|
const submitButtonText = useI18nMessage({ id: I18nMessages.SUMMARY_SUBMIT_BUTTON });
|
|
@@ -30,19 +31,18 @@ const Pricing = ({ orderTotal, subtotal, balanceDiscount, discount, discountPerc
|
|
|
30
31
|
const isPSServiceFree = service.discount.amount === PS_SERVICE_FREE_INDICATOR;
|
|
31
32
|
const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
|
|
32
33
|
const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
|
|
33
|
-
return (React.createElement(Pressable, { disabled: !collapsible,
|
|
34
|
-
collapsible && (React.createElement(View, { style: style.iconContainer },
|
|
35
|
-
React.createElement(Icon, { name: collapsed ? "arrow-up" : "arrow-down" }))),
|
|
34
|
+
return (React.createElement(Pressable, { disabled: !collapsible, testID: "pricing", onPress: onPress },
|
|
35
|
+
collapsible && (React.createElement(View, { style: style.iconContainer }, collapsed ? (React.createElement(ArrowUp, { style: style.icon, testID: "arrow-up" })) : (React.createElement(ArrowDown, { style: style.icon, testID: "arrow-down" })))),
|
|
36
36
|
collapsed && collapsible ? (React.createElement(animated.View, { style: [style.collapsed, { opacity: collapsedStyle.opacitiy }] },
|
|
37
37
|
React.createElement(View, null,
|
|
38
38
|
React.createElement(Text, { level: 1, style: style.totalCollapsed, detail: true },
|
|
39
39
|
totalText,
|
|
40
40
|
" ",
|
|
41
|
-
|
|
41
|
+
totalCheckoutItemsKeptText),
|
|
42
42
|
React.createElement(Price, { price: orderTotal, variant: "detail" })),
|
|
43
43
|
React.createElement(View, null,
|
|
44
44
|
React.createElement(Button, { small: true, onPress: onSubmit }, submitButtonText)))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
|
|
45
|
-
React.createElement(Row, { text: `${subtotalText} ${
|
|
45
|
+
React.createElement(Row, { text: `${subtotalText} ${totalCheckoutItemsKeptText}` },
|
|
46
46
|
React.createElement(Price, { price: subtotal, variant: "subtotal" })),
|
|
47
47
|
discount && (React.createElement(Row, { text: discountText },
|
|
48
48
|
React.createElement(Price, { price: discount, variant: "subtotal" }))),
|
|
@@ -3,16 +3,16 @@ declare const style: {
|
|
|
3
3
|
flexDirection: "row";
|
|
4
4
|
justifyContent: "space-between";
|
|
5
5
|
};
|
|
6
|
-
container: {
|
|
7
|
-
paddingBottom: number;
|
|
8
|
-
paddingHorizontal: number;
|
|
9
|
-
paddingTop: number;
|
|
10
|
-
};
|
|
11
6
|
divider: {
|
|
12
7
|
backgroundColor: string;
|
|
13
8
|
height: number;
|
|
14
9
|
marginBottom: number;
|
|
15
10
|
};
|
|
11
|
+
icon: {
|
|
12
|
+
height: number;
|
|
13
|
+
stroke: string;
|
|
14
|
+
width: number;
|
|
15
|
+
};
|
|
16
16
|
iconContainer: {
|
|
17
17
|
alignItems: "center";
|
|
18
18
|
marginBottom: number;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const { colorContent,
|
|
3
|
+
const { colorContent, colorGrayscaleS, spaceXS, spaceL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
collapsed: {
|
|
6
6
|
flexDirection: "row",
|
|
7
7
|
justifyContent: "space-between",
|
|
8
8
|
},
|
|
9
|
-
container: {
|
|
10
|
-
paddingBottom: spaceXL,
|
|
11
|
-
paddingHorizontal: spaceXL,
|
|
12
|
-
paddingTop: spaceM,
|
|
13
|
-
},
|
|
14
9
|
divider: {
|
|
15
10
|
backgroundColor: colorContent,
|
|
16
11
|
height: 1,
|
|
17
12
|
marginBottom: 19,
|
|
18
13
|
},
|
|
14
|
+
icon: {
|
|
15
|
+
height: 10,
|
|
16
|
+
stroke: colorGrayscaleS,
|
|
17
|
+
width: 58,
|
|
18
|
+
},
|
|
19
19
|
iconContainer: {
|
|
20
20
|
alignItems: "center",
|
|
21
21
|
marginBottom: spaceL,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
const ArrowDown = (props) => (React.createElement(Svg, { viewBox: "0 0 58 10", ...props },
|
|
4
|
+
React.createElement(Path, { d: "M1.198 1.23 28.27 8.698M55.802 1.23 28.73 8.698", strokeLinecap: "round", strokeWidth: 2 })));
|
|
5
|
+
export { ArrowDown };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
const ArrowUp = (props) => (React.createElement(Svg, { viewBox: "0 0 58 10", ...props },
|
|
4
|
+
React.createElement(Path, { d: "M1.698 8.77 28.77 1.302M56.302 8.77 29.23 1.302", strokeLinecap: "round", strokeWidth: 2 })));
|
|
5
|
+
export { ArrowUp };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { PricingProjection } from "../../../../../../projection/pricing/pricing";
|
|
3
|
+
interface StickyPricingProps {
|
|
4
|
+
readonly pricing: PricingProjection;
|
|
5
|
+
readonly totalCheckoutItemsKept: number;
|
|
6
|
+
readonly collapsed: boolean;
|
|
7
|
+
readonly onPress: () => void;
|
|
8
|
+
readonly onSubmit: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const StickyPricing: FC<StickyPricingProps>;
|
|
11
|
+
export { StickyPricing };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Body } from "../../../../components/layouts/body/Body";
|
|
3
|
+
import { Sticky } from "../../../../shared/components/layouts/sticky/Sticky";
|
|
4
|
+
import { Pricing } from "../pricing/Pricing";
|
|
5
|
+
import { style } from "./StickyPricing.style";
|
|
6
|
+
const StickyPricing = ({ pricing, totalCheckoutItemsKept, collapsed, onPress, onSubmit }) => (React.createElement(Sticky, null,
|
|
7
|
+
React.createElement(Body, { style: { column: style.container } },
|
|
8
|
+
React.createElement(Pricing, { balanceDiscount: pricing.balanceDiscount, collapsed: collapsed, discount: pricing.discount, discountPercentage: pricing.discountPercentage, orderTotal: pricing.orderTotal, service: pricing.service, subtotal: pricing.subtotal, totalCheckoutItemsKept: totalCheckoutItemsKept, onPress: onPress, onSubmit: onSubmit }))));
|
|
9
|
+
export { StickyPricing };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@lookiero/messaging-react": "^8.0.0",
|
|
34
34
|
"@react-spring/native": "^9.5.5",
|
|
35
35
|
"react-native-safe-area-context": "^4.4.1",
|
|
36
|
-
"react-native-svg": "
|
|
36
|
+
"react-native-svg": "12.3.0",
|
|
37
37
|
"react-router-dom": "^6.4.2",
|
|
38
38
|
"react-router-native": "^6.4.2",
|
|
39
39
|
"tiny-invariant": "^1.2.0",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Currency } from "../../../domain/checkoutItem/model/currency";
|
|
2
|
-
const pricing = {
|
|
3
|
-
orderTotal: {
|
|
4
|
-
amount: 14323,
|
|
5
|
-
currency: Currency.EUR,
|
|
6
|
-
},
|
|
7
|
-
subtotal: {
|
|
8
|
-
amount: 21801,
|
|
9
|
-
currency: Currency.EUR,
|
|
10
|
-
},
|
|
11
|
-
discount: {
|
|
12
|
-
amount: -2500,
|
|
13
|
-
currency: Currency.EUR,
|
|
14
|
-
},
|
|
15
|
-
discountPercentage: 25,
|
|
16
|
-
balanceDiscount: {
|
|
17
|
-
amount: 1000,
|
|
18
|
-
currency: Currency.EUR,
|
|
19
|
-
},
|
|
20
|
-
service: {
|
|
21
|
-
reference: "LK-service",
|
|
22
|
-
originalPrice: {
|
|
23
|
-
amount: 10.0,
|
|
24
|
-
currency: Currency.EUR,
|
|
25
|
-
},
|
|
26
|
-
discount: {
|
|
27
|
-
amount: 0,
|
|
28
|
-
currency: Currency.EUR,
|
|
29
|
-
},
|
|
30
|
-
finalPrice: {
|
|
31
|
-
amount: -1000,
|
|
32
|
-
currency: Currency.EUR,
|
|
33
|
-
},
|
|
34
|
-
prepaid: true,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
export { pricing };
|