@lookiero/checkout 0.1.1 → 0.1.2

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.
Files changed (69) hide show
  1. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +4 -4
  2. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js +3 -2
  3. package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +3 -2
  4. package/dist/domain/checkoutBooking/model/checkoutBooking.js +2 -1
  5. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +4 -4
  6. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.js +3 -2
  7. package/dist/domain/checkoutBooking/model/checkoutBookings.d.ts +3 -2
  8. package/dist/domain/uiSetting/command/updateUiSetting.d.ts +4 -4
  9. package/dist/domain/uiSetting/command/updateUiSetting.js +3 -2
  10. package/dist/domain/uiSetting/model/uiSetting.d.ts +3 -2
  11. package/dist/domain/uiSetting/model/uiSetting.js +2 -1
  12. package/dist/domain/uiSetting/model/uiSettingUpdated.d.ts +4 -4
  13. package/dist/domain/uiSetting/model/uiSettingUpdated.js +3 -2
  14. package/dist/domain/uiSetting/model/uiSettings.d.ts +3 -2
  15. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.d.ts +2 -2
  16. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +2 -1
  17. package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +2 -2
  18. package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js +2 -1
  19. package/dist/infrastructure/domain/react/useSetCheckoutIntroShown.d.ts +13 -0
  20. package/dist/infrastructure/domain/react/useSetCheckoutIntroShown.js +9 -0
  21. package/dist/infrastructure/domain/react/useUpdateUiSetting.d.ts +2 -2
  22. package/dist/infrastructure/domain/react/useUpdateUiSetting.js +2 -1
  23. package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +3 -3
  24. package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.js +3 -2
  25. package/dist/infrastructure/persistence/asyncStorageStorage.d.ts +3 -2
  26. package/dist/infrastructure/persistence/asyncStorageStorage.js +3 -2
  27. package/dist/infrastructure/persistence/storage.d.ts +3 -2
  28. package/dist/infrastructure/persistence/uiSettingData.d.ts +2 -1
  29. package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.d.ts +2 -0
  30. package/dist/infrastructure/projection/react/useViewCheckoutIntroShown.js +6 -0
  31. package/dist/infrastructure/projection/react/useViewUiSettingByKey.d.ts +3 -3
  32. package/dist/infrastructure/projection/react/useViewUiSettingByKey.js +6 -4
  33. package/dist/infrastructure/projection/storageUiSettingByKeyView.d.ts +2 -2
  34. package/dist/infrastructure/projection/storageUiSettingByKeyView.js +2 -1
  35. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +4 -4
  36. package/dist/infrastructure/ui/settings/UISettings.d.ts +4 -0
  37. package/dist/infrastructure/ui/settings/UISettings.js +5 -0
  38. package/dist/projection/uiSetting/viewUiSettingByKey.d.ts +6 -6
  39. package/dist/projection/uiSetting/viewUiSettingByKey.js +4 -3
  40. package/package.json +1 -1
  41. package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.ts +15 -7
  42. package/src/domain/checkoutBooking/model/checkoutBooking.ts +4 -2
  43. package/src/domain/checkoutBooking/model/checkoutBookingBooked.ts +5 -5
  44. package/src/domain/checkoutBooking/model/checkoutBookings.ts +4 -2
  45. package/src/domain/uiSetting/command/updateUiSetting.ts +5 -3
  46. package/src/domain/uiSetting/model/uiSetting.ts +4 -2
  47. package/src/domain/uiSetting/model/uiSettingUpdated.ts +5 -3
  48. package/src/domain/uiSetting/model/uiSettings.ts +4 -2
  49. package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.ts +3 -1
  50. package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.ts +3 -1
  51. package/src/infrastructure/domain/react/useSetCheckoutIntroShown.test.ts +34 -0
  52. package/src/infrastructure/domain/react/useSetCheckoutIntroShown.ts +30 -0
  53. package/src/infrastructure/domain/react/useUpdateUiSetting.ts +3 -1
  54. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +4 -2
  55. package/src/infrastructure/persistence/asyncStorageStorage.ts +4 -3
  56. package/src/infrastructure/persistence/storage.ts +4 -2
  57. package/src/infrastructure/persistence/uiSettingData.ts +3 -1
  58. package/src/infrastructure/projection/react/useViewCheckoutIntroShown.test.ts +41 -0
  59. package/src/infrastructure/projection/react/useViewCheckoutIntroShown.ts +9 -0
  60. package/src/infrastructure/projection/react/useViewUiSettingByKey.test.ts +1 -1
  61. package/src/infrastructure/projection/react/useViewUiSettingByKey.ts +11 -5
  62. package/src/infrastructure/projection/storageUiSettingByKeyView.ts +3 -1
  63. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +7 -7
  64. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +4 -4
  65. package/src/infrastructure/ui/settings/UISettings.ts +5 -0
  66. package/src/projection/uiSetting/viewUiSettingByKey.ts +17 -9
  67. package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.d.ts +0 -3
  68. package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.js +0 -3
  69. package/src/infrastructure/projection/react/useViewIsCheckoutIntroVisible.ts +0 -5
@@ -1,15 +1,15 @@
1
1
  import { Command } from "@lookiero/messaging";
2
- export declare const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
2
+ declare const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
3
3
  interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
4
4
  readonly aggregateId: string;
5
5
  readonly checkoutId: string;
6
6
  readonly checkoutItemId: string;
7
7
  readonly checkoutBookingId: string;
8
8
  }
9
- export interface BookSizeReplaceableProductVariantsForCheckoutItem extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, BookSizeReplaceableProductVariantsForCheckoutItemPayload {
9
+ interface BookSizeReplaceableProductVariantsForCheckoutItem extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, BookSizeReplaceableProductVariantsForCheckoutItemPayload {
10
10
  }
11
11
  interface BookSizeReplaceableProductVariantsForCheckoutItemFunction {
12
12
  (payload: BookSizeReplaceableProductVariantsForCheckoutItemPayload): BookSizeReplaceableProductVariantsForCheckoutItem;
13
13
  }
14
- export declare const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction;
15
- export {};
14
+ declare const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction;
15
+ export { BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, BookSizeReplaceableProductVariantsForCheckoutItem, bookSizeReplaceableProductVariantsForCheckoutItem, };
@@ -1,6 +1,7 @@
1
1
  import { command } from "@lookiero/messaging";
2
- export const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
3
- export const bookSizeReplaceableProductVariantsForCheckoutItem = ({ aggregateId, ...payload }) => ({
2
+ const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
3
+ const bookSizeReplaceableProductVariantsForCheckoutItem = ({ aggregateId, ...payload }) => ({
4
4
  ...command({ aggregateId, name: BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
5
5
  ...payload,
6
6
  });
7
+ export { BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, bookSizeReplaceableProductVariantsForCheckoutItem, };
@@ -1,8 +1,9 @@
1
1
  import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
2
  import { BookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bookSizeReplaceableProductVariantsForCheckoutItem";
3
- export interface CheckoutBooking extends AggregateRoot {
3
+ interface CheckoutBooking extends AggregateRoot {
4
4
  readonly checkoutId: string;
5
5
  readonly checkoutItemId: string;
6
6
  readonly checkoutBookingId: string;
7
7
  }
8
- export declare const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<BookSizeReplaceableProductVariantsForCheckoutItem, CheckoutBooking>;
8
+ declare const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<BookSizeReplaceableProductVariantsForCheckoutItem, CheckoutBooking>;
9
+ export { CheckoutBooking, bookSizeReplaceableProductVariantsForCheckoutItemHandler };
@@ -1,5 +1,5 @@
1
1
  import { checkoutBookingBooked } from "./checkoutBookingBooked";
2
- export const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
2
+ const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
3
3
  const { aggregateId, checkoutId, checkoutItemId, checkoutBookingId } = command;
4
4
  return {
5
5
  ...aggregateRoot,
@@ -14,3 +14,4 @@ export const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => as
14
14
  }),
15
15
  };
16
16
  };
17
+ export { bookSizeReplaceableProductVariantsForCheckoutItemHandler };
@@ -1,15 +1,15 @@
1
1
  import { DomainEvent } from "@lookiero/messaging";
2
- export declare const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
2
+ declare const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
3
3
  interface CheckoutBookingBookedPayload {
4
4
  readonly aggregateId: string;
5
5
  readonly checkoutId: string;
6
6
  readonly checkoutItemId: string;
7
7
  readonly checkoutBookingId: string;
8
8
  }
9
- export interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {
9
+ interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {
10
10
  }
11
11
  interface CheckoutBookingBookedFunction {
12
12
  (payload: CheckoutBookingBookedPayload): CheckoutBookingBooked;
13
13
  }
14
- export declare const checkoutBookingBooked: CheckoutBookingBookedFunction;
15
- export {};
14
+ declare const checkoutBookingBooked: CheckoutBookingBookedFunction;
15
+ export { CHECKOUT_BOOKING_BOOKED, CheckoutBookingBooked, checkoutBookingBooked };
@@ -1,6 +1,7 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
- export const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
3
- export const checkoutBookingBooked = ({ aggregateId, ...payload }) => ({
2
+ const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
3
+ const checkoutBookingBooked = ({ aggregateId, ...payload }) => ({
4
4
  ...domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BOOKED }),
5
5
  ...payload,
6
6
  });
7
+ export { CHECKOUT_BOOKING_BOOKED, checkoutBookingBooked };
@@ -1,6 +1,7 @@
1
1
  import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
2
2
  import { CheckoutBooking } from "./checkoutBooking";
3
- export interface CheckoutBookingsGetFunction extends RepositoryGetFunction<CheckoutBooking> {
3
+ interface CheckoutBookingsGetFunction extends RepositoryGetFunction<CheckoutBooking> {
4
4
  }
5
- export interface CheckoutBookingsSaveFunction extends RepositorySaveFunction<CheckoutBooking> {
5
+ interface CheckoutBookingsSaveFunction extends RepositorySaveFunction<CheckoutBooking> {
6
6
  }
7
+ export { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction };
@@ -1,14 +1,14 @@
1
1
  import { Command } from "@lookiero/messaging";
2
- export declare const UPDATE_UI_SETTING = "update_ui_setting";
2
+ declare const UPDATE_UI_SETTING = "update_ui_setting";
3
3
  interface UpdateUiSettingPayload {
4
4
  readonly aggregateId: string;
5
5
  readonly key: string;
6
6
  readonly value: unknown;
7
7
  }
8
- export interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
8
+ interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
9
9
  }
10
10
  interface UpdateUiSettingFunction {
11
11
  (payload: UpdateUiSettingPayload): UpdateUiSetting;
12
12
  }
13
- export declare const updateUiSetting: UpdateUiSettingFunction;
14
- export {};
13
+ declare const updateUiSetting: UpdateUiSettingFunction;
14
+ export { UPDATE_UI_SETTING, UpdateUiSetting, updateUiSetting };
@@ -1,9 +1,10 @@
1
1
  import { command } from "@lookiero/messaging";
2
- export const UPDATE_UI_SETTING = "update_ui_setting";
3
- export const updateUiSetting = ({ aggregateId, ...payload }) => ({
2
+ const UPDATE_UI_SETTING = "update_ui_setting";
3
+ const updateUiSetting = ({ aggregateId, ...payload }) => ({
4
4
  ...command({
5
5
  aggregateId,
6
6
  name: UPDATE_UI_SETTING,
7
7
  }),
8
8
  ...payload,
9
9
  });
10
+ export { UPDATE_UI_SETTING, updateUiSetting };
@@ -1,8 +1,9 @@
1
1
  import { AggregateRoot } from "@lookiero/messaging";
2
2
  import { CommandHandlerFunction } from "@lookiero/messaging/domain/model";
3
3
  import { UpdateUiSetting } from "../command/updateUiSetting";
4
- export interface UiSetting extends AggregateRoot {
4
+ interface UiSetting extends AggregateRoot {
5
5
  readonly key: string;
6
6
  readonly value: unknown;
7
7
  }
8
- export declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
8
+ declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
9
+ export { UiSetting, updateUiSettingHandler };
@@ -1,5 +1,5 @@
1
1
  import { uiSettingUpdated } from "./uiSettingUpdated";
2
- export const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
2
+ const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
3
3
  const { aggregateId, key, value } = command;
4
4
  return {
5
5
  ...aggregateRoot,
@@ -8,3 +8,4 @@ export const updateUiSettingHandler = () => async ({ aggregateRoot, command }) =
8
8
  domainEvents: uiSettingUpdated({ aggregateId, key }),
9
9
  };
10
10
  };
11
+ export { updateUiSettingHandler };
@@ -1,13 +1,13 @@
1
1
  import { DomainEvent } from "@lookiero/messaging";
2
- export declare const UI_SETTING_UPDATED = "ui_setting_updated";
2
+ declare const UI_SETTING_UPDATED = "ui_setting_updated";
3
3
  interface UiSettingUpdatedPayload {
4
4
  readonly aggregateId: string;
5
5
  readonly key: string;
6
6
  }
7
- export interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
7
+ interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
8
8
  }
9
9
  interface UiSettingUpdatedFunction {
10
10
  (payload: UiSettingUpdatedPayload): UiSettingUpdated;
11
11
  }
12
- export declare const uiSettingUpdated: UiSettingUpdatedFunction;
13
- export {};
12
+ declare const uiSettingUpdated: UiSettingUpdatedFunction;
13
+ export { UI_SETTING_UPDATED, UiSettingUpdated, uiSettingUpdated };
@@ -1,6 +1,7 @@
1
1
  import { domainEvent } from "@lookiero/messaging";
2
- export const UI_SETTING_UPDATED = "ui_setting_updated";
3
- export const uiSettingUpdated = ({ aggregateId, key }) => ({
2
+ const UI_SETTING_UPDATED = "ui_setting_updated";
3
+ const uiSettingUpdated = ({ aggregateId, key }) => ({
4
4
  ...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
5
5
  key,
6
6
  });
7
+ export { UI_SETTING_UPDATED, uiSettingUpdated };
@@ -1,6 +1,7 @@
1
1
  import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
2
2
  import { UiSetting } from "./uiSetting";
3
- export interface UiSettingGetFunction extends RepositoryGetFunction<UiSetting> {
3
+ interface UiSettingGetFunction extends RepositoryGetFunction<UiSetting> {
4
4
  }
5
- export interface UiSettingSaveFunction extends RepositorySaveFunction<UiSetting> {
5
+ interface UiSettingSaveFunction extends RepositorySaveFunction<UiSetting> {
6
6
  }
7
+ export { UiSettingGetFunction, UiSettingSaveFunction };
@@ -6,5 +6,5 @@ interface HttpCheckoutBookingsSaveFunctionArgs {
6
6
  interface HttpCheckoutBookingsSaveFunction {
7
7
  (args: HttpCheckoutBookingsSaveFunctionArgs): CheckoutBookingsSaveFunction;
8
8
  }
9
- export declare const saveCheckoutBooking: HttpCheckoutBookingsSaveFunction;
10
- export {};
9
+ declare const saveCheckoutBooking: HttpCheckoutBookingsSaveFunction;
10
+ export { saveCheckoutBooking };
@@ -1,4 +1,4 @@
1
- export const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
1
+ const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
2
2
  try {
3
3
  const response = await httpPost({
4
4
  endpoint: "/book-size-replaceable-product-variants-for-checkout-item",
@@ -17,3 +17,4 @@ export const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checko
17
17
  throw new Error("Could not fetch BookSizeReplaceableProductVariantsForCheckoutItem");
18
18
  }
19
19
  };
20
+ export { saveCheckoutBooking };
@@ -11,5 +11,5 @@ interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
11
11
  interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunction {
12
12
  (args: UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs): UseBookSizeReplaceableProductVariantsForCheckoutItem;
13
13
  }
14
- export declare const useBookSizeReplaceableProductVariantsForCheckoutItem: UseBookSizeReplaceableProductVariantsForCheckoutItemFunction;
15
- export {};
14
+ declare const useBookSizeReplaceableProductVariantsForCheckoutItem: UseBookSizeReplaceableProductVariantsForCheckoutItemFunction;
15
+ export { useBookSizeReplaceableProductVariantsForCheckoutItem };
@@ -2,7 +2,7 @@ import { useCommand } from "@lookiero/messaging-react";
2
2
  import { useCallback } from "react";
3
3
  import { v4 as uuid } from "uuid";
4
4
  import { bookSizeReplaceableProductVariantsForCheckoutItem } from "../../../domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem";
5
- export const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
5
+ const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
6
6
  const [commandBus, status] = useCommand();
7
7
  const book = useCallback(async () => await commandBus(bookSizeReplaceableProductVariantsForCheckoutItem({
8
8
  aggregateId: uuid(),
@@ -15,3 +15,4 @@ export const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutI
15
15
  status,
16
16
  };
17
17
  };
18
+ export { useBookSizeReplaceableProductVariantsForCheckoutItem };
@@ -0,0 +1,13 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ interface SetCheckoutIntroShownFunction {
3
+ (): Promise<void>;
4
+ }
5
+ interface UseSetCheckoutIntroShown {
6
+ readonly setCheckoutIntroShown: SetCheckoutIntroShownFunction;
7
+ readonly status: CommandStatus;
8
+ }
9
+ interface UseSetCheckoutIntroShownFunction {
10
+ (): UseSetCheckoutIntroShown;
11
+ }
12
+ declare const useSetCheckoutIntroShown: UseSetCheckoutIntroShownFunction;
13
+ export { useSetCheckoutIntroShown };
@@ -0,0 +1,9 @@
1
+ import { useCallback } from "react";
2
+ import { UISettings } from "../../ui/settings/UISettings";
3
+ import { useUpdateUiSetting } from "./useUpdateUiSetting";
4
+ const useSetCheckoutIntroShown = () => {
5
+ const { update, status } = useUpdateUiSetting();
6
+ const setCheckoutIntroShown = useCallback(() => update({ key: UISettings.CHECKOUT_INTRO_SHOWN, value: true }), [update]);
7
+ return { setCheckoutIntroShown, status };
8
+ };
9
+ export { useSetCheckoutIntroShown };
@@ -13,5 +13,5 @@ interface UseUpdateUiSetting {
13
13
  interface UseUpdateUiSettingFunction {
14
14
  (): UseUpdateUiSetting;
15
15
  }
16
- export declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
17
- export {};
16
+ declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
17
+ export { useUpdateUiSetting };
@@ -2,7 +2,7 @@ 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
- export const useUpdateUiSetting = () => {
5
+ const useUpdateUiSetting = () => {
6
6
  const [commandBus, status] = useCommand();
7
7
  const update = useCallback(async ({ key, value }) => await commandBus(updateUiSetting({
8
8
  aggregateId: uuid(),
@@ -14,3 +14,4 @@ export const useUpdateUiSetting = () => {
14
14
  status,
15
15
  };
16
16
  };
17
+ export { useUpdateUiSetting };
@@ -7,12 +7,12 @@ interface StorageUiSettingsGetFunctionArgs {
7
7
  interface StorageUiSettingsGetFunction {
8
8
  (args: StorageUiSettingsGetFunctionArgs): UiSettingGetFunction;
9
9
  }
10
- export declare const getUiSetting: StorageUiSettingsGetFunction;
10
+ declare const getUiSetting: StorageUiSettingsGetFunction;
11
11
  interface StorageUiSettingsSaveFunctionArgs {
12
12
  readonly write: WriteFunction<UiSettingDto>;
13
13
  }
14
14
  interface StorageUiSettingsSaveFunction {
15
15
  (args: StorageUiSettingsSaveFunctionArgs): UiSettingSaveFunction;
16
16
  }
17
- export declare const saveUiSetting: StorageUiSettingsSaveFunction;
18
- export {};
17
+ declare const saveUiSetting: StorageUiSettingsSaveFunction;
18
+ export { getUiSetting, saveUiSetting };
@@ -9,11 +9,12 @@ const fromDomain = (uiSetting) => ({
9
9
  key: uiSetting.key,
10
10
  value: uiSetting.value,
11
11
  });
12
- export const getUiSetting = ({ read }) => async (uiSettingKey) => {
12
+ const getUiSetting = ({ read }) => async (uiSettingKey) => {
13
13
  const uiSettingDto = await read(uiSettingKey);
14
14
  if (!uiSettingDto) {
15
15
  throw new Error(`UiSetting not found: ${uiSettingKey}`);
16
16
  }
17
17
  return toDomain(uiSettingDto);
18
18
  };
19
- export const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
19
+ const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
20
+ export { getUiSetting, saveUiSetting };
@@ -1,4 +1,5 @@
1
1
  import { ReadFunction, WriteFunction } from "./storage";
2
2
  import { UiSettingDto } from "./uiSettingData";
3
- export declare const read: ReadFunction<UiSettingDto>;
4
- export declare const write: WriteFunction<UiSettingDto>;
3
+ declare const read: ReadFunction<UiSettingDto>;
4
+ declare const write: WriteFunction<UiSettingDto>;
5
+ export { read, write };
@@ -1,6 +1,7 @@
1
1
  import AsyncStorage from "@react-native-async-storage/async-storage";
2
- export const read = async (key) => {
2
+ const read = async (key) => {
3
3
  const value = await AsyncStorage.getItem(key);
4
4
  return value ? JSON.parse(value) : undefined;
5
5
  };
6
- export const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
6
+ const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
7
+ export { read, write };
@@ -1,6 +1,7 @@
1
- export interface ReadFunction<T> {
1
+ interface ReadFunction<T> {
2
2
  (key: string): Promise<T | undefined>;
3
3
  }
4
- export interface WriteFunction<T> {
4
+ interface WriteFunction<T> {
5
5
  (key: string, value: T): Promise<void>;
6
6
  }
7
+ export { ReadFunction, WriteFunction };
@@ -1,5 +1,6 @@
1
- export interface UiSettingDto {
1
+ interface UiSettingDto {
2
2
  readonly id: string;
3
3
  readonly key: string;
4
4
  readonly value: unknown;
5
5
  }
6
+ export { UiSettingDto };
@@ -0,0 +1,2 @@
1
+ declare const useViewCheckoutIntroShown: () => import("@lookiero/messaging-react").UseQueryFunctionResult<import("../../../projection/uiSetting/viewUiSettingByKey").UiSettingProjection>;
2
+ export { useViewCheckoutIntroShown };
@@ -0,0 +1,6 @@
1
+ import { UISettings } from "../../ui/settings/UISettings";
2
+ import { useViewUiSettingByKey } from "./useViewUiSettingByKey";
3
+ const useViewCheckoutIntroShown = () => useViewUiSettingByKey({
4
+ key: UISettings.CHECKOUT_INTRO_SHOWN,
5
+ });
6
+ export { useViewCheckoutIntroShown };
@@ -1,10 +1,10 @@
1
1
  import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
2
  import { UiSettingProjection } from "../../../projection/uiSetting/viewUiSettingByKey";
3
3
  interface UseViewUiSettingByKeyFunctionArgs {
4
- readonly uiSettingKey: string;
4
+ readonly key: string;
5
5
  }
6
6
  interface UseViewUiSettingByKeyFunction {
7
7
  (args: UseViewUiSettingByKeyFunctionArgs): UseQueryFunctionResult<UiSettingProjection>;
8
8
  }
9
- export declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
10
- export {};
9
+ declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
10
+ export { useViewUiSettingByKey };
@@ -1,8 +1,10 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { uiSettingUpdated } from "../../../domain/uiSetting/model/uiSettingUpdated";
2
+ import { UI_SETTING_UPDATED } from "../../../domain/uiSetting/model/uiSettingUpdated";
3
3
  import { viewUiSettingByKey } from "../../../projection/uiSetting/viewUiSettingByKey";
4
- export const useViewUiSettingByKey = ({ uiSettingKey }) => useQuery({
5
- query: viewUiSettingByKey({ key: uiSettingKey }),
6
- invalidation: (event) => event instanceof uiSettingUpdated,
4
+ const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
5
+ const useViewUiSettingByKey = ({ key }) => useQuery({
6
+ query: viewUiSettingByKey({ key }),
7
+ invalidation: isUiSettingUpdated,
7
8
  options: { staleTime: Infinity },
8
9
  });
10
+ export { useViewUiSettingByKey };
@@ -9,5 +9,5 @@ interface StorageUiSettingByKeyViewFunctionArgs {
9
9
  interface StorageUiSettingByKeyViewFunction {
10
10
  (args: StorageUiSettingByKeyViewFunctionArgs): StorageUiSettingByKeyView;
11
11
  }
12
- export declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
13
- export {};
12
+ declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
13
+ export { storageUiSettingByKeyView };
@@ -3,7 +3,7 @@ const toUiSettingProjection = (uiSettingDto) => ({
3
3
  key: uiSettingDto.key,
4
4
  value: uiSettingDto.value,
5
5
  });
6
- export const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
6
+ const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
7
7
  try {
8
8
  const uiSettingDto = await read(key);
9
9
  return uiSettingDto ? toUiSettingProjection(uiSettingDto) : undefined;
@@ -12,3 +12,4 @@ export const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
12
12
  throw new Error("Could not fetch the uiSetting");
13
13
  }
14
14
  };
15
+ export { storageUiSettingByKeyView };
@@ -2,21 +2,21 @@ import { QueryStatus } from "@lookiero/messaging-react";
2
2
  import { generatePath, Navigate, Outlet, useMatch } from "react-router";
3
3
  import { CheckoutItemStatus, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
4
4
  import { useViewFirstAvailableCheckoutByCustomerId } from "../../projection/react/useViewFirstAvailableCheckoutByCustomerId";
5
- import { useViewIsCheckoutIntroVisible } from "../../projection/react/useViewIsCheckoutIntroVisible";
5
+ import { useViewCheckoutIntroShown } from "../../projection/react/useViewCheckoutIntroShown";
6
6
  import { Spinner } from "../components/atoms/spiner/Spinner";
7
7
  import { Routes } from "./routes";
8
8
  const CheckoutMiddleware = ({ customerId, loader = <Spinner /> }) => {
9
- const [isIntroVisible, isIntroVisibleStatus] = useViewIsCheckoutIntroVisible();
9
+ const [checkoutIntroShown, checkoutIntroShownStatus] = useViewCheckoutIntroShown();
10
10
  const [checkout, checkoutStatus] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
11
11
  const firstItemWithoutCustomerDecision = checkout?.items.find((item) => [CheckoutItemStatus.EXPIRED, CheckoutItemStatus.INITIAL].includes(item.status));
12
12
  const isIntroRoute = useMatch(Routes.INTRO);
13
13
  const isItemRoute = useMatch(Routes.ITEM);
14
14
  const isSummaryRoute = useMatch(Routes.SUMMARY);
15
- const dependenciesLoaded = isIntroVisibleStatus === QueryStatus.SUCCESS && checkoutStatus === QueryStatus.SUCCESS;
15
+ const dependenciesLoaded = checkoutIntroShownStatus === QueryStatus.SUCCESS && checkoutStatus === QueryStatus.SUCCESS;
16
16
  if (!dependenciesLoaded) {
17
17
  return loader;
18
18
  }
19
- if (isIntroVisible) {
19
+ if (checkoutIntroShown) {
20
20
  if (!isIntroRoute) {
21
21
  return <Navigate replace to={Routes.INTRO}/>;
22
22
  }
@@ -0,0 +1,4 @@
1
+ declare enum UISettings {
2
+ CHECKOUT_INTRO_SHOWN = "CHECKOUT_INTRO_SHOWN"
3
+ }
4
+ export { UISettings };
@@ -0,0 +1,5 @@
1
+ var UISettings;
2
+ (function (UISettings) {
3
+ UISettings["CHECKOUT_INTRO_SHOWN"] = "CHECKOUT_INTRO_SHOWN";
4
+ })(UISettings || (UISettings = {}));
5
+ export { UISettings };
@@ -1,10 +1,10 @@
1
1
  import { Query, QueryHandlerFunction, QueryHandlerFunctionArgs } from "@lookiero/messaging";
2
- export interface UiSettingProjection {
2
+ interface UiSettingProjection {
3
3
  readonly id: string;
4
4
  readonly key: string;
5
5
  readonly value: unknown;
6
6
  }
7
- export declare const VIEW_UI_SETTING_BY_KEY = "view_ui_setting_by_key";
7
+ declare const VIEW_UI_SETTING_BY_KEY = "view_ui_setting_by_key";
8
8
  interface ViewUiSettingByKeyPayload {
9
9
  readonly key: string;
10
10
  }
@@ -13,16 +13,16 @@ interface ViewUiSettingByKey extends Query<typeof VIEW_UI_SETTING_BY_KEY>, ViewU
13
13
  interface ViewUiSettingByKeyFunction {
14
14
  (payload: ViewUiSettingByKeyPayload): ViewUiSettingByKey;
15
15
  }
16
+ declare const viewUiSettingByKey: ViewUiSettingByKeyFunction;
16
17
  declare type ViewUiSettingByKeyResult = UiSettingProjection | undefined;
17
18
  interface UiSettingByKeyViewArgs {
18
19
  readonly key: string;
19
20
  }
20
- export interface UiSettingByKeyView {
21
+ interface UiSettingByKeyView {
21
22
  (args: UiSettingByKeyViewArgs): Promise<ViewUiSettingByKeyResult>;
22
23
  }
23
24
  interface ViewUiSettingByKeyHandlerFunctionArgs extends QueryHandlerFunctionArgs {
24
25
  readonly view: UiSettingByKeyView;
25
26
  }
26
- export declare const viewUiSettingByKey: ViewUiSettingByKeyFunction;
27
- export declare const viewUiSettingByKeyHandler: QueryHandlerFunction<ViewUiSettingByKey, ViewUiSettingByKeyResult, ViewUiSettingByKeyHandlerFunctionArgs>;
28
- export {};
27
+ declare const viewUiSettingByKeyHandler: QueryHandlerFunction<ViewUiSettingByKey, ViewUiSettingByKeyResult, ViewUiSettingByKeyHandlerFunctionArgs>;
28
+ export { UiSettingProjection, VIEW_UI_SETTING_BY_KEY, UiSettingByKeyView, viewUiSettingByKey, viewUiSettingByKeyHandler, };
@@ -1,7 +1,8 @@
1
1
  import { query } from "@lookiero/messaging";
2
- export const VIEW_UI_SETTING_BY_KEY = "view_ui_setting_by_key";
3
- export const viewUiSettingByKey = (payload) => ({
2
+ const VIEW_UI_SETTING_BY_KEY = "view_ui_setting_by_key";
3
+ const viewUiSettingByKey = (payload) => ({
4
4
  ...query({ name: VIEW_UI_SETTING_BY_KEY }),
5
5
  ...payload,
6
6
  });
7
- export const viewUiSettingByKeyHandler = ({ view }) => async ({ key }) => view({ key });
7
+ const viewUiSettingByKeyHandler = ({ view }) => async ({ key }) => view({ key });
8
+ export { VIEW_UI_SETTING_BY_KEY, viewUiSettingByKey, viewUiSettingByKeyHandler, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "engines": {
@@ -1,6 +1,6 @@
1
1
  import { command, Command } from "@lookiero/messaging";
2
2
 
3
- export const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM =
3
+ const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM =
4
4
  "book_size_replaceable_product_variants_for_checkout_item";
5
5
 
6
6
  interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
@@ -10,7 +10,7 @@ interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
10
10
  readonly checkoutBookingId: string;
11
11
  }
12
12
 
13
- export interface BookSizeReplaceableProductVariantsForCheckoutItem
13
+ interface BookSizeReplaceableProductVariantsForCheckoutItem
14
14
  extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>,
15
15
  BookSizeReplaceableProductVariantsForCheckoutItemPayload {}
16
16
 
@@ -20,8 +20,16 @@ interface BookSizeReplaceableProductVariantsForCheckoutItemFunction {
20
20
  ): BookSizeReplaceableProductVariantsForCheckoutItem;
21
21
  }
22
22
 
23
- export const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction =
24
- ({ aggregateId, ...payload }) => ({
25
- ...command({ aggregateId, name: BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
26
- ...payload,
27
- });
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
+ };
@@ -2,13 +2,13 @@ import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
2
  import { BookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bookSizeReplaceableProductVariantsForCheckoutItem";
3
3
  import { checkoutBookingBooked } from "./checkoutBookingBooked";
4
4
 
5
- export interface CheckoutBooking extends AggregateRoot {
5
+ interface CheckoutBooking extends AggregateRoot {
6
6
  readonly checkoutId: string;
7
7
  readonly checkoutItemId: string;
8
8
  readonly checkoutBookingId: string;
9
9
  }
10
10
 
11
- export const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<
11
+ const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<
12
12
  BookSizeReplaceableProductVariantsForCheckoutItem,
13
13
  CheckoutBooking
14
14
  > =
@@ -29,3 +29,5 @@ export const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHa
29
29
  }),
30
30
  };
31
31
  };
32
+
33
+ export { CheckoutBooking, bookSizeReplaceableProductVariantsForCheckoutItemHandler };