@lookiero/checkout 1.1.4-beta.2 → 1.1.4-beta.3
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandStatus, QueryStatus } from "@lookiero/messaging-react";
|
|
2
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { useParams } from "react-router-native";
|
|
4
4
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
5
5
|
import { useLogger } from "../../../../shared/logging/useLogger";
|
|
@@ -68,24 +68,20 @@ const Item = ({ customerId, country }) => {
|
|
|
68
68
|
trackReturnItem();
|
|
69
69
|
}, [hideReturnQuestions, returnCheckoutItem, trackReturnItem]);
|
|
70
70
|
/* ReturnCheckoutItem */
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// : []
|
|
79
|
-
// : undefined,
|
|
80
|
-
// [bookedProductsVariants, isSizeChangeEnabled, sizeChangeEnabledStatus],
|
|
81
|
-
// );
|
|
71
|
+
const replaceableFor = useMemo(() => sizeChangeEnabledStatus === QueryStatus.SUCCESS
|
|
72
|
+
? isSizeChangeEnabled
|
|
73
|
+
? bookedProductsVariants
|
|
74
|
+
? bookedProductsVariants.productVariants.map(({ id }) => id)
|
|
75
|
+
: undefined
|
|
76
|
+
: []
|
|
77
|
+
: undefined, [bookedProductsVariants, isSizeChangeEnabled, sizeChangeEnabledStatus]);
|
|
82
78
|
useTrackItemPageView({
|
|
83
79
|
page: TrackingPage.ITEM,
|
|
84
80
|
country,
|
|
85
81
|
checkoutId: checkout?.id,
|
|
86
82
|
checkoutItemId: checkoutItem.id,
|
|
87
83
|
productVariantId: checkoutItem.productVariant.id,
|
|
88
|
-
|
|
84
|
+
replaceableFor: replaceableFor ? replaceableFor.toString() : undefined,
|
|
89
85
|
unique: checkoutItem.productVariant.size.unique,
|
|
90
86
|
});
|
|
91
87
|
const dependenciesLoaded = checkoutStatus !== QueryStatus.LOADING &&
|
|
@@ -6,6 +6,7 @@ interface UseTrackItemPageViewFunctionArgs {
|
|
|
6
6
|
readonly checkoutId?: string;
|
|
7
7
|
readonly checkoutItemId: string;
|
|
8
8
|
readonly productVariantId: string;
|
|
9
|
+
readonly replaceableFor: string | undefined;
|
|
9
10
|
readonly unique: boolean;
|
|
10
11
|
}
|
|
11
12
|
interface UseTrackItemPageViewFunction {
|
|
@@ -2,12 +2,10 @@ import { useLayoutEffect } from "react";
|
|
|
2
2
|
import { PROJECT } from "../../../infrastructure/tracking/tracking";
|
|
3
3
|
import { TrackingEvent, TrackingEventCategory } from "../tracking";
|
|
4
4
|
import { useEmitUserEvent } from "./useEmitUserEvent";
|
|
5
|
-
const useTrackItemPageView = ({ page, country, checkoutId, checkoutItemId, productVariantId,
|
|
6
|
-
// replaceableFor,
|
|
7
|
-
unique, }) => {
|
|
5
|
+
const useTrackItemPageView = ({ page, country, checkoutId, checkoutItemId, productVariantId, replaceableFor, unique, }) => {
|
|
8
6
|
const emitUserEvent = useEmitUserEvent();
|
|
9
7
|
useLayoutEffect(() => {
|
|
10
|
-
if (!checkoutId) {
|
|
8
|
+
if (!(checkoutId && replaceableFor)) {
|
|
11
9
|
return;
|
|
12
10
|
}
|
|
13
11
|
const itemPageViewTrackingEvent = {
|
|
@@ -18,10 +16,10 @@ unique, }) => {
|
|
|
18
16
|
checkoutId,
|
|
19
17
|
checkoutItemId,
|
|
20
18
|
productVariantId,
|
|
21
|
-
|
|
19
|
+
replaceableFor,
|
|
22
20
|
unique,
|
|
23
21
|
};
|
|
24
22
|
emitUserEvent(itemPageViewTrackingEvent);
|
|
25
|
-
}, [checkoutId, checkoutItemId, country, emitUserEvent, page, productVariantId, unique]);
|
|
23
|
+
}, [checkoutId, checkoutItemId, country, emitUserEvent, page, productVariantId, replaceableFor, unique]);
|
|
26
24
|
};
|
|
27
25
|
export { useTrackItemPageView };
|
|
@@ -31,6 +31,7 @@ type PageViewTrackingEvent = BaseTrackingEvent;
|
|
|
31
31
|
interface ItemPageViewTrackingEvent extends BaseTrackingEvent {
|
|
32
32
|
readonly checkoutItemId: string;
|
|
33
33
|
readonly productVariantId: string;
|
|
34
|
+
readonly replaceableFor: string;
|
|
34
35
|
readonly unique: boolean;
|
|
35
36
|
}
|
|
36
37
|
interface KeepItemTrackingEvent extends BaseTrackingEvent {
|