my menu 화면에서 삭제한 상품 및 콘텐츠 정보수직 로그작업

This commit is contained in:
Dev TWIN0906
2025-05-16 17:15:15 +09:00
parent d41e24ad00
commit 6b3ef11abd
4 changed files with 127 additions and 12 deletions

View File

@@ -590,7 +590,7 @@ export const LOG_CONTEXT_NAME = {
SHOW: "shoptime.show",
SHOPBYMOBILE: "shoptime.shopbymobile",
GNB: "shoptime.gnb",
REMINDER: "shoptime.reminder",
REMINDERS: "shoptime.reminders",
MYPAGE: "shoptime.mypage",
FEATURED_BRANDS: "shoptime.featuredpartner",
};

View File

@@ -6,7 +6,10 @@ import Spotlight from "@enact/spotlight";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import { setContainerLastFocusedElement } from "@enact/spotlight/src/container";
import { sendLogMyPageMyDelete } from "../../../../actions/logActions";
import {
sendLogMyPageMyDelete,
sendLogTotalRecommend,
} from "../../../../actions/logActions";
import {
clearFavorites,
deleteMyFavorite,
@@ -23,7 +26,11 @@ import TCheckBox from "../../../../components/TCheckBox/TCheckBox";
import THeader from "../../../../components/THeader/THeader";
import TVerticalPagenator from "../../../../components/TVerticalPagenator/TVerticalPagenator";
import usePrevious from "../../../../hooks/usePrevious";
import { panel_names } from "../../../../utils/Config";
import {
LOG_CONTEXT_NAME,
LOG_MESSAGE_ID,
panel_names,
} from "../../../../utils/Config";
import { $L } from "../../../../utils/helperMethods";
import { SpotlightIds } from "../../../../utils/SpotlightIds";
import MyPageItemCard, { SIZES } from "../../MyPageItemCard/MyPageItemCard";
@@ -122,6 +129,7 @@ export default function Favorites({ title, panelInfo, isOnTop }) {
let productList = [];
let showList = [];
let deleteList = [];
Object.entries(selectedItems).forEach(([id, selected]) => {
if (selected) {
@@ -130,12 +138,39 @@ export default function Favorites({ title, panelInfo, isOnTop }) {
);
if (item.prdtId === id) {
productList.push({ patnrId: item.patnrId, prdtId: item.prdtId });
deleteList.push({
productId: item.prdtId,
productTitle: item.prdtNm,
partner: item.patncNm,
});
} else if (item.showId === id) {
showList.push({ showId: item.showId });
}
}
});
if (deleteList.length > 0) {
const { productId, productTitle, partner } = deleteList.reduce(
(acc, item) => {
acc.productId.push(item.productId);
acc.productTitle.push(item.productTitle);
acc.partner.push(item.partner);
return acc;
},
{ productId: [], productTitle: [], partner: [] }
);
const params = {
menu: "Favorite",
productId: productId.join(","),
productTitle: productTitle.join(","),
partner: partner.join(","),
contextName: LOG_CONTEXT_NAME.MYPAGE,
messageId: LOG_MESSAGE_ID.MYPAGE_DELETE,
};
dispatch(sendLogTotalRecommend(params));
}
if (productList.length > 0 || showList.length > 0) {
dispatch(deleteMyFavorite({ productList, showList }));
dispatch(

View File

@@ -1,4 +1,10 @@
import React, { useCallback, useEffect, useRef, useState, useMemo } from "react";
import React, {
useCallback,
useEffect,
useRef,
useState,
useMemo,
} from "react";
import { useDispatch, useSelector } from "react-redux";
@@ -9,7 +15,10 @@ import {
changeAppStatus,
changeLocalSettings,
} from "../../../../actions/commonActions";
import { sendLogMyPageMyDelete } from "../../../../actions/logActions";
import {
sendLogMyPageMyDelete,
sendLogTotalRecommend,
} from "../../../../actions/logActions";
import {
clearRecentlyViewedInfo,
getMyRecentlyViewedInfo,
@@ -24,6 +33,7 @@ import { $L } from "../../../../utils/helperMethods";
import { SpotlightIds } from "../../../../utils/SpotlightIds";
import css from "../RecentlyViewed/RecentlyViewed.module.less";
import RecentlyViewedContents from "./RecentlyViewedContents";
import { LOG_CONTEXT_NAME, LOG_MESSAGE_ID } from "../../../../utils/Config";
const HeaderButtonContainer = SpotlightContainerDecorator(
{ enterTo: "last-focused" },
@@ -153,7 +163,42 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
})
);
}
// delete 버튼 클릭 시 삭제된 데이터 출력
recentlyDatas.reduce((acc, data) => {
const deleteProductInfo = data.productInfos.filter((item) => {
const id = item.prdtId;
return selectedItems[id];
});
if (deleteProductInfo.length > 0) {
const sendDeleteLog = (items) => {
const { productId, productTitle, partner } = items.reduce(
(result, item) => {
result.productId.push(item.prdtId);
result.productTitle.push(item.prdtNm);
result.partner.push(item.patncNm);
return result;
},
{ productId: [], productTitle: [], partner: [] }
);
const params = {
menu: "Recently Viewed",
productId: productId.join(","),
productTitle: productTitle.join(","),
partner: partner.join(","),
contextName: LOG_CONTEXT_NAME.MYPAGE,
messageId: LOG_MESSAGE_ID.MYPAGE_DELETE,
};
dispatch(sendLogTotalRecommend(params));
};
sendDeleteLog(deleteProductInfo);
}
return acc;
}, []);
groupByDate();
}
@@ -214,7 +259,6 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
dispatch(
changeAppStatus({ showLoadingPanel: { show: true, type: "wait" } })
);
let productListData = [];
let showListData = [];
@@ -227,6 +271,7 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
showListData.push({ cntryCd, patnrId, showId });
}
});
dispatch(
getMyRecentlyViewedInfo({
showList: showListData,
@@ -326,7 +371,12 @@ export default function RecentlyViewed({ title, panelInfo, isOnTop }) {
(recentlyProductsData?.length > 0 || recentlyShowData?.length > 0) &&
recentlyDatas?.length > 0
);
}, [recentlyViewedSuccess, recentlyProductsData, recentlyShowData, recentlyDatas]);
}, [
recentlyViewedSuccess,
recentlyProductsData,
recentlyShowData,
recentlyDatas,
]);
return (
<>

View File

@@ -138,11 +138,13 @@ export default function Reminders({ title, cbScrollTo }) {
dispatch(setMyUpcomingUseAlert({ upcomingAlamUseFlag: flag }));
setUseAlarm(!useAlarm);
dispatch(sendLogTotalRecommend({
dispatch(
sendLogTotalRecommend({
status: flag === "N" ? "Off" : "On",
contextName: Config.LOG_CONTEXT_NAME.REMINDER,
messageId: Config.LOG_MESSAGE_ID.TOGGLE_CLICK
}))
contextName: Config.LOG_CONTEXT_NAME.REMINDERS,
messageId: Config.LOG_MESSAGE_ID.TOGGLE_CLICK,
})
);
dispatch(
sendLogMyPageAlertFlag({
alertFlag: flag === "N" ? "Off" : "On",
@@ -154,6 +156,7 @@ export default function Reminders({ title, cbScrollTo }) {
if (activeDelete) {
const updatedSelectedItems = {};
let showList = [];
let deletedList = [];
Object.keys(selectedItems).forEach((id) => {
updatedSelectedItems[id] = false;
@@ -172,8 +175,35 @@ export default function Reminders({ title, cbScrollTo }) {
showId: foundItem.showId,
});
}
deletedList.push({
partner: foundItem.patncNm,
contentTitle: foundItem.showNm,
contentId: foundItem.showId,
});
}
});
if (deletedList.length > 0) {
const { contentId, contentTitle, partner } = deletedList.reduce(
(acc, item) => {
acc.contentId.push(item.contentId);
acc.contentTitle.push(item.contentTitle);
acc.partner.push(item.partner);
return acc;
},
{ contentId: [], contentTitle: [], partner: [] }
);
const params = {
menu: "Reminders",
contentId: contentId.join(","),
contentTitle: contentTitle.join(","),
partner: partner.join(","),
contextName: Config.LOG_CONTEXT_NAME.MYPAGE,
messageId: Config.LOG_MESSAGE_ID.MYPAGE_DELETE,
};
dispatch(sendLogTotalRecommend(params));
}
setSelectedItems(updatedSelectedItems);
setSelectAll(false);