@lookiero/checkout 12.1.2 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/infrastructure/delivery/baseBootstrap.d.ts +2 -11
- package/dist/src/infrastructure/delivery/baseBootstrap.js +3 -8
- package/dist/src/infrastructure/delivery/bootstrap.js +0 -7
- package/dist/src/infrastructure/delivery/bootstrap.mock.js +0 -7
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/src/infrastructure/delivery/baseBootstrap.ts +3 -28
- package/src/infrastructure/delivery/bootstrap.mock.ts +0 -7
- package/src/infrastructure/delivery/bootstrap.ts +0 -7
- package/dist/src/domain/uiSetting/command/updateUiSetting.d.ts +0 -15
- package/dist/src/domain/uiSetting/command/updateUiSetting.js +0 -10
- package/dist/src/domain/uiSetting/model/uiSetting.d.ts +0 -9
- package/dist/src/domain/uiSetting/model/uiSetting.js +0 -11
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.d.ts +0 -15
- package/dist/src/domain/uiSetting/model/uiSettingUpdated.js +0 -8
- package/dist/src/domain/uiSetting/model/uiSettings.d.ts +0 -7
- package/dist/src/domain/uiSetting/model/uiSettings.js +0 -1
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +0 -17
- package/dist/src/infrastructure/domain/uiSetting/model/storageUiSettings.js +0 -20
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.d.ts +0 -18
- package/dist/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.js +0 -22
- package/dist/src/infrastructure/persistence/asyncStorageStorage.d.ts +0 -5
- package/dist/src/infrastructure/persistence/asyncStorageStorage.js +0 -7
- package/dist/src/infrastructure/persistence/uiSettingData.d.ts +0 -6
- package/dist/src/infrastructure/persistence/uiSettingData.js +0 -1
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.d.ts +0 -10
- package/dist/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.js +0 -11
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.d.ts +0 -13
- package/dist/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.js +0 -15
- package/dist/src/infrastructure/ui/settings/UISettings.d.ts +0 -3
- package/dist/src/infrastructure/ui/settings/UISettings.js +0 -4
- package/dist/src/projection/uiSetting/viewUiSettingByKey.d.ts +0 -29
- package/dist/src/projection/uiSetting/viewUiSettingByKey.js +0 -8
- package/src/domain/uiSetting/command/updateUiSetting.test.ts +0 -18
- package/src/domain/uiSetting/command/updateUiSetting.ts +0 -26
- package/src/domain/uiSetting/model/uiSetting.test.ts +0 -25
- package/src/domain/uiSetting/model/uiSetting.ts +0 -24
- package/src/domain/uiSetting/model/uiSettingUpdated.test.ts +0 -16
- package/src/domain/uiSetting/model/uiSettingUpdated.ts +0 -25
- package/src/domain/uiSetting/model/uiSettings.ts +0 -15
- package/src/infrastructure/domain/uiSetting/model/storageUiSettings.test.ts +0 -50
- package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +0 -49
- package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.test.ts +0 -62
- package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.ts +0 -50
- package/src/infrastructure/persistence/asyncStorageStorage.ts +0 -13
- package/src/infrastructure/persistence/uiSettingData.ts +0 -7
- package/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.test.ts +0 -33
- package/src/infrastructure/projection/uiSetting/react/useViewUiSettingByKey.ts +0 -22
- package/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.test.ts +0 -36
- package/src/infrastructure/projection/uiSetting/storageUiSettingByKeyView.ts +0 -37
- package/src/infrastructure/ui/settings/UISettings.ts +0 -3
- package/src/projection/uiSetting/viewUiSettingByKey.test.ts +0 -23
- package/src/projection/uiSetting/viewUiSettingByKey.ts +0 -50
|
@@ -8,8 +8,6 @@ import { CheckoutFeedback } from "../../domain/checkoutFeedback/model/checkoutFe
|
|
|
8
8
|
import { CheckoutFeedbacksGetFunction, CheckoutFeedbacksSaveFunction } from "../../domain/checkoutFeedback/model/checkoutFeedbacks";
|
|
9
9
|
import { CheckoutItem } from "../../domain/checkoutItem/model/checkoutItem";
|
|
10
10
|
import { CheckoutItemsGetFunction, CheckoutItemsSaveFunction } from "../../domain/checkoutItem/model/checkoutItems";
|
|
11
|
-
import { UiSetting } from "../../domain/uiSetting/model/uiSetting";
|
|
12
|
-
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../domain/uiSetting/model/uiSettings";
|
|
13
11
|
import { BookedProductsVariantsForCheckoutItemView } from "../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
14
12
|
import { CheckoutByIdView } from "../../projection/checkout/viewCheckoutById";
|
|
15
13
|
import { FirstAvailableCheckoutByCustomerIdView } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
@@ -22,17 +20,15 @@ import { CheckoutQuestionsByCheckoutIdView } from "../../projection/checkoutQues
|
|
|
22
20
|
import { PaymentFlowPayloadByCheckoutIdView } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
|
|
23
21
|
import { PricingByCheckoutIdView } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
24
22
|
import { ReturnQuestionsByCheckoutItemIdView } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
25
|
-
import { UiSettingByKeyView } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
26
23
|
declare const MESSAGING_CONTEXT_ID = "Checkout";
|
|
27
24
|
type NeverWhenEmptyRecord<K extends [Record<string, unknown>]> = K extends [Record<string, never>] ? [never?] : K;
|
|
28
25
|
type RepositoryDependencies<A extends AggregateRoot, GetFunctionArgs extends RepositoryGetFunctionArgs, SaveFunctionArgs extends RepositorySaveFunctionArgs> = Omit<Parameters<RepositoryGetFunction<A, GetFunctionArgs>>[0] & Parameters<RepositorySaveFunction<A, SaveFunctionArgs>>[0], keyof RepositoryGetFunctionArgs>;
|
|
29
|
-
interface BaseBootstrapFunctionArgs<
|
|
26
|
+
interface BaseBootstrapFunctionArgs<CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutItemSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutBookingGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutBookingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutFeedbackGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutFeedbackSaveFunctionArgs extends RepositorySaveFunctionArgs> {
|
|
30
27
|
readonly checkoutByIdView: CheckoutByIdView;
|
|
31
28
|
readonly firstAvailableCheckoutByCustomerIdView: FirstAvailableCheckoutByCustomerIdView;
|
|
32
29
|
readonly isCheckoutEnabledByCustomerIdView: IsCheckoutEnabledByCustomerIdView;
|
|
33
30
|
readonly isSizeChangeEnabledByCheckoutIdView: IsSizeChangeEnabledByCheckoutIdView;
|
|
34
31
|
readonly fiveItemsDiscountByCustomerIdView: FiveItemsDiscountByCustomerIdView;
|
|
35
|
-
readonly uiSettingByKeyView: UiSettingByKeyView;
|
|
36
32
|
readonly checkoutItemByIdView: CheckoutItemByIdView;
|
|
37
33
|
readonly checkoutBookingByIdView: CheckoutBookingByIdView;
|
|
38
34
|
readonly returnQuestionsByCheckoutItemIdView: ReturnQuestionsByCheckoutItemIdView;
|
|
@@ -40,11 +36,6 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
40
36
|
readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
|
|
41
37
|
readonly paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView;
|
|
42
38
|
readonly checkoutQuestionsByCheckoutIdView: CheckoutQuestionsByCheckoutIdView;
|
|
43
|
-
readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
|
|
44
|
-
readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
|
|
45
|
-
readonly uiSettingsDependencies: NeverWhenEmptyRecord<[
|
|
46
|
-
RepositoryDependencies<UiSetting, UiSettingGetFunctionArgs, UiSettingSaveFunctionArgs>
|
|
47
|
-
]>;
|
|
48
39
|
readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
|
|
49
40
|
readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
|
|
50
41
|
readonly checkoutsDependencies: NeverWhenEmptyRecord<[
|
|
@@ -67,7 +58,7 @@ interface BaseBootstrapFunctionArgs<UiSettingGetFunctionArgs extends RepositoryG
|
|
|
67
58
|
]>;
|
|
68
59
|
}
|
|
69
60
|
interface BaseBootstrapFunction {
|
|
70
|
-
<
|
|
61
|
+
<CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutItemSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutBookingGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutBookingSaveFunctionArgs extends RepositorySaveFunctionArgs, CheckoutFeedbackGetFunctionArgs extends RepositoryGetFunctionArgs, CheckoutFeedbackSaveFunctionArgs extends RepositorySaveFunctionArgs>(args: BaseBootstrapFunctionArgs<CheckoutGetFunctionArgs, CheckoutSaveFunctionArgs, CheckoutItemGetFunctionArgs, CheckoutItemSaveFunctionArgs, CheckoutBookingGetFunctionArgs, CheckoutBookingSaveFunctionArgs, CheckoutFeedbackGetFunctionArgs, CheckoutFeedbackSaveFunctionArgs>): BuildBootstrapFunctionReturn;
|
|
71
62
|
}
|
|
72
63
|
declare const baseBootstrap: BaseBootstrapFunction;
|
|
73
64
|
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
2
2
|
import { bootstrapWithBuilder as bootstrapNotifications, inMemoryStorageNotifications, } from "@lookiero/sty-psp-notifications";
|
|
3
|
+
import { bootstrapWithBuilder as bootstrapUiSettings, asyncStorageUiSettings } from "@lookiero/sty-psp-ui-settings";
|
|
3
4
|
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
4
5
|
import { SUBMIT_CHECKOUT } from "../../domain/checkout/command/submitCheckout";
|
|
5
6
|
import { createModalNotificationWhenCheckoutSubmitted } from "../../domain/checkout/event/createModalNotificationWhenCheckoutSubmitted";
|
|
@@ -19,8 +20,6 @@ import { RETURN_CHECKOUT_ITEM } from "../../domain/checkoutItem/command/returnCh
|
|
|
19
20
|
import { createModalNotificationWhenCheckoutItemReplaced } from "../../domain/checkoutItem/event/createModalNotificationWhenCheckoutItemReplaced";
|
|
20
21
|
import { keepCheckoutItemHandler, replaceCheckoutItemHandler, resetCheckoutItemHandler, returnCheckoutItemHandler, } from "../../domain/checkoutItem/model/checkoutItem";
|
|
21
22
|
import { CHECKOUT_ITEM_REPLACED } from "../../domain/checkoutItem/model/checkoutItemReplaced";
|
|
22
|
-
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
23
|
-
import { updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
24
23
|
import { viewBookedProductsVariantsForCheckoutItemHandler, VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM, } from "../../projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem";
|
|
25
24
|
import { viewCheckoutByIdHandler, VIEW_CHECKOUT_BY_ID, } from "../../projection/checkout/viewCheckoutById";
|
|
26
25
|
import { viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
@@ -33,9 +32,8 @@ import { listCheckoutQuestionsByCheckoutIdHandler, LIST_CHECKOUT_QUESTIONS_BY_CH
|
|
|
33
32
|
import { viewPaymentFlowPayloadByCheckoutIdHandler, VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID, } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
|
|
34
33
|
import { viewPricingByCheckoutIdHandler, VIEW_PRICING_BY_CHECKOUT_ID, } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
35
34
|
import { listReturnQuestionsByCheckoutItemIdHandler, LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID, } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
36
|
-
import { viewUiSettingByKeyHandler, VIEW_UI_SETTING_BY_KEY, } from "../../projection/uiSetting/viewUiSettingByKey";
|
|
37
35
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
38
|
-
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView,
|
|
36
|
+
const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdView, isCheckoutEnabledByCustomerIdView, isSizeChangeEnabledByCheckoutIdView, fiveItemsDiscountByCustomerIdView, checkoutItemByIdView, returnQuestionsByCheckoutItemIdView, bookedProductsVariantsForCheckoutItemView, checkoutBookingByIdView, pricingByCheckoutIdView, paymentFlowPayloadByCheckoutIdView, checkoutQuestionsByCheckoutIdView, getCheckout, saveCheckout, checkoutsDependencies, getCheckoutItem, saveCheckoutItem, checkoutItemsDependencies, getCheckoutBooking, saveCheckoutBooking, checkoutBookingsDependencies, getCheckoutFeedback, saveCheckoutFeedback, checkoutFeedbacksDependencies, }) => {
|
|
39
37
|
let messaging = messagingBootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
40
38
|
.query(VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID, viewFiveItemsDiscountByCustomerIdHandler, {
|
|
41
39
|
view: fiveItemsDiscountByCustomerIdView,
|
|
@@ -82,14 +80,11 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
82
80
|
.command(BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM, bookCheckoutBookingForCheckoutItemHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
83
81
|
.command(BLOCK_CHECKOUT_BOOKING, blockCheckoutBookingHandler)(getCheckoutBooking, saveCheckoutBooking, ...checkoutBookingsDependencies)
|
|
84
82
|
.command(GIVE_CHECKOUT_FEEDBACK, giveCheckoutFeedbackHandler)(getCheckoutFeedback, saveCheckoutFeedback, ...checkoutFeedbacksDependencies)
|
|
85
|
-
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
86
|
-
view: uiSettingByKeyView,
|
|
87
|
-
})
|
|
88
|
-
.command(UPDATE_UI_SETTING, updateUiSettingHandler)(getUiSetting, saveUiSetting, ...uiSettingsDependencies)
|
|
89
83
|
.processManager(CHECKOUT_BOOKING_EXPIRED, createToastNotificationWhenCheckoutBookingExpired)
|
|
90
84
|
.processManager(CHECKOUT_ITEM_REPLACED, createModalNotificationWhenCheckoutItemReplaced)
|
|
91
85
|
.processManager(CHECKOUT_SUBMITTED, createModalNotificationWhenCheckoutSubmitted);
|
|
92
86
|
messaging = bootstrapNotifications({ messaging, storage: inMemoryStorageNotifications() });
|
|
87
|
+
messaging = bootstrapUiSettings({ messaging, storage: asyncStorageUiSettings() });
|
|
93
88
|
return messaging.build();
|
|
94
89
|
};
|
|
95
90
|
export { baseBootstrap, MESSAGING_CONTEXT_ID };
|
|
@@ -5,8 +5,6 @@ import { getCheckout, saveCheckout } from "../domain/checkout/model/httpCheckout
|
|
|
5
5
|
import { getCheckoutBooking, saveCheckoutBooking } from "../domain/checkoutBooking/model/httpCheckoutBookings";
|
|
6
6
|
import { getCheckoutFeedback, saveCheckoutFeedback } from "../domain/checkoutFeedback/model/httpCheckoutFeedbacks";
|
|
7
7
|
import { getCheckoutItem, saveCheckoutItem } from "../domain/checkoutItem/model/httpCheckoutItems";
|
|
8
|
-
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
9
|
-
import { read, write } from "../persistence/asyncStorageStorage";
|
|
10
8
|
import { httpBookedProductsVariantsForCheckoutItemView } from "../projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView";
|
|
11
9
|
import { httpCheckoutByIdView } from "../projection/checkout/httpCheckoutByIdView";
|
|
12
10
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checkout/httpFirstAvailableCheckoutByCustomerIdView";
|
|
@@ -19,7 +17,6 @@ import { httpCheckoutQuestionsByCheckoutIdView } from "../projection/checkoutQue
|
|
|
19
17
|
import { httpPaymentFlowPayloadByCheckoutIdView } from "../projection/payment/httpPaymentFlowPayloadByCheckoutIdView";
|
|
20
18
|
import { httpPricingByCheckoutIdView } from "../projection/pricing/httpPricingByCheckoutIdView";
|
|
21
19
|
import { httpReturnQuestionsByCheckoutItemIdView } from "../projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView";
|
|
22
|
-
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
23
20
|
import { baseBootstrap } from "./baseBootstrap";
|
|
24
21
|
const device = Platform.OS;
|
|
25
22
|
const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
@@ -31,7 +28,6 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
31
28
|
isCheckoutEnabledByCustomerIdView: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
|
|
32
29
|
isSizeChangeEnabledByCheckoutIdView: httpIsSizeChangeEnabledByCheckoutIdView({ httpGet }),
|
|
33
30
|
fiveItemsDiscountByCustomerIdView: httpFiveItemsDiscountByCustomerIdView({ httpGet }),
|
|
34
|
-
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
35
31
|
checkoutItemByIdView: httpCheckoutItemByIdView({ httpPost }),
|
|
36
32
|
returnQuestionsByCheckoutItemIdView: httpReturnQuestionsByCheckoutItemIdView({ httpPost }),
|
|
37
33
|
checkoutBookingByIdView: httpCheckoutBookingByIdView({ httpPost }),
|
|
@@ -47,9 +43,6 @@ const bootstrap = ({ apiUrl, getAuthToken }) => {
|
|
|
47
43
|
checkoutQuestionsByCheckoutIdView: httpCheckoutQuestionsByCheckoutIdView({
|
|
48
44
|
httpPost,
|
|
49
45
|
}),
|
|
50
|
-
getUiSetting,
|
|
51
|
-
saveUiSetting,
|
|
52
|
-
uiSettingsDependencies: [{ read, write }],
|
|
53
46
|
getCheckout,
|
|
54
47
|
saveCheckout,
|
|
55
48
|
checkoutsDependencies: [{ httpPost }],
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CheckoutItemStatus } from "../../domain/checkoutItem/model/checkoutItem";
|
|
2
|
-
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
3
|
-
import { read, write } from "../persistence/asyncStorageStorage";
|
|
4
2
|
import { bookedProductsVariants } from "../projection/bookedProductsVariants/bookedProductsVariants.mock";
|
|
5
3
|
import { checkout } from "../projection/checkout/checkout.mock";
|
|
6
4
|
import { checkoutBooking as checkoutBookingMock } from "../projection/checkoutBooking/checkoutBooking.mock";
|
|
@@ -10,7 +8,6 @@ import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
|
|
|
10
8
|
import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
|
|
11
9
|
import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
|
|
12
10
|
import { returnQuestions as returnQuestionsMock } from "../projection/returnQuestion/returnQuestions.mock";
|
|
13
|
-
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
14
11
|
import { baseBootstrap } from "./baseBootstrap";
|
|
15
12
|
import { checkoutBookingDataSource } from "./mock/checkoutBookingDataSource";
|
|
16
13
|
import { checkoutDataSource } from "./mock/checkoutDataSource";
|
|
@@ -64,7 +61,6 @@ const bootstrap = () => baseBootstrap({
|
|
|
64
61
|
isCheckoutEnabledByCustomerIdView,
|
|
65
62
|
isSizeChangeEnabledByCheckoutIdView,
|
|
66
63
|
fiveItemsDiscountByCustomerIdView,
|
|
67
|
-
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
68
64
|
checkoutItemByIdView,
|
|
69
65
|
returnQuestionsByCheckoutItemIdView,
|
|
70
66
|
checkoutBookingByIdView,
|
|
@@ -72,9 +68,6 @@ const bootstrap = () => baseBootstrap({
|
|
|
72
68
|
pricingByCheckoutIdView,
|
|
73
69
|
paymentFlowPayloadByCheckoutIdView,
|
|
74
70
|
checkoutQuestionsByCheckoutIdView,
|
|
75
|
-
getUiSetting,
|
|
76
|
-
saveUiSetting,
|
|
77
|
-
uiSettingsDependencies: [{ read, write }],
|
|
78
71
|
getCheckout,
|
|
79
72
|
saveCheckout,
|
|
80
73
|
checkoutsDependencies: [{ dataSource }],
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "12.
|
|
1
|
+
export declare const VERSION = "12.2.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "12.
|
|
1
|
+
export const VERSION = "12.2.0";
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
bootstrapWithBuilder as bootstrapNotifications,
|
|
11
11
|
inMemoryStorageNotifications,
|
|
12
12
|
} from "@lookiero/sty-psp-notifications";
|
|
13
|
+
import { bootstrapWithBuilder as bootstrapUiSettings, asyncStorageUiSettings } from "@lookiero/sty-psp-ui-settings";
|
|
13
14
|
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
14
15
|
import { SUBMIT_CHECKOUT } from "../../domain/checkout/command/submitCheckout";
|
|
15
16
|
import { createModalNotificationWhenCheckoutSubmitted } from "../../domain/checkout/event/createModalNotificationWhenCheckoutSubmitted";
|
|
@@ -49,9 +50,6 @@ import {
|
|
|
49
50
|
} from "../../domain/checkoutItem/model/checkoutItem";
|
|
50
51
|
import { CHECKOUT_ITEM_REPLACED } from "../../domain/checkoutItem/model/checkoutItemReplaced";
|
|
51
52
|
import { CheckoutItemsGetFunction, CheckoutItemsSaveFunction } from "../../domain/checkoutItem/model/checkoutItems";
|
|
52
|
-
import { UPDATE_UI_SETTING } from "../../domain/uiSetting/command/updateUiSetting";
|
|
53
|
-
import { UiSetting, updateUiSettingHandler } from "../../domain/uiSetting/model/uiSetting";
|
|
54
|
-
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../domain/uiSetting/model/uiSettings";
|
|
55
53
|
import {
|
|
56
54
|
BookedProductsVariantsForCheckoutItemView,
|
|
57
55
|
viewBookedProductsVariantsForCheckoutItemHandler,
|
|
@@ -112,11 +110,6 @@ import {
|
|
|
112
110
|
LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID,
|
|
113
111
|
ReturnQuestionsByCheckoutItemIdView,
|
|
114
112
|
} from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
115
|
-
import {
|
|
116
|
-
UiSettingByKeyView,
|
|
117
|
-
viewUiSettingByKeyHandler,
|
|
118
|
-
VIEW_UI_SETTING_BY_KEY,
|
|
119
|
-
} from "../../projection/uiSetting/viewUiSettingByKey";
|
|
120
113
|
|
|
121
114
|
const MESSAGING_CONTEXT_ID = "Checkout";
|
|
122
115
|
|
|
@@ -132,8 +125,6 @@ type RepositoryDependencies<
|
|
|
132
125
|
>;
|
|
133
126
|
|
|
134
127
|
interface BaseBootstrapFunctionArgs<
|
|
135
|
-
UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
136
|
-
UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
137
128
|
CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
138
129
|
CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
139
130
|
CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
@@ -148,7 +139,6 @@ interface BaseBootstrapFunctionArgs<
|
|
|
148
139
|
readonly isCheckoutEnabledByCustomerIdView: IsCheckoutEnabledByCustomerIdView;
|
|
149
140
|
readonly isSizeChangeEnabledByCheckoutIdView: IsSizeChangeEnabledByCheckoutIdView;
|
|
150
141
|
readonly fiveItemsDiscountByCustomerIdView: FiveItemsDiscountByCustomerIdView;
|
|
151
|
-
readonly uiSettingByKeyView: UiSettingByKeyView;
|
|
152
142
|
readonly checkoutItemByIdView: CheckoutItemByIdView;
|
|
153
143
|
readonly checkoutBookingByIdView: CheckoutBookingByIdView;
|
|
154
144
|
readonly returnQuestionsByCheckoutItemIdView: ReturnQuestionsByCheckoutItemIdView;
|
|
@@ -156,11 +146,6 @@ interface BaseBootstrapFunctionArgs<
|
|
|
156
146
|
readonly pricingByCheckoutIdView: PricingByCheckoutIdView;
|
|
157
147
|
readonly paymentFlowPayloadByCheckoutIdView: PaymentFlowPayloadByCheckoutIdView;
|
|
158
148
|
readonly checkoutQuestionsByCheckoutIdView: CheckoutQuestionsByCheckoutIdView;
|
|
159
|
-
readonly getUiSetting: UiSettingGetFunction<UiSettingGetFunctionArgs>;
|
|
160
|
-
readonly saveUiSetting: UiSettingSaveFunction<UiSettingSaveFunctionArgs>;
|
|
161
|
-
readonly uiSettingsDependencies: NeverWhenEmptyRecord<
|
|
162
|
-
[RepositoryDependencies<UiSetting, UiSettingGetFunctionArgs, UiSettingSaveFunctionArgs>]
|
|
163
|
-
>;
|
|
164
149
|
readonly getCheckout: CheckoutsGetFunction<CheckoutGetFunctionArgs>;
|
|
165
150
|
readonly saveCheckout: CheckoutsSaveFunction<CheckoutSaveFunctionArgs>;
|
|
166
151
|
readonly checkoutsDependencies: NeverWhenEmptyRecord<
|
|
@@ -185,8 +170,6 @@ interface BaseBootstrapFunctionArgs<
|
|
|
185
170
|
|
|
186
171
|
interface BaseBootstrapFunction {
|
|
187
172
|
<
|
|
188
|
-
UiSettingGetArgs extends RepositoryGetFunctionArgs,
|
|
189
|
-
UiSettingSaveArgs extends RepositorySaveFunctionArgs,
|
|
190
173
|
CheckoutGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
191
174
|
CheckoutSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
192
175
|
CheckoutItemGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
@@ -197,8 +180,6 @@ interface BaseBootstrapFunction {
|
|
|
197
180
|
CheckoutFeedbackSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
198
181
|
>(
|
|
199
182
|
args: BaseBootstrapFunctionArgs<
|
|
200
|
-
UiSettingGetArgs,
|
|
201
|
-
UiSettingSaveArgs,
|
|
202
183
|
CheckoutGetFunctionArgs,
|
|
203
184
|
CheckoutSaveFunctionArgs,
|
|
204
185
|
CheckoutItemGetFunctionArgs,
|
|
@@ -224,10 +205,6 @@ const baseBootstrap: BaseBootstrapFunction = ({
|
|
|
224
205
|
pricingByCheckoutIdView,
|
|
225
206
|
paymentFlowPayloadByCheckoutIdView,
|
|
226
207
|
checkoutQuestionsByCheckoutIdView,
|
|
227
|
-
uiSettingByKeyView,
|
|
228
|
-
getUiSetting,
|
|
229
|
-
saveUiSetting,
|
|
230
|
-
uiSettingsDependencies,
|
|
231
208
|
getCheckout,
|
|
232
209
|
saveCheckout,
|
|
233
210
|
checkoutsDependencies,
|
|
@@ -315,16 +292,14 @@ const baseBootstrap: BaseBootstrapFunction = ({
|
|
|
315
292
|
saveCheckoutFeedback,
|
|
316
293
|
...checkoutFeedbacksDependencies,
|
|
317
294
|
)
|
|
318
|
-
.query(VIEW_UI_SETTING_BY_KEY, viewUiSettingByKeyHandler, {
|
|
319
|
-
view: uiSettingByKeyView,
|
|
320
|
-
})
|
|
321
|
-
.command(UPDATE_UI_SETTING, updateUiSettingHandler)(getUiSetting, saveUiSetting, ...uiSettingsDependencies)
|
|
322
295
|
.processManager(CHECKOUT_BOOKING_EXPIRED, createToastNotificationWhenCheckoutBookingExpired)
|
|
323
296
|
.processManager(CHECKOUT_ITEM_REPLACED, createModalNotificationWhenCheckoutItemReplaced)
|
|
324
297
|
.processManager(CHECKOUT_SUBMITTED, createModalNotificationWhenCheckoutSubmitted);
|
|
325
298
|
|
|
326
299
|
messaging = bootstrapNotifications({ messaging, storage: inMemoryStorageNotifications() });
|
|
327
300
|
|
|
301
|
+
messaging = bootstrapUiSettings({ messaging, storage: asyncStorageUiSettings() });
|
|
302
|
+
|
|
328
303
|
return messaging.build();
|
|
329
304
|
};
|
|
330
305
|
|
|
@@ -12,8 +12,6 @@ import { CheckoutQuestionsByCheckoutIdView } from "../../projection/checkoutQues
|
|
|
12
12
|
import { PaymentFlowPayloadByCheckoutIdView } from "../../projection/payment/viewPaymentFlowPayloadByCheckoutId";
|
|
13
13
|
import { PricingByCheckoutIdView } from "../../projection/pricing/viewPricingByCheckoutId";
|
|
14
14
|
import { ReturnQuestionsByCheckoutItemIdView } from "../../projection/returnQuestion/listReturnQuestionsByCheckoutItemId";
|
|
15
|
-
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
16
|
-
import { read, write } from "../persistence/asyncStorageStorage";
|
|
17
15
|
import { bookedProductsVariants } from "../projection/bookedProductsVariants/bookedProductsVariants.mock";
|
|
18
16
|
import { checkout } from "../projection/checkout/checkout.mock";
|
|
19
17
|
import { checkoutBooking as checkoutBookingMock } from "../projection/checkoutBooking/checkoutBooking.mock";
|
|
@@ -23,7 +21,6 @@ import { feedback as feedbackMock } from "../projection/feedback/feedback.mock";
|
|
|
23
21
|
import { paymentFlowPayload as paymentFlowPayloadMock } from "../projection/payment/paymentFlowPayload.mock";
|
|
24
22
|
import { pricing as pricingMock } from "../projection/pricing/pricing.mock";
|
|
25
23
|
import { returnQuestions as returnQuestionsMock } from "../projection/returnQuestion/returnQuestions.mock";
|
|
26
|
-
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
27
24
|
import { baseBootstrap } from "./baseBootstrap";
|
|
28
25
|
import { checkoutBookingDataSource } from "./mock/checkoutBookingDataSource";
|
|
29
26
|
import { checkoutDataSource } from "./mock/checkoutDataSource";
|
|
@@ -85,7 +82,6 @@ const bootstrap: () => BuildBootstrapFunctionReturn = () =>
|
|
|
85
82
|
isCheckoutEnabledByCustomerIdView,
|
|
86
83
|
isSizeChangeEnabledByCheckoutIdView,
|
|
87
84
|
fiveItemsDiscountByCustomerIdView,
|
|
88
|
-
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
89
85
|
checkoutItemByIdView,
|
|
90
86
|
returnQuestionsByCheckoutItemIdView,
|
|
91
87
|
checkoutBookingByIdView,
|
|
@@ -93,9 +89,6 @@ const bootstrap: () => BuildBootstrapFunctionReturn = () =>
|
|
|
93
89
|
pricingByCheckoutIdView,
|
|
94
90
|
paymentFlowPayloadByCheckoutIdView,
|
|
95
91
|
checkoutQuestionsByCheckoutIdView,
|
|
96
|
-
getUiSetting,
|
|
97
|
-
saveUiSetting,
|
|
98
|
-
uiSettingsDependencies: [{ read, write }],
|
|
99
92
|
getCheckout,
|
|
100
93
|
saveCheckout,
|
|
101
94
|
checkoutsDependencies: [{ dataSource }],
|
|
@@ -6,8 +6,6 @@ import { getCheckout, saveCheckout } from "../domain/checkout/model/httpCheckout
|
|
|
6
6
|
import { getCheckoutBooking, saveCheckoutBooking } from "../domain/checkoutBooking/model/httpCheckoutBookings";
|
|
7
7
|
import { getCheckoutFeedback, saveCheckoutFeedback } from "../domain/checkoutFeedback/model/httpCheckoutFeedbacks";
|
|
8
8
|
import { getCheckoutItem, saveCheckoutItem } from "../domain/checkoutItem/model/httpCheckoutItems";
|
|
9
|
-
import { getUiSetting, saveUiSetting } from "../domain/uiSetting/model/storageUiSettings";
|
|
10
|
-
import { read, write } from "../persistence/asyncStorageStorage";
|
|
11
9
|
import { httpBookedProductsVariantsForCheckoutItemView } from "../projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView";
|
|
12
10
|
import { httpCheckoutByIdView } from "../projection/checkout/httpCheckoutByIdView";
|
|
13
11
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "../projection/checkout/httpFirstAvailableCheckoutByCustomerIdView";
|
|
@@ -20,7 +18,6 @@ import { httpCheckoutQuestionsByCheckoutIdView } from "../projection/checkoutQue
|
|
|
20
18
|
import { httpPaymentFlowPayloadByCheckoutIdView } from "../projection/payment/httpPaymentFlowPayloadByCheckoutIdView";
|
|
21
19
|
import { httpPricingByCheckoutIdView } from "../projection/pricing/httpPricingByCheckoutIdView";
|
|
22
20
|
import { httpReturnQuestionsByCheckoutItemIdView } from "../projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView";
|
|
23
|
-
import { storageUiSettingByKeyView } from "../projection/uiSetting/storageUiSettingByKeyView";
|
|
24
21
|
import { baseBootstrap } from "./baseBootstrap";
|
|
25
22
|
|
|
26
23
|
type OS = typeof Platform.OS;
|
|
@@ -46,7 +43,6 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken }) => {
|
|
|
46
43
|
isCheckoutEnabledByCustomerIdView: httpIsCheckoutEnabledByCustomerIdView({ httpGet }),
|
|
47
44
|
isSizeChangeEnabledByCheckoutIdView: httpIsSizeChangeEnabledByCheckoutIdView({ httpGet }),
|
|
48
45
|
fiveItemsDiscountByCustomerIdView: httpFiveItemsDiscountByCustomerIdView({ httpGet }),
|
|
49
|
-
uiSettingByKeyView: storageUiSettingByKeyView({ read }),
|
|
50
46
|
checkoutItemByIdView: httpCheckoutItemByIdView({ httpPost }),
|
|
51
47
|
returnQuestionsByCheckoutItemIdView: httpReturnQuestionsByCheckoutItemIdView({ httpPost }),
|
|
52
48
|
checkoutBookingByIdView: httpCheckoutBookingByIdView({ httpPost }),
|
|
@@ -62,9 +58,6 @@ const bootstrap: BootstrapFunction = ({ apiUrl, getAuthToken }) => {
|
|
|
62
58
|
checkoutQuestionsByCheckoutIdView: httpCheckoutQuestionsByCheckoutIdView({
|
|
63
59
|
httpPost,
|
|
64
60
|
}),
|
|
65
|
-
getUiSetting,
|
|
66
|
-
saveUiSetting,
|
|
67
|
-
uiSettingsDependencies: [{ read, write }],
|
|
68
61
|
getCheckout,
|
|
69
62
|
saveCheckout,
|
|
70
63
|
checkoutsDependencies: [{ httpPost }],
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from "@lookiero/messaging";
|
|
2
|
-
declare const UPDATE_UI_SETTING = "update_ui_setting";
|
|
3
|
-
interface UpdateUiSettingPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
readonly key: string;
|
|
6
|
-
readonly value: unknown;
|
|
7
|
-
}
|
|
8
|
-
interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
|
|
9
|
-
}
|
|
10
|
-
interface UpdateUiSettingFunction {
|
|
11
|
-
(payload: UpdateUiSettingPayload): UpdateUiSetting;
|
|
12
|
-
}
|
|
13
|
-
declare const updateUiSetting: UpdateUiSettingFunction;
|
|
14
|
-
export type { UpdateUiSetting };
|
|
15
|
-
export { UPDATE_UI_SETTING, updateUiSetting };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { command } from "@lookiero/messaging";
|
|
2
|
-
const UPDATE_UI_SETTING = "update_ui_setting";
|
|
3
|
-
const updateUiSetting = ({ aggregateId, ...payload }) => ({
|
|
4
|
-
...command({
|
|
5
|
-
aggregateId,
|
|
6
|
-
name: UPDATE_UI_SETTING,
|
|
7
|
-
}),
|
|
8
|
-
...payload,
|
|
9
|
-
});
|
|
10
|
-
export { UPDATE_UI_SETTING, updateUiSetting };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
-
import { UpdateUiSetting } from "../command/updateUiSetting";
|
|
3
|
-
interface UiSetting extends AggregateRoot {
|
|
4
|
-
readonly key: string;
|
|
5
|
-
readonly value: unknown;
|
|
6
|
-
}
|
|
7
|
-
declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
|
|
8
|
-
export type { UiSetting };
|
|
9
|
-
export { updateUiSettingHandler };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { uiSettingUpdated } from "./uiSettingUpdated";
|
|
2
|
-
const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
|
|
3
|
-
const { aggregateId, key, value } = command;
|
|
4
|
-
return {
|
|
5
|
-
...aggregateRoot,
|
|
6
|
-
key,
|
|
7
|
-
value,
|
|
8
|
-
domainEvents: [uiSettingUpdated({ aggregateId, key })],
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export { updateUiSettingHandler };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DomainEvent, MessageName } from "@lookiero/messaging";
|
|
2
|
-
declare const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
3
|
-
interface UiSettingUpdatedPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
readonly key: string;
|
|
6
|
-
}
|
|
7
|
-
interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
|
|
8
|
-
}
|
|
9
|
-
interface UiSettingUpdatedFunction {
|
|
10
|
-
(payload: UiSettingUpdatedPayload): UiSettingUpdated;
|
|
11
|
-
}
|
|
12
|
-
declare const uiSettingUpdated: UiSettingUpdatedFunction;
|
|
13
|
-
declare const isUiSettingUpdated: (event: DomainEvent<MessageName>) => event is UiSettingUpdated;
|
|
14
|
-
export type { UiSettingUpdated };
|
|
15
|
-
export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { domainEvent } from "@lookiero/messaging";
|
|
2
|
-
const UI_SETTING_UPDATED = "ui_setting_updated";
|
|
3
|
-
const uiSettingUpdated = ({ aggregateId, key }) => ({
|
|
4
|
-
...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
|
|
5
|
-
key,
|
|
6
|
-
});
|
|
7
|
-
const isUiSettingUpdated = (event) => event.name === UI_SETTING_UPDATED;
|
|
8
|
-
export { UI_SETTING_UPDATED, uiSettingUpdated, isUiSettingUpdated };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { RepositoryGetFunction, RepositoryGetFunctionArgs, RepositorySaveFunction, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
-
import { UiSetting } from "./uiSetting";
|
|
3
|
-
interface UiSettingGetFunction<UiSettingGetFunctionArgs extends RepositoryGetFunctionArgs> extends RepositoryGetFunction<UiSetting, UiSettingGetFunctionArgs> {
|
|
4
|
-
}
|
|
5
|
-
interface UiSettingSaveFunction<UiSettingSaveFunctionArgs extends RepositorySaveFunctionArgs> extends RepositorySaveFunction<UiSetting, UiSettingSaveFunctionArgs> {
|
|
6
|
-
}
|
|
7
|
-
export type { UiSettingGetFunction, UiSettingSaveFunction };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RepositoryGetFunctionArgs, RepositorySaveFunctionArgs } from "@lookiero/messaging";
|
|
2
|
-
import { UiSettingGetFunction, UiSettingSaveFunction } from "../../../../domain/uiSetting/model/uiSettings";
|
|
3
|
-
import { ReadFunction, WriteFunction } from "../../../persistence/storage";
|
|
4
|
-
import { UiSettingDto } from "../../../persistence/uiSettingData";
|
|
5
|
-
interface StorageUiSettingsGetFunctionArgs extends RepositoryGetFunctionArgs {
|
|
6
|
-
readonly read: ReadFunction<UiSettingDto>;
|
|
7
|
-
}
|
|
8
|
-
interface StorageUiSettingsGetFunction extends UiSettingGetFunction<StorageUiSettingsGetFunctionArgs> {
|
|
9
|
-
}
|
|
10
|
-
declare const getUiSetting: StorageUiSettingsGetFunction;
|
|
11
|
-
interface StorageUiSettingsSaveFunctionArgs extends RepositorySaveFunctionArgs {
|
|
12
|
-
readonly write: WriteFunction<UiSettingDto>;
|
|
13
|
-
}
|
|
14
|
-
interface StorageUiSettingsSaveFunction extends UiSettingSaveFunction<StorageUiSettingsSaveFunctionArgs> {
|
|
15
|
-
}
|
|
16
|
-
declare const saveUiSetting: StorageUiSettingsSaveFunction;
|
|
17
|
-
export { getUiSetting, saveUiSetting };
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
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
|
-
const saveUiSetting = ({ write }) => async (aggregateRoot) => await write(aggregateRoot.key, fromDomain(aggregateRoot));
|
|
20
|
-
export { getUiSetting, saveUiSetting };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import { Logger } from "@lookiero/sty-psp-logging";
|
|
3
|
-
interface UpdateFunctionArgs {
|
|
4
|
-
readonly key: string;
|
|
5
|
-
readonly value: unknown;
|
|
6
|
-
}
|
|
7
|
-
interface UpdateFunction {
|
|
8
|
-
(args: UpdateFunctionArgs): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
type UseUpdateUiSetting = [update: UpdateFunction, status: CommandStatus];
|
|
11
|
-
interface UseUpdateUiSettingArgs {
|
|
12
|
-
readonly logger: Logger;
|
|
13
|
-
}
|
|
14
|
-
interface UseUpdateUiSettingFunction {
|
|
15
|
-
(args: UseUpdateUiSettingArgs): UseUpdateUiSetting;
|
|
16
|
-
}
|
|
17
|
-
declare const useUpdateUiSetting: UseUpdateUiSettingFunction;
|
|
18
|
-
export { useUpdateUiSetting };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
|
-
import { useCommand } from "@lookiero/messaging-react";
|
|
4
|
-
import { updateUiSetting } from "../../../../domain/uiSetting/command/updateUiSetting";
|
|
5
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const useUpdateUiSetting = ({ logger }) => {
|
|
7
|
-
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const update = useCallback(async ({ key, value }) => {
|
|
9
|
-
try {
|
|
10
|
-
await commandBus(updateUiSetting({
|
|
11
|
-
aggregateId: uuid(),
|
|
12
|
-
key,
|
|
13
|
-
value,
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
logger.captureException(error);
|
|
18
|
-
}
|
|
19
|
-
}, [commandBus, logger]);
|
|
20
|
-
return [update, status];
|
|
21
|
-
};
|
|
22
|
-
export { useUpdateUiSetting };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2
|
-
const read = async (key) => {
|
|
3
|
-
const value = await AsyncStorage.getItem(key);
|
|
4
|
-
return value ? JSON.parse(value) : null;
|
|
5
|
-
};
|
|
6
|
-
const write = async (key, value) => AsyncStorage.setItem(key, JSON.stringify(value));
|
|
7
|
-
export { read, write };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UseQueryFunctionResult } from "@lookiero/messaging-react";
|
|
2
|
-
import { UiSettingProjection } from "../../../../projection/uiSetting/viewUiSettingByKey";
|
|
3
|
-
interface UseViewUiSettingByKeyFunctionArgs {
|
|
4
|
-
readonly key: string;
|
|
5
|
-
}
|
|
6
|
-
interface UseViewUiSettingByKeyFunction {
|
|
7
|
-
(args: UseViewUiSettingByKeyFunctionArgs): UseQueryFunctionResult<UiSettingProjection>;
|
|
8
|
-
}
|
|
9
|
-
declare const useViewUiSettingByKey: UseViewUiSettingByKeyFunction;
|
|
10
|
-
export { useViewUiSettingByKey };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
-
import { isUiSettingUpdated } from "../../../../domain/uiSetting/model/uiSettingUpdated";
|
|
3
|
-
import { viewUiSettingByKey } from "../../../../projection/uiSetting/viewUiSettingByKey";
|
|
4
|
-
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
5
|
-
const useViewUiSettingByKey = ({ key }) => useQuery({
|
|
6
|
-
query: viewUiSettingByKey({ key }),
|
|
7
|
-
contextId: MESSAGING_CONTEXT_ID,
|
|
8
|
-
invalidation: isUiSettingUpdated,
|
|
9
|
-
options: { refetchOnMount: "always", staleTime: Infinity, retry: false, refetchOnWindowFocus: false },
|
|
10
|
-
});
|
|
11
|
-
export { useViewUiSettingByKey };
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
declare const storageUiSettingByKeyView: StorageUiSettingByKeyViewFunction;
|
|
13
|
-
export { storageUiSettingByKeyView };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const toUiSettingProjection = (uiSettingDto) => ({
|
|
2
|
-
id: uiSettingDto.id,
|
|
3
|
-
key: uiSettingDto.key,
|
|
4
|
-
value: uiSettingDto.value,
|
|
5
|
-
});
|
|
6
|
-
const storageUiSettingByKeyView = ({ read }) => async ({ key }) => {
|
|
7
|
-
try {
|
|
8
|
-
const uiSettingDto = await read(key);
|
|
9
|
-
return uiSettingDto ? toUiSettingProjection(uiSettingDto) : null;
|
|
10
|
-
}
|
|
11
|
-
catch (ignored) {
|
|
12
|
-
throw new Error("Could not fetch the uiSetting");
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export { storageUiSettingByKeyView };
|