fix(performance): 구글 광고 INVALID_LOGIN_CUSTOMER_ID 안내 + 저장된 일반 칸을 비우면 지워지게

- 로그인 고객 ID(MCC) 오류에 "직접 추가했다면 칸을 비우고, MCC 면 서비스 계정을 추가한 그 MCC 번호" 안내
- API 설정 창: 저장값이 보이던 일반(비밀 아님) 선택 칸을 비우면 [저장] 때 지우고(clear), [연결 테스트]도 빈 값으로 시험
  (예전엔 빈 칸 = 기존 값 유지라 한 번 넣은 MCC 번호를 지울 수 없었음)
- performance.js 20261015b

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 15:24:47 +09:00
parent 42d2671f80
commit 4eda10df00
9 changed files with 60 additions and 19 deletions
+10 -5
View File
@@ -841,12 +841,14 @@
? '<span class="perf-secret-state">현재 값: •••••••• (저장됨' + (f.updated_at ? ", " + esc(f.updated_at.slice(0, 16).replace("T", " ")) : "") + ")</span>"
: '<span class="perf-secret-state is-empty">저장된 값 없음</span>';
}
// 저장된 일반(비밀 아님) 선택 항목 — 칸을 비우면 저장된 값을 지운다(data-had, cleared())
const had = !f.secret && f.has_value && !f.required ? ' data-had="1"' : "";
// 여러 줄 항목(서비스 계정 JSON 키 등)은 textarea — 비밀값이면 저장 후 내용은 다시 보이지 않는다
const field = f.multiline
? '<textarea class="erp-input perf-cred-multi" id="' + id + '" data-key="' + esc(f.key) + '" rows="6" spellcheck="false" ' +
? '<textarea class="erp-input perf-cred-multi" id="' + id + '" data-key="' + esc(f.key) + '"' + had + ' rows="6" spellcheck="false" ' +
'autocomplete="off" placeholder="' + (f.secret && f.has_value ? "변경할 때만 새 값 붙여넣기" : esc(f.placeholder || "붙여넣기")) + '">' +
(f.secret ? "" : esc(f.value || "")) + "</textarea>"
: '<input class="erp-input" id="' + id + '" data-key="' + esc(f.key) + '" ' +
: '<input class="erp-input" id="' + id + '" data-key="' + esc(f.key) + '"' + had + " " +
(f.secret ? 'type="password" autocomplete="new-password" placeholder="' + (f.has_value ? "변경할 때만 새 값 입력" : "입력") + '"'
: 'type="text" value="' + esc(f.value || "") + '" placeholder="' + esc(f.placeholder || "") + '"') + " />";
return '<div class="perf-form-row"><label for="' + id + '">' + esc(f.label) + (f.required ? " *" : "") + "</label>" + state +
@@ -855,7 +857,7 @@
(f.secret && f.has_value && !f.required ? '<label class="perf-check"><input type="checkbox" data-clear="' + esc(f.key) + '" /> 저장된 값 지우기</label>' : "") +
"</div>";
}).join("") + "</form>" +
'<p class="perf-foot perf-muted">[연결 테스트]는 입력한 새 값으로 시험하며 저장하지 않습니다(빈 칸은 저장된 값 사용). ' +
'<p class="perf-foot perf-muted">[연결 테스트]는 입력한 새 값으로 시험하며 저장하지 않습니다(빈 비밀 칸은 저장된 값 사용, 값이 보이던 칸을 비우면 빈 값으로 시험). ' +
"[저장]은 연결 테스트 결과와 관계없이 저장합니다 — 쇼핑몰의 일시 장애로 테스트가 실패할 수 있기 때문입니다. " +
"저장 후 자동으로 한 번 더 연결 테스트를 합니다.</p>";
m.body.innerHTML = html;
@@ -883,15 +885,18 @@
return out;
}
function cleared() {
return Array.prototype.filter.call(m.body.querySelectorAll("input[data-clear]"), function (c) { return c.checked; })
const out = Array.prototype.filter.call(m.body.querySelectorAll("input[data-clear]"), function (c) { return c.checked; })
.map(function (c) { return c.dataset.clear; });
// 저장값이 보이던 일반 칸을 비웠으면 지우기(예: 구글 광고 로그인 고객 ID)
m.body.querySelectorAll("[data-had]").forEach(function (i) { if (!i.value.trim() && out.indexOf(i.dataset.key) < 0) out.push(i.dataset.key); });
return out;
}
async function test(withTyped) {
testBtn.disabled = true;
result.className = "perf-test-result";
result.textContent = "연결 확인 중…";
try {
const res = await api("POST", base + code + "/test", withTyped ? { values: typed() } : {});
const res = await api("POST", base + code + "/test", withTyped ? { values: typed(), clear: cleared() } : {});
result.className = "perf-test-result " + (res.ok ? "is-ok" : "is-bad");
result.textContent = (res.ok ? "● " : "● " + res.label + " — ") + res.message + (res.unsaved ? " (저장 안 한 값으로 시험)" : "");
if (!res.unsaved) m.changed = true;