@lookiero/checkout 14.2.2 → 14.3.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.
- package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +3 -2
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +28 -1
- package/dist/src/infrastructure/ui/hooks/useCheckoutFlow.js +1 -1
- package/dist/src/projection/pricing/pricing.d.ts +25 -1
- package/dist/src/projection/pricing/pricing.js +12 -1
- package/dist/src/version.d.ts +2 -2
- package/dist/src/version.js +2 -2
- package/package.json +6 -4
- package/src/domain/checkout/model/checkouts.ts +6 -4
- package/src/domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem.ts +1 -2
- package/src/domain/checkoutBooking/event/createToastNotificationWhenCheckoutBookingExpired.ts +1 -2
- package/src/domain/checkoutBooking/model/checkoutBookings.ts +6 -4
- package/src/domain/checkoutFeedback/model/checkoutFeedbacks.ts +6 -4
- package/src/domain/checkoutItem/event/createModalNotificationWhenCheckoutItemReplaced.ts +1 -2
- package/src/domain/checkoutItem/model/checkoutItems.ts +6 -4
- package/src/infrastructure/delivery/mock/dataSourceCheckoutBookings.ts +1 -2
- package/src/infrastructure/delivery/mock/dataSourceCheckoutFeedbacks.ts +1 -2
- package/src/infrastructure/delivery/mock/dataSourceCheckoutItems.ts +1 -2
- package/src/infrastructure/domain/checkout/react/useStartCheckout.test.ts +1 -5
- package/src/infrastructure/domain/checkout/react/useSubmitCheckout.test.ts +1 -5
- package/src/infrastructure/domain/checkoutFeedback/model/httpCheckoutFeedbacks.ts +1 -2
- package/src/infrastructure/domain/checkoutFeedback/react/useGiveCheckoutFeedback.test.ts +1 -5
- package/src/infrastructure/domain/checkoutItem/react/useKeepCheckoutItem.test.ts +1 -5
- package/src/infrastructure/domain/checkoutItem/react/useReplaceCheckoutItem.test.ts +1 -5
- package/src/infrastructure/domain/checkoutItem/react/useResetCheckoutItem.test.ts +1 -5
- package/src/infrastructure/domain/checkoutItem/react/useReturnCheckoutItem.test.ts +1 -5
- package/src/infrastructure/projection/pricing/pricing.mock.ts +34 -2
- package/src/infrastructure/tracking/tracking.ts +4 -2
- package/src/infrastructure/ui/hooks/useCheckoutFlow.tsx +1 -1
- package/src/projection/bookedProductsVariants/viewBookedProductVariantsForCheckoutItem.ts +2 -1
- package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.ts +1 -2
- package/src/projection/checkout/viewFiveItemsDiscountByCustomerId.ts +1 -2
- package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.ts +1 -2
- package/src/projection/checkout/viewIsSizeChangeEnabledByCheckoutId.ts +1 -2
- package/src/projection/checkoutFeedback/viewCheckoutFeedbackDefinitionByCheckoutId.ts +2 -1
- package/src/projection/payment/viewPaymentFlowPayloadByCheckoutId.ts +1 -2
- package/src/projection/pricing/pricing.ts +29 -1
- package/src/projection/returnQuestion/listReturnQuestionsByCheckoutItemId.ts +1 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PricingProjection } from "../../../projection/pricing/pricing";
|
|
1
|
+
import { CheckoutPricingProjection, PricingProjection } from "../../../projection/pricing/pricing";
|
|
2
2
|
interface PricingFunctionArgs {
|
|
3
3
|
readonly paidWithPromocode: boolean;
|
|
4
4
|
}
|
|
@@ -6,4 +6,5 @@ interface PricingFunction {
|
|
|
6
6
|
(args?: PricingFunctionArgs): PricingProjection;
|
|
7
7
|
}
|
|
8
8
|
declare const pricing: PricingFunction;
|
|
9
|
-
|
|
9
|
+
declare const mockCheckoutPricingProjection: CheckoutPricingProjection;
|
|
10
|
+
export { pricing, mockCheckoutPricingProjection };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Currency } from "@lookiero/sty-psp-locale";
|
|
2
|
+
import { CheckoutPrincingContext, CheckoutPrincingType, } from "../../../projection/pricing/pricing";
|
|
2
3
|
const pricing = ({ paidWithPromocode } = { paidWithPromocode: false }) => ({
|
|
3
4
|
orderTotal: {
|
|
4
5
|
amount: 18301,
|
|
@@ -39,4 +40,30 @@ const pricing = ({ paidWithPromocode } = { paidWithPromocode: false }) => ({
|
|
|
39
40
|
paidWithPromocode,
|
|
40
41
|
},
|
|
41
42
|
});
|
|
42
|
-
|
|
43
|
+
const mockCheckoutPricingProjection = {
|
|
44
|
+
currency: Currency.EUR,
|
|
45
|
+
final: 12127,
|
|
46
|
+
original: 21195,
|
|
47
|
+
modifiers: [
|
|
48
|
+
{
|
|
49
|
+
amount: 7068,
|
|
50
|
+
percentage: 35,
|
|
51
|
+
type: CheckoutPrincingType.DISCOUNT,
|
|
52
|
+
context: CheckoutPrincingContext.PROMOCODE,
|
|
53
|
+
translationKey: "summary.discount",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
amount: 1000,
|
|
57
|
+
type: CheckoutPrincingType.DISCOUNT,
|
|
58
|
+
context: CheckoutPrincingContext.BALANCE,
|
|
59
|
+
translationKey: "summary.credit",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
amount: 1000,
|
|
63
|
+
type: CheckoutPrincingType.DISCOUNT,
|
|
64
|
+
context: CheckoutPrincingContext.PS_FEE,
|
|
65
|
+
translationKey: "summary.fee",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
export { pricing, mockCheckoutPricingProjection };
|
|
@@ -74,7 +74,7 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, getAuthToken, onSuccess
|
|
|
74
74
|
const onPaymentError = useCallback((payload) => {
|
|
75
75
|
setStartLegacyBoxCheckoutStatus("error");
|
|
76
76
|
createNotification({
|
|
77
|
-
bodyI18nKey: payload.metadata?.
|
|
77
|
+
bodyI18nKey: payload.metadata?.translation || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
78
78
|
level: NotificationLevel.ERROR,
|
|
79
79
|
});
|
|
80
80
|
}, [createNotification]);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Currency } from "@lookiero/sty-psp-locale";
|
|
1
2
|
import { PriceProjection } from "../price/price";
|
|
2
3
|
interface ServiceProjection {
|
|
3
4
|
readonly discount: PriceProjection;
|
|
@@ -16,4 +17,27 @@ interface PricingProjection {
|
|
|
16
17
|
readonly service: ServiceProjection;
|
|
17
18
|
readonly subtotal: PriceProjection;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
declare enum Type {
|
|
21
|
+
DISCOUNT = "DISCOUNT",
|
|
22
|
+
CHARGE = "CHARGE"
|
|
23
|
+
}
|
|
24
|
+
declare enum Context {
|
|
25
|
+
PS_FEE = "PS_FEE",
|
|
26
|
+
PROMOCODE = "PROMOCODE",
|
|
27
|
+
BALANCE = "BALANCE"
|
|
28
|
+
}
|
|
29
|
+
interface Modify {
|
|
30
|
+
readonly amount: number;
|
|
31
|
+
readonly percentage?: number;
|
|
32
|
+
readonly type: Type;
|
|
33
|
+
readonly context: Context;
|
|
34
|
+
readonly translationKey: string;
|
|
35
|
+
}
|
|
36
|
+
interface CheckoutPricingProjection {
|
|
37
|
+
readonly currency: Currency;
|
|
38
|
+
readonly final: number;
|
|
39
|
+
readonly original: number;
|
|
40
|
+
readonly modifiers: Modify[];
|
|
41
|
+
}
|
|
42
|
+
export type { PricingProjection, ServiceProjection, CheckoutPricingProjection };
|
|
43
|
+
export { Type as CheckoutPrincingType, Context as CheckoutPrincingContext };
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
var Type;
|
|
2
|
+
(function (Type) {
|
|
3
|
+
Type["DISCOUNT"] = "DISCOUNT";
|
|
4
|
+
Type["CHARGE"] = "CHARGE";
|
|
5
|
+
})(Type || (Type = {}));
|
|
6
|
+
var Context;
|
|
7
|
+
(function (Context) {
|
|
8
|
+
Context["PS_FEE"] = "PS_FEE";
|
|
9
|
+
Context["PROMOCODE"] = "PROMOCODE";
|
|
10
|
+
Context["BALANCE"] = "BALANCE";
|
|
11
|
+
})(Context || (Context = {}));
|
|
12
|
+
export { Type as CheckoutPrincingType, Context as CheckoutPrincingContext };
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "14.
|
|
2
|
-
export declare const RELEASE = "checkout@14.
|
|
1
|
+
export declare const VERSION = "14.3.1";
|
|
2
|
+
export declare const RELEASE = "checkout@14.3.1";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "14.
|
|
2
|
-
export const RELEASE = "checkout@14.
|
|
1
|
+
export const VERSION = "14.3.1";
|
|
2
|
+
export const RELEASE = "checkout@14.3.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": "false",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"@lookiero/sty-psp-i18n": "^2.0",
|
|
29
29
|
"@lookiero/sty-psp-locale": "^2.1",
|
|
30
30
|
"@lookiero/sty-psp-logging": "^2.2",
|
|
31
|
-
"@lookiero/sty-psp-notifications": "^2.
|
|
31
|
+
"@lookiero/sty-psp-notifications": "^2.17",
|
|
32
32
|
"@lookiero/sty-psp-react-native": "^2.0",
|
|
33
33
|
"@lookiero/sty-psp-segment": "^0.1",
|
|
34
34
|
"@lookiero/sty-psp-storage": "^1.1",
|
|
35
35
|
"@lookiero/sty-psp-tracking": "^2.4",
|
|
36
|
-
"@lookiero/sty-psp-ui": "^3.
|
|
36
|
+
"@lookiero/sty-psp-ui": "^3.6",
|
|
37
37
|
"@lookiero/sty-psp-ui-settings": "^1.6",
|
|
38
38
|
"@lookiero/sty-psp-units": "^0.1",
|
|
39
39
|
"@lookiero/sty-psp-uuid": "^0.2",
|
|
@@ -69,7 +69,9 @@
|
|
|
69
69
|
"react-native-gesture-handler": "~2.24.0",
|
|
70
70
|
"react-native-get-random-values": "~1.11.0",
|
|
71
71
|
"react-native-reanimated": "~3.17.4",
|
|
72
|
-
"react-native-safe-area-context": "5.4.0"
|
|
72
|
+
"react-native-safe-area-context": "5.4.0",
|
|
73
|
+
"react-router-dom": "6.30.3",
|
|
74
|
+
"react-router-native": "6.30.3"
|
|
73
75
|
},
|
|
74
76
|
"peerDependencies": {
|
|
75
77
|
"@gorhom/portal": ">=1.0",
|
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
} from "@lookiero/messaging";
|
|
7
7
|
import { Checkout } from "./checkout";
|
|
8
8
|
|
|
9
|
-
interface CheckoutsGetFunction<
|
|
10
|
-
extends
|
|
9
|
+
interface CheckoutsGetFunction<
|
|
10
|
+
CheckoutsGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
11
|
+
> extends RepositoryGetFunction<Checkout, CheckoutsGetFunctionArgs> {}
|
|
11
12
|
|
|
12
|
-
interface CheckoutsSaveFunction<
|
|
13
|
-
extends
|
|
13
|
+
interface CheckoutsSaveFunction<
|
|
14
|
+
CheckoutsSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
15
|
+
> extends RepositorySaveFunction<Checkout, CheckoutsSaveFunctionArgs> {}
|
|
14
16
|
|
|
15
17
|
export type { CheckoutsGetFunction, CheckoutsSaveFunction };
|
|
@@ -8,8 +8,7 @@ interface BookCheckoutBookingForCheckoutItemPayload {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
interface BookCheckoutBookingForCheckoutItem
|
|
11
|
-
extends Command<typeof BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM>,
|
|
12
|
-
BookCheckoutBookingForCheckoutItemPayload {}
|
|
11
|
+
extends Command<typeof BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM>, BookCheckoutBookingForCheckoutItemPayload {}
|
|
13
12
|
|
|
14
13
|
interface BookCheckoutBookingForCheckoutItemFunction {
|
|
15
14
|
(payload: BookCheckoutBookingForCheckoutItemPayload): BookCheckoutBookingForCheckoutItem;
|
package/src/domain/checkoutBooking/event/createToastNotificationWhenCheckoutBookingExpired.ts
CHANGED
|
@@ -5,8 +5,7 @@ import { CheckoutBookingExpired } from "../model/checkoutBookingExpired";
|
|
|
5
5
|
|
|
6
6
|
const CHECKOUT_BOOKING_EXPIRED_NOTIFICATION_ID = "d423934e-2499-46ab-8cfb-39e1e398237e";
|
|
7
7
|
|
|
8
|
-
interface CreateToastNotificationWhenCheckoutBookingExpiredFunction
|
|
9
|
-
extends ProcessManagerFunction<CheckoutBookingExpired> {}
|
|
8
|
+
interface CreateToastNotificationWhenCheckoutBookingExpiredFunction extends ProcessManagerFunction<CheckoutBookingExpired> {}
|
|
10
9
|
|
|
11
10
|
const createToastNotificationWhenCheckoutBookingExpired: CreateToastNotificationWhenCheckoutBookingExpiredFunction =
|
|
12
11
|
({ commandBus }) =>
|
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
} from "@lookiero/messaging";
|
|
7
7
|
import { CheckoutBooking } from "./checkoutBooking";
|
|
8
8
|
|
|
9
|
-
interface CheckoutBookingsGetFunction<
|
|
10
|
-
extends
|
|
9
|
+
interface CheckoutBookingsGetFunction<
|
|
10
|
+
CheckoutBookingsGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
11
|
+
> extends RepositoryGetFunction<CheckoutBooking, CheckoutBookingsGetFunctionArgs> {}
|
|
11
12
|
|
|
12
|
-
interface CheckoutBookingsSaveFunction<
|
|
13
|
-
extends
|
|
13
|
+
interface CheckoutBookingsSaveFunction<
|
|
14
|
+
CheckoutBookingsSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
15
|
+
> extends RepositorySaveFunction<CheckoutBooking, CheckoutBookingsSaveFunctionArgs> {}
|
|
14
16
|
|
|
15
17
|
export type { CheckoutBookingsGetFunction, CheckoutBookingsSaveFunction };
|
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
} from "@lookiero/messaging";
|
|
7
7
|
import { CheckoutFeedback } from "./checkoutFeedback";
|
|
8
8
|
|
|
9
|
-
interface CheckoutFeedbacksGetFunction<
|
|
10
|
-
extends
|
|
9
|
+
interface CheckoutFeedbacksGetFunction<
|
|
10
|
+
CheckoutFeedbacksGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
11
|
+
> extends RepositoryGetFunction<CheckoutFeedback, CheckoutFeedbacksGetFunctionArgs> {}
|
|
11
12
|
|
|
12
|
-
interface CheckoutFeedbacksSaveFunction<
|
|
13
|
-
extends
|
|
13
|
+
interface CheckoutFeedbacksSaveFunction<
|
|
14
|
+
CheckoutFeedbacksSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
15
|
+
> extends RepositorySaveFunction<CheckoutFeedback, CheckoutFeedbacksSaveFunctionArgs> {}
|
|
14
16
|
|
|
15
17
|
export type { CheckoutFeedbacksGetFunction, CheckoutFeedbacksSaveFunction };
|
|
@@ -5,8 +5,7 @@ import { CheckoutItemReplaced } from "../model/checkoutItemReplaced";
|
|
|
5
5
|
|
|
6
6
|
const SIZE_CHANGE_NOTIFICATION_ID = "ce89b8b2-e025-4b54-8cdc-52520dc3dd23";
|
|
7
7
|
|
|
8
|
-
interface CreateModalNotificationWhenCheckoutItemReplacedFunction
|
|
9
|
-
extends ProcessManagerFunction<CheckoutItemReplaced> {}
|
|
8
|
+
interface CreateModalNotificationWhenCheckoutItemReplacedFunction extends ProcessManagerFunction<CheckoutItemReplaced> {}
|
|
10
9
|
|
|
11
10
|
const createModalNotificationWhenCheckoutItemReplaced: CreateModalNotificationWhenCheckoutItemReplacedFunction =
|
|
12
11
|
({ commandBus }) =>
|
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
} from "@lookiero/messaging";
|
|
7
7
|
import { CheckoutItem } from "./checkoutItem";
|
|
8
8
|
|
|
9
|
-
interface CheckoutItemsGetFunction<
|
|
10
|
-
extends
|
|
9
|
+
interface CheckoutItemsGetFunction<
|
|
10
|
+
CheckoutItemsGetFunctionArgs extends RepositoryGetFunctionArgs,
|
|
11
|
+
> extends RepositoryGetFunction<CheckoutItem, CheckoutItemsGetFunctionArgs> {}
|
|
11
12
|
|
|
12
|
-
interface CheckoutItemsSaveFunction<
|
|
13
|
-
extends
|
|
13
|
+
interface CheckoutItemsSaveFunction<
|
|
14
|
+
CheckoutItemsSaveFunctionArgs extends RepositorySaveFunctionArgs,
|
|
15
|
+
> extends RepositorySaveFunction<CheckoutItem, CheckoutItemsSaveFunctionArgs> {}
|
|
14
16
|
|
|
15
17
|
export type { CheckoutItemsGetFunction, CheckoutItemsSaveFunction };
|
|
@@ -48,8 +48,7 @@ interface DataSourceCheckoutItemsSaveFunctionArgs extends RepositorySaveFunction
|
|
|
48
48
|
readonly dataSource: CheckoutBookingDataSource;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
interface DataSourceCheckoutItemsSaveFunction
|
|
52
|
-
extends CheckoutBookingsSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {}
|
|
51
|
+
interface DataSourceCheckoutItemsSaveFunction extends CheckoutBookingsSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {}
|
|
53
52
|
|
|
54
53
|
const saveCheckoutBooking: DataSourceCheckoutItemsSaveFunction =
|
|
55
54
|
({ dataSource }) =>
|
|
@@ -19,8 +19,7 @@ interface DataSourceCheckoutItemsSaveFunctionArgs extends RepositorySaveFunction
|
|
|
19
19
|
readonly dataSource: CheckoutFeedbackDataSource;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface DataSourceCheckoutItemsSaveFunction
|
|
23
|
-
extends CheckoutFeedbacksSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {}
|
|
22
|
+
interface DataSourceCheckoutItemsSaveFunction extends CheckoutFeedbacksSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {}
|
|
24
23
|
|
|
25
24
|
const saveCheckoutFeedback: DataSourceCheckoutItemsSaveFunction =
|
|
26
25
|
({ dataSource }) =>
|
|
@@ -49,8 +49,7 @@ interface DataSourceCheckoutItemsSaveFunctionArgs extends RepositorySaveFunction
|
|
|
49
49
|
readonly dataSource: CheckoutDataSource;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
interface DataSourceCheckoutItemsSaveFunction
|
|
53
|
-
extends CheckoutItemsSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {}
|
|
52
|
+
interface DataSourceCheckoutItemsSaveFunction extends CheckoutItemsSaveFunction<DataSourceCheckoutItemsSaveFunctionArgs> {}
|
|
54
53
|
|
|
55
54
|
const saveCheckoutItem: DataSourceCheckoutItemsSaveFunction =
|
|
56
55
|
({ dataSource }) =>
|
|
@@ -24,11 +24,7 @@ const saveMock = jest.fn();
|
|
|
24
24
|
const save = jest.fn(() => saveMock);
|
|
25
25
|
const mockStartCheckoutHandler = jest.fn();
|
|
26
26
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
27
|
-
.command(
|
|
28
|
-
START_CHECKOUT,
|
|
29
|
-
mockStartCheckoutHandler,
|
|
30
|
-
{},
|
|
31
|
-
)(get, save)
|
|
27
|
+
.command(START_CHECKOUT, mockStartCheckoutHandler, {})(get, save)
|
|
32
28
|
.build();
|
|
33
29
|
|
|
34
30
|
const logger = mock<Logger>();
|
|
@@ -32,11 +32,7 @@ const saveMock = jest.fn();
|
|
|
32
32
|
const save = jest.fn(() => saveMock);
|
|
33
33
|
const mockSubmitCheckoutHandler = jest.fn();
|
|
34
34
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
35
|
-
.command(
|
|
36
|
-
SUBMIT_CHECKOUT,
|
|
37
|
-
mockSubmitCheckoutHandler,
|
|
38
|
-
{},
|
|
39
|
-
)(get, save)
|
|
35
|
+
.command(SUBMIT_CHECKOUT, mockSubmitCheckoutHandler, {})(get, save)
|
|
40
36
|
.build();
|
|
41
37
|
|
|
42
38
|
beforeEach(() => {
|
|
@@ -18,8 +18,7 @@ interface HttpCheckoutFeedbacksSaveFunctionArgs extends RepositorySaveFunctionAr
|
|
|
18
18
|
readonly httpPost: HttpPostFunction;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
interface HttpCheckoutFeedbacksSaveFunction
|
|
22
|
-
extends CheckoutFeedbacksSaveFunction<HttpCheckoutFeedbacksSaveFunctionArgs> {}
|
|
21
|
+
interface HttpCheckoutFeedbacksSaveFunction extends CheckoutFeedbacksSaveFunction<HttpCheckoutFeedbacksSaveFunctionArgs> {}
|
|
23
22
|
|
|
24
23
|
const saveCheckoutFeedback: HttpCheckoutFeedbacksSaveFunction =
|
|
25
24
|
({ httpPost }) =>
|
|
@@ -33,11 +33,7 @@ const saveMock = jest.fn();
|
|
|
33
33
|
const save = jest.fn(() => saveMock);
|
|
34
34
|
const mockFiveCheckoutFeedbackHandler = jest.fn();
|
|
35
35
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
36
|
-
.command(
|
|
37
|
-
GIVE_CHECKOUT_FEEDBACK,
|
|
38
|
-
mockFiveCheckoutFeedbackHandler,
|
|
39
|
-
{},
|
|
40
|
-
)(get, save)
|
|
36
|
+
.command(GIVE_CHECKOUT_FEEDBACK, mockFiveCheckoutFeedbackHandler, {})(get, save)
|
|
41
37
|
.build();
|
|
42
38
|
|
|
43
39
|
describe("useGiveCheckoutFeedback integration hook", () => {
|
|
@@ -35,11 +35,7 @@ const saveMock = jest.fn();
|
|
|
35
35
|
const save = jest.fn(() => saveMock);
|
|
36
36
|
const mockKeepCheckoutItemHandler = jest.fn();
|
|
37
37
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
38
|
-
.command(
|
|
39
|
-
KEEP_CHECKOUT_ITEM,
|
|
40
|
-
mockKeepCheckoutItemHandler,
|
|
41
|
-
{},
|
|
42
|
-
)(get, save)
|
|
38
|
+
.command(KEEP_CHECKOUT_ITEM, mockKeepCheckoutItemHandler, {})(get, save)
|
|
43
39
|
.build();
|
|
44
40
|
|
|
45
41
|
describe("useKeepCheckoutItem integration hook", () => {
|
|
@@ -35,11 +35,7 @@ const saveMock = jest.fn();
|
|
|
35
35
|
const save = jest.fn(() => saveMock);
|
|
36
36
|
const mockReplaceCheckoutItemHandler = jest.fn();
|
|
37
37
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
38
|
-
.command(
|
|
39
|
-
REPLACE_CHECKOUT_ITEM,
|
|
40
|
-
mockReplaceCheckoutItemHandler,
|
|
41
|
-
{},
|
|
42
|
-
)(get, save)
|
|
38
|
+
.command(REPLACE_CHECKOUT_ITEM, mockReplaceCheckoutItemHandler, {})(get, save)
|
|
43
39
|
.build();
|
|
44
40
|
|
|
45
41
|
describe("useReplaceCheckoutItem integration hook", () => {
|
|
@@ -35,11 +35,7 @@ const saveMock = jest.fn();
|
|
|
35
35
|
const save = jest.fn(() => saveMock);
|
|
36
36
|
const mockResetCheckoutItemHandler = jest.fn();
|
|
37
37
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
38
|
-
.command(
|
|
39
|
-
RESET_CHECKOUT_ITEM,
|
|
40
|
-
mockResetCheckoutItemHandler,
|
|
41
|
-
{},
|
|
42
|
-
)(get, save)
|
|
38
|
+
.command(RESET_CHECKOUT_ITEM, mockResetCheckoutItemHandler, {})(get, save)
|
|
43
39
|
.build();
|
|
44
40
|
|
|
45
41
|
describe("useResetCheckoutItem integration hook", () => {
|
|
@@ -35,11 +35,7 @@ const saveMock = jest.fn();
|
|
|
35
35
|
const save = jest.fn(() => saveMock);
|
|
36
36
|
const mockReturnCheckoutItemHandler = jest.fn();
|
|
37
37
|
const { Component: Messaging } = bootstrap({ id: MESSAGING_CONTEXT_ID })
|
|
38
|
-
.command(
|
|
39
|
-
RETURN_CHECKOUT_ITEM,
|
|
40
|
-
mockReturnCheckoutItemHandler,
|
|
41
|
-
{},
|
|
42
|
-
)(get, save)
|
|
38
|
+
.command(RETURN_CHECKOUT_ITEM, mockReturnCheckoutItemHandler, {})(get, save)
|
|
43
39
|
.build();
|
|
44
40
|
|
|
45
41
|
describe("useReturnCheckoutItem integration hook", () => {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Currency } from "@lookiero/sty-psp-locale";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CheckoutPricingProjection,
|
|
4
|
+
CheckoutPrincingContext,
|
|
5
|
+
CheckoutPrincingType,
|
|
6
|
+
PricingProjection,
|
|
7
|
+
} from "../../../projection/pricing/pricing";
|
|
3
8
|
|
|
4
9
|
interface PricingFunctionArgs {
|
|
5
10
|
readonly paidWithPromocode: boolean;
|
|
@@ -50,4 +55,31 @@ const pricing: PricingFunction = ({ paidWithPromocode } = { paidWithPromocode: f
|
|
|
50
55
|
},
|
|
51
56
|
});
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
const mockCheckoutPricingProjection: CheckoutPricingProjection = {
|
|
59
|
+
currency: Currency.EUR,
|
|
60
|
+
final: 12127,
|
|
61
|
+
original: 21195,
|
|
62
|
+
modifiers: [
|
|
63
|
+
{
|
|
64
|
+
amount: 7068,
|
|
65
|
+
percentage: 35,
|
|
66
|
+
type: CheckoutPrincingType.DISCOUNT,
|
|
67
|
+
context: CheckoutPrincingContext.PROMOCODE,
|
|
68
|
+
translationKey: "summary.discount",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
amount: 1000,
|
|
72
|
+
type: CheckoutPrincingType.DISCOUNT,
|
|
73
|
+
context: CheckoutPrincingContext.BALANCE,
|
|
74
|
+
translationKey: "summary.credit",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
amount: 1000,
|
|
78
|
+
type: CheckoutPrincingType.DISCOUNT,
|
|
79
|
+
context: CheckoutPrincingContext.PS_FEE,
|
|
80
|
+
translationKey: "summary.fee",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { pricing, mockCheckoutPricingProjection };
|
|
@@ -110,8 +110,10 @@ interface PressPreviousTrackingEvent extends CheckoutBaseTrackingEvent<TrackingE
|
|
|
110
110
|
readonly to: string;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
interface CheckoutTrackingEvent
|
|
114
|
-
|
|
113
|
+
interface CheckoutTrackingEvent extends CheckoutBaseTrackingEvent<
|
|
114
|
+
TrackingEventName.CHECKOUT,
|
|
115
|
+
TrackingEventCategory.ECOMMERCE
|
|
116
|
+
> {
|
|
115
117
|
readonly userId: string;
|
|
116
118
|
readonly sizeChanges: number;
|
|
117
119
|
// readonly isFirstOrder: boolean;
|
|
@@ -128,7 +128,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({ checkout: checkoutProjection
|
|
|
128
128
|
setStartLegacyBoxCheckoutStatus("error");
|
|
129
129
|
|
|
130
130
|
createNotification({
|
|
131
|
-
bodyI18nKey: payload.metadata?.
|
|
131
|
+
bodyI18nKey: payload.metadata?.translation || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
132
132
|
level: NotificationLevel.ERROR,
|
|
133
133
|
});
|
|
134
134
|
},
|
|
@@ -14,7 +14,8 @@ interface ViewBookedProductsVariantsForCheckoutItemPayload {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface ViewBookedProductsVariantsForCheckoutItem
|
|
17
|
-
extends
|
|
17
|
+
extends
|
|
18
|
+
Query<typeof VIEW_BOOKED_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>,
|
|
18
19
|
ViewBookedProductsVariantsForCheckoutItemPayload {}
|
|
19
20
|
|
|
20
21
|
interface ViewBookedProductsVariantsForCheckoutItemFunction {
|
|
@@ -14,8 +14,7 @@ interface ViewFirstAvailableCheckoutByCustomerIdPayload {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface ViewFirstAvailableCheckoutByCustomerId
|
|
17
|
-
extends Query<typeof VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID>,
|
|
18
|
-
ViewFirstAvailableCheckoutByCustomerIdPayload {}
|
|
17
|
+
extends Query<typeof VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID>, ViewFirstAvailableCheckoutByCustomerIdPayload {}
|
|
19
18
|
|
|
20
19
|
interface ViewFirstAvailableCheckoutByCustomerIdFunction {
|
|
21
20
|
(payload: ViewFirstAvailableCheckoutByCustomerIdPayload): ViewFirstAvailableCheckoutByCustomerId;
|
|
@@ -15,8 +15,7 @@ interface ViewFiveItemsDiscountByCustomerIdPayload {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface ViewFiveItemsDiscountByCustomerId
|
|
18
|
-
extends Query<typeof VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID>,
|
|
19
|
-
ViewFiveItemsDiscountByCustomerIdPayload {}
|
|
18
|
+
extends Query<typeof VIEW_FIVE_ITEMS_DISCOUNT_BY_CUSTOMER_ID>, ViewFiveItemsDiscountByCustomerIdPayload {}
|
|
20
19
|
|
|
21
20
|
interface ViewFiveItemsDiscountByCustomerIdFunction {
|
|
22
21
|
(payload: ViewFiveItemsDiscountByCustomerIdPayload): ViewFiveItemsDiscountByCustomerId;
|
|
@@ -15,8 +15,7 @@ interface ViewIsCheckoutEnabledByCustomerIdPayload {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface ViewIsCheckoutEnabledByCustomerId
|
|
18
|
-
extends Query<typeof VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID>,
|
|
19
|
-
ViewIsCheckoutEnabledByCustomerIdPayload {}
|
|
18
|
+
extends Query<typeof VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID>, ViewIsCheckoutEnabledByCustomerIdPayload {}
|
|
20
19
|
|
|
21
20
|
interface ViewIsCheckoutEnabledByCustomerIdFunction {
|
|
22
21
|
(payload: ViewIsCheckoutEnabledByCustomerIdPayload): ViewIsCheckoutEnabledByCustomerId;
|
|
@@ -15,8 +15,7 @@ interface ViewIsSizeChangeEnabledByCheckoutIdPayload {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface ViewIsSizeChangeEnabledByCheckoutId
|
|
18
|
-
extends Query<typeof VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID>,
|
|
19
|
-
ViewIsSizeChangeEnabledByCheckoutIdPayload {}
|
|
18
|
+
extends Query<typeof VIEW_IS_SIZE_CHANGE_ENABLED_BY_CHECKOUT_ID>, ViewIsSizeChangeEnabledByCheckoutIdPayload {}
|
|
20
19
|
|
|
21
20
|
interface ViewIsSizeChangeEnabledByCheckoutIdFunction {
|
|
22
21
|
(payload: ViewIsSizeChangeEnabledByCheckoutIdPayload): ViewIsSizeChangeEnabledByCheckoutId;
|
|
@@ -14,7 +14,8 @@ interface ViewCheckoutFeedbackDefinitionByCheckoutIdPayload {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface ViewCheckoutFeedbackDefinitionByCheckoutId
|
|
17
|
-
extends
|
|
17
|
+
extends
|
|
18
|
+
Query<typeof VIEW_CHECKOUT_FEEDBACK_DEFINITION_BY_CHECKOUT_ID>,
|
|
18
19
|
ViewCheckoutFeedbackDefinitionByCheckoutIdPayload {}
|
|
19
20
|
|
|
20
21
|
interface ViewCheckoutFeedbackDefinitionByCheckoutIdFunction {
|
|
@@ -14,8 +14,7 @@ interface ViewPaymentFlowPayloadByCheckoutIdPayload {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface ViewPaymentFlowPayloadByCheckoutId
|
|
17
|
-
extends Query<typeof VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID>,
|
|
18
|
-
ViewPaymentFlowPayloadByCheckoutIdPayload {}
|
|
17
|
+
extends Query<typeof VIEW_PAYMENT_FLOW_PAYLOAD_BY_CHECKOUT_ID>, ViewPaymentFlowPayloadByCheckoutIdPayload {}
|
|
19
18
|
|
|
20
19
|
interface ViewPaymentFlowPayloadByCheckoutIdFunction {
|
|
21
20
|
(payload: ViewPaymentFlowPayloadByCheckoutIdPayload): ViewPaymentFlowPayloadByCheckoutId;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Currency } from "@lookiero/sty-psp-locale";
|
|
1
2
|
import { PriceProjection } from "../price/price";
|
|
2
3
|
|
|
3
4
|
interface ServiceProjection {
|
|
@@ -19,4 +20,31 @@ interface PricingProjection {
|
|
|
19
20
|
readonly subtotal: PriceProjection;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
enum Type {
|
|
24
|
+
DISCOUNT = "DISCOUNT",
|
|
25
|
+
CHARGE = "CHARGE",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
enum Context {
|
|
29
|
+
PS_FEE = "PS_FEE",
|
|
30
|
+
PROMOCODE = "PROMOCODE",
|
|
31
|
+
BALANCE = "BALANCE",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface Modify {
|
|
35
|
+
readonly amount: number;
|
|
36
|
+
readonly percentage?: number;
|
|
37
|
+
readonly type: Type;
|
|
38
|
+
readonly context: Context;
|
|
39
|
+
readonly translationKey: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface CheckoutPricingProjection {
|
|
43
|
+
readonly currency: Currency;
|
|
44
|
+
readonly final: number; // total a pagar
|
|
45
|
+
readonly original: number; // precio original de la caja
|
|
46
|
+
readonly modifiers: Modify[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { PricingProjection, ServiceProjection, CheckoutPricingProjection };
|
|
50
|
+
export { Type as CheckoutPrincingType, Context as CheckoutPrincingContext };
|
|
@@ -14,8 +14,7 @@ interface ListReturnQuestionsByCheckoutItemIdPayload {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface ListReturnQuestionsByCheckoutItemId
|
|
17
|
-
extends Query<typeof LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID>,
|
|
18
|
-
ListReturnQuestionsByCheckoutItemIdPayload {}
|
|
17
|
+
extends Query<typeof LIST_RETURN_QUESTIONS_BY_CHECKOUT_ITEM_ID>, ListReturnQuestionsByCheckoutItemIdPayload {}
|
|
19
18
|
|
|
20
19
|
interface ListReturnQuestionsByCheckoutItemIdFunction {
|
|
21
20
|
(payload: ListReturnQuestionsByCheckoutItemIdPayload): ListReturnQuestionsByCheckoutItemId;
|