Files
shoptime/com.twin.app.shoptime/src/actions/brandActions.js
optrader 1ee664e8c1 [251212] fix: FeaturedBrandsPanel관련 로그 정리
🕐 커밋 시간: 2025. 12. 12. 14:41:05

📊 변경 통계:
  • 총 파일: 9개
  • 추가: +118줄
  • 삭제: -87줄

📝 수정된 파일:
  ~ com.twin.app.shoptime/src/actions/brandActions.js
  ~ com.twin.app.shoptime/src/views/DetailPanel/DetailPanel.jsx
  ~ com.twin.app.shoptime/src/views/DetailPanel/components/DetailPanelBackground/DetailPanelBackground.jsx
  ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/Banner/Banner.jsx
  ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBestSeller/FeaturedBestSeller.jsx
  ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBestSeller/FeaturedBestSellerList/FeaturedBestSellerList.jsx
  ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx
  ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/TopBannerImage/TopBannerImage.jsx
  ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx

🔧 주요 변경 내용:
  • 핵심 비즈니스 로직 개선
  • UI 컴포넌트 아키텍처 개선
  • 중간 규모 기능 개선
  • 코드 정리 및 최적화
  • 모듈 구조 개선
2025-12-12 14:41:06 +09:00

554 lines
15 KiB
JavaScript

import { URLS } from '../api/apiConfig';
import { TAxios } from '../api/TAxios';
import { types } from './actionTypes';
import { changeAppStatus } from './commonActions';
import { createDebugHelpers } from '../utils/debug';
// 디버그 헬퍼 설정
const DEBUG_MODE = false;
const { derror } = createDebugHelpers(DEBUG_MODE);
// Featured Brands 정보 조회 IF-LGSP-304
export const getBrandList = () => (dispatch, getState) => {
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandList onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIST,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandList onFail', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_LIST, {}, {}, onSuccess, onFail);
};
// Featured Brands LAYOUT (shelf) 정보 조회 IF-LGSP-305
export const getBrandLayoutInfo = (props) => (dispatch, getState) => {
const { patnrId } = props;
// console.log("[getBrandLayoutInfo] Called - patnrId:", patnrId);
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// console.log("[getBrandLayoutInfo] onSuccess - patnrId:", patnrId, "data:", response.data.data);
dispatch({
type: types.GET_BRAND_LAYOUT_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
// console.log("[getBrandLayoutInfo] onFail - patnrId:", patnrId, "error:", error);
derror('getBrandLayoutInfo onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_LAYOUT_INFO, { patnrId }, {}, onSuccess, onFail);
};
// Featured Brands Live 채널 정보 조회 IF-LGSP-306
export const getBrandLiveChannelInfo = (props) => (dispatch, getState) => {
const { patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandLiveChannelInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_LIVE_CHANNEL_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandLiveChannelInfo onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_LIVE_CHANNEL_INFO,
{ patnrId },
{},
onSuccess,
onFail
);
};
export const getBrandChanInfo = (props) => (dispatch, getState) => {
const { patnrId } = props;
const onSuccess = (response) => {
// dlog("getBrandChanInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CHAN_INFO,
payload: {
data: response.data.data,
},
});
};
const onFail = (error) => {
derror('getBrandChanInfo onFail ', error);
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_LIVE_CHANNEL_INFO,
{ patnrId },
{},
onSuccess,
onFail
);
};
// Featured Brands Today's Deals 정보 조회 IF-LGSP-307
export const getBrandTSVInfo = (props) => (dispatch, getState) => {
const { patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandTSVInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_TSV_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandTSVInfo onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_TSV_INFO, { patnrId }, {}, onSuccess, onFail);
};
// Featured Brand Recommended Show 정보 조회 IF-LGSP-308
export const getBrandRecommendedShowInfo = (props) => (dispatch, getState) => {
const { catCd, patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandRecommendedShowInfo onSuccess", response.data);
dispatch({
type: types.GET_BRAND_RECOMMENDED_SHOW_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandRecommendedShowInfo onFail', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_RECOMMENDED_SHOW_INFO,
{ catCd, patnrId },
{},
onSuccess,
onFail
);
};
// Featured Brands Featured Creators 정보 조회 IF-LGSP-309
export const getBrandCreatorsInfo = (props) => (dispatch, getState) => {
const { hstNm, patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandCreatorsInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CREATORS_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandCreatorsInfo onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_CREATORS_INFO,
{ hstNm, patnrId },
{},
onSuccess,
onFail
);
};
// Featured Brands Series 정보 조회 IF-LGSP-310
export const getBrandSeriesInfo = (props) => (dispatch, getState) => {
const { patnrId, seriesId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandSeriesInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_SERIES_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandSeriesInfo onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_SERIES_INFO,
{ patnrId, seriesId },
{},
onSuccess,
onFail
);
};
// Featured Brands 카테고리별 상품 조회 IF-LGSP-311
export const getBrandCategoryInfo = (props) => (dispatch, getState) => {
const { catCdLv1, catCdLv2, patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandCategoryInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CATEGORY_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
derror('getBrandCategoryInfo onFail ', error);
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_CATEGORY_INFO,
{ catCdLv1, catCdLv2, patnrId },
{},
onSuccess,
onFail
);
};
export const getBrandCategoryProductInfo = (props) => (dispatch, getState) => {
const { catCdLv1, catCdLv2, patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandCategoryProductInfo onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_CATEGORY_PRODUCT_INFO,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandCategoryProductInfo onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_CATEGORY_INFO,
{ catCdLv1, catCdLv2, patnrId },
{},
onSuccess,
onFail
);
};
// Featured Brand Best Seller 상품 목록 조회 IF-LGSP-312
export const getBrandBestSeller = (props) => (dispatch, getState) => {
const { patnrId } = props;
// console.log("[getBrandBestSeller] Called - patnrId:", patnrId);
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// console.log("[getBrandBestSeller] onSuccess - patnrId:", patnrId);
// console.log("[getBrandBestSeller] Full response:", response.data.data);
// console.log("[getBrandBestSeller] brandBestSellerInfo:", response.data.data.brandBestSellerInfo);
// console.log("[getBrandBestSeller] brandBestSellerTitle in response:", response.data.data.brandBestSellerTitle);
dispatch({
type: types.GET_BRAND_BEST_SELLER,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
// console.log("[getBrandBestSeller] onFail - patnrId:", patnrId, "error:", error);
derror('getBrandBestSeller onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_BEST_SELLER, { patnrId }, {}, onSuccess, onFail);
};
// Featured Brands Showroom 조회 IF-LGSP-372
export const getBrandShowroom = (props) => (dispatch, getState) => {
const { patnrId } = props;
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// dlog("getBrandShowroom onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_SHOWROOM,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
derror('getBrandShowroom onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_SHOWROOM, { patnrId }, {}, onSuccess, onFail);
};
// Featured Brands SHOP BY SHOW 정보 조회 IF-LGSP-376
export const getBrandShopByShow = (props) => (dispatch, getState) => {
const { patnrId, contsId } = props;
// console.log("[getBrandShopByShow] Called - patnrId:", patnrId, "contsId:", contsId);
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// console.log("[getBrandShopByShow] onSuccess - patnrId:", patnrId, "data:", response.data.data);
dispatch({
type: types.GET_BRAND_SHOP_BY_SHOW,
payload: {
data: response.data.data,
patnrId,
contsId,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
// console.log("[getBrandShopByShow] onFail - patnrId:", patnrId, "error:", error);
derror('getBrandShopByShow onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
// patnrId: 필수, contsId: 선택
const params = contsId ? { patnrId, contsId } : { patnrId };
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_SHOP_BY_SHOW, params, {}, onSuccess, onFail);
};
// Featured Brands Top Banner 정보 조회 IF-LGSP-377 (NBCU 전용)
export const getBrandTopBanner = (props) => (dispatch, getState) => {
const { patnrId } = props;
// console.log("[BRAND-TOP-BANNER-API] Called - patnrId:", patnrId);
// NBCU(patnrId: 21)가 아니면 호출하지 않음
if (patnrId !== 21 && patnrId !== "21") {
console.log("[BRAND-TOP-BANNER-API] Skip - patnrId is not 21 (NBCU), patnrId:", patnrId, "(type:", typeof patnrId, ")");
return;
}
dispatch(changeAppStatus({ showLoadingPanel: { show: true, type: 'wait' } }));
const onSuccess = (response) => {
// console.log("[BRAND-TOP-BANNER-API] onSuccess - patnrId:", patnrId);
// console.log("[BRAND-TOP-BANNER-API] Full response data:", response.data.data);
// console.log("[BRAND-TOP-BANNER-API] brandTopBannerInfo:", response.data.data.brandTopBannerInfo);
dispatch({
type: types.GET_BRAND_TOP_BANNER,
payload: {
data: response.data.data,
},
});
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
const onFail = (error) => {
// console.log("[BRAND-TOP-BANNER-API] onFail - patnrId:", patnrId, "error:", error);
derror('getBrandTopBanner onFail ', error);
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(dispatch, getState, 'get', URLS.GET_BRAND_TOP_BANNER, { patnrId }, {}, onSuccess, onFail);
};
// Featured Brands Recently Aired 조회 IF-LGSP-373
export const getBrandRecentlyAired = (props) => (dispatch, getState) => {
const { patnrId } = props;
const onSuccess = (response) => {
// dlog("getBrandRecentlyAired onSuccess ", response.data);
dispatch({
type: types.GET_BRAND_RECENTLY_AIRED,
payload: {
data: response.data.data,
},
});
};
const onFail = (error) => {
derror('getBrandRecentlyAired onFail ', error);
// dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
};
TAxios(
dispatch,
getState,
'get',
URLS.GET_BRAND_RECENTLY_AIRED,
{ patnrId },
{},
onSuccess,
onFail
);
};
export const setBrandLiveChannelUpcoming = (props) => (dispatch, getState) => {
const { showId, strtDt } = props;
const storedBrandLiveChannelUpcoming =
getState().brand.brandLiveChannelInfoData.data.brandLiveChannelUpcoming;
const brandLiveChannelUpcoming = storedBrandLiveChannelUpcoming //
.map((item) => {
if (item.showId === showId && item.strtDt === strtDt) {
item.alamDispFlag = item.alamDispFlag === 'Y' ? 'N' : 'Y';
}
return item;
});
dispatch({
type: types.SET_BRAND_LIVE_CHANNEL_UPCOMING,
payload: {
...getState().brand.brandLiveChannelInfoData,
data: {
...getState().brand.brandLiveChannelInfoData.data,
brandLiveChannelUpcoming,
},
},
});
};
export const setBrandChanInfo = (props) => (dispatch, getState) => {
const { showId, strtDt } = props;
const storedBrandLiveChanInfo = getState().brand.brandLiveChannelInfoData.data.brandChanInfo;
const brandChanInfo = storedBrandLiveChanInfo.map((item) => {
if (item.showId === showId && item.strtDt === strtDt) {
item.alamDispFlag = item.alamDispFlag === 'Y' ? 'N' : 'Y';
}
return item;
});
dispatch({
type: types.SET_BRAND_CHAN_INFO,
payload: {
...getState().brand.brandLiveChannelInfoData,
data: {
...getState().brand.brandLiveChannelInfoData.data,
brandChanInfo,
},
},
});
};