@lookiero/checkout 0.2.5 → 0.2.7
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/checkoutBooking/model/checkoutBookings.d.ts +3 -3
- package/dist/domain/uiSetting/model/uiSettings.d.ts +3 -3
- package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +1 -4
- package/dist/infrastructure/delivery/bootstrap.js +1 -4
- package/dist/infrastructure/delivery/http/fetchHttpClient.js +0 -1
- package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.d.ts +1 -2
- package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +5 -6
- package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.js +1 -1
- package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.js +1 -1
- package/dist/infrastructure/ui/components/atoms/price/Price.d.ts +7 -0
- package/dist/infrastructure/ui/components/atoms/price/Price.js +22 -0
- package/dist/infrastructure/ui/components/atoms/price/Price.style.d.ts +13 -0
- package/dist/infrastructure/ui/components/atoms/price/Price.style.js +16 -0
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.js +4 -5
- package/dist/infrastructure/ui/components/layouts/body/Body.js +4 -5
- package/dist/infrastructure/ui/components/layouts/body/Body.style.d.ts +3 -2
- package/dist/infrastructure/ui/components/layouts/body/Body.style.js +3 -2
- package/dist/infrastructure/ui/components/layouts/slider/Slider.js +6 -14
- package/dist/infrastructure/ui/components/layouts/slider/Slider.style.d.ts +2 -0
- package/dist/infrastructure/ui/components/layouts/slider/Slider.style.js +2 -0
- package/dist/infrastructure/ui/i18n/i18n.d.ts +4 -1
- package/dist/infrastructure/ui/i18n/i18n.js +3 -0
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +1 -0
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +7 -4
- package/dist/infrastructure/ui/routing/Routing.js +2 -0
- package/dist/infrastructure/ui/views/intro/Intro.js +19 -18
- package/dist/infrastructure/ui/views/intro/Intro.style.d.ts +12 -2
- package/dist/infrastructure/ui/views/intro/Intro.style.js +12 -2
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.d.ts +11 -0
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.js +25 -0
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +19 -0
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +22 -0
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.style.d.ts +0 -1
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.style.js +0 -1
- package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +2 -1
- package/package.json +6 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
|
|
1
|
+
import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
import { CheckoutBooking } from "./checkoutBooking";
|
|
3
|
-
interface CheckoutBookingsGetFunction extends RepositoryGetFunction<CheckoutBooking> {
|
|
3
|
+
interface CheckoutBookingsGetFunction<CheckoutBookingsGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<CheckoutBooking, CheckoutBookingsGetFunctionArgs> {
|
|
4
4
|
}
|
|
5
|
-
interface CheckoutBookingsSaveFunction extends RepositorySaveFunction<CheckoutBooking> {
|
|
5
|
+
interface CheckoutBookingsSaveFunction<CheckoutBookingsSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<CheckoutBooking, CheckoutBookingsSaveFunctionArgs> {
|
|
6
6
|
}
|
|
7
7
|
export { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
|
|
1
|
+
import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
2
|
import { UiSetting } from "./uiSetting";
|
|
3
|
-
interface UiSettingGetFunction extends RepositoryGetFunction<UiSetting> {
|
|
3
|
+
interface UiSettingGetFunction<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<UiSetting, UiSettingGetFunctionArgs> {
|
|
4
4
|
}
|
|
5
|
-
interface UiSettingSaveFunction extends RepositorySaveFunction<UiSetting> {
|
|
5
|
+
interface UiSettingSaveFunction<UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<UiSetting, UiSettingSaveFunctionArgs> {
|
|
6
6
|
}
|
|
7
7
|
export { UiSettingGetFunction, UiSettingSaveFunction };
|
|
@@ -28,9 +28,6 @@ const bootstrap = () => messagingBootstrap({ id: CHECKOUT_MESSAGING_REACT_ID })
|
|
|
28
28
|
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
29
29
|
view: storageUiSettingByKeyView({ read }),
|
|
30
30
|
})
|
|
31
|
-
.command(UPDATE_UI_SETTING, updateUiSettingHandler, {
|
|
32
|
-
get: getUiSetting({ read }),
|
|
33
|
-
save: saveUiSetting({ write }),
|
|
34
|
-
})
|
|
31
|
+
.command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, { read, write })
|
|
35
32
|
.build();
|
|
36
33
|
export { bootstrap };
|
|
@@ -31,10 +31,7 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
31
31
|
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
32
32
|
view: storageUiSettingByKeyView({ read }),
|
|
33
33
|
})
|
|
34
|
-
.command(UPDATE_UI_SETTING, updateUiSettingHandler, {
|
|
35
|
-
get: getUiSetting({ read }),
|
|
36
|
-
save: saveUiSetting({ write }),
|
|
37
|
-
})
|
|
34
|
+
.command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, { read, write })
|
|
38
35
|
.build();
|
|
39
36
|
};
|
|
40
37
|
export { bootstrap, CHECKOUT_MESSAGING_REACT_ID };
|
|
@@ -9,7 +9,6 @@ const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body }) =
|
|
|
9
9
|
const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint }) => fetch(`${apiUrl}${endpoint}`, {
|
|
10
10
|
method: "GET",
|
|
11
11
|
credentials: "include",
|
|
12
|
-
mode: "no-cors",
|
|
13
12
|
headers: {
|
|
14
13
|
authorization: `Bearer ${getAuthToken()}`,
|
|
15
14
|
},
|
|
@@ -3,8 +3,7 @@ import { HttpPostFunction } from "../../../delivery/http/httpClient";
|
|
|
3
3
|
interface HttpCheckoutBookingsSaveFunctionArgs {
|
|
4
4
|
readonly httpPost: HttpPostFunction;
|
|
5
5
|
}
|
|
6
|
-
interface HttpCheckoutBookingsSaveFunction {
|
|
7
|
-
(args: HttpCheckoutBookingsSaveFunctionArgs): CheckoutBookingsSaveFunction;
|
|
6
|
+
interface HttpCheckoutBookingsSaveFunction extends CheckoutBookingsSaveFunction<HttpCheckoutBookingsSaveFunctionArgs> {
|
|
8
7
|
}
|
|
9
8
|
declare const saveCheckoutBooking: HttpCheckoutBookingsSaveFunction;
|
|
10
9
|
export { saveCheckoutBooking };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
1
2
|
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../../../domain/uiSetting/model/uiSettings";
|
|
2
3
|
import { ReadFunction, WriteFunction } from "../../../persistence/storage";
|
|
3
4
|
import { UiSettingDto } from "../../../persistence/uiSettingData";
|
|
4
|
-
interface StorageUiSettingsGetFunctionArgs {
|
|
5
|
+
interface StorageUiSettingsGetFunctionArgs extends RepositoryGetFunctionArgs {
|
|
5
6
|
readonly read: ReadFunction<UiSettingDto>;
|
|
6
7
|
}
|
|
7
|
-
interface StorageUiSettingsGetFunction {
|
|
8
|
-
(args: StorageUiSettingsGetFunctionArgs): UiSettingGetFunction;
|
|
8
|
+
interface StorageUiSettingsGetFunction extends UiSettingGetFunction<StorageUiSettingsGetFunctionArgs> {
|
|
9
9
|
}
|
|
10
10
|
declare const getUiSetting: StorageUiSettingsGetFunction;
|
|
11
|
-
interface StorageUiSettingsSaveFunctionArgs {
|
|
11
|
+
interface StorageUiSettingsSaveFunctionArgs extends RepositorySaveFunctionArgs {
|
|
12
12
|
readonly write: WriteFunction<UiSettingDto>;
|
|
13
13
|
}
|
|
14
|
-
interface StorageUiSettingsSaveFunction {
|
|
15
|
-
(args: StorageUiSettingsSaveFunctionArgs): UiSettingSaveFunction;
|
|
14
|
+
interface StorageUiSettingsSaveFunction extends UiSettingSaveFunction<StorageUiSettingsSaveFunctionArgs> {
|
|
16
15
|
}
|
|
17
16
|
declare const saveUiSetting: StorageUiSettingsSaveFunction;
|
|
18
17
|
export { getUiSetting, saveUiSetting };
|
|
@@ -4,6 +4,6 @@ import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
|
|
|
4
4
|
const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
|
|
5
5
|
query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
|
|
6
6
|
contextId: CHECKOUT_MESSAGING_REACT_ID,
|
|
7
|
-
options: { staleTime: Infinity, retry: false },
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
8
|
});
|
|
9
9
|
export { useViewFirstAvailableCheckoutByCustomerId };
|
|
@@ -4,6 +4,6 @@ import { CHECKOUT_MESSAGING_REACT_ID } from "../../delivery/bootstrap";
|
|
|
4
4
|
const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
|
|
5
5
|
query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
|
|
6
6
|
contextId: CHECKOUT_MESSAGING_REACT_ID,
|
|
7
|
-
options: { staleTime: Infinity },
|
|
7
|
+
options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
8
8
|
});
|
|
9
9
|
export { useViewIsCheckoutAccessibleByCustomerId };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { useI18nNumber } from "@lookiero/i18n-react";
|
|
4
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
5
|
+
import { style } from "./Price.style";
|
|
6
|
+
const Price = ({ price }) => {
|
|
7
|
+
const isDiscounted = price.discountedPrice && price.discountedPrice.percentage !== 0;
|
|
8
|
+
const productPrice = useI18nNumber({
|
|
9
|
+
value: price.amount / 100,
|
|
10
|
+
style: "currency",
|
|
11
|
+
currency: price.currency,
|
|
12
|
+
});
|
|
13
|
+
const productDiscountedPrice = useI18nNumber({
|
|
14
|
+
value: (price.discountedPrice?.amount || 0) / 100,
|
|
15
|
+
style: "currency",
|
|
16
|
+
currency: price.currency,
|
|
17
|
+
});
|
|
18
|
+
return (React.createElement(View, { style: style.price, testID: "price" },
|
|
19
|
+
React.createElement(Text, { body: true, level: 3, style: isDiscounted && style.priceTextDiscounted, testID: "price-text" }, productPrice),
|
|
20
|
+
isDiscounted && (React.createElement(Text, { body: true, level: 3, style: style.discountedPriceText, testID: "discounted-price-text" }, productDiscountedPrice))));
|
|
21
|
+
};
|
|
22
|
+
export { Price };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../theme/theme";
|
|
3
|
+
const { colorPrimary, spaceS } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
price: {
|
|
6
|
+
flexDirection: "row",
|
|
7
|
+
},
|
|
8
|
+
priceTextDiscounted: {
|
|
9
|
+
textDecorationLine: "line-through",
|
|
10
|
+
},
|
|
11
|
+
discountedPriceText: {
|
|
12
|
+
marginLeft: spaceS,
|
|
13
|
+
color: colorPrimary,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export { style };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
2
|
+
import { ActivityIndicator, View } from "react-native";
|
|
3
|
+
import { theme } from "../../../theme/theme";
|
|
3
4
|
import { style } from "./Spinner.style";
|
|
5
|
+
const { colorPrimary } = theme();
|
|
4
6
|
const Spinner = () => (React.createElement(View, { style: style.container },
|
|
5
|
-
React.createElement(
|
|
6
|
-
React.createElement("circle", { cx: "50", cy: "50", r: "32", stroke: "#000000", strokeWidth: "6", strokeLinecap: "round", fill: "none" },
|
|
7
|
-
React.createElement("animateTransform", { attributeName: "transform", type: "rotate", repeatCount: "indefinite", dur: "1.5384615384615383s", values: "0 50 50;180 50 50;720 50 50", keyTimes: "0;0.5;1" }),
|
|
8
|
-
React.createElement("animate", { attributeName: "stroke-dasharray", repeatCount: "indefinite", dur: "1.5384615384615383s", values: "42.22300526424682 158.83892456549995;176.93449825017714 24.127431579569617;42.22300526424682 158.83892456549995", keyTimes: "0;0.5;1" })))));
|
|
7
|
+
React.createElement(ActivityIndicator, { size: "large", color: colorPrimary })));
|
|
9
8
|
export { Spinner };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Box } from "@lookiero/aurora-next/build/components/atoms/Box/Box";
|
|
2
2
|
import { Layout } from "@lookiero/aurora-next/build/components/atoms/Layout/Layout";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { SafeAreaView } from "react-native";
|
|
4
5
|
import { style } from "./Body.style";
|
|
5
|
-
const Body = ({ children }) => (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
React.createElement(Layout, { style: style.layout },
|
|
9
|
-
React.createElement(Box, { size: { M: "2/3", L: "1/3" }, style: style.box }, children)));
|
|
6
|
+
const Body = ({ children }) => (React.createElement(SafeAreaView, { style: style.container },
|
|
7
|
+
React.createElement(Layout, { style: style.layout },
|
|
8
|
+
React.createElement(Box, { size: { M: "2/3", L: "1/3" }, style: style.box }, children))));
|
|
10
9
|
export { Body };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
declare const style: {
|
|
2
|
+
container: {
|
|
3
|
+
flex: number;
|
|
4
|
+
};
|
|
2
5
|
layout: {
|
|
3
6
|
flex: number;
|
|
4
7
|
justifyContent: "center";
|
|
5
8
|
padding: number;
|
|
6
|
-
textAlign: "center";
|
|
7
9
|
};
|
|
8
10
|
box: {
|
|
9
11
|
height: string;
|
|
10
|
-
justifyContent: "space-between";
|
|
11
12
|
};
|
|
12
13
|
};
|
|
13
14
|
export { style };
|
|
@@ -2,15 +2,16 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "../../../theme/theme";
|
|
3
3
|
const { spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
},
|
|
5
8
|
layout: {
|
|
6
9
|
flex: 1,
|
|
7
10
|
justifyContent: "center",
|
|
8
11
|
padding: spaceXL,
|
|
9
|
-
textAlign: "center",
|
|
10
12
|
},
|
|
11
13
|
box: {
|
|
12
14
|
height: "100%",
|
|
13
|
-
justifyContent: "space-between",
|
|
14
15
|
},
|
|
15
16
|
});
|
|
16
17
|
export { style };
|
|
@@ -120,21 +120,13 @@ const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5,
|
|
|
120
120
|
widthRef.current = width;
|
|
121
121
|
fixState();
|
|
122
122
|
}, [fixState]);
|
|
123
|
-
return (React.createElement(View, { onLayout: onLayoutWrapper, testID: "slider" },
|
|
124
|
-
React.createElement(View, { style: StyleSheet.flatten([
|
|
123
|
+
return (React.createElement(View, { style: style.container, onLayout: onLayoutWrapper, testID: "slider" },
|
|
124
|
+
React.createElement(Animated.View, { style: StyleSheet.flatten([
|
|
125
125
|
{
|
|
126
|
-
|
|
126
|
+
transform: [{ translateX: pan.x }, { translateY: pan.y }],
|
|
127
127
|
},
|
|
128
|
-
style.
|
|
129
|
-
]) },
|
|
130
|
-
|
|
131
|
-
{
|
|
132
|
-
width: width * count,
|
|
133
|
-
transform: [{ translateX: pan.x }, { translateY: pan.y }],
|
|
134
|
-
},
|
|
135
|
-
style.sliderAreaStyle,
|
|
136
|
-
]), ...panResponder.panHandlers }, flatennedChildren.map((child, index) => (React.createElement(View, { key: index, style: { width } },
|
|
137
|
-
React.createElement(View, { testID: "slider-child" }, child))))),
|
|
138
|
-
paginationEnabled && (React.createElement(Pagination, { count: count, activeIndex: getActiveIndex(), onChange: (index) => goTo(index), paginationStyle: paginationStyle, paginationItemStyle: paginationItemStyle, paginationActiveItemStyle: paginationActiveItemStyle, renderItem: paginationRenderItem })))));
|
|
128
|
+
style.sliderAreaStyle,
|
|
129
|
+
]), ...panResponder.panHandlers }, flatennedChildren.map((child, index) => (React.createElement(View, { key: index, style: { width }, testID: "slider-child" }, child)))),
|
|
130
|
+
paginationEnabled && (React.createElement(Pagination, { count: count, activeIndex: getActiveIndex(), onChange: (index) => goTo(index), paginationStyle: paginationStyle, paginationItemStyle: paginationItemStyle, paginationActiveItemStyle: paginationActiveItemStyle, renderItem: paginationRenderItem }))));
|
|
139
131
|
};
|
|
140
132
|
export { Slider };
|
|
@@ -5,6 +5,9 @@ declare enum I18nMessages {
|
|
|
5
5
|
INTRO_BULLET_ONE = "intro.bullet_one",
|
|
6
6
|
INTRO_BULLET_TWO = "intro.bullet_two",
|
|
7
7
|
INTRO_BULLET_THREE = "intro.bullet_three",
|
|
8
|
-
INTRO_BUTTON = "intro.button"
|
|
8
|
+
INTRO_BUTTON = "intro.button",
|
|
9
|
+
ITEM_SIZE = "item.size",
|
|
10
|
+
ITEM_COLOR = "item.color",
|
|
11
|
+
ITEM_UNIQUE = "item.unique"
|
|
9
12
|
}
|
|
10
13
|
export { I18nMessages };
|
|
@@ -7,5 +7,8 @@ var I18nMessages;
|
|
|
7
7
|
I18nMessages["INTRO_BULLET_TWO"] = "intro.bullet_two";
|
|
8
8
|
I18nMessages["INTRO_BULLET_THREE"] = "intro.bullet_three";
|
|
9
9
|
I18nMessages["INTRO_BUTTON"] = "intro.button";
|
|
10
|
+
I18nMessages["ITEM_SIZE"] = "item.size";
|
|
11
|
+
I18nMessages["ITEM_COLOR"] = "item.color";
|
|
12
|
+
I18nMessages["ITEM_UNIQUE"] = "item.unique";
|
|
10
13
|
})(I18nMessages || (I18nMessages = {}));
|
|
11
14
|
export { I18nMessages };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import "react-native-get-random-values";
|
|
1
2
|
import React, { useEffect, useRef } from "react";
|
|
2
3
|
import { Outlet } from "react-router-native";
|
|
3
4
|
import { useViewIsCheckoutAccessibleByCustomerId } from "../../projection/react/useViewIsCheckoutAccessibleByCustomerId";
|
|
4
5
|
import { Spinner } from "../components/atoms/spinner/Spinner";
|
|
6
|
+
import { QueryStatus } from "@lookiero/messaging-react";
|
|
5
7
|
const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader = React.createElement(Spinner, null), }) => {
|
|
6
|
-
const [accessible] = useViewIsCheckoutAccessibleByCustomerId({ customerId });
|
|
8
|
+
const [accessible, status] = useViewIsCheckoutAccessibleByCustomerId({ customerId });
|
|
7
9
|
const onNotAccessibleRef = useRef(onNotAccessible);
|
|
8
10
|
onNotAccessibleRef.current = onNotAccessible;
|
|
11
|
+
const notAccessible = accessible === false || status === QueryStatus.ERROR;
|
|
9
12
|
useEffect(() => {
|
|
10
|
-
if (
|
|
13
|
+
if (notAccessible) {
|
|
11
14
|
onNotAccessibleRef.current();
|
|
12
15
|
}
|
|
13
|
-
}, [
|
|
14
|
-
return accessible === undefined ? loader : accessible ? React.createElement(Outlet, null) : null;
|
|
16
|
+
}, [notAccessible, onNotAccessible]);
|
|
17
|
+
return accessible === undefined && [QueryStatus.IDLE, QueryStatus.LOADING].includes(status) ? (loader) : accessible ? (React.createElement(Outlet, null)) : null;
|
|
15
18
|
};
|
|
16
19
|
export { CheckoutAccessibilityMiddleware };
|
|
@@ -14,10 +14,12 @@ const Routing = ({ onNotAccessible, customerId, locale, I18n, onI18nError }) =>
|
|
|
14
14
|
element: React.createElement(CheckoutAccessibilityMiddleware, { customerId: customerId, onNotAccessible: onNotAccessible }),
|
|
15
15
|
children: [
|
|
16
16
|
{
|
|
17
|
+
path: "",
|
|
17
18
|
element: (React.createElement(I18n, { locale: locale, loader: React.createElement(Spinner, null), onError: onI18nError },
|
|
18
19
|
React.createElement(Outlet, null))),
|
|
19
20
|
children: [
|
|
20
21
|
{
|
|
22
|
+
path: "",
|
|
21
23
|
element: React.createElement(CheckoutMiddleware, { customerId: customerId }),
|
|
22
24
|
children: [
|
|
23
25
|
{
|
|
@@ -9,10 +9,10 @@ import { useSetCheckoutIntroShown } from "../../../domain/react/useSetCheckoutIn
|
|
|
9
9
|
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/react/useViewFiveItemsDiscountByCustomerId";
|
|
10
10
|
import { View } from "react-native";
|
|
11
11
|
import React, { useCallback } from "react";
|
|
12
|
-
import { styles } from "./Intro.style";
|
|
13
12
|
import { Body } from "../../components/layouts/body/Body";
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { style } from "./Intro.style";
|
|
14
|
+
const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
|
|
15
|
+
React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
|
|
16
16
|
React.createElement(Text, { detail: true, level: 2 }, text)));
|
|
17
17
|
const Intro = ({ customerId }) => {
|
|
18
18
|
const titleText = useI18nMessage({ id: I18nMessages.INTRO_TITLE });
|
|
@@ -30,20 +30,21 @@ const Intro = ({ customerId }) => {
|
|
|
30
30
|
if (fiveItemsDiscountState === QueryStatus.LOADING)
|
|
31
31
|
return React.createElement(Spinner, null);
|
|
32
32
|
return (React.createElement(Body, null,
|
|
33
|
-
React.createElement(View,
|
|
34
|
-
React.createElement(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
React.createElement(View, { style:
|
|
38
|
-
React.createElement(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
React.createElement(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
React.createElement(View, { style: style.container },
|
|
34
|
+
React.createElement(View, { style: style.content },
|
|
35
|
+
React.createElement(Text, { heading: true, level: 3, style: style.title }, titleText),
|
|
36
|
+
React.createElement(Text, { body: true, level: 3 }, subTitleText),
|
|
37
|
+
React.createElement(View, { style: style.discountContainer },
|
|
38
|
+
React.createElement(View, { style: style.discount },
|
|
39
|
+
React.createElement(Text, { heading: true, level: 2 },
|
|
40
|
+
"- ",
|
|
41
|
+
fiveItemsDiscount),
|
|
42
|
+
React.createElement(Text, { heading: true, level: 3, style: style.percentage }, "%")),
|
|
43
|
+
React.createElement(Text, { body: true, level: 3 }, discountText)),
|
|
44
|
+
React.createElement(View, { style: style.description },
|
|
45
|
+
React.createElement(Bullet, { text: bulletOneText }),
|
|
46
|
+
React.createElement(Bullet, { text: bulletTwoText }),
|
|
47
|
+
React.createElement(Bullet, { text: bulletThreeText }))),
|
|
48
|
+
React.createElement(Button, { disabled: setCheckoutIntroShownStatus === CommandStatus.LOADING, onPress: handleOnPress }, buttonText))));
|
|
48
49
|
};
|
|
49
50
|
export { Intro };
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const style: {
|
|
2
|
+
container: {
|
|
3
|
+
flex: number;
|
|
4
|
+
justifyContent: "space-between";
|
|
5
|
+
};
|
|
6
|
+
content: {
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
textAlign: "center";
|
|
9
|
+
};
|
|
2
10
|
title: {
|
|
3
11
|
marginBottom: number;
|
|
4
12
|
};
|
|
5
13
|
discountContainer: {
|
|
14
|
+
alignItems: "center";
|
|
6
15
|
backgroundColor: string;
|
|
7
16
|
marginVertical: number;
|
|
8
17
|
padding: number;
|
|
18
|
+
textAlign: "center";
|
|
9
19
|
width: string;
|
|
10
20
|
};
|
|
11
21
|
discount: {
|
|
@@ -31,4 +41,4 @@ declare const styles: {
|
|
|
31
41
|
marginRight: number;
|
|
32
42
|
};
|
|
33
43
|
};
|
|
34
|
-
export {
|
|
44
|
+
export { style };
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../theme/theme";
|
|
3
3
|
const { borderSize, colorAccent, spaceXS, spaceS, spaceM, spaceL, spaceXL } = theme();
|
|
4
|
-
const
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
justifyContent: "space-between",
|
|
8
|
+
},
|
|
9
|
+
content: {
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
textAlign: "center",
|
|
12
|
+
},
|
|
5
13
|
title: {
|
|
6
14
|
marginBottom: spaceM,
|
|
7
15
|
},
|
|
8
16
|
discountContainer: {
|
|
17
|
+
alignItems: "center",
|
|
9
18
|
backgroundColor: colorAccent,
|
|
10
19
|
marginVertical: spaceL,
|
|
11
20
|
padding: spaceM,
|
|
21
|
+
textAlign: "center",
|
|
12
22
|
width: "100%",
|
|
13
23
|
},
|
|
14
24
|
discount: {
|
|
@@ -34,4 +44,4 @@ const styles = StyleSheet.create({
|
|
|
34
44
|
marginRight: spaceS,
|
|
35
45
|
},
|
|
36
46
|
});
|
|
37
|
-
export {
|
|
47
|
+
export { style };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ColorProjection, PriceProjection, SizeProjection } from "../../../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
3
|
+
interface ProductVariantDescriptionProps {
|
|
4
|
+
readonly brand: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly price: PriceProjection;
|
|
7
|
+
readonly size: SizeProjection;
|
|
8
|
+
readonly color: ColorProjection;
|
|
9
|
+
}
|
|
10
|
+
declare const ProductVariantDescription: FC<ProductVariantDescriptionProps>;
|
|
11
|
+
export { ProductVariantDescription };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
4
|
+
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
5
|
+
import { I18nMessages } from "../../../../i18n/i18n";
|
|
6
|
+
import { Price } from "../../../../components/atoms/price/Price";
|
|
7
|
+
import { style } from "./ProductVariantDescription.style";
|
|
8
|
+
const ProductVariantDescription = ({ brand, name, price, size, color }) => {
|
|
9
|
+
const sizeText = useI18nMessage({ id: I18nMessages.ITEM_SIZE });
|
|
10
|
+
const colorText = useI18nMessage({ id: I18nMessages.ITEM_COLOR });
|
|
11
|
+
const uniqueText = useI18nMessage({ id: I18nMessages.ITEM_UNIQUE });
|
|
12
|
+
return (React.createElement(View, { style: style.container },
|
|
13
|
+
React.createElement(Text, { detail: true, level: 3, style: style.brand }, brand),
|
|
14
|
+
React.createElement(Text, { body: true, level: 2, style: style.name }, name),
|
|
15
|
+
React.createElement(Price, { price: price }),
|
|
16
|
+
React.createElement(Text, { detail: true, level: 2, style: style.size },
|
|
17
|
+
sizeText,
|
|
18
|
+
": ",
|
|
19
|
+
React.createElement(Text, { style: style.text }, size.unique ? uniqueText : size.lookiero)),
|
|
20
|
+
React.createElement(Text, { detail: true, level: 2 },
|
|
21
|
+
colorText,
|
|
22
|
+
": ",
|
|
23
|
+
React.createElement(Text, { style: style.text }, color.label))));
|
|
24
|
+
};
|
|
25
|
+
export { ProductVariantDescription };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const style: {
|
|
2
|
+
container: {
|
|
3
|
+
width: string;
|
|
4
|
+
};
|
|
5
|
+
brand: {
|
|
6
|
+
color: string;
|
|
7
|
+
textTransform: "uppercase";
|
|
8
|
+
};
|
|
9
|
+
name: {
|
|
10
|
+
marginVertical: number;
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
marginVertical: number;
|
|
14
|
+
};
|
|
15
|
+
text: {
|
|
16
|
+
color: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export { style };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { colorGrayscaleL, spaceS, spaceL } = theme();
|
|
4
|
+
const style = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
},
|
|
8
|
+
brand: {
|
|
9
|
+
color: colorGrayscaleL,
|
|
10
|
+
textTransform: "uppercase",
|
|
11
|
+
},
|
|
12
|
+
name: {
|
|
13
|
+
marginVertical: spaceS,
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
marginVertical: spaceL,
|
|
17
|
+
},
|
|
18
|
+
text: {
|
|
19
|
+
color: colorGrayscaleL,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export { style };
|
|
@@ -101,4 +101,5 @@ interface ViewFirstAvailableCheckoutByCustomerIdHandlerFunctionArgs extends Quer
|
|
|
101
101
|
readonly view: FirstAvailableCheckoutByCustomerIdView;
|
|
102
102
|
}
|
|
103
103
|
declare const viewFirstAvailableCheckoutByCustomerIdHandler: QueryHandlerFunction<ViewFirstAvailableCheckoutByCustomerId, ViewFirstAvailableCheckoutByCustomerIdResult, ViewFirstAvailableCheckoutByCustomerIdHandlerFunctionArgs>;
|
|
104
|
-
export {
|
|
104
|
+
export type { CheckoutItemProjection, CheckoutProjection, ColorProjection, FirstAvailableCheckoutByCustomerIdView, MediaProjection, PriceProjection, SizeProjection, };
|
|
105
|
+
export { CheckoutStatus, CheckoutItemStatus, MediaPerspective, Currency, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerId, viewFirstAvailableCheckoutByCustomerIdHandler, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
"test:coverage": "jest --coverage --coverageReporters=text --detectOpenHandles --forceExit --silent"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@lookiero/i18n": "^0.7.
|
|
25
|
-
"@lookiero/i18n-react": "^0.7.
|
|
26
|
-
"@lookiero/messaging": "^
|
|
27
|
-
"@lookiero/messaging-react": "^
|
|
24
|
+
"@lookiero/i18n": "^0.7.3",
|
|
25
|
+
"@lookiero/i18n-react": "^0.7.3",
|
|
26
|
+
"@lookiero/messaging": "^7.0.0",
|
|
27
|
+
"@lookiero/messaging-react": "^7.0.0",
|
|
28
|
+
"react-native-get-random-values": "^1.8.0",
|
|
28
29
|
"react-router-dom": "^6.3.0",
|
|
29
30
|
"react-router-native": "^6.3.0",
|
|
30
31
|
"uuid": "^9.0.0"
|