@lookiero/checkout 0.2.9 → 0.2.10

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/index.d.ts CHANGED
@@ -10,7 +10,7 @@ interface IsCheckoutAccessibleFunction {
10
10
  (args: IsCheckoutAccessibleFunctionArgs): Promise<IsCheckoutAccessibleByCustomerIdProjection>;
11
11
  }
12
12
  interface BootstrapFunctionArgs {
13
- readonly getAuthToken: () => string;
13
+ readonly getAuthToken: () => Promise<string>;
14
14
  readonly apiUrl: string;
15
15
  readonly translations: EndpointFunction;
16
16
  }
@@ -0,0 +1,31 @@
1
+ import { AggregateRoot, RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
2
+ import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
3
+ import { Checkout } from "../../domain/checkout/model/checkout";
4
+ import { CheckoutsGetFunction, CheckoutsSaveFunction } from "../../domain/checkout/model/checkouts";
5
+ import { UiSetting } from "../../domain/uiSetting/model/uiSetting";
6
+ import { UiSettingGetFunction, UiSettingSaveFunction } from "../../domain/uiSetting/model/uiSettings";
7
+ import { CheckoutByIdView } from "../../projection/checkout/viewCheckoutById";
8
+ import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
9
+ import { FiveItemsDiscountByCustomerIdView } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
10
+ import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
11
+ import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
12
+ declare const MESSAGING_CONTEXT_ID = "Checkout";
13
+ declare type RepositoryDependencies<A extends AggregateRoot, GetFunctionArgs extends RepositoryGetFunctionArgs, SaveFunctionArgs extends RepositorySaveFunctionArgs> = Omit<Parameters<RepositoryGetFunction<A, GetFunctionArgs>>[0] & Parameters<RepositorySaveFunction<A, SaveFunctionArgs>>[0], keyof RepositoryGetFunctionArgs>;
14
+ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs, UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs> {
15
+ readonly checkoutByIdView: CheckoutByIdView;
16
+ readonly firstAvailableCheckoutByCustomerIdView: FirstAvailableCheckoutByCustomerIdView;
17
+ readonly isCheckoutEnabledByCustomerIdView: IsCheckoutEnabledByCustomerIdView;
18
+ readonly fiveItemsDiscountByCustomerIdView: FiveItemsDiscountByCustomerIdView;
19
+ readonly uiSettingByKeyView: UiSettingByKeyView;
20
+ readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
21
+ readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
22
+ readonly uiSettingsDependencies: RepositoryDependencies<UiSetting, UiSettingGetFunctionArgs, UiSettingSaveFunctionArgs>;
23
+ readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
24
+ readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
25
+ readonly checkoutsDependencies: RepositoryDependencies<Checkout, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs>;
26
+ }
27
+ interface BaseBootstrapFunction {
28
+ <UiSettingGetArgs extends RepositoryGetFunctionArgs, UiSettingSaveArgs extends RepositorySaveFunctionArgs, CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs>(args: BaseBootstrapFunctionArgs<UiSettingGetArgs, UiSettingSaveArgs, CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs>): BuildBootstrapFunctionReturn;
29
+ }
30
+ declare const baseBootstrap: BaseBootstrapFunction;
31
+ export { baseBootstrap, MESSAGING_CONTEXT_ID };
@@ -0,0 +1,33 @@
1
+ import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
2
+ import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
3
+ import { startCheckoutHandler } from "../../domain/checkout/model/checkout";
4
+ import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
5
+ import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
6
+ import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID, } from "../../projection/checkout/viewCheckoutById";
7
+ import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
8
+ import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
9
+ import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
10
+ import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
11
+ import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
12
+ const MESSAGING_CONTEXT_ID = "Checkout";
13
+ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, fiveItemsDiscountByCustomerIdView, uiSettingByKeyView, getUiSetting, saveUiSetting, uiSettingsDependencies, getCheckout, saveCheckout, checkoutsDependencies, }) => messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
14
+ .query(VIEW_CHECKOUT_BY_ID, viewCheckoutByIdHandler, {
15
+ view: checkoutByIdView,
16
+ })
17
+ .query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
18
+ view: firstAvailableCheckoutByCustomerIdView,
19
+ })
20
+ .query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
21
+ view: isCheckoutEnabledByCustomerIdView,
22
+ })
23
+ .query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
24
+ .query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
25
+ view: fiveItemsDiscountByCustomerIdView,
26
+ })
27
+ .query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
28
+ view: uiSettingByKeyView,
29
+ })
30
+ .command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, uiSettingsDependencies)
31
+ .command(START_CHECKOUT, startCheckoutHandler, {})(getCheckout, saveCheckout, checkoutsDependencies)
32
+ .build();
33
+ export { baseBootstrap, MESSAGING_CONTEXT_ID };
@@ -1,11 +1,10 @@
1
1
  import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
2
- declare const CHECKOUT_MESSAGING_REACT_ID = "Checkout";
3
2
  interface BootstrapFunctionArgs {
4
- readonly getAuthToken: () => string;
3
+ readonly getAuthToken: () => Promise<string>;
5
4
  readonly apiUrl: string;
6
5
  }
7
6
  interface BootstrapFunction {
8
7
  (args: BootstrapFunctionArgs): BuildBootstrapFunctionReturn;
9
8
  }
10
9
  declare const bootstrap: BootstrapFunction;
11
- export { bootstrap, CHECKOUT_MESSAGING_REACT_ID };
10
+ export { bootstrap };
@@ -1,14 +1,3 @@
1
- import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
2
- import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
3
- import { startCheckoutHandler } from "../../domain/checkout/model/checkout";
4
- import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
5
- import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
6
- import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID } from "../../projection/checkout/viewCheckoutById";
7
- import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
8
- import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
9
- import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
10
- import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
11
- import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY } from "../../projection/uiSetting/viewUiSettingByKey";
12
1
  import { getCheckout, saveCheckout } from "../domain/checkout/model/httpCheckouts";
13
2
  import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
14
3
  import { read, write } from "../persistence/asyncStorageStorage";
@@ -17,30 +6,23 @@ import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checko
17
6
  import { httpFiveItemsDiscountByCustomerIdView } from "../projection/checkout/httpFiveItemsDiscountByCustomerIdView";
18
7
  import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/checkout/httpIsCheckoutEnabledByCustomerIdView";
19
8
  import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
9
+ import { baseBootstrap } from "./baseBootstrap";
20
10
  import { fetchHttpGet, fetchHttpPost } from "./http/fetchHttpClient";
21
- const CHECKOUT_MESSAGING_REACT_ID = "Checkout";
22
11
  const bootstrap = ({ apiUrl, getAuthToken }) => {
23
12
  const httpGet = fetchHttpGet({ apiUrl, getAuthToken });
24
13
  const httpPost = fetchHttpPost({ apiUrl, getAuthToken });
25
- return messagingBootstrap({ id: CHECKOUT_MESSAGING_REACT_ID })
26
- .query(VIEW_CHECKOUT_BY_ID, viewCheckoutByIdHandler, {
27
- view: httpCheckoutByIdView({ httpPost }),
28
- })
29
- .query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
30
- view: httpFirstAvailableCheckoutByCustomerIdView({ httpPost }),
31
- })
32
- .query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
33
- view: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
34
- })
35
- .query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
36
- .query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
37
- view: httpFiveItemsDiscountByCustomerIdView({ httpGet }),
38
- })
39
- .query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
40
- view: storageUiSettingByKeyView({ read }),
41
- })
42
- .command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, { read, write })
43
- .command(START_CHECKOUT, startCheckoutHandler, {})(getCheckout, saveCheckout, { httpPost })
44
- .build();
14
+ return baseBootstrap({
15
+ checkoutByIdView: httpCheckoutByIdView({ httpPost }),
16
+ firstAvailableCheckoutByCustomerIdView: httpFirstAvailableCheckoutByCustomerIdView({ httpPost }),
17
+ isCheckoutEnabledByCustomerIdView: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
18
+ fiveItemsDiscountByCustomerIdView: httpFiveItemsDiscountByCustomerIdView({ httpGet }),
19
+ uiSettingByKeyView: storageUiSettingByKeyView({ read }),
20
+ getUiSetting,
21
+ saveUiSetting,
22
+ uiSettingsDependencies: { read, write },
23
+ getCheckout,
24
+ saveCheckout,
25
+ checkoutsDependencies: { httpPost },
26
+ });
45
27
  };
46
- export { bootstrap, CHECKOUT_MESSAGING_REACT_ID };
28
+ export { bootstrap };
@@ -1,6 +1,3 @@
1
1
  import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
2
- interface BootstrapFunction {
3
- (): BuildBootstrapFunctionReturn;
4
- }
5
- declare const bootstrap: BootstrapFunction;
2
+ declare const bootstrap: () => BuildBootstrapFunctionReturn;
6
3
  export { bootstrap };
@@ -1,34 +1,63 @@
1
- import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
2
- import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
3
- import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
1
+ import invariant from "tiny-invariant";
4
2
  import { CheckoutItemStatus } from "../../projection/checkout/checkout";
5
- import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
6
- import { viewFiveItemsDiscountByCustomerIdHandler, VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFiveItemsDiscountByCustomerId";
7
- import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
8
- import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
9
- import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY } from "../../projection/uiSetting/viewUiSettingByKey";
3
+ import { viewCheckoutById, } from "../../projection/checkout/viewCheckoutById";
10
4
  import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
11
5
  import { read, write } from "../persistence/asyncStorageStorage";
12
6
  import { startedCheckoutWithStatusProjection } from "../projection/checkout/checkout.mock";
13
7
  import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
14
- import { CHECKOUT_MESSAGING_REACT_ID } from "./bootstrap";
15
- const firstAvailableCheckoutByCustomerIdView = async () => startedCheckoutWithStatusProjection({ status: [CheckoutItemStatus.KEPT, CheckoutItemStatus.INITIAL] });
16
- const isCheckoutEnabledByCustomerIdView = async () => true;
8
+ import { baseBootstrap } from "./baseBootstrap";
9
+ const checkoutDataSource = () => {
10
+ let data = startedCheckoutWithStatusProjection({
11
+ status: [
12
+ CheckoutItemStatus.INITIAL,
13
+ CheckoutItemStatus.INITIAL,
14
+ CheckoutItemStatus.INITIAL,
15
+ CheckoutItemStatus.INITIAL,
16
+ CheckoutItemStatus.INITIAL,
17
+ ],
18
+ });
19
+ const get = () => data;
20
+ const save = (checkout) => {
21
+ data = { ...data, ...checkout };
22
+ };
23
+ return {
24
+ get,
25
+ save,
26
+ };
27
+ };
28
+ const isCheckoutEnabled = true;
29
+ const checkoutByIdView = async () => checkoutDataSource().get();
30
+ const firstAvailableCheckoutByCustomerIdView = async () => checkoutDataSource().get();
31
+ const isCheckoutEnabledByCustomerIdView = async () => isCheckoutEnabled;
17
32
  const fiveItemsDiscountByCustomerIdView = async () => 25;
18
- const bootstrap = () => messagingBootstrap({ id: CHECKOUT_MESSAGING_REACT_ID })
19
- .query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
20
- view: firstAvailableCheckoutByCustomerIdView,
21
- })
22
- .query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
23
- view: isCheckoutEnabledByCustomerIdView,
24
- })
25
- .query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
26
- .query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
27
- view: fiveItemsDiscountByCustomerIdView,
28
- })
29
- .query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
30
- view: storageUiSettingByKeyView({ read }),
31
- })
32
- .command(UPDATE_UI_SETTING, updateUiSettingHandler, {})(getUiSetting, saveUiSetting, { read, write })
33
- .build();
33
+ const toCheckoutDomain = (checkout) => {
34
+ invariant(checkout, "No checkout found!");
35
+ return {
36
+ id: checkout.id,
37
+ status: checkout.status,
38
+ customerId: checkout.customerId,
39
+ boxId: checkout.boxId,
40
+ bookingId: checkout.bookingId,
41
+ expiresOn: checkout.expiresOn,
42
+ aggregateId: checkout.id,
43
+ domainEvents: [],
44
+ };
45
+ };
46
+ const getCheckout = ({ queryBus }) => async (aggregateId) => toCheckoutDomain(await queryBus(viewCheckoutById({ checkoutId: aggregateId })));
47
+ const saveCheckout = () => async (aggregateRoot) => {
48
+ checkoutDataSource().save(aggregateRoot);
49
+ };
50
+ const bootstrap = () => baseBootstrap({
51
+ checkoutByIdView,
52
+ firstAvailableCheckoutByCustomerIdView,
53
+ isCheckoutEnabledByCustomerIdView,
54
+ fiveItemsDiscountByCustomerIdView,
55
+ uiSettingByKeyView: storageUiSettingByKeyView({ read }),
56
+ getUiSetting,
57
+ saveUiSetting,
58
+ uiSettingsDependencies: { read, write },
59
+ getCheckout,
60
+ saveCheckout,
61
+ checkoutsDependencies: {},
62
+ });
34
63
  export { bootstrap };
@@ -1,7 +1,7 @@
1
1
  import { HttpGetFunction, HttpPostFunction } from "./httpClient";
2
2
  interface FetchHttpFunctionArgs {
3
3
  readonly apiUrl: string;
4
- readonly getAuthToken: () => string;
4
+ readonly getAuthToken: () => Promise<string>;
5
5
  }
6
6
  interface FetchHttpPostFunction {
7
7
  (args: FetchHttpFunctionArgs): HttpPostFunction;
@@ -2,7 +2,7 @@ const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body }) =
2
2
  method: "POST",
3
3
  headers: {
4
4
  ["Content-Type"]: "application/json",
5
- authorization: `Bearer ${getAuthToken()}`,
5
+ authorization: `Bearer ${await getAuthToken()}`,
6
6
  },
7
7
  body: JSON.stringify(body),
8
8
  });
@@ -10,7 +10,7 @@ const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint }) => fetch
10
10
  method: "GET",
11
11
  credentials: "include",
12
12
  headers: {
13
- authorization: `Bearer ${getAuthToken()}`,
13
+ authorization: `Bearer ${await getAuthToken()}`,
14
14
  },
15
15
  referrer: "",
16
16
  });
@@ -1,9 +1,9 @@
1
1
  import { useCommand } from "@lookiero/messaging-react";
2
2
  import { useCallback } from "react";
3
3
  import { startCheckout } from "../../../../domain/checkout/command/startCheckout";
4
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
4
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
5
  const useStartCheckout = ({ checkoutId }) => {
6
- const [commandBus, status] = useCommand({ contextId: CHECKOUT_MESSAGING_REACT_ID });
6
+ const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
7
7
  const start = useCallback(async () => await commandBus(startCheckout({ aggregateId: checkoutId })), [checkoutId, commandBus]);
8
8
  return [start, status];
9
9
  };
@@ -2,9 +2,9 @@ import { useCommand } from "@lookiero/messaging-react";
2
2
  import { useCallback } from "react";
3
3
  import { v4 as uuid } from "uuid";
4
4
  import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
5
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
5
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
6
  const useUpdateUiSetting = () => {
7
- const [commandBus, status] = useCommand({ contextId: CHECKOUT_MESSAGING_REACT_ID });
7
+ const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
8
  const update = useCallback(async ({ key, value }) => await commandBus(updateUiSetting({
9
9
  aggregateId: uuid(),
10
10
  key,
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
2
  import { viewBookedSizeReplaceableProductVariantsForCheckoutItem, } from "../../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewBookedSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
5
5
  query: viewBookedSizeReplaceableProductVariantsForCheckoutItem({ checkoutItemId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity },
8
8
  });
9
9
  export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
2
  import { viewFirstAvailableCheckoutByCustomerId } from "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
8
8
  });
9
9
  export { useViewFirstAvailableCheckoutByCustomerId };
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
2
  import { viewFiveItemsDiscountByCustomerId, } from "../../../../projection/checkout/viewFiveItemsDiscountByCustomerId";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewFiveItemsDiscountByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewFiveItemsDiscountByCustomerId({ customerId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity },
8
8
  });
9
9
  export { useViewFiveItemsDiscountByCustomerId };
@@ -1,9 +1,9 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
2
  import { viewIsCheckoutAccessibleByCustomerId, } from "../../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
3
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
3
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
4
4
  const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
5
5
  query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
6
- contextId: CHECKOUT_MESSAGING_REACT_ID,
6
+ contextId: MESSAGING_CONTEXT_ID,
7
7
  options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
8
8
  });
9
9
  export { useViewIsCheckoutAccessibleByCustomerId };
@@ -1,11 +1,11 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
2
  import { UI_SETTING_UPDATED } from "../../../../domain/uiSetting/model/uiSettingUpdated";
3
3
  import { viewUiSettingByKey } from "../../../../projection/uiSetting/viewUiSettingByKey";
4
- import { CHECKOUT_MESSAGING_REACT_ID } from "../../../delivery/bootstrap";
4
+ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
5
5
  const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
6
6
  const useViewUiSettingByKey = ({ key }) => useQuery({
7
7
  query: viewUiSettingByKey({ key }),
8
- contextId: CHECKOUT_MESSAGING_REACT_ID,
8
+ contextId: MESSAGING_CONTEXT_ID,
9
9
  invalidation: isUiSettingUpdated,
10
10
  options: { staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
11
11
  });
@@ -30,7 +30,7 @@ const Routing = ({ onNotAccessible, customerId, locale, I18n, onI18nError }) =>
30
30
  {
31
31
  path: Routes.ITEM,
32
32
  element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
33
- React.createElement(Item, null))),
33
+ React.createElement(Item, { customerId: customerId }))),
34
34
  },
35
35
  {
36
36
  path: Routes.SUMMARY,
@@ -1,3 +1,6 @@
1
1
  import { FC } from "react";
2
- declare const Item: FC;
2
+ interface ItemProps {
3
+ readonly customerId: string;
4
+ }
5
+ declare const Item: FC<ItemProps>;
3
6
  export { Item };
@@ -3,8 +3,11 @@ import { useI18nMessage } from "@lookiero/i18n-react";
3
3
  import React from "react";
4
4
  import { StyleSheet, View } from "react-native";
5
5
  import { useParams } from "react-router-native";
6
- const Item = () => {
6
+ import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
7
+ const Item = ({ customerId }) => {
7
8
  const { id } = useParams();
9
+ const [checkout] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
10
+ console.log(checkout);
8
11
  const itemText = useI18nMessage({ id: "item" });
9
12
  return (React.createElement(View, { style: styles.container },
10
13
  React.createElement(Text, { heading: true, level: 3 }, itemText),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [