deeplink 디버그 재수정

This commit is contained in:
opacity@t-win.kr
2025-08-28 10:45:16 +09:00
parent eb9ee79f36
commit 44d3c05678
7 changed files with 257 additions and 85 deletions

View File

@@ -71,8 +71,6 @@ import { sendLogTotalRecommend } from "../actions/logActions";
// } from "../utils/focus-monitor";
// import { PanelHoc } from "../components/TPanel/TPanel";
let foreGroundChangeTimer = null;
// 기존 콘솔 메서드를 백업
@@ -149,15 +147,15 @@ function AppBase(props) {
(state) => state.common.appStatus.cursorVisible
);
const introTermsAgree = useSelector((state) => state.common.introTermsAgree);
const deviceRegistered = useSelector((state) => state.common.deviceRegistered);
const deviceRegistered = useSelector(
(state) => state.common.deviceRegistered
);
// const optionalTermsAgree = useSelector((state) => state.common.optionalTermsAgree);
const termsLoading = useSelector((state) => state.common.termsLoading);
// termsFlag 전체 상태 확인
// const termsFlag = useSelector((state) => state.common.termsFlag);
const termsData = useSelector((state) => state.home.termsData);
useEffect(() => {
// Chromium68 호환성을 위해 Optional Chaining 제거
if (termsData && termsData.data && termsData.data.terms) {
@@ -173,7 +171,8 @@ function AppBase(props) {
// const macAddress = useSelector((state) => state.common.macAddress);
// Chromium68 호환성을 위해 Optional Chaining 제거
const deviceCountryCode = httpHeader && httpHeader["X-Device-Country"] || "";
const deviceCountryCode =
(httpHeader && httpHeader["X-Device-Country"]) || "";
useEffect(() => {
if (!cursorVisible && !Spotlight.getCurrent()) {
@@ -221,9 +220,7 @@ function AppBase(props) {
// called by [receive httpHeader, launch, relaunch]
const initService = useCallback(
(haveyInit = true) => {
// console.log(
// "<<<<<<<<<<<<< appinfo >>>>>>>>>>>>{heavyInit, appinfo} ",
// haveyInit,
@@ -243,7 +240,10 @@ function AppBase(props) {
dispatch(
changeAppStatus({
// Chromium68 호환성을 위해 Optional Chaining 제거
cursorVisible: window.PalmSystem && window.PalmSystem.cursor && window.PalmSystem.cursor.visibility,
cursorVisible:
window.PalmSystem &&
window.PalmSystem.cursor &&
window.PalmSystem.cursor.visibility,
})
);
}
@@ -252,7 +252,7 @@ function AppBase(props) {
dispatch(getMyUpcomingAlertShow());
}
const launchParams = getLaunchParams();
const launchParams = getLaunchParams(dispatch);
console.log(
"initService...{haveyInit, launchParams}",
@@ -314,7 +314,11 @@ function AppBase(props) {
console.log(
"visibility changed !!! ==> set to foreground cursorVisible",
// Chromium68 호환성을 위해 Optional Chaining 제거
JSON.stringify(window.PalmSystem && window.PalmSystem.cursor && window.PalmSystem.cursor.visibility)
JSON.stringify(
window.PalmSystem &&
window.PalmSystem.cursor &&
window.PalmSystem.cursor.visibility
)
); // eslint-disable-line no-console
if (platform.platformName !== "webos") {
//for debug
@@ -329,7 +333,10 @@ function AppBase(props) {
changeAppStatus({
isAppForeground: true,
// Chromium68 호환성을 위해 Optional Chaining 제거
cursorVisible: window.PalmSystem && window.PalmSystem.cursor && window.PalmSystem.cursor.visibility,
cursorVisible:
window.PalmSystem &&
window.PalmSystem.cursor &&
window.PalmSystem.cursor.visibility,
})
);
}
@@ -450,7 +457,7 @@ function AppBase(props) {
}, [introTermsAgree, deviceRegistered, dispatch, initService, termsLoading]);
useEffect(() => {
const launchParmas = getLaunchParams();
const launchParmas = getLaunchParams(dispatch);
const linkTpNm = launchParmas.contentTarget
? launchParmas.contentTarget.split("_")[2] || ""
: Config.LOG_MENU.APP;

View File

@@ -68,7 +68,7 @@ export const handleDeepLink = (contentTarget) => (dispatch, getState) => {
expsOrd = tokens[6]; // 노출순번
curationId = tokens[7]; // 큐레이션아이디
panelName = panel_names.DETAIL_PANEL;
deeplinkPanel = "Product Detaoil";
deeplinkPanel = "Product Detail";
panelInfo = {
patnrId: patnrId,
prdtId: prdtId,

View File

@@ -20,7 +20,8 @@ export const types = {
CHANGE_APP_STATUS: "CHANGE_APP_STATUS",
SEND_BROADCAST: "SEND_BROADCAST",
CHANGE_LOCAL_SETTINGS: "CHANGE_LOCAL_SETTINGS",
GNB_OPENED: "GNB_OPENED", SET_SHOW_POPUP: "SET_SHOW_POPUP",
GNB_OPENED: "GNB_OPENED",
SET_SHOW_POPUP: "SET_SHOW_POPUP",
SET_SHOW_SECONDARY_POPUP: "SET_SHOW_SECONDARY_POPUP",
SET_HIDE_POPUP: "SET_HIDE_POPUP",
SET_HIDE_SECONDARY_POPUP: "SET_HIDE_SECONDARY_POPUP",
@@ -43,6 +44,7 @@ export const types = {
SET_SYSTEM_NOTICE: "SET_SYSTEM_NOTICE",
SET_SYSTEM_TERMINATION: "SET_SYSTEM_TERMINATION",
SET_DEEP_LINK: "SET_DEEP_LINK",
SET_DEEP_LINK_DEBUG: "SET_DEEP_LINK_DEBUG",
SET_SECOND_LAYER_INFO: "SET_SECOND_LAYER_INFO",
SET_ERROR_MESSAGE: "SET_ERROR_MESSAGE",
CLEAR_ERROR_MESSAGE: "CLEAR_ERROR_MESSAGE",

View File

@@ -32,7 +32,7 @@ export const gnbOpened = (status) => ({
});
export const setShowPopup = (config) => {
const payload = typeof config === 'string' ? { activePopup: config } : config;
const payload = typeof config === "string" ? { activePopup: config } : config;
return {
type: types.SET_SHOW_POPUP,
payload,
@@ -293,21 +293,24 @@ export const getTermsAgreeYn = () => (dispatch, getState) => {
try {
const { terms } = getState().home.termsData.data;
console.log("getTermsAgreeYn", terms.map(term => ({
console.log(
"getTermsAgreeYn",
terms.map((term) => ({
trmsId: term.trmsId,
trmsTpCd: term.trmsTpCd,
trmsAgrFlag: term.trmsAgrFlag,
trmsPopFlag: term.trmsPopFlag,
})));
}))
);
// MST00405 선택약관 정보만 따로 출력
const optionalTerm = terms.find(term => term.trmsTpCd === 'MST00405');
const optionalTerm = terms.find((term) => term.trmsTpCd === "MST00405");
if (optionalTerm) {
console.log("getTermsAgreeYn MST00405 선택약관:", {
trmsId: optionalTerm.trmsId,
trmsTpCd: optionalTerm.trmsTpCd,
trmsAgrFlag: optionalTerm.trmsAgrFlag,
trmsPopFlag: optionalTerm.trmsPopFlag
trmsPopFlag: optionalTerm.trmsPopFlag,
});
} else {
console.log("getTermsAgreeYn MST00405 선택약관을 찾을 수 없습니다.");
@@ -561,6 +564,11 @@ export const setDeepLink = (deepLinkInfo) => ({
payload: deepLinkInfo,
});
export const setDeepLinkDebug = (debugInfo) => ({
type: types.SET_DEEP_LINK_DEBUG,
payload: debugInfo,
});
export const setSecondLayerInfo = (secondLayerInfo) => ({
type: types.SET_SECOND_LAYER_INFO,
payload: secondLayerInfo,
@@ -758,35 +766,37 @@ export const resetOptionalTermsSession = () => ({
// 선택약관 동의 처리를 위한 헬퍼 함수
export const handleOptionalTermsAgree = () => (dispatch) => {
console.log('[CommonActions] 선택약관 동의 처리');
dispatch(setOptionalTermsUserDecision('agreed'));
console.log("[CommonActions] 선택약관 동의 처리");
dispatch(setOptionalTermsUserDecision("agreed"));
dispatch(setOptionalTermsPopupShown(true));
};
// 선택약관 거절 처리를 위한 헬퍼 함수
export const handleOptionalTermsDecline = () => (dispatch) => {
console.log('[CommonActions] 선택약관 거절 처리');
dispatch(setOptionalTermsUserDecision('declined'));
console.log("[CommonActions] 선택약관 거절 처리");
dispatch(setOptionalTermsUserDecision("declined"));
dispatch(setOptionalTermsPopupShown(true));
};
// 선택약관 상태 통합 업데이트 (TV 환경 최적화 - API 호출 없이 즉시 반영)
export const updateOptionalTermsAgreement = (agreed = true) => (dispatch) => {
export const updateOptionalTermsAgreement =
(agreed = true) =>
(dispatch) => {
console.log(`[CommonActions] 선택약관 통합 상태 업데이트: ${agreed}`);
// 1. optionalTermsPopupFlow 업데이트 (TV 환경용)
dispatch(setOptionalTermsUserDecision(agreed ? 'agreed' : 'declined'));
dispatch(setOptionalTermsUserDecision(agreed ? "agreed" : "declined"));
dispatch(setOptionalTermsPopupShown(true));
// 2. 기본 optionalTermsAgree 상태 직접 업데이트 (API 호출 없이)
dispatch({
type: types.UPDATE_OPTIONAL_TERMS_AGREE_DIRECT,
payload: agreed
payload: agreed,
});
// 3. termsAgreementStatus도 동기화
dispatch({
type: types.UPDATE_TERMS_AGREEMENT_STATUS_DIRECT,
payload: { MST00405: agreed }
payload: { MST00405: agreed },
});
};

View File

@@ -20,7 +20,8 @@ const initialState = {
},
broadcast: {},
httpHeader: null,
isGnbOpened: false, popup: {
isGnbOpened: false,
popup: {
popupVisible: false,
activePopup: null,
secondaryPopup: null,
@@ -71,6 +72,15 @@ const initialState = {
isDeepLink: false,
},
deepLinkDebug: {
rawLaunchParams: "",
parsedParams: null,
finalParams: null,
containerLaunch: false,
parseError: null,
timestamp: null,
},
secondLayerInfo: {},
macAddress: { wifi: "", wired: "", p2p: "" },
connectionFailed: false,
@@ -184,7 +194,8 @@ export const commonReducer = (state = initialState, action) => {
secondaryPopupVisible: false,
secondaryPopup: null,
},
}; case types.SET_HIDE_SECONDARY_POPUP:
};
case types.SET_HIDE_SECONDARY_POPUP:
return {
...state,
popup: {
@@ -233,8 +244,13 @@ export const commonReducer = (state = initialState, action) => {
}
case types.GET_TERMS_AGREE_YN_SUCCESS: {
const { privacyTerms, serviceTerms, purchaseTerms, paymentTerms, optionalTerms } =
action.payload;
const {
privacyTerms,
serviceTerms,
purchaseTerms,
paymentTerms,
optionalTerms,
} = action.payload;
const introTermsAgree = privacyTerms === "Y" && serviceTerms === "Y";
const checkoutTermsAgree = purchaseTerms === "Y" && paymentTerms === "Y";
@@ -262,9 +278,11 @@ export const commonReducer = (state = initialState, action) => {
case types.GET_HOME_TERMS: {
const newTermsStatus = { ...state.termsAgreementStatus };
if (action.payload?.data?.terms) {
action.payload.data.terms.forEach(term => {
if (Object.prototype.hasOwnProperty.call(newTermsStatus, term.trmsTpCd)) {
newTermsStatus[term.trmsTpCd] = term.trmsAgrFlag === 'Y';
action.payload.data.terms.forEach((term) => {
if (
Object.prototype.hasOwnProperty.call(newTermsStatus, term.trmsTpCd)
) {
newTermsStatus[term.trmsTpCd] = term.trmsAgrFlag === "Y";
}
});
}
@@ -279,7 +297,7 @@ export const commonReducer = (state = initialState, action) => {
const newTermsStatus = { ...state.termsAgreementStatus };
// action payload에 담겨온 동의한 약관 코드 리스트를 기반으로 상태 업데이트
if (action.payload?.agreedTermCodes) {
action.payload.agreedTermCodes.forEach(termCode => {
action.payload.agreedTermCodes.forEach((termCode) => {
if (Object.prototype.hasOwnProperty.call(newTermsStatus, termCode)) {
newTermsStatus[termCode] = true;
}
@@ -288,7 +306,7 @@ export const commonReducer = (state = initialState, action) => {
return {
...state,
termsLoading: false,
termsAgreementStatus: newTermsStatus
termsAgreementStatus: newTermsStatus,
};
}
case types.SET_MYPAGE_TERMS_AGREE_FAIL:
@@ -310,7 +328,7 @@ export const commonReducer = (state = initialState, action) => {
...state.termsAgreementStatus,
MST00401: true,
MST00402: true,
}
},
};
} else {
return state;
@@ -364,6 +382,17 @@ export const commonReducer = (state = initialState, action) => {
};
}
case types.SET_DEEP_LINK_DEBUG: {
return {
...state,
deepLinkDebug: {
...state.deepLinkDebug,
...action.payload,
timestamp: new Date().toISOString(),
},
};
}
case types.SET_SECOND_LAYER_INFO: {
return {
...state,
@@ -398,7 +427,7 @@ export const commonReducer = (state = initialState, action) => {
optionalTermsPopupFlow: {
...state.optionalTermsPopupFlow,
userDecision: action.payload,
agreedInSession: action.payload === 'agreed',
agreedInSession: action.payload === "agreed",
},
};
}

View File

@@ -147,8 +147,15 @@ let localLaunchParams = {
// contentTarget: "V3_2001_HOMEBANNER:1240712_TM_10",
};
export const getLaunchParams = () => {
export const getLaunchParams = (dispatch = null) => {
let params = {};
let debugInfo = {
rawLaunchParams: "",
parsedParams: null,
finalParams: null,
containerLaunch: false,
parseError: null,
};
if (
typeof window === "object" &&
@@ -156,15 +163,58 @@ export const getLaunchParams = () => {
window.PalmSystem.launchParams
) {
try {
debugInfo.rawLaunchParams = window.PalmSystem.launchParams;
console.log("[DEBUG] Raw launchParams:", window.PalmSystem.launchParams);
params = JSON.parse(window.PalmSystem.launchParams);
debugInfo.parsedParams = JSON.parse(JSON.stringify(params));
console.log("[DEBUG] Parsed params:", JSON.stringify(params, null, 2));
if (params["x-webos-app-container-launch"] === true) {
params = params.details;
debugInfo.containerLaunch = true;
console.log(
"[DEBUG] Container launch detected, extracting details:",
params.details
);
params = params.details || {};
}
debugInfo.finalParams = JSON.parse(JSON.stringify(params));
console.log("[DEBUG] Final params:", JSON.stringify(params, null, 2));
} catch (e) {
console.log("[DEBUG] LaunchParams parsing error:", e);
debugInfo.parseError = e.message;
params = {};
}
// Redux dispatch가 전달된 경우 디버그 정보 저장
if (dispatch && typeof dispatch === "function") {
try {
const { setDeepLinkDebug } = require("../actions/commonActions");
dispatch(setDeepLinkDebug(debugInfo));
} catch (importError) {
console.log("[DEBUG] Failed to dispatch debug info:", importError);
}
}
return params;
} else {
debugInfo.rawLaunchParams = "No PalmSystem or launchParams available";
debugInfo.finalParams = localLaunchParams;
console.log("[DEBUG] No PalmSystem or launchParams, using local params");
// Redux dispatch가 전달된 경우 디버그 정보 저장
if (dispatch && typeof dispatch === "function") {
try {
const { setDeepLinkDebug } = require("../actions/commonActions");
dispatch(setDeepLinkDebug(debugInfo));
} catch (importError) {
console.log("[DEBUG] Failed to dispatch debug info:", importError);
}
}
return localLaunchParams;
}
};

View File

@@ -676,6 +676,7 @@ export default function MainView({ className, initService }) {
const contentTarget = useSelector(
(state) => state.common.deepLinkInfo.contentTarget
);
const deepLinkDebug = useSelector((state) => state.common.deepLinkDebug);
return (
<div
className={classNames(css.mainViewWrap, className)}
@@ -835,15 +836,88 @@ export default function MainView({ className, initService }) {
left: "0",
bottom: "0",
color: "#fff",
fontSize: "13px",
opacity: ".5",
fontSize: "11px",
opacity: ".8",
zIndex: "999",
backgroundColor: "black",
padding: "10px",
backgroundColor: "rgba(0,0,0,0.9)",
padding: "15px",
maxWidth: "600px",
maxHeight: "600px",
overflow: "auto",
borderRadius: "8px",
fontFamily: "monospace",
}}
>
deepLinkInfo
<p>{contentTarget}</p>
<div
style={{ fontWeight: "bold", marginBottom: "10px", color: "#00ff00" }}
>
🔍 DEEPLINK DEBUG INFO
</div>
<div style={{ marginBottom: "8px" }}>
<strong style={{ color: "#ffff00" }}>ContentTarget:</strong>
<div style={{ marginLeft: "10px", wordBreak: "break-all" }}>
{contentTarget || "없음"}
</div>
</div>
<div style={{ marginBottom: "8px" }}>
<strong style={{ color: "#ffff00" }}>Raw LaunchParams:</strong>
<div
style={{
marginLeft: "10px",
wordBreak: "break-all",
fontSize: "10px",
}}
>
{deepLinkDebug.rawLaunchParams || "없음"}
</div>
</div>
<div style={{ marginBottom: "8px" }}>
<strong style={{ color: "#ffff00" }}>Parsed Params:</strong>
<div style={{ marginLeft: "10px", fontSize: "10px" }}>
{deepLinkDebug.parsedParams
? JSON.stringify(deepLinkDebug.parsedParams, null, 1)
: "없음"}
</div>
</div>
<div style={{ marginBottom: "8px" }}>
<strong style={{ color: "#ffff00" }}>Final Params:</strong>
<div style={{ marginLeft: "10px", fontSize: "10px" }}>
{deepLinkDebug.finalParams
? JSON.stringify(deepLinkDebug.finalParams, null, 1)
: "없음"}
</div>
</div>
<div style={{ marginBottom: "8px" }}>
<strong style={{ color: "#ffff00" }}>Container Launch:</strong>
<span
style={{
marginLeft: "10px",
color: deepLinkDebug.containerLaunch ? "#00ff00" : "#ff0000",
}}
>
{deepLinkDebug.containerLaunch ? "YES" : "NO"}
</span>
</div>
{deepLinkDebug.parseError && (
<div style={{ marginBottom: "8px" }}>
<strong style={{ color: "#ff0000" }}>Parse Error:</strong>
<div
style={{ marginLeft: "10px", color: "#ff0000", fontSize: "10px" }}
>
{deepLinkDebug.parseError}
</div>
</div>
)}
<div style={{ fontSize: "9px", color: "#888", marginTop: "10px" }}>
Last Update: {deepLinkDebug.timestamp || "없음"}
</div>
</div>
</div>
);