@lookiero/checkout 12.2.0-beta.0 → 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/infrastructure/ui/Root.d.ts +1 -2
- package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.d.ts +0 -2
- package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +5 -5
- package/dist/src/infrastructure/ui/routing/Routing.d.ts +1 -2
- package/dist/src/infrastructure/ui/views/checkout/Checkout.d.ts +1 -2
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +0 -1
- package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.d.ts +1 -2
- package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/src/ExpoRoot.tsx +1 -2
- 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/src/infrastructure/ui/Root.tsx +1 -2
- package/src/infrastructure/ui/hooks/useCheckoutFlow.test.tsx +7 -12
- package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +4 -6
- package/src/infrastructure/ui/routing/Routing.tsx +1 -2
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +1 -3
- package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +2 -3
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- 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/integration/useRedirect.d.ts +0 -7
- package/dist/src/infrastructure/integration/useRedirect.js +0 -1
- 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/hooks/useSubmitCheckout.d.ts +0 -27
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +0 -97
- package/dist/src/infrastructure/ui/routing/useBasePath.d.ts +0 -8
- package/dist/src/infrastructure/ui/routing/useBasePath.js +0 -9
- package/dist/src/infrastructure/ui/settings/UISettings.d.ts +0 -3
- package/dist/src/infrastructure/ui/settings/UISettings.js +0 -4
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +0 -90
- 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/integration/useRedirect.ts +0 -9
- 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 }],
|
|
@@ -11,7 +11,6 @@ import { Customer } from "../../projection/customer/customer";
|
|
|
11
11
|
import { OrderProjection } from "../../projection/order/order";
|
|
12
12
|
import { SubscriptionProjection } from "../../projection/subscription/subscription";
|
|
13
13
|
import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
|
|
14
|
-
import { UseRedirectFunction } from "../integration/useRedirect";
|
|
15
14
|
interface RootFunctionArgs {
|
|
16
15
|
readonly Messaging: MessagingRoot;
|
|
17
16
|
readonly I18n: I18n;
|
|
@@ -34,7 +33,7 @@ interface RootProps {
|
|
|
34
33
|
readonly tradename: Tradename;
|
|
35
34
|
readonly onNotAccessible: () => void;
|
|
36
35
|
readonly onCheckoutFlowSuccess: () => void;
|
|
37
|
-
readonly useRedirect:
|
|
36
|
+
readonly useRedirect: () => Record<string, string>;
|
|
38
37
|
readonly useRoutes?: typeof reactRouterUseRoutes;
|
|
39
38
|
}
|
|
40
39
|
declare const root: RootFunction;
|
|
@@ -2,7 +2,6 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import { CheckoutProjection } from "../../../projection/checkout/checkout";
|
|
3
3
|
import { OrderProjection } from "../../../projection/order/order";
|
|
4
4
|
import { SubscriptionProjection } from "../../../projection/subscription/subscription";
|
|
5
|
-
import { UseRedirectFunction } from "../../integration/useRedirect";
|
|
6
5
|
type CheckoutFlowStatus = "idle" | "loading" | "success" | "error";
|
|
7
6
|
interface CheckoutFlowFunction {
|
|
8
7
|
(): Promise<void>;
|
|
@@ -18,7 +17,6 @@ interface UseCheckoutFlowArgs {
|
|
|
18
17
|
readonly subscription: SubscriptionProjection;
|
|
19
18
|
readonly getAuthToken: () => Promise<string>;
|
|
20
19
|
readonly onSuccess: () => void;
|
|
21
|
-
readonly useRedirect: UseRedirectFunction;
|
|
22
20
|
}
|
|
23
21
|
interface UseCheckoutFlowFunction {
|
|
24
22
|
(args: UseCheckoutFlowArgs): CheckoutFlowReturn;
|
|
@@ -12,14 +12,14 @@ import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/
|
|
|
12
12
|
import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
13
13
|
import { useTrackCheckout } from "../../tracking/useTrackCheckout";
|
|
14
14
|
import { I18nMessages } from "../i18n/i18n";
|
|
15
|
+
import { Routes } from "../routing/routes";
|
|
15
16
|
import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
|
|
16
17
|
import { useQueryBus } from "./useQueryBus";
|
|
17
18
|
import { useStaticInfo } from "./useStaticInfo";
|
|
18
|
-
const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection, subscription: subscriptionProjection, getAuthToken, onSuccess,
|
|
19
|
+
const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection, subscription: subscriptionProjection, getAuthToken, onSuccess, }) => {
|
|
19
20
|
const logger = useLogger();
|
|
20
21
|
const queryBus = useQueryBus();
|
|
21
|
-
const { customer: { customerId, country, segment, name, email }, tradename, } = useStaticInfo();
|
|
22
|
-
const { returnUrl } = useRedirect();
|
|
22
|
+
const { customer: { customerId, country, segment, name, email }, basePath, tradename, } = useStaticInfo();
|
|
23
23
|
const paymentFlowRef = useRef(null);
|
|
24
24
|
const [paymentFlowPayload] = useViewPaymentFlowPayloadByCheckoutId({
|
|
25
25
|
checkoutId: checkoutProjection?.id,
|
|
@@ -73,14 +73,14 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection,
|
|
|
73
73
|
paymentFlowRef.current?.startLegacyBoxCheckout({
|
|
74
74
|
...paymentFlowPayload,
|
|
75
75
|
userInformation: { email, name },
|
|
76
|
-
returnUrl
|
|
76
|
+
returnUrl: `${basePath}/${Routes.CHECKOUT}`,
|
|
77
77
|
});
|
|
78
78
|
}, [
|
|
79
79
|
checkoutProjection?.checkoutBookingId,
|
|
80
80
|
paymentFlowPayload,
|
|
81
81
|
email,
|
|
82
82
|
name,
|
|
83
|
-
|
|
83
|
+
basePath,
|
|
84
84
|
sizeChangeEnabled,
|
|
85
85
|
blockCheckoutBooking,
|
|
86
86
|
queryBus,
|
|
@@ -8,7 +8,6 @@ import { Customer } from "../../../projection/customer/customer";
|
|
|
8
8
|
import { OrderProjection } from "../../../projection/order/order";
|
|
9
9
|
import { SubscriptionProjection } from "../../../projection/subscription/subscription";
|
|
10
10
|
import { KameleoonEnvironment } from "../../ab-testing/kameleoonEnvironment";
|
|
11
|
-
import { UseRedirectFunction } from "../../integration/useRedirect";
|
|
12
11
|
interface RoutingProps {
|
|
13
12
|
readonly basePath?: string;
|
|
14
13
|
readonly customer: Customer;
|
|
@@ -23,7 +22,7 @@ interface RoutingProps {
|
|
|
23
22
|
readonly onNotAccessible: () => void;
|
|
24
23
|
readonly onCheckoutFlowSuccess: () => void;
|
|
25
24
|
readonly onI18nError?: (err: Error) => void;
|
|
26
|
-
readonly useRedirect:
|
|
25
|
+
readonly useRedirect: () => Record<string, string>;
|
|
27
26
|
readonly useRoutes: typeof reactRouterUseRoutes;
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
@@ -2,14 +2,13 @@ import { FC } from "react";
|
|
|
2
2
|
import { Layout as UiLayout } from "@lookiero/sty-psp-ui";
|
|
3
3
|
import { OrderProjection } from "../../../../projection/order/order";
|
|
4
4
|
import { SubscriptionProjection } from "../../../../projection/subscription/subscription";
|
|
5
|
-
import { UseRedirectFunction } from "../../../integration/useRedirect";
|
|
6
5
|
interface CheckoutProps {
|
|
7
6
|
readonly layout: UiLayout;
|
|
8
7
|
readonly order: OrderProjection;
|
|
9
8
|
readonly subscription: SubscriptionProjection;
|
|
10
9
|
readonly getAuthToken: () => Promise<string>;
|
|
11
10
|
readonly onCheckoutFlowSuccess: () => void;
|
|
12
|
-
readonly useRedirect:
|
|
11
|
+
readonly useRedirect: () => Record<string, string>;
|
|
13
12
|
}
|
|
14
13
|
declare const Checkout: FC<CheckoutProps>;
|
|
15
14
|
export { Checkout };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { UseRedirectFunction } from "../../../../../integration/useRedirect";
|
|
3
2
|
interface PaymentInstrumentProps {
|
|
4
|
-
readonly useRedirect:
|
|
3
|
+
readonly useRedirect: () => Record<string, string>;
|
|
5
4
|
}
|
|
6
5
|
declare const PaymentInstrument: FC<PaymentInstrumentProps>;
|
|
7
6
|
export { PaymentInstrument };
|
package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useStaticInfo } from "../../../../hooks/useStaticInfo";
|
|
|
4
4
|
const PaymentInstrument = ({ useRedirect }) => {
|
|
5
5
|
const { returnUrl } = useRedirect();
|
|
6
6
|
const { customer } = useStaticInfo();
|
|
7
|
-
return (React.createElement(PaymentInstrumentSelect, { beforeRedirect: () => Promise.resolve(returnUrl), hasError: false, section: Section.BOX_CHECKOUT, userInformation: {
|
|
7
|
+
return (React.createElement(PaymentInstrumentSelect, { beforeRedirect: returnUrl ? () => Promise.resolve(returnUrl) : undefined, hasError: false, section: Section.BOX_CHECKOUT, userInformation: {
|
|
8
8
|
email: customer.email,
|
|
9
9
|
name: customer.name,
|
|
10
10
|
}, showSingleUsePaymentMethods: true }));
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "12.2.0
|
|
1
|
+
export declare const VERSION = "12.2.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "12.2.0
|
|
1
|
+
export const VERSION = "12.2.0";
|
package/package.json
CHANGED
package/src/ExpoRoot.tsx
CHANGED
|
@@ -17,7 +17,6 @@ import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
|
17
17
|
import { KameleoonEnvironment } from "./infrastructure/ab-testing/kameleoonEnvironment";
|
|
18
18
|
import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
|
|
19
19
|
import { bootstrap as checkoutMockBootstrap } from "./infrastructure/delivery/bootstrap.mock";
|
|
20
|
-
import { UseRedirectFunction } from "./infrastructure/integration/useRedirect";
|
|
21
20
|
import { root } from "./infrastructure/ui/Root";
|
|
22
21
|
import { DOMAIN } from "./infrastructure/ui/i18n/i18n";
|
|
23
22
|
import { Router } from "./infrastructure/ui/routing/router/Router";
|
|
@@ -80,7 +79,7 @@ const translations: EndpointFunction[] = [
|
|
|
80
79
|
})(locale),
|
|
81
80
|
];
|
|
82
81
|
|
|
83
|
-
const useRedirect:
|
|
82
|
+
const useRedirect: () => Record<string, string> = () => ({
|
|
84
83
|
returnUrl: "https://web2.dev.aws.lookiero.es/user/",
|
|
85
84
|
});
|
|
86
85
|
|
|
@@ -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 }],
|
|
@@ -13,7 +13,6 @@ import { Customer } from "../../projection/customer/customer";
|
|
|
13
13
|
import { OrderProjection } from "../../projection/order/order";
|
|
14
14
|
import { SubscriptionProjection } from "../../projection/subscription/subscription";
|
|
15
15
|
import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
|
|
16
|
-
import { UseRedirectFunction } from "../integration/useRedirect";
|
|
17
16
|
import { QueryBusProvider } from "./hooks/useQueryBus";
|
|
18
17
|
import { Routing } from "./routing/Routing";
|
|
19
18
|
|
|
@@ -41,7 +40,7 @@ interface RootProps {
|
|
|
41
40
|
readonly tradename: Tradename;
|
|
42
41
|
readonly onNotAccessible: () => void;
|
|
43
42
|
readonly onCheckoutFlowSuccess: () => void;
|
|
44
|
-
readonly useRedirect:
|
|
43
|
+
readonly useRedirect: () => Record<string, string>;
|
|
45
44
|
readonly useRoutes?: typeof reactRouterUseRoutes;
|
|
46
45
|
}
|
|
47
46
|
|
|
@@ -11,7 +11,6 @@ import { OrderProjection } from "../../../projection/order/order";
|
|
|
11
11
|
import { SubscriptionProjection } from "../../../projection/subscription/subscription";
|
|
12
12
|
import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
|
|
13
13
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
14
|
-
import { UseRedirectFunction } from "../../integration/useRedirect";
|
|
15
14
|
import { checkout } from "../../projection/checkout/checkout.mock";
|
|
16
15
|
import { useViewIsSizeChangeEnabledByCheckoutId } from "../../projection/checkout/react/useViewIsSizeChangeEnabledByCheckoutId";
|
|
17
16
|
import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
|
|
@@ -19,15 +18,11 @@ import { useViewPaymentFlowPayloadByCheckoutId } from "../../projection/payment/
|
|
|
19
18
|
import { pricing } from "../../projection/pricing/pricing.mock";
|
|
20
19
|
import { useViewPricingByCheckoutId } from "../../projection/pricing/react/useViewPricingByCheckoutId";
|
|
21
20
|
import { I18nMessages } from "../i18n/i18n";
|
|
21
|
+
import { Routes } from "../routing/routes";
|
|
22
22
|
import { useCheckoutFlow as sut } from "./useCheckoutFlow";
|
|
23
23
|
import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
|
|
24
24
|
import { useQueryBus } from "./useQueryBus";
|
|
25
25
|
|
|
26
|
-
const returnUrl = "/checkout";
|
|
27
|
-
const useRedirect: UseRedirectFunction = () => ({
|
|
28
|
-
returnUrl,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
26
|
const getAuthToken = () => Promise.resolve("token");
|
|
32
27
|
const mockCheckout = checkout({
|
|
33
28
|
items: [
|
|
@@ -124,7 +119,7 @@ describe("useCheckoutFlow custom hook", () => {
|
|
|
124
119
|
});
|
|
125
120
|
|
|
126
121
|
const { result } = renderHook(() =>
|
|
127
|
-
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess
|
|
122
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
128
123
|
);
|
|
129
124
|
|
|
130
125
|
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
@@ -150,7 +145,7 @@ describe("useCheckoutFlow custom hook", () => {
|
|
|
150
145
|
expect.objectContaining({
|
|
151
146
|
...mockPaymentFlowPayload,
|
|
152
147
|
userInformation: { email, name },
|
|
153
|
-
returnUrl
|
|
148
|
+
returnUrl: `${basePath}/${Routes.CHECKOUT}`,
|
|
154
149
|
}),
|
|
155
150
|
);
|
|
156
151
|
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
@@ -180,7 +175,7 @@ describe("useCheckoutFlow custom hook", () => {
|
|
|
180
175
|
});
|
|
181
176
|
|
|
182
177
|
const { result } = renderHook(() =>
|
|
183
|
-
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess
|
|
178
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
184
179
|
);
|
|
185
180
|
|
|
186
181
|
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
@@ -206,7 +201,7 @@ describe("useCheckoutFlow custom hook", () => {
|
|
|
206
201
|
expect.objectContaining({
|
|
207
202
|
...mockPaymentFlowPayload,
|
|
208
203
|
userInformation: { email, name },
|
|
209
|
-
returnUrl
|
|
204
|
+
returnUrl: `${basePath}/${Routes.CHECKOUT}`,
|
|
210
205
|
}),
|
|
211
206
|
);
|
|
212
207
|
expect(mockSubmitCheckout).toHaveBeenCalled();
|
|
@@ -236,7 +231,7 @@ describe("useCheckoutFlow custom hook", () => {
|
|
|
236
231
|
});
|
|
237
232
|
|
|
238
233
|
const { result } = renderHook(() =>
|
|
239
|
-
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess
|
|
234
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
240
235
|
);
|
|
241
236
|
|
|
242
237
|
let checkoutFlow: () => void, status, paymentFlowComponent;
|
|
@@ -283,7 +278,7 @@ describe("useCheckoutFlow custom hook", () => {
|
|
|
283
278
|
});
|
|
284
279
|
|
|
285
280
|
const { result } = renderHook(() =>
|
|
286
|
-
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess
|
|
281
|
+
sut({ checkout: mockCheckout, order, subscription, getAuthToken, onSuccess: mockOnSuccess }),
|
|
287
282
|
);
|
|
288
283
|
|
|
289
284
|
let checkoutFlow: () => void, status, paymentFlowComponent;
|