@lookiero/checkout 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +2 -1
- package/dist/infrastructure/delivery/bootstrap.d.ts +2 -1
- package/dist/infrastructure/delivery/bootstrap.js +3 -2
- package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +2 -1
- package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.js +2 -1
- package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.js +2 -1
- package/dist/infrastructure/projection/react/useViewUiSettingByKey.js +3 -1
- package/dist/infrastructure/ui/Root.js +8 -10
- package/dist/infrastructure/ui/components/atoms/spinner/Spinner.js +9 -0
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +4 -4
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +12 -9
- package/dist/infrastructure/ui/routing/Routing.js +11 -14
- package/dist/infrastructure/ui/views/intro/Intro.js +5 -7
- package/dist/infrastructure/ui/views/item/Item.js +6 -8
- package/dist/infrastructure/ui/views/summary/Summary.js +5 -7
- package/package.json +6 -3
- package/.eslintignore +0 -7
- package/.eslintrc +0 -72
- package/.expo-shared/assets.json +0 -4
- package/.github/CODEOWNERS +0 -1
- package/.github/actions/version/action.yaml +0 -32
- package/.github/dependabot.yaml +0 -10
- package/.github/workflows/build.yaml +0 -71
- package/.github/workflows/publish.yaml +0 -52
- package/.husky/pre-commit +0 -4
- package/.husky/prepare-commit-msg +0 -26
- package/.husky/prepush +0 -12
- package/.lintstagedrc.json +0 -4
- package/.nvmrc +0 -1
- package/.prettierignore +0 -2
- package/.prettierrc.json +0 -6
- package/@types/aurora-next.d.ts +0 -1
- package/app.config.js +0 -4
- package/app.json +0 -31
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +0 -6
- package/dist/infrastructure/ui/components/atoms/spiner/Spinner.js +0 -11
- package/dist/infrastructure/ui/test/render.d.ts +0 -19
- package/dist/infrastructure/ui/test/render.js +0 -14
- package/jest.config.js +0 -9
- package/jest.setup.js +0 -3
- package/src/Expo.tsx +0 -59
- package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -26
- package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.ts +0 -35
- package/src/domain/checkoutBooking/model/checkoutBooking.test.ts +0 -30
- package/src/domain/checkoutBooking/model/checkoutBooking.ts +0 -33
- package/src/domain/checkoutBooking/model/checkoutBookingBooked.test.ts +0 -23
- package/src/domain/checkoutBooking/model/checkoutBookingBooked.ts +0 -23
- package/src/domain/checkoutBooking/model/checkoutBookings.ts +0 -8
- package/src/domain/uiSetting/command/updateUiSetting.test.ts +0 -19
- package/src/domain/uiSetting/command/updateUiSetting.ts +0 -25
- package/src/domain/uiSetting/model/uiSetting.test.ts +0 -26
- package/src/domain/uiSetting/model/uiSetting.ts +0 -24
- package/src/domain/uiSetting/model/uiSettingUpdated.test.ts +0 -17
- package/src/domain/uiSetting/model/uiSettingUpdated.ts +0 -21
- package/src/domain/uiSetting/model/uiSettings.ts +0 -8
- package/src/index.ts +0 -44
- package/src/infrastructure/delivery/_mock/bootstrap.mock.ts +0 -38
- package/src/infrastructure/delivery/_mock/checkout.mock.ts +0 -81
- package/src/infrastructure/delivery/bootstrap.ts +0 -42
- package/src/infrastructure/delivery/http/fetchHttpClient.test.ts +0 -51
- package/src/infrastructure/delivery/http/fetchHttpClient.ts +0 -41
- package/src/infrastructure/delivery/http/httpClient.ts +0 -18
- package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.test.ts +0 -45
- package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.ts +0 -34
- package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -38
- package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.ts +0 -46
- package/src/infrastructure/domain/react/useSetCheckoutIntroShown.test.ts +0 -34
- package/src/infrastructure/domain/react/useSetCheckoutIntroShown.ts +0 -30
- package/src/infrastructure/domain/react/useUpdateUiSetting.test.ts +0 -31
- package/src/infrastructure/domain/react/useUpdateUiSetting.ts +0 -45
- package/src/infrastructure/domain/uiSetting/model/storageUiSettings.test.ts +0 -50
- package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +0 -52
- package/src/infrastructure/persistence/asyncStorageStorage.ts +0 -13
- package/src/infrastructure/persistence/storage.ts +0 -9
- package/src/infrastructure/persistence/uiSettingData.ts +0 -7
- package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.test.ts +0 -65
- package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.ts +0 -102
- package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.test.ts +0 -99
- package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.ts +0 -128
- package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.test.ts +0 -32
- package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.ts +0 -27
- package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -51
- package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +0 -25
- package/src/infrastructure/projection/react/useViewCheckoutIntroShown.test.ts +0 -41
- package/src/infrastructure/projection/react/useViewCheckoutIntroShown.ts +0 -9
- package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.test.ts +0 -28
- package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.ts +0 -22
- package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.test.ts +0 -44
- package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.ts +0 -24
- package/src/infrastructure/projection/react/useViewUiSettingByKey.test.ts +0 -30
- package/src/infrastructure/projection/react/useViewUiSettingByKey.ts +0 -24
- package/src/infrastructure/projection/storageUiSettingByKeyView.test.ts +0 -32
- package/src/infrastructure/projection/storageUiSettingByKeyView.ts +0 -37
- package/src/infrastructure/ui/Root.tsx +0 -53
- package/src/infrastructure/ui/components/atoms/spiner/Spinner.style.ts +0 -12
- package/src/infrastructure/ui/components/atoms/spiner/Spinner.tsx +0 -35
- package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.test.tsx +0 -70
- package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.tsx +0 -31
- package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +0 -100
- package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +0 -52
- package/src/infrastructure/ui/routing/Routing.tsx +0 -64
- package/src/infrastructure/ui/routing/router/Router.native.ts +0 -1
- package/src/infrastructure/ui/routing/router/Router.ts +0 -1
- package/src/infrastructure/ui/routing/routes.ts +0 -6
- package/src/infrastructure/ui/settings/UISettings.ts +0 -5
- package/src/infrastructure/ui/test/render.tsx +0 -47
- package/src/infrastructure/ui/views/intro/Intro.test.tsx +0 -15
- package/src/infrastructure/ui/views/intro/Intro.tsx +0 -27
- package/src/infrastructure/ui/views/item/Item.tsx +0 -31
- package/src/infrastructure/ui/views/summary/Summary.tsx +0 -27
- package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +0 -40
- package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +0 -85
- package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.test.ts +0 -22
- package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.ts +0 -149
- package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.test.ts +0 -54
- package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.ts +0 -46
- package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.test.ts +0 -20
- package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.ts +0 -51
- package/src/projection/uiSetting/viewUiSettingByKey.test.ts +0 -22
- package/src/projection/uiSetting/viewUiSettingByKey.ts +0 -55
- package/tsconfig.build.json +0 -16
- package/tsconfig.json +0 -19
- package/webpack.config.js +0 -17
- /package/dist/infrastructure/ui/components/atoms/{spiner → spinner}/Spinner.d.ts +0 -0
- /package/dist/infrastructure/ui/components/atoms/{spiner → spinner}/Spinner.style.d.ts +0 -0
- /package/dist/infrastructure/ui/components/atoms/{spiner → spinner}/Spinner.style.js +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
#
|
|
3
|
-
# Automatically add branch name and branch description to every commit message except merge commit.
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
COMMIT_EDITMSG=$1
|
|
7
|
-
|
|
8
|
-
addBranchName() {
|
|
9
|
-
NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
10
|
-
DESCRIPTION=$(git config branch."$NAME".description)
|
|
11
|
-
if [ ! -z "$NAME" ] && [ "$NAME" != "HEAD" ] ; then
|
|
12
|
-
echo "[$NAME]: $(cat $COMMIT_EDITMSG)" > $COMMIT_EDITMSG
|
|
13
|
-
if [ -n "$DESCRIPTION" ]
|
|
14
|
-
then
|
|
15
|
-
echo "" >> $COMMIT_EDITMSG
|
|
16
|
-
echo $DESCRIPTION >> $COMMIT_EDITMSG
|
|
17
|
-
fi
|
|
18
|
-
fi
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
IS_AMEND=$(ps -ocommand= -p $PPID | grep -e '--amend');
|
|
22
|
-
MERGE=$(cat $COMMIT_EDITMSG|grep -i 'merge'|wc -l)
|
|
23
|
-
|
|
24
|
-
if ! [ -n "$IS_AMEND" ] && [ $MERGE -eq 0 ] ; then
|
|
25
|
-
addBranchName
|
|
26
|
-
fi
|
package/.husky/prepush
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
protected_branch='master'
|
|
4
|
-
current_branch=$(git rev-parse --abbrev-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
|
5
|
-
|
|
6
|
-
if [ $protected_branch = $current_branch ]
|
|
7
|
-
then
|
|
8
|
-
echo "Push master is not allowed"
|
|
9
|
-
exit 1 # push will not execute
|
|
10
|
-
else
|
|
11
|
-
exit 0 # push will execute
|
|
12
|
-
fi
|
package/.lintstagedrc.json
DELETED
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v14.19.3
|
package/.prettierignore
DELETED
package/.prettierrc.json
DELETED
package/@types/aurora-next.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module "@lookiero/aurora-next";
|
package/app.config.js
DELETED
package/app.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"expo": {
|
|
3
|
-
"name": "checkout-front",
|
|
4
|
-
"slug": "checkout-front",
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"orientation": "portrait",
|
|
7
|
-
"icon": "./assets/icon.png",
|
|
8
|
-
"userInterfaceStyle": "light",
|
|
9
|
-
"splash": {
|
|
10
|
-
"image": "./assets/splash.png",
|
|
11
|
-
"resizeMode": "contain",
|
|
12
|
-
"backgroundColor": "#ffffff"
|
|
13
|
-
},
|
|
14
|
-
"updates": {
|
|
15
|
-
"fallbackToCacheTimeout": 0
|
|
16
|
-
},
|
|
17
|
-
"assetBundlePatterns": ["**/*"],
|
|
18
|
-
"ios": {
|
|
19
|
-
"supportsTablet": true
|
|
20
|
-
},
|
|
21
|
-
"android": {
|
|
22
|
-
"adaptiveIcon": {
|
|
23
|
-
"foregroundImage": "./assets/adaptive-icon.png",
|
|
24
|
-
"backgroundColor": "#FFFFFF"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"web": {
|
|
28
|
-
"favicon": "./assets/favicon.png"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
package/assets/adaptive-icon.png
DELETED
|
Binary file
|
package/assets/favicon.png
DELETED
|
Binary file
|
package/assets/icon.png
DELETED
|
Binary file
|
package/assets/splash.png
DELETED
|
Binary file
|
package/babel.config.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { View } from "react-native";
|
|
2
|
-
import { style } from "./Spinner.style";
|
|
3
|
-
const Spinner = () => (<View style={style.container}>
|
|
4
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="30px" height="30px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
|
|
5
|
-
<circle cx="50" cy="50" r="32" stroke="#000000" strokeWidth="6" strokeLinecap="round" fill="none">
|
|
6
|
-
<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"></animateTransform>
|
|
7
|
-
<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"></animate>
|
|
8
|
-
</circle>
|
|
9
|
-
</svg>
|
|
10
|
-
</View>);
|
|
11
|
-
export { Spinner };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
2
|
-
import { RenderAPI } from "@testing-library/react-native";
|
|
3
|
-
import { TranslationMessages } from "@lookiero/i18n/domain/translation/model/translationMessages";
|
|
4
|
-
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
5
|
-
interface Viewport {
|
|
6
|
-
readonly height: number;
|
|
7
|
-
readonly width: number;
|
|
8
|
-
}
|
|
9
|
-
interface RenderArgs {
|
|
10
|
-
readonly locale?: string;
|
|
11
|
-
readonly viewport?: Viewport;
|
|
12
|
-
readonly messages?: TranslationMessages;
|
|
13
|
-
readonly messaging?: MessagingRoot;
|
|
14
|
-
}
|
|
15
|
-
interface RenderWithProvidersFunction {
|
|
16
|
-
(ui: ReactElement, args?: RenderArgs): RenderAPI;
|
|
17
|
-
}
|
|
18
|
-
declare const renderWithProviders: RenderWithProvidersFunction;
|
|
19
|
-
export { renderWithProviders as render };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Aurora } from "@lookiero/aurora-next/build/components/primitives/Aurora/Aurora";
|
|
2
|
-
import { Fragment } from "react";
|
|
3
|
-
import { render } from "@testing-library/react-native";
|
|
4
|
-
import { IntlProvider } from "react-intl";
|
|
5
|
-
const defaultViewport = { width: 1200, height: 800 };
|
|
6
|
-
const renderWrapper = ({ locale, viewport, messages = {}, messaging: Messaging = Fragment }) =>
|
|
7
|
-
// eslint-disable-next-line react/display-name, react/prop-types
|
|
8
|
-
({ children }) => (<Aurora forceViewport={viewport}>
|
|
9
|
-
<IntlProvider messages={messages} locale={locale} onError={() => void 0}>
|
|
10
|
-
<Messaging>{children}</Messaging>
|
|
11
|
-
</IntlProvider>
|
|
12
|
-
</Aurora>);
|
|
13
|
-
const renderWithProviders = (ui, { locale, viewport, messages, messaging } = { locale: "en", viewport: defaultViewport }) => render(ui, { wrapper: renderWrapper({ locale, viewport, messages, messaging }) });
|
|
14
|
-
export { renderWithProviders as render };
|
package/jest.config.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
preset: "jest-expo",
|
|
3
|
-
transformIgnorePatterns: [
|
|
4
|
-
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg|@lookiero/messaging|@lookiero/messaging-react|@lookiero/i18n|@lookiero/i18n-react|react-router-native)",
|
|
5
|
-
],
|
|
6
|
-
coveragePathIgnorePatterns: ["<rootDir>/src/infrastructure/ui/test/"],
|
|
7
|
-
testPathIgnorePatterns: ["<rootDir>/dist/"],
|
|
8
|
-
setupFiles: ["<rootDir>/jest.setup.js"],
|
|
9
|
-
};
|
package/jest.setup.js
DELETED
package/src/Expo.tsx
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Aurora } from "@lookiero/aurora-next/build/components/primitives/Aurora/Aurora";
|
|
2
|
-
import { Text } from "@lookiero/aurora-next/build/components/primitives/Text/Text";
|
|
3
|
-
import { useFonts } from "expo-font";
|
|
4
|
-
import { activateKeepAwake } from "expo-keep-awake";
|
|
5
|
-
import withExpoRoot from "expo/build/launch/withExpoRoot";
|
|
6
|
-
import { useCallback, useState } from "react";
|
|
7
|
-
import { createRoot } from "react-dom/client";
|
|
8
|
-
import { AppRegistry, Platform, StatusBar } from "react-native";
|
|
9
|
-
// import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/_mock/bootstrap.mock";
|
|
10
|
-
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
11
|
-
import { root } from "./infrastructure/ui/Root";
|
|
12
|
-
|
|
13
|
-
const apiUrl = Platform.OS === "web" ? "/local-to-dev" : "https://web2.ps.dev.aws.lookiero.es/checkout/api";
|
|
14
|
-
const authToken =
|
|
15
|
-
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIwOTUxNjAsImV4cCI6MTY2NTEzMzQxMywiZGlzcGxheU5hbWUiOiJBbGV4YW5kZXIiLCJjb3VudHJ5X2NvZGUiOiJFUyIsImFjY2Vzc1ZpYSI6ImVtYWlsIiwic3Vic2NyaXB0aW9uU3RhcnRpbmdEYXRlIjoiMjAyMC0wOS0wMSIsImltcGVyc29uYXRlZCI6ZmFsc2UsInV1aWQiOiJjZjdjNjQxZi0wZTVjLTQ4NTAtYWUwNy0yNzY3NDdlZGZkMGIiLCJpYXQiOjE2NjI1NDE0MTN9.v17FPhySnvKPjOYiZumdcy-pVQO-F_PHjWSY-tnk2xU";
|
|
16
|
-
|
|
17
|
-
// const { Component: Messaging } = checkoutMockBootstrap();
|
|
18
|
-
const { Component: Messaging } = checkoutBootstrap({ apiUrl, getAuthToken: () => authToken });
|
|
19
|
-
const Root = root({ Messaging });
|
|
20
|
-
|
|
21
|
-
const ExpoRoot = () => {
|
|
22
|
-
const [fontsLoaded] = useFonts({
|
|
23
|
-
["Romie-Regular"]: require("@lookiero/aurora-fonts/Romie-Regular.ttf"),
|
|
24
|
-
["FoundersGroteskText-Regular"]: require("@lookiero/aurora-fonts/FoundersGroteskText-Regular.ttf"),
|
|
25
|
-
auroraicons: require("@lookiero/aurora-iconfont/dist/auroraicons.ttf"),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const [isAccessible, setIsAccessible] = useState<boolean>();
|
|
29
|
-
const onNotAccessible = useCallback(() => setIsAccessible(false), []);
|
|
30
|
-
|
|
31
|
-
return fontsLoaded ? (
|
|
32
|
-
<>
|
|
33
|
-
<Aurora usePortal={false} useStack={false}>
|
|
34
|
-
{isAccessible === false && <Text heading={true}>Checkout is not accessible!</Text>}
|
|
35
|
-
<Root locale="es" customerId="606d8c89-d4f2-438b-89a8-906e6526992d" onNotAccessible={onNotAccessible} />
|
|
36
|
-
</Aurora>
|
|
37
|
-
<StatusBar />
|
|
38
|
-
</>
|
|
39
|
-
) : null;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
if (__DEV__) {
|
|
43
|
-
activateKeepAwake();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
AppRegistry.registerComponent("main", () => withExpoRoot(ExpoRoot));
|
|
47
|
-
|
|
48
|
-
if ("web" === Platform.OS) {
|
|
49
|
-
const rootElement = document.getElementById("root") ?? document.getElementById("main");
|
|
50
|
-
|
|
51
|
-
if (rootElement) {
|
|
52
|
-
const rootTag = createRoot(rootElement);
|
|
53
|
-
const RootComponent = withExpoRoot(ExpoRoot);
|
|
54
|
-
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
rootTag.render(<RootComponent />);
|
|
58
|
-
}
|
|
59
|
-
}
|
package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.test.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
import {
|
|
3
|
-
bookSizeReplaceableProductVariantsForCheckoutItem as sut,
|
|
4
|
-
BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM,
|
|
5
|
-
} from "./bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
6
|
-
|
|
7
|
-
describe("bookSizeReplaceableProductVariantsForCheckoutItem", () => {
|
|
8
|
-
it("returns an BookSizeReplaceableProductVariantsForCheckoutItem command", () => {
|
|
9
|
-
const aggregateId = uuid();
|
|
10
|
-
const checkoutBooking = {
|
|
11
|
-
checkoutId: "this-should-be-a-uuid",
|
|
12
|
-
checkoutItemId: "this-should-be-a-uuid",
|
|
13
|
-
checkoutBookingId: "this-should-be-a-uuid",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const command = sut({ aggregateId, ...checkoutBooking });
|
|
17
|
-
|
|
18
|
-
expect(command.aggregateId).toBe(aggregateId);
|
|
19
|
-
expect(command.checkoutId).toBe(checkoutBooking.checkoutId);
|
|
20
|
-
expect(command.checkoutItemId).toBe(checkoutBooking.checkoutItemId);
|
|
21
|
-
expect(command.checkoutBookingId).toBe(checkoutBooking.checkoutBookingId);
|
|
22
|
-
expect(command.name).toBe(BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM);
|
|
23
|
-
expect(typeof command.messageId).toBe("string");
|
|
24
|
-
expect(typeof command.occurredOn).toBe("number");
|
|
25
|
-
});
|
|
26
|
-
});
|
package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { command, Command } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM =
|
|
4
|
-
"book_size_replaceable_product_variants_for_checkout_item";
|
|
5
|
-
|
|
6
|
-
interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
|
|
7
|
-
readonly aggregateId: string;
|
|
8
|
-
readonly checkoutId: string;
|
|
9
|
-
readonly checkoutItemId: string;
|
|
10
|
-
readonly checkoutBookingId: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface BookSizeReplaceableProductVariantsForCheckoutItem
|
|
14
|
-
extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>,
|
|
15
|
-
BookSizeReplaceableProductVariantsForCheckoutItemPayload {}
|
|
16
|
-
|
|
17
|
-
interface BookSizeReplaceableProductVariantsForCheckoutItemFunction {
|
|
18
|
-
(
|
|
19
|
-
payload: BookSizeReplaceableProductVariantsForCheckoutItemPayload,
|
|
20
|
-
): BookSizeReplaceableProductVariantsForCheckoutItem;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction = ({
|
|
24
|
-
aggregateId,
|
|
25
|
-
...payload
|
|
26
|
-
}) => ({
|
|
27
|
-
...command({ aggregateId, name: BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
|
|
28
|
-
...payload,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM,
|
|
33
|
-
BookSizeReplaceableProductVariantsForCheckoutItem,
|
|
34
|
-
bookSizeReplaceableProductVariantsForCheckoutItem,
|
|
35
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { DomainEvent, QueryBus } from "@lookiero/messaging";
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
|
-
import { mock } from "jest-mock-extended";
|
|
4
|
-
import { CHECKOUT_BOOKING_BOOKED } from "./checkoutBookingBooked";
|
|
5
|
-
import { bookSizeReplaceableProductVariantsForCheckoutItemHandler as sut } from "./checkoutBooking";
|
|
6
|
-
import { bookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
7
|
-
|
|
8
|
-
describe("checkoutBooking", () => {
|
|
9
|
-
const queryBus = mock<QueryBus>();
|
|
10
|
-
|
|
11
|
-
it("bookSizeReplaceableProductVariantsForCheckoutItem publishing CheckoutBookingBooked", async () => {
|
|
12
|
-
const aggregateId = uuid();
|
|
13
|
-
const checkoutBooking = {
|
|
14
|
-
checkoutId: "this-should-be-a-uuid",
|
|
15
|
-
checkoutItemId: "this-should-be-a-uuid",
|
|
16
|
-
checkoutBookingId: "this-should-be-a-uuid",
|
|
17
|
-
};
|
|
18
|
-
const state = { aggregateId, ...checkoutBooking, domainEvents: [] };
|
|
19
|
-
|
|
20
|
-
const command = bookSizeReplaceableProductVariantsForCheckoutItem({ aggregateId, ...checkoutBooking });
|
|
21
|
-
|
|
22
|
-
const aggregateRoot = await sut({ queryBus })({ aggregateRoot: state, command });
|
|
23
|
-
|
|
24
|
-
expect(aggregateRoot.aggregateId).toBe(aggregateId);
|
|
25
|
-
expect(aggregateRoot.checkoutId).toBe(checkoutBooking.checkoutId);
|
|
26
|
-
expect(aggregateRoot.checkoutItemId).toBe(checkoutBooking.checkoutItemId);
|
|
27
|
-
expect(aggregateRoot.checkoutBookingId).toBe(checkoutBooking.checkoutBookingId);
|
|
28
|
-
expect((aggregateRoot.domainEvents as DomainEvent<string>).name).toBe(CHECKOUT_BOOKING_BOOKED);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
-
import { BookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bookSizeReplaceableProductVariantsForCheckoutItem";
|
|
3
|
-
import { checkoutBookingBooked } from "./checkoutBookingBooked";
|
|
4
|
-
|
|
5
|
-
interface CheckoutBooking extends AggregateRoot {
|
|
6
|
-
readonly checkoutId: string;
|
|
7
|
-
readonly checkoutItemId: string;
|
|
8
|
-
readonly checkoutBookingId: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<
|
|
12
|
-
BookSizeReplaceableProductVariantsForCheckoutItem,
|
|
13
|
-
CheckoutBooking
|
|
14
|
-
> =
|
|
15
|
-
() =>
|
|
16
|
-
async ({ aggregateRoot, command }) => {
|
|
17
|
-
const { aggregateId, checkoutId, checkoutItemId, checkoutBookingId } = command;
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
...aggregateRoot,
|
|
21
|
-
checkoutId,
|
|
22
|
-
checkoutItemId,
|
|
23
|
-
checkoutBookingId,
|
|
24
|
-
domainEvents: checkoutBookingBooked({
|
|
25
|
-
aggregateId,
|
|
26
|
-
checkoutId,
|
|
27
|
-
checkoutItemId,
|
|
28
|
-
checkoutBookingId,
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { CheckoutBooking, bookSizeReplaceableProductVariantsForCheckoutItemHandler };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
import { checkoutBookingBooked as sut, CHECKOUT_BOOKING_BOOKED } from "./checkoutBookingBooked";
|
|
3
|
-
|
|
4
|
-
describe("checkoutBookingBooked", () => {
|
|
5
|
-
it("returns an CheckoutBookingBooked domain event", () => {
|
|
6
|
-
const aggregateId = uuid();
|
|
7
|
-
const checkoutBooking = {
|
|
8
|
-
checkoutId: "this-should-be-a-uuid",
|
|
9
|
-
checkoutItemId: "this-should-be-a-uuid",
|
|
10
|
-
checkoutBookingId: "this-should-be-a-uuid",
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const domainEvent = sut({ aggregateId, ...checkoutBooking });
|
|
14
|
-
|
|
15
|
-
expect(domainEvent.aggregateId).toBe(aggregateId);
|
|
16
|
-
expect(domainEvent.checkoutId).toBe(checkoutBooking.checkoutId);
|
|
17
|
-
expect(domainEvent.checkoutItemId).toBe(checkoutBooking.checkoutItemId);
|
|
18
|
-
expect(domainEvent.checkoutBookingId).toBe(checkoutBooking.checkoutBookingId);
|
|
19
|
-
expect(domainEvent.name).toBe(CHECKOUT_BOOKING_BOOKED);
|
|
20
|
-
expect(typeof domainEvent.messageId).toBe("string");
|
|
21
|
-
expect(typeof domainEvent.occurredOn).toBe("number");
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { domainEvent, DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
|
|
4
|
-
|
|
5
|
-
interface CheckoutBookingBookedPayload {
|
|
6
|
-
readonly aggregateId: string;
|
|
7
|
-
readonly checkoutId: string;
|
|
8
|
-
readonly checkoutItemId: string;
|
|
9
|
-
readonly checkoutBookingId: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {}
|
|
13
|
-
|
|
14
|
-
interface CheckoutBookingBookedFunction {
|
|
15
|
-
(payload: CheckoutBookingBookedPayload): CheckoutBookingBooked;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const checkoutBookingBooked: CheckoutBookingBookedFunction = ({ aggregateId, ...payload }) => ({
|
|
19
|
-
...domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BOOKED }),
|
|
20
|
-
...payload,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export { CHECKOUT_BOOKING_BOOKED, CheckoutBookingBooked, checkoutBookingBooked };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
|
|
2
|
-
import { CheckoutBooking } from "./checkoutBooking";
|
|
3
|
-
|
|
4
|
-
interface CheckoutBookingsGetFunction extends RepositoryGetFunction<CheckoutBooking> {}
|
|
5
|
-
|
|
6
|
-
interface CheckoutBookingsSaveFunction extends RepositorySaveFunction<CheckoutBooking> {}
|
|
7
|
-
|
|
8
|
-
export { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
import { updateUiSetting as sut, UPDATE_UI_SETTING } from "./updateUiSetting";
|
|
3
|
-
|
|
4
|
-
describe("updateUiSetting", () => {
|
|
5
|
-
it("returns an UpdateUiSetting command", () => {
|
|
6
|
-
const aggregateId = uuid();
|
|
7
|
-
const key = "ui_setting_key";
|
|
8
|
-
const value = "ui_setting_value";
|
|
9
|
-
|
|
10
|
-
const command = sut({ aggregateId, key, value });
|
|
11
|
-
|
|
12
|
-
expect(command.aggregateId).toBe(aggregateId);
|
|
13
|
-
expect(command.key).toBe(key);
|
|
14
|
-
expect(command.value).toBe(value);
|
|
15
|
-
expect(command.name).toBe(UPDATE_UI_SETTING);
|
|
16
|
-
expect(typeof command.messageId).toBe("string");
|
|
17
|
-
expect(typeof command.occurredOn).toBe("number");
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { command, Command } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
const UPDATE_UI_SETTING = "update_ui_setting";
|
|
4
|
-
|
|
5
|
-
interface UpdateUiSettingPayload {
|
|
6
|
-
readonly aggregateId: string;
|
|
7
|
-
readonly key: string;
|
|
8
|
-
readonly value: unknown;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {}
|
|
12
|
-
|
|
13
|
-
interface UpdateUiSettingFunction {
|
|
14
|
-
(payload: UpdateUiSettingPayload): UpdateUiSetting;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const updateUiSetting: UpdateUiSettingFunction = ({ aggregateId, ...payload }) => ({
|
|
18
|
-
...command({
|
|
19
|
-
aggregateId,
|
|
20
|
-
name: UPDATE_UI_SETTING,
|
|
21
|
-
}),
|
|
22
|
-
...payload,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export { UPDATE_UI_SETTING, UpdateUiSetting, updateUiSetting };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DomainEvent, QueryBus } from "@lookiero/messaging";
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
|
-
import { mock } from "jest-mock-extended";
|
|
4
|
-
import { UI_SETTING_UPDATED } from "./uiSettingUpdated";
|
|
5
|
-
import { updateUiSettingHandler as sut } from "./uiSetting";
|
|
6
|
-
import { updateUiSetting } from "../command/updateUiSetting";
|
|
7
|
-
|
|
8
|
-
describe("uiSetting", () => {
|
|
9
|
-
const queryBus = mock<QueryBus>();
|
|
10
|
-
|
|
11
|
-
it("updateUiSetting publishing UiSettingUpdated", async () => {
|
|
12
|
-
const aggregateId = uuid();
|
|
13
|
-
const key = "ui_setting_key";
|
|
14
|
-
const value = "ui_setting_value";
|
|
15
|
-
const state = { aggregateId, key, value, domainEvents: [] };
|
|
16
|
-
|
|
17
|
-
const command = updateUiSetting({ aggregateId, key, value });
|
|
18
|
-
|
|
19
|
-
const aggregateRoot = await sut({ queryBus })({ aggregateRoot: state, command });
|
|
20
|
-
|
|
21
|
-
expect(aggregateRoot.aggregateId).toBe(aggregateId);
|
|
22
|
-
expect(aggregateRoot.key).toBe(key);
|
|
23
|
-
expect(aggregateRoot.value).toBe(value);
|
|
24
|
-
expect((aggregateRoot.domainEvents as DomainEvent<string>).name).toBe(UI_SETTING_UPDATED);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AggregateRoot } from "@lookiero/messaging";
|
|
2
|
-
import { CommandHandlerFunction } from "@lookiero/messaging/domain/model";
|
|
3
|
-
import { UpdateUiSetting } from "../command/updateUiSetting";
|
|
4
|
-
import { uiSettingUpdated } from "./uiSettingUpdated";
|
|
5
|
-
|
|
6
|
-
interface UiSetting extends AggregateRoot {
|
|
7
|
-
readonly key: string;
|
|
8
|
-
readonly value: unknown;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting> =
|
|
12
|
-
() =>
|
|
13
|
-
async ({ aggregateRoot, command }) => {
|
|
14
|
-
const { aggregateId, key, value } = command;
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
...aggregateRoot,
|
|
18
|
-
key,
|
|
19
|
-
value,
|
|
20
|
-
domainEvents: uiSettingUpdated({ aggregateId, key }),
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { UiSetting, updateUiSettingHandler };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
import { uiSettingUpdated as sut, UI_SETTING_UPDATED } from "./uiSettingUpdated";
|
|
3
|
-
|
|
4
|
-
describe("uiSettingUpdated", () => {
|
|
5
|
-
it("returns an UiSettingUpdated domain event", () => {
|
|
6
|
-
const aggregateId = uuid();
|
|
7
|
-
const key = "ui_setting_key";
|
|
8
|
-
|
|
9
|
-
const domainEvent = sut({ aggregateId, key });
|
|
10
|
-
|
|
11
|
-
expect(domainEvent.aggregateId).toBe(aggregateId);
|
|
12
|
-
expect(domainEvent.key).toBe(key);
|
|
13
|
-
expect(domainEvent.name).toBe(UI_SETTING_UPDATED);
|
|
14
|
-
expect(typeof domainEvent.messageId).toBe("string");
|
|
15
|
-
expect(typeof domainEvent.occurredOn).toBe("number");
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { domainEvent, DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
|
|
3
|
-
const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
4
|
-
|
|
5
|
-
interface UiSettingUpdatedPayload {
|
|
6
|
-
readonly aggregateId: string;
|
|
7
|
-
readonly key: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {}
|
|
11
|
-
|
|
12
|
-
interface UiSettingUpdatedFunction {
|
|
13
|
-
(payload: UiSettingUpdatedPayload): UiSettingUpdated;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const uiSettingUpdated: UiSettingUpdatedFunction = ({ aggregateId, key }) => ({
|
|
17
|
-
...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
|
|
18
|
-
key,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { UI_SETTING_UPDATED, UiSettingUpdated, uiSettingUpdated };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
|
|
2
|
-
import { UiSetting } from "./uiSetting";
|
|
3
|
-
|
|
4
|
-
interface UiSettingGetFunction extends RepositoryGetFunction<UiSetting> {}
|
|
5
|
-
|
|
6
|
-
interface UiSettingSaveFunction extends RepositorySaveFunction<UiSetting> {}
|
|
7
|
-
|
|
8
|
-
export { UiSettingGetFunction, UiSettingSaveFunction };
|
package/src/index.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
3
|
-
import { root, RootProps } from "./infrastructure/ui/Root";
|
|
4
|
-
import {
|
|
5
|
-
IsCheckoutAccessibleByCustomerIdProjection,
|
|
6
|
-
viewIsCheckoutAccessibleByCustomerId,
|
|
7
|
-
} from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
|
|
8
|
-
|
|
9
|
-
interface IsCheckoutAccessibleFunctionArgs {
|
|
10
|
-
readonly customerId: string | undefined;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface IsCheckoutAccessibleFunction {
|
|
14
|
-
(args: IsCheckoutAccessibleFunctionArgs): Promise<IsCheckoutAccessibleByCustomerIdProjection>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface BootstrapFunctionArgs {
|
|
18
|
-
readonly getAuthToken: () => string;
|
|
19
|
-
readonly apiUrl: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface BootstrapFunctionReturn {
|
|
23
|
-
readonly Root: FC<RootProps>;
|
|
24
|
-
readonly isCheckoutAccessible: IsCheckoutAccessibleFunction;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface BootstrapFunction {
|
|
28
|
-
(args: BootstrapFunctionArgs): BootstrapFunctionReturn;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken }) => {
|
|
32
|
-
const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
|
|
33
|
-
const Root = root({ Messaging });
|
|
34
|
-
|
|
35
|
-
const isCheckoutAccessible: IsCheckoutAccessibleFunction = ({ customerId }) =>
|
|
36
|
-
queryBus(viewIsCheckoutAccessibleByCustomerId({ customerId }));
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
Root,
|
|
40
|
-
isCheckoutAccessible,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export { bootstrap };
|