@lookiero/checkout 0.1.1

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 (202) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc +72 -0
  3. package/.expo-shared/assets.json +4 -0
  4. package/.github/CODEOWNERS +1 -0
  5. package/.github/actions/version/action.yaml +32 -0
  6. package/.github/dependabot.yaml +10 -0
  7. package/.github/workflows/build.yaml +71 -0
  8. package/.github/workflows/publish.yaml +52 -0
  9. package/.husky/pre-commit +4 -0
  10. package/.husky/prepare-commit-msg +26 -0
  11. package/.husky/prepush +12 -0
  12. package/.lintstagedrc.json +4 -0
  13. package/.nvmrc +1 -0
  14. package/.prettierignore +2 -0
  15. package/.prettierrc.json +6 -0
  16. package/@types/aurora-next.d.ts +1 -0
  17. package/README.md +19 -0
  18. package/app.config.js +4 -0
  19. package/app.json +31 -0
  20. package/assets/adaptive-icon.png +0 -0
  21. package/assets/favicon.png +0 -0
  22. package/assets/icon.png +0 -0
  23. package/assets/splash.png +0 -0
  24. package/babel.config.js +6 -0
  25. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +15 -0
  26. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js +6 -0
  27. package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +8 -0
  28. package/dist/domain/checkoutBooking/model/checkoutBooking.js +16 -0
  29. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +15 -0
  30. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.js +6 -0
  31. package/dist/domain/checkoutBooking/model/checkoutBookings.d.ts +6 -0
  32. package/dist/domain/checkoutBooking/model/checkoutBookings.js +1 -0
  33. package/dist/domain/uiSetting/command/updateUiSetting.d.ts +14 -0
  34. package/dist/domain/uiSetting/command/updateUiSetting.js +9 -0
  35. package/dist/domain/uiSetting/model/uiSetting.d.ts +8 -0
  36. package/dist/domain/uiSetting/model/uiSetting.js +10 -0
  37. package/dist/domain/uiSetting/model/uiSettingUpdated.d.ts +13 -0
  38. package/dist/domain/uiSetting/model/uiSettingUpdated.js +6 -0
  39. package/dist/domain/uiSetting/model/uiSettings.d.ts +6 -0
  40. package/dist/domain/uiSetting/model/uiSettings.js +1 -0
  41. package/dist/index.d.ts +22 -0
  42. package/dist/index.js +13 -0
  43. package/dist/infrastructure/delivery/_mock/bootstrap.mock.d.ts +6 -0
  44. package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +17 -0
  45. package/dist/infrastructure/delivery/_mock/checkout.mock.d.ts +9 -0
  46. package/dist/infrastructure/delivery/_mock/checkout.mock.js +45 -0
  47. package/dist/infrastructure/delivery/bootstrap.d.ts +10 -0
  48. package/dist/infrastructure/delivery/bootstrap.js +21 -0
  49. package/dist/infrastructure/delivery/http/fetchHttpClient.d.ts +14 -0
  50. package/dist/infrastructure/delivery/http/fetchHttpClient.js +18 -0
  51. package/dist/infrastructure/delivery/http/httpClient.d.ts +14 -0
  52. package/dist/infrastructure/delivery/http/httpClient.js +1 -0
  53. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.d.ts +10 -0
  54. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +19 -0
  55. package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +15 -0
  56. package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js +17 -0
  57. package/dist/infrastructure/domain/react/useUpdateUiSetting.d.ts +17 -0
  58. package/dist/infrastructure/domain/react/useUpdateUiSetting.js +16 -0
  59. package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +18 -0
  60. package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.js +19 -0
  61. package/dist/infrastructure/persistence/asyncStorageStorage.d.ts +4 -0
  62. package/dist/infrastructure/persistence/asyncStorageStorage.js +6 -0
  63. package/dist/infrastructure/persistence/storage.d.ts +6 -0
  64. package/dist/infrastructure/persistence/storage.js +1 -0
  65. package/dist/infrastructure/persistence/uiSettingData.d.ts +5 -0
  66. package/dist/infrastructure/persistence/uiSettingData.js +1 -0
  67. package/dist/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts +36 -0
  68. package/dist/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +30 -0
  69. package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.d.ts +60 -0
  70. package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.js +54 -0
  71. package/dist/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.d.ts +12 -0
  72. package/dist/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.js +7 -0
  73. package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +10 -0
  74. package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +8 -0
  75. package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.d.ts +10 -0
  76. package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.js +8 -0
  77. package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +10 -0
  78. package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.js +8 -0
  79. package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.d.ts +3 -0
  80. package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.js +3 -0
  81. package/dist/infrastructure/projection/react/useViewUiSettingByKey.d.ts +10 -0
  82. package/dist/infrastructure/projection/react/useViewUiSettingByKey.js +8 -0
  83. package/dist/infrastructure/projection/storageUiSettingByKeyView.d.ts +13 -0
  84. package/dist/infrastructure/projection/storageUiSettingByKeyView.js +14 -0
  85. package/dist/infrastructure/ui/Root.d.ts +15 -0
  86. package/dist/infrastructure/ui/Root.js +25 -0
  87. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.d.ts +3 -0
  88. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.js +11 -0
  89. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.style.d.ts +9 -0
  90. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.style.js +10 -0
  91. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +8 -0
  92. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +16 -0
  93. package/dist/infrastructure/ui/routing/CheckoutMiddleware.d.ts +7 -0
  94. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +34 -0
  95. package/dist/infrastructure/ui/routing/Routing.d.ts +7 -0
  96. package/dist/infrastructure/ui/routing/Routing.js +49 -0
  97. package/dist/infrastructure/ui/routing/router/Router.d.ts +1 -0
  98. package/dist/infrastructure/ui/routing/router/Router.js +1 -0
  99. package/dist/infrastructure/ui/routing/router/Router.native.d.ts +1 -0
  100. package/dist/infrastructure/ui/routing/router/Router.native.js +1 -0
  101. package/dist/infrastructure/ui/routing/routes.d.ts +6 -0
  102. package/dist/infrastructure/ui/routing/routes.js +7 -0
  103. package/dist/infrastructure/ui/test/render.d.ts +19 -0
  104. package/dist/infrastructure/ui/test/render.js +14 -0
  105. package/dist/infrastructure/ui/views/intro/Intro.d.ts +3 -0
  106. package/dist/infrastructure/ui/views/intro/Intro.js +20 -0
  107. package/dist/infrastructure/ui/views/item/Item.d.ts +3 -0
  108. package/dist/infrastructure/ui/views/item/Item.js +23 -0
  109. package/dist/infrastructure/ui/views/summary/Summary.d.ts +3 -0
  110. package/dist/infrastructure/ui/views/summary/Summary.js +20 -0
  111. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +43 -0
  112. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.js +8 -0
  113. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +104 -0
  114. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +43 -0
  115. package/dist/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +16 -0
  116. package/dist/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +13 -0
  117. package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.d.ts +23 -0
  118. package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.js +8 -0
  119. package/dist/projection/uiSetting/viewUiSettingByKey.d.ts +28 -0
  120. package/dist/projection/uiSetting/viewUiSettingByKey.js +7 -0
  121. package/jest.config.js +9 -0
  122. package/jest.setup.js +3 -0
  123. package/package.json +75 -0
  124. package/src/Expo.tsx +59 -0
  125. package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.test.ts +26 -0
  126. package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.ts +27 -0
  127. package/src/domain/checkoutBooking/model/checkoutBooking.test.ts +30 -0
  128. package/src/domain/checkoutBooking/model/checkoutBooking.ts +31 -0
  129. package/src/domain/checkoutBooking/model/checkoutBookingBooked.test.ts +23 -0
  130. package/src/domain/checkoutBooking/model/checkoutBookingBooked.ts +23 -0
  131. package/src/domain/checkoutBooking/model/checkoutBookings.ts +6 -0
  132. package/src/domain/uiSetting/command/updateUiSetting.test.ts +19 -0
  133. package/src/domain/uiSetting/command/updateUiSetting.ts +23 -0
  134. package/src/domain/uiSetting/model/uiSetting.test.ts +26 -0
  135. package/src/domain/uiSetting/model/uiSetting.ts +22 -0
  136. package/src/domain/uiSetting/model/uiSettingUpdated.test.ts +17 -0
  137. package/src/domain/uiSetting/model/uiSettingUpdated.ts +19 -0
  138. package/src/domain/uiSetting/model/uiSettings.ts +6 -0
  139. package/src/index.ts +44 -0
  140. package/src/infrastructure/delivery/_mock/bootstrap.mock.ts +38 -0
  141. package/src/infrastructure/delivery/_mock/checkout.mock.ts +81 -0
  142. package/src/infrastructure/delivery/bootstrap.ts +42 -0
  143. package/src/infrastructure/delivery/http/fetchHttpClient.test.ts +51 -0
  144. package/src/infrastructure/delivery/http/fetchHttpClient.ts +41 -0
  145. package/src/infrastructure/delivery/http/httpClient.ts +18 -0
  146. package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.test.ts +45 -0
  147. package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.ts +32 -0
  148. package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.test.ts +38 -0
  149. package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.ts +44 -0
  150. package/src/infrastructure/domain/react/useUpdateUiSetting.test.ts +31 -0
  151. package/src/infrastructure/domain/react/useUpdateUiSetting.ts +43 -0
  152. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.test.ts +50 -0
  153. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +50 -0
  154. package/src/infrastructure/persistence/asyncStorageStorage.ts +12 -0
  155. package/src/infrastructure/persistence/storage.ts +7 -0
  156. package/src/infrastructure/persistence/uiSettingData.ts +5 -0
  157. package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.test.ts +65 -0
  158. package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.ts +102 -0
  159. package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.test.ts +99 -0
  160. package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.ts +128 -0
  161. package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.test.ts +32 -0
  162. package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.ts +27 -0
  163. package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +51 -0
  164. package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +25 -0
  165. package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.test.ts +28 -0
  166. package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.ts +22 -0
  167. package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.test.ts +44 -0
  168. package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.ts +24 -0
  169. package/src/infrastructure/projection/react/useViewIsCheckoutIntroVisible.ts +5 -0
  170. package/src/infrastructure/projection/react/useViewUiSettingByKey.test.ts +30 -0
  171. package/src/infrastructure/projection/react/useViewUiSettingByKey.ts +18 -0
  172. package/src/infrastructure/projection/storageUiSettingByKeyView.test.ts +32 -0
  173. package/src/infrastructure/projection/storageUiSettingByKeyView.ts +35 -0
  174. package/src/infrastructure/ui/Root.tsx +53 -0
  175. package/src/infrastructure/ui/components/atoms/spiner/Spinner.style.ts +12 -0
  176. package/src/infrastructure/ui/components/atoms/spiner/Spinner.tsx +35 -0
  177. package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.test.tsx +70 -0
  178. package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.tsx +31 -0
  179. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +100 -0
  180. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +52 -0
  181. package/src/infrastructure/ui/routing/Routing.tsx +64 -0
  182. package/src/infrastructure/ui/routing/router/Router.native.ts +1 -0
  183. package/src/infrastructure/ui/routing/router/Router.ts +1 -0
  184. package/src/infrastructure/ui/routing/routes.ts +6 -0
  185. package/src/infrastructure/ui/test/render.tsx +47 -0
  186. package/src/infrastructure/ui/views/intro/Intro.test.tsx +15 -0
  187. package/src/infrastructure/ui/views/intro/Intro.tsx +27 -0
  188. package/src/infrastructure/ui/views/item/Item.tsx +31 -0
  189. package/src/infrastructure/ui/views/summary/Summary.tsx +27 -0
  190. package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +40 -0
  191. package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +85 -0
  192. package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.test.ts +22 -0
  193. package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.ts +149 -0
  194. package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.test.ts +54 -0
  195. package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.ts +46 -0
  196. package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.test.ts +20 -0
  197. package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.ts +51 -0
  198. package/src/projection/uiSetting/viewUiSettingByKey.test.ts +22 -0
  199. package/src/projection/uiSetting/viewUiSettingByKey.ts +47 -0
  200. package/tsconfig.build.json +16 -0
  201. package/tsconfig.json +19 -0
  202. package/webpack.config.js +17 -0
@@ -0,0 +1,45 @@
1
+ import { v4 as uuid } from "uuid";
2
+ import { CheckoutStatus, Currency, MediaPerspective, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ const checkoutItem = ({ status }) => ({
4
+ id: uuid(),
5
+ status,
6
+ productVariant: {
7
+ id: uuid(),
8
+ media: [
9
+ {
10
+ id: uuid(),
11
+ url: "https://cdn-catalog-back-prod.envs.lookiero.tech/d2/65/d2655b80-7745-4537-bb17-eb38f960a8de.jpg",
12
+ perspective: MediaPerspective.FRONT,
13
+ },
14
+ ],
15
+ brand: "CKS",
16
+ name: "Sari Tshirt lines",
17
+ price: {
18
+ amount: 3999,
19
+ currency: Currency.EUR,
20
+ },
21
+ size: {
22
+ id: uuid(),
23
+ lookiero: "M",
24
+ uk: "M",
25
+ it: "M",
26
+ europe: "M",
27
+ unique: false,
28
+ },
29
+ color: {
30
+ id: uuid(),
31
+ label: "black_C2",
32
+ },
33
+ },
34
+ });
35
+ const checkoutWithItems = ({ items }) => ({
36
+ id: uuid(),
37
+ status: CheckoutStatus.STARTED,
38
+ customerId: uuid(),
39
+ boxId: uuid(),
40
+ bookingId: uuid(),
41
+ expiresOn: new Date("2022-09-20"),
42
+ items,
43
+ });
44
+ const startedCheckoutWithItems = ({ status }) => checkoutWithItems({ items: status.map((status) => checkoutItem({ status })) });
45
+ export { startedCheckoutWithItems };
@@ -0,0 +1,10 @@
1
+ import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
2
+ interface BootstrapFunctionArgs {
3
+ readonly getAuthToken: () => string;
4
+ readonly apiUrl: string;
5
+ }
6
+ interface BootstrapFunction {
7
+ (args: BootstrapFunctionArgs): BuildBootstrapFunctionReturn;
8
+ }
9
+ declare const bootstrap: BootstrapFunction;
10
+ export { bootstrap };
@@ -0,0 +1,21 @@
1
+ import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
2
+ import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
4
+ import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
5
+ import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/httpFirstAvailableCheckoutByCustomerIdView";
6
+ import { httpIsCheckoutEnabledByCustomerIdView } from "../projection/httpIsCheckoutEnabledByCustomerIdView";
7
+ import { fetchHttpGet, fetchHttpPost } from "./http/fetchHttpClient";
8
+ const bootstrap = ({ apiUrl, getAuthToken }) => {
9
+ const httpGet = fetchHttpGet({ apiUrl, getAuthToken });
10
+ const httpPost = fetchHttpPost({ apiUrl, getAuthToken });
11
+ return messagingBootstrap({ id: "Checkout" })
12
+ .query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
13
+ view: httpFirstAvailableCheckoutByCustomerIdView({ httpPost }),
14
+ })
15
+ .query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
16
+ view: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
17
+ })
18
+ .query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
19
+ .build();
20
+ };
21
+ export { bootstrap };
@@ -0,0 +1,14 @@
1
+ import { HttpGetFunction, HttpPostFunction } from "./httpClient";
2
+ interface FetchHttpFunctionArgs {
3
+ readonly apiUrl: string;
4
+ readonly getAuthToken: () => string;
5
+ }
6
+ interface FetchHttpPostFunction {
7
+ (args: FetchHttpFunctionArgs): HttpPostFunction;
8
+ }
9
+ interface FetchHttpGetFunction {
10
+ (args: FetchHttpFunctionArgs): HttpGetFunction;
11
+ }
12
+ declare const fetchHttpPost: FetchHttpPostFunction;
13
+ declare const fetchHttpGet: FetchHttpGetFunction;
14
+ export { fetchHttpGet, fetchHttpPost };
@@ -0,0 +1,18 @@
1
+ const fetchHttpPost = ({ apiUrl, getAuthToken }) => async ({ endpoint, body }) => fetch(`${apiUrl}${endpoint}`, {
2
+ method: "POST",
3
+ headers: {
4
+ ["Content-Type"]: "application/json",
5
+ authorization: `Bearer ${getAuthToken()}`,
6
+ },
7
+ body: JSON.stringify(body),
8
+ });
9
+ const fetchHttpGet = ({ apiUrl, getAuthToken }) => async ({ endpoint }) => fetch(`${apiUrl}${endpoint}`, {
10
+ method: "GET",
11
+ credentials: "include",
12
+ mode: "no-cors",
13
+ headers: {
14
+ authorization: `Bearer ${getAuthToken()}`,
15
+ },
16
+ referrer: "",
17
+ });
18
+ export { fetchHttpGet, fetchHttpPost };
@@ -0,0 +1,14 @@
1
+ interface HttpGetFunctionArgs {
2
+ readonly endpoint: string;
3
+ }
4
+ interface HttpGetFunction {
5
+ (args: HttpGetFunctionArgs): Promise<Response>;
6
+ }
7
+ interface HttpPostFunctionArgs {
8
+ readonly endpoint: string;
9
+ readonly body: Record<string, unknown>;
10
+ }
11
+ interface HttpPostFunction {
12
+ (args: HttpPostFunctionArgs): Promise<Response>;
13
+ }
14
+ export { HttpGetFunction, HttpPostFunction };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { CheckoutBookingsSaveFunction } from "../../../../domain/checkoutBooking/model/checkoutBookings";
2
+ import { HttpPostFunction } from "../../../delivery/http/httpClient";
3
+ interface HttpCheckoutBookingsSaveFunctionArgs {
4
+ readonly httpPost: HttpPostFunction;
5
+ }
6
+ interface HttpCheckoutBookingsSaveFunction {
7
+ (args: HttpCheckoutBookingsSaveFunctionArgs): CheckoutBookingsSaveFunction;
8
+ }
9
+ export declare const saveCheckoutBooking: HttpCheckoutBookingsSaveFunction;
10
+ export {};
@@ -0,0 +1,19 @@
1
+ export const saveCheckoutBooking = ({ httpPost }) => async ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
2
+ try {
3
+ const response = await httpPost({
4
+ endpoint: "/book-size-replaceable-product-variants-for-checkout-item",
5
+ body: {
6
+ checkout_id: checkoutId,
7
+ checkout_item_id: checkoutItemId,
8
+ checkout_booking_id: checkoutBookingId,
9
+ },
10
+ });
11
+ if (!response.ok) {
12
+ throw new Error("Book size replaceable product variants for checkout item");
13
+ }
14
+ return;
15
+ }
16
+ catch (ignored) {
17
+ throw new Error("Could not fetch BookSizeReplaceableProductVariantsForCheckoutItem");
18
+ }
19
+ };
@@ -0,0 +1,15 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ interface UseBookSizeReplaceableProductVariantsForCheckoutItem {
3
+ readonly book: () => Promise<void>;
4
+ readonly status: CommandStatus;
5
+ }
6
+ interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
7
+ readonly checkoutId: string;
8
+ readonly checkoutItemId: string;
9
+ readonly checkoutBookingId: string;
10
+ }
11
+ interface UseBookSizeReplaceableProductVariantsForCheckoutItemFunction {
12
+ (args: UseBookSizeReplaceableProductVariantsForCheckoutItemFunctionArgs): UseBookSizeReplaceableProductVariantsForCheckoutItem;
13
+ }
14
+ export declare const useBookSizeReplaceableProductVariantsForCheckoutItem: UseBookSizeReplaceableProductVariantsForCheckoutItemFunction;
15
+ export {};
@@ -0,0 +1,17 @@
1
+ import { useCommand } from "@lookiero/messaging-react";
2
+ import { useCallback } from "react";
3
+ import { v4 as uuid } from "uuid";
4
+ import { bookSizeReplaceableProductVariantsForCheckoutItem } from "../../../domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem";
5
+ export const useBookSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutId, checkoutItemId, checkoutBookingId }) => {
6
+ const [commandBus, status] = useCommand();
7
+ const book = useCallback(async () => await commandBus(bookSizeReplaceableProductVariantsForCheckoutItem({
8
+ aggregateId: uuid(),
9
+ checkoutId,
10
+ checkoutItemId,
11
+ checkoutBookingId,
12
+ })), [checkoutBookingId, checkoutId, checkoutItemId, commandBus]);
13
+ return {
14
+ book,
15
+ status,
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ import { CommandStatus } from "@lookiero/messaging-react";
2
+ interface UpdateFunctionArgs {
3
+ readonly key: string;
4
+ readonly value: unknown;
5
+ }
6
+ interface UpdateFunction {
7
+ (args: UpdateFunctionArgs): Promise<void>;
8
+ }
9
+ interface UseUpdateUiSetting {
10
+ readonly update: UpdateFunction;
11
+ readonly status: CommandStatus;
12
+ }
13
+ interface UseUpdateUiSettingFunction {
14
+ (): UseUpdateUiSetting;
15
+ }
16
+ export declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
17
+ export {};
@@ -0,0 +1,16 @@
1
+ import { useCommand } from "@lookiero/messaging-react";
2
+ import { useCallback } from "react";
3
+ import { v4 as uuid } from "uuid";
4
+ import { updateUiSetting } from "../../../domain/uiSetting/command/updateUiSetting";
5
+ export const useUpdateUiSetting = () => {
6
+ const [commandBus, status] = useCommand();
7
+ const update = useCallback(async ({ key, value }) => await commandBus(updateUiSetting({
8
+ aggregateId: uuid(),
9
+ key,
10
+ value,
11
+ })), [commandBus]);
12
+ return {
13
+ update,
14
+ status,
15
+ };
16
+ };
@@ -0,0 +1,18 @@
1
+ import { UiSettingGetFunction, UiSettingSaveFunction } from "../../../../domain/uiSetting/model/uiSettings";
2
+ import { ReadFunction, WriteFunction } from "../../../persistence/storage";
3
+ import { UiSettingDto } from "../../../persistence/uiSettingData";
4
+ interface StorageUiSettingsGetFunctionArgs {
5
+ readonly read: ReadFunction<UiSettingDto>;
6
+ }
7
+ interface StorageUiSettingsGetFunction {
8
+ (args: StorageUiSettingsGetFunctionArgs): UiSettingGetFunction;
9
+ }
10
+ export declare const getUiSetting: StorageUiSettingsGetFunction;
11
+ interface StorageUiSettingsSaveFunctionArgs {
12
+ readonly write: WriteFunction<UiSettingDto>;
13
+ }
14
+ interface StorageUiSettingsSaveFunction {
15
+ (args: StorageUiSettingsSaveFunctionArgs): UiSettingSaveFunction;
16
+ }
17
+ export declare const saveUiSetting: StorageUiSettingsSaveFunction;
18
+ export {};
@@ -0,0 +1,19 @@
1
+ const toDomain = (uiSettingDto) => ({
2
+ aggregateId: uiSettingDto.id,
3
+ key: uiSettingDto.key,
4
+ value: uiSettingDto.value,
5
+ domainEvents: [],
6
+ });
7
+ const fromDomain = (uiSetting) => ({
8
+ id: uiSetting.aggregateId,
9
+ key: uiSetting.key,
10
+ value: uiSetting.value,
11
+ });
12
+ export const getUiSetting = ({ read }) => async (uiSettingKey) => {
13
+ const uiSettingDto = await read(uiSettingKey);
14
+ if (!uiSettingDto) {
15
+ throw new Error(`UiSetting not found: ${uiSettingKey}`);
16
+ }
17
+ return toDomain(uiSettingDto);
18
+ };
19
+ export const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
@@ -0,0 +1,4 @@
1
+ import { ReadFunction, WriteFunction } from "./storage";
2
+ import { UiSettingDto } from "./uiSettingData";
3
+ export declare const read: ReadFunction<UiSettingDto>;
4
+ export declare const write: WriteFunction<UiSettingDto>;
@@ -0,0 +1,6 @@
1
+ import AsyncStorage from "@react-native-async-storage/async-storage";
2
+ export const read = async (key) => {
3
+ const value = await AsyncStorage.getItem(key);
4
+ return value ? JSON.parse(value) : undefined;
5
+ };
6
+ export const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
@@ -0,0 +1,6 @@
1
+ export interface ReadFunction<T> {
2
+ (key: string): Promise<T | undefined>;
3
+ }
4
+ export interface WriteFunction<T> {
5
+ (key: string, value: T): Promise<void>;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface UiSettingDto {
2
+ readonly id: string;
3
+ readonly key: string;
4
+ readonly value: unknown;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { BookedSizeReplaceableProductVariantsProjection, BookedSizeReplaceableProductVariantsForCheckoutItemView } from "../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
2
+ import { HttpPostFunction } from "../delivery/http/httpClient";
3
+ interface SizeFormatDto {
4
+ readonly size: string;
5
+ readonly format: string;
6
+ readonly length?: string;
7
+ }
8
+ interface SizeDto {
9
+ readonly id: string;
10
+ readonly europe: SizeFormatDto;
11
+ readonly it: SizeFormatDto;
12
+ readonly lookiero: SizeFormatDto;
13
+ readonly uk: SizeFormatDto;
14
+ }
15
+ interface ProductVariantDto {
16
+ readonly id: string;
17
+ readonly size: SizeDto;
18
+ }
19
+ interface BookedSizeReplaceableProductVariantsDto {
20
+ readonly booking: string | null;
21
+ readonly product_variants: ProductVariantDto[];
22
+ }
23
+ interface ToBookedSizeReplaceableProductVariantsFunction {
24
+ (bookedSizeReplaceableProductVariants: BookedSizeReplaceableProductVariantsDto): BookedSizeReplaceableProductVariantsProjection;
25
+ }
26
+ declare const toBookedSizeReplaceableProductVariants: ToBookedSizeReplaceableProductVariantsFunction;
27
+ interface HttpBookedSizeReplaceableProductVariantsForCheckoutItemView extends BookedSizeReplaceableProductVariantsForCheckoutItemView {
28
+ }
29
+ interface HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunctionArgs {
30
+ readonly httpPost: HttpPostFunction;
31
+ }
32
+ interface HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunction {
33
+ (args: HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunctionArgs): HttpBookedSizeReplaceableProductVariantsForCheckoutItemView;
34
+ }
35
+ declare const httpBookedSizeReplaceableProductVariantsForCheckoutItemView: HttpBookedSizeReplaceableProductVariantsForCheckoutItemViewFunction;
36
+ export { BookedSizeReplaceableProductVariantsDto, toBookedSizeReplaceableProductVariants, httpBookedSizeReplaceableProductVariantsForCheckoutItemView, };
@@ -0,0 +1,30 @@
1
+ const toSize = (size) => ({
2
+ id: size.id,
3
+ europe: size.europe,
4
+ it: size.it,
5
+ lookiero: size.lookiero,
6
+ uk: size.uk,
7
+ });
8
+ const toProductVariant = (productVariant) => ({
9
+ id: productVariant.id,
10
+ size: toSize(productVariant.size),
11
+ });
12
+ const toBookedSizeReplaceableProductVariants = (bookedSizeReplaceableProductVariants) => ({
13
+ booking: bookedSizeReplaceableProductVariants.booking,
14
+ productVariants: bookedSizeReplaceableProductVariants.product_variants.map(toProductVariant),
15
+ });
16
+ const httpBookedSizeReplaceableProductVariantsForCheckoutItemView = ({ httpPost }) => async ({ checkoutItemId }) => {
17
+ try {
18
+ const response = await httpPost({
19
+ endpoint: "/view-booked-size-replaceable-product-variants-for-checkout-item",
20
+ body: { checkout_item_id: checkoutItemId },
21
+ });
22
+ return response.status === 404
23
+ ? undefined
24
+ : toBookedSizeReplaceableProductVariants((await response.json()).result);
25
+ }
26
+ catch (ignored) {
27
+ throw new Error("Could not fetch BookedSizeReplaceableProductVariantsForCheckoutItem");
28
+ }
29
+ };
30
+ export { toBookedSizeReplaceableProductVariants, httpBookedSizeReplaceableProductVariantsForCheckoutItemView, };
@@ -0,0 +1,60 @@
1
+ import { CheckoutItemStatus, CheckoutProjection, CheckoutStatus, Currency, FirstAvailableCheckoutByCustomerIdView, MediaPerspective } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ import { HttpPostFunction } from "../delivery/http/httpClient";
3
+ interface CheckoutDto {
4
+ readonly id: string;
5
+ readonly customer_id: string;
6
+ readonly box_id: string;
7
+ readonly booking_id: string;
8
+ readonly status: CheckoutStatus;
9
+ readonly expires_on: string;
10
+ readonly items: {
11
+ readonly id: string;
12
+ readonly status: CheckoutItemStatus;
13
+ readonly product_variant: {
14
+ readonly id: string;
15
+ readonly media: {
16
+ readonly id: string;
17
+ readonly url: string;
18
+ readonly perspective: MediaPerspective;
19
+ }[];
20
+ readonly brand: string;
21
+ readonly name: string;
22
+ readonly price: {
23
+ readonly amount: number;
24
+ readonly currency: Currency;
25
+ readonly discounted_price?: {
26
+ readonly amount: number;
27
+ readonly percentage: number;
28
+ };
29
+ };
30
+ readonly size: {
31
+ readonly id: string;
32
+ readonly lookiero: string;
33
+ readonly uk: string;
34
+ readonly it: string;
35
+ readonly europe: string;
36
+ readonly unique: boolean;
37
+ readonly visual_order?: number;
38
+ };
39
+ readonly color: {
40
+ readonly id: string;
41
+ readonly label: string;
42
+ };
43
+ };
44
+ readonly replaced_for?: string;
45
+ }[];
46
+ }
47
+ interface ToCheckoutProjectionFunction {
48
+ (checkoutDto: CheckoutDto): CheckoutProjection;
49
+ }
50
+ declare const toCheckoutProjection: ToCheckoutProjectionFunction;
51
+ interface HttpFirstAvailableCheckoutByCustomerIdView extends FirstAvailableCheckoutByCustomerIdView {
52
+ }
53
+ interface HttpFirstAvailableCheckoutByCustomerIdViewFunctionArgs {
54
+ readonly httpPost: HttpPostFunction;
55
+ }
56
+ interface HttpFirstAvailableCheckoutByCustomerIdViewFunction {
57
+ (args: HttpFirstAvailableCheckoutByCustomerIdViewFunctionArgs): HttpFirstAvailableCheckoutByCustomerIdView;
58
+ }
59
+ declare const httpFirstAvailableCheckoutByCustomerIdView: HttpFirstAvailableCheckoutByCustomerIdViewFunction;
60
+ export { CheckoutDto, toCheckoutProjection, httpFirstAvailableCheckoutByCustomerIdView };
@@ -0,0 +1,54 @@
1
+ const toCheckoutProjection = (checkoutDto) => ({
2
+ id: checkoutDto.id,
3
+ customerId: checkoutDto.customer_id,
4
+ boxId: checkoutDto.box_id,
5
+ bookingId: checkoutDto.booking_id,
6
+ status: checkoutDto.status,
7
+ expiresOn: new Date(checkoutDto.expires_on),
8
+ items: checkoutDto.items.map((item) => ({
9
+ id: item.id,
10
+ status: item.status,
11
+ replacedFor: item.replaced_for,
12
+ productVariant: {
13
+ id: item.product_variant.id,
14
+ media: item.product_variant.media.map((media) => ({
15
+ id: media.id,
16
+ url: media.url,
17
+ perspective: media.perspective,
18
+ })),
19
+ brand: item.product_variant.brand,
20
+ name: item.product_variant.name,
21
+ price: {
22
+ amount: item.product_variant.price.amount,
23
+ currency: item.product_variant.price.currency,
24
+ discountedPrice: item.product_variant.price.discounted_price
25
+ ? {
26
+ amount: item.product_variant.price.discounted_price.amount,
27
+ percentage: item.product_variant.price.discounted_price.percentage,
28
+ }
29
+ : undefined,
30
+ },
31
+ size: {
32
+ id: item.product_variant.size.id,
33
+ lookiero: item.product_variant.size.lookiero,
34
+ uk: item.product_variant.size.uk,
35
+ it: item.product_variant.size.it,
36
+ europe: item.product_variant.size.europe,
37
+ unique: item.product_variant.size.unique,
38
+ visualOrder: item.product_variant.size.visual_order,
39
+ },
40
+ color: {
41
+ id: item.product_variant.color.id,
42
+ label: item.product_variant.color.label,
43
+ },
44
+ },
45
+ })),
46
+ });
47
+ const httpFirstAvailableCheckoutByCustomerIdView = ({ httpPost }) => async ({ customerId }) => {
48
+ const response = await httpPost({
49
+ endpoint: "/view-first-available-checkout-by-customer-id",
50
+ body: { customer_id: customerId },
51
+ });
52
+ return !response.ok || response.status === 404 ? undefined : toCheckoutProjection((await response.json()).result);
53
+ };
54
+ export { toCheckoutProjection, httpFirstAvailableCheckoutByCustomerIdView };
@@ -0,0 +1,12 @@
1
+ import { IsCheckoutEnabledByCustomerIdView } from "../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
2
+ import { HttpGetFunction } from "../delivery/http/httpClient";
3
+ interface HttpIsCheckoutEnabledByCustomerIdView extends IsCheckoutEnabledByCustomerIdView {
4
+ }
5
+ interface HttpIsCheckoutEnabledByCustomerIdViewFunctionArgs {
6
+ readonly httpGet: HttpGetFunction;
7
+ }
8
+ interface HttpIsCheckoutEnabledByCustomerIdViewFunction {
9
+ (args: HttpIsCheckoutEnabledByCustomerIdViewFunctionArgs): HttpIsCheckoutEnabledByCustomerIdView;
10
+ }
11
+ declare const httpIsCheckoutEnabledByCustomerIdView: HttpIsCheckoutEnabledByCustomerIdViewFunction;
12
+ export { httpIsCheckoutEnabledByCustomerIdView };
@@ -0,0 +1,7 @@
1
+ const httpIsCheckoutEnabledByCustomerIdView = ({ httpGet }) => async ({ customerId }) => {
2
+ const response = await httpGet({
3
+ endpoint: `/is-new-checkout-enabled/${customerId}`,
4
+ });
5
+ return !response.ok ? false : await response.json();
6
+ };
7
+ export { httpIsCheckoutEnabledByCustomerIdView };
@@ -0,0 +1,10 @@
1
+ import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
+ import { BookedSizeReplaceableProductVariantsProjection } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
3
+ interface UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunctionArgs {
4
+ readonly checkoutItemId: string;
5
+ }
6
+ interface UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction {
7
+ (args: UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunctionArgs): UseQueryFunctionResult<BookedSizeReplaceableProductVariantsProjection>;
8
+ }
9
+ declare const useViewBookedSizeReplaceableProductVariantsForCheckoutItem: UseViewBookedSizeReplaceableProductVariantsForCheckoutItemFunction;
10
+ export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
@@ -0,0 +1,8 @@
1
+ import { useQuery } from "@lookiero/messaging-react";
2
+ import { viewBookedSizeReplaceableProductVariantsForCheckoutItem, } from "../../../projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem";
3
+ const useViewBookedSizeReplaceableProductVariantsForCheckoutItem = ({ checkoutItemId }) => useQuery({
4
+ query: viewBookedSizeReplaceableProductVariantsForCheckoutItem({ checkoutItemId }),
5
+ contextId: "Checkout",
6
+ options: { staleTime: Infinity },
7
+ });
8
+ export { useViewBookedSizeReplaceableProductVariantsForCheckoutItem };
@@ -0,0 +1,10 @@
1
+ import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
+ import { CheckoutProjection } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ interface UseViewFirstAvailableCheckoutByCustomerIdFunctionArgs {
4
+ readonly customerId: string;
5
+ }
6
+ interface UseViewFirstAvailableCheckoutByCustomerIdFunction {
7
+ (args: UseViewFirstAvailableCheckoutByCustomerIdFunctionArgs): UseQueryFunctionResult<CheckoutProjection>;
8
+ }
9
+ declare const useViewFirstAvailableCheckoutByCustomerId: UseViewFirstAvailableCheckoutByCustomerIdFunction;
10
+ export { useViewFirstAvailableCheckoutByCustomerId };
@@ -0,0 +1,8 @@
1
+ import { useQuery } from "@lookiero/messaging-react";
2
+ import { viewFirstAvailableCheckoutByCustomerId, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ const useViewFirstAvailableCheckoutByCustomerId = ({ customerId }) => useQuery({
4
+ query: viewFirstAvailableCheckoutByCustomerId({ customerId }),
5
+ contextId: "Checkout",
6
+ options: { staleTime: Infinity, retry: false },
7
+ });
8
+ export { useViewFirstAvailableCheckoutByCustomerId };
@@ -0,0 +1,10 @@
1
+ import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
+ import { IsCheckoutAccessibleByCustomerIdProjection } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
3
+ interface UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs {
4
+ readonly customerId: string | undefined;
5
+ }
6
+ interface UseViewIsCheckoutAccessibleByCustomerIdFunction {
7
+ (args: UseViewIsCheckoutAccessibleByCustomerIdFunctionArgs): UseQueryFunctionResult<IsCheckoutAccessibleByCustomerIdProjection>;
8
+ }
9
+ declare const useViewIsCheckoutAccessibleByCustomerId: UseViewIsCheckoutAccessibleByCustomerIdFunction;
10
+ export { useViewIsCheckoutAccessibleByCustomerId };
@@ -0,0 +1,8 @@
1
+ import { useQuery } from "@lookiero/messaging-react";
2
+ import { viewIsCheckoutAccessibleByCustomerId, } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
3
+ const useViewIsCheckoutAccessibleByCustomerId = ({ customerId }) => useQuery({
4
+ query: viewIsCheckoutAccessibleByCustomerId({ customerId }),
5
+ contextId: "Checkout",
6
+ options: { staleTime: Infinity },
7
+ });
8
+ export { useViewIsCheckoutAccessibleByCustomerId };
@@ -0,0 +1,3 @@
1
+ import { QueryStatus } from "@lookiero/messaging-react";
2
+ declare const useViewIsCheckoutIntroVisible: () => (boolean | QueryStatus)[];
3
+ export { useViewIsCheckoutIntroVisible };
@@ -0,0 +1,3 @@
1
+ import { QueryStatus } from "@lookiero/messaging-react";
2
+ const useViewIsCheckoutIntroVisible = () => [false, QueryStatus.SUCCESS];
3
+ export { useViewIsCheckoutIntroVisible };
@@ -0,0 +1,10 @@
1
+ import { UseQueryFunctionResult } from "@lookiero/messaging-react";
2
+ import { UiSettingProjection } from "../../../projection/uiSetting/viewUiSettingByKey";
3
+ interface UseViewUiSettingByKeyFunctionArgs {
4
+ readonly uiSettingKey: string;
5
+ }
6
+ interface UseViewUiSettingByKeyFunction {
7
+ (args: UseViewUiSettingByKeyFunctionArgs): UseQueryFunctionResult<UiSettingProjection>;
8
+ }
9
+ export declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import { useQuery } from "@lookiero/messaging-react";
2
+ import { uiSettingUpdated } from "../../../domain/uiSetting/model/uiSettingUpdated";
3
+ import { viewUiSettingByKey } from "../../../projection/uiSetting/viewUiSettingByKey";
4
+ export const useViewUiSettingByKey = ({ uiSettingKey }) => useQuery({
5
+ query: viewUiSettingByKey({ key: uiSettingKey }),
6
+ invalidation: (event) => event instanceof uiSettingUpdated,
7
+ options: { staleTime: Infinity },
8
+ });
@@ -0,0 +1,13 @@
1
+ import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
2
+ import { ReadFunction } from "../persistence/storage";
3
+ import { UiSettingDto } from "../persistence/uiSettingData";
4
+ interface StorageUiSettingByKeyView extends UiSettingByKeyView {
5
+ }
6
+ interface StorageUiSettingByKeyViewFunctionArgs {
7
+ readonly read: ReadFunction<UiSettingDto>;
8
+ }
9
+ interface StorageUiSettingByKeyViewFunction {
10
+ (args: StorageUiSettingByKeyViewFunctionArgs): StorageUiSettingByKeyView;
11
+ }
12
+ export declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
13
+ export {};