통합로그 피드백 수정

This commit is contained in:
opacity@t-win.kr
2025-08-12 16:38:43 +09:00
parent eac8a1d1d4
commit fd4358b986
4 changed files with 241 additions and 164 deletions

View File

@@ -44,7 +44,7 @@ const SpottableComponent = Spottable("div");
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused", preserveId: true },
"div",
"div"
);
const LINK_TYPES = {
@@ -87,13 +87,13 @@ export default function RollingUnit({
const { curationId, curationTitle } = useSelector((state) => state.home);
const curtNm = useSelector((state) => state.home?.bannerData?.curtNm);
const shptmTmplCd = useSelector(
(state) => state.home?.bannerData?.shptmTmplCd,
(state) => state.home?.bannerData?.shptmTmplCd
);
const nowMenu = useSelector((state) => state.common.menu.nowMenu);
const entryMenu = useSelector((state) => state.common.menu.entryMenu);
const homeCategory = useSelector(
(state) => state.home.menuData?.data?.homeCategory,
(state) => state.home.menuData?.data?.homeCategory
);
const countryCode = useSelector((state) => state.common.httpHeader.cntry_cd);
@@ -101,7 +101,7 @@ export default function RollingUnit({
const savedIndex = useSelector((state) => state.home.bannerIndices[bannerId]);
const [startIndex, setStartIndex] = useState(
savedIndex !== undefined ? savedIndex : 0,
savedIndex !== undefined ? savedIndex : 0
);
const lastIndexRef = useRef(rollingDataLength - 1);
const doRollingRef = useRef(false);
@@ -172,31 +172,42 @@ export default function RollingUnit({
return {};
}, [shptmTmplCd, startIndex]);
const sendBannerLog = useCallback(() => {
if (rollingDataRef.current && nowMenu === LOG_MENU.HOME_TOP) {
dispatch(
sendLogTotalRecommend({
contextName: LOG_CONTEXT_NAME.HOME,
messageId: LOG_MESSAGE_ID.BANNER,
curationId: curationId,
curationTitle: curationTitle,
contentType: rollingDataRef.current[startIndex].shptmBanrTpNm,
contentId: rollingDataRef.current[startIndex].showId,
contentTitle: rollingDataRef.current[startIndex].showNm,
productId: rollingDataRef.current[startIndex].prdtId,
productTitle: rollingDataRef.current[startIndex].prdtNm,
displayType: "button",
partner: rollingDataRef.current[startIndex].patncNm,
brand: rollingDataRef.current[startIndex].brndNm,
location: rollingDataRef.current[startIndex].dspyOrdr,
bannerType:
rollingDataRef.current[startIndex].vtctpYn === "Y"
? "Vertical"
: "Horizontal",
}),
);
}
}, [nowMenu, rollingDataRef]);
const sendBannerLog = useCallback(
(bannerClick) => {
const data = rollingDataRef.current[startIndex];
const newParams =
bannerData.banrLctnNo === "2"
? {
bannerType: "Horizontal",
}
: {
bannerType: "Vertical",
};
if (rollingDataRef.current && nowMenu === LOG_MENU.HOME_TOP) {
dispatch(
sendLogTotalRecommend({
contextName: LOG_CONTEXT_NAME.HOME,
messageId: bannerClick
? LOG_MESSAGE_ID.BANNER_CLICK
: LOG_MESSAGE_ID.BANNER,
curationId: curationId,
curationTitle: curationTitle,
contentType: data.shptmBanrTpNm,
contentId: data.showId,
contentTitle: data.showNm,
productId: data.prdtId,
productTitle: data.prdtNm,
displayType: "button",
partner: data.patncNm,
brand: data.brndNm,
location: bannerData.banrLctnNo,
...newParams,
})
);
}
},
[nowMenu, rollingDataRef]
);
useEffect(() => {
if (savedIndex !== undefined) {
@@ -210,7 +221,7 @@ export default function RollingUnit({
if (deltaTime >= 10000 && doRollingRef.current) {
setStartIndex((prevIndex) =>
prevIndex === lastIndexRef.current ? 0 : prevIndex + 1,
prevIndex === lastIndexRef.current ? 0 : prevIndex + 1
);
previousTimeRef.current = time;
}
@@ -304,7 +315,7 @@ export default function RollingUnit({
) {
if (homeCategory && homeCategory.length > 0) {
const foundCategory = homeCategory.find(
(data) => data.lgCatCd === rollingData[startIndex].lgCatCd,
(data) => data.lgCatCd === rollingData[startIndex].lgCatCd
);
if (foundCategory) {
return {
@@ -324,14 +335,14 @@ export default function RollingUnit({
(name, panelInfo) => {
dispatch(pushPanel({ name, panelInfo }));
},
[dispatch],
[dispatch]
);
const handleStartVideoPlayer = useCallback(
(playerInfo) => {
dispatch(startVideoPlayer(playerInfo));
},
[dispatch],
[dispatch]
);
const imageBannerClick = useCallback(() => {
@@ -350,7 +361,7 @@ export default function RollingUnit({
...topContentsLogInfo,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.CLICK,
}),
})
);
return;
}
@@ -366,14 +377,14 @@ export default function RollingUnit({
case LINK_TYPES.TRENDING_NOW:
handlePushPanel(
panel_names.TRENDING_NOW_PANEL,
createPanelInfo(currentData),
createPanelInfo(currentData)
);
break;
case LINK_TYPES.HOT_PICKS:
handlePushPanel(
panel_names.HOT_PICKS_PANEL,
createPanelInfo(currentData),
createPanelInfo(currentData)
);
break;
@@ -387,7 +398,7 @@ export default function RollingUnit({
if (Object.keys(categoryData).length > 0) {
handlePushPanel(
panel_names.CATEGORY_PANEL,
createPanelInfo(currentData, categoryData),
createPanelInfo(currentData, categoryData)
);
}
break;
@@ -412,13 +423,13 @@ export default function RollingUnit({
default:
return;
}
sendBannerLog();
sendBannerLog(true);
dispatch(
sendLogTopContents({
...topContentsLogInfo,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.CLICK,
}),
})
);
}, [
rollingData,
@@ -427,6 +438,7 @@ export default function RollingUnit({
dispatch,
categoryData,
handlePushPanel,
sendBannerLog,
topContentsLogInfo,
]);
@@ -443,7 +455,7 @@ export default function RollingUnit({
focusedContainerId: TEMPLATE_CODE_CONF.TOP,
currentSpot: currentSpot?.getAttribute("data-spotlight-id"),
},
}),
})
);
}
@@ -471,7 +483,7 @@ export default function RollingUnit({
...topContentsLogInfo,
inDt: formatGMTString(new Date()) ?? "",
logTpNo: LOG_TP_NO.TOP_CONTENTS.CLICK,
}),
})
);
}, [
rollingData,
@@ -544,7 +556,7 @@ export default function RollingUnit({
<Container
className={classNames(
css.rollingWrap,
isHorizontal && css.isHorizontalWrap,
isHorizontal && css.isHorizontalWrap
)}
spotlightId={`container-${spotlightId}`}
onFocus={shelfFocus}
@@ -603,7 +615,7 @@ export default function RollingUnit({
<div
className={classNames(
css.itemBox,
isHorizontal && css.isHorizontal,
isHorizontal && css.isHorizontal
)}
>
{rollingData[startIndex].tmnlImgPath == null ? (
@@ -662,7 +674,7 @@ export default function RollingUnit({
<div
className={classNames(
css.itemBox,
isHorizontal && css.isHorizontal,
isHorizontal && css.isHorizontal
)}
>
{rollingData[startIndex].tmnlImgPath == null ? (
@@ -715,7 +727,7 @@ export default function RollingUnit({
css.todaysDeals,
countryCode === "RU" ? css.ru : "",
countryCode === "DE" ? css.de : "",
isHorizontal && css.isHorizontal,
isHorizontal && css.isHorizontal
)}
onClick={imageBannerClick}
onFocus={onFocus}