Files
Gnuboard7/plugins/_bundled/sirsoft-verification_nhnkcp/dist/js/plugin.iife.js
T
HeuJung 0bcd42ac04 fix(admin_basic,core,ecommerce,plugins,basic): stale dist 전수 재빌드 + 소스맵 게이트 audit 룰 신설
공개 — admin_basic 1.0.4 가 이전 소스로 빌드된 stale dist 를 릴리즈에
실어 주문 상세 합계행에 표현식 원문이 노출되던 회귀를 1.0.5 재빌드로 재수록.

- admin_basic 1.0.5: --production 재빌드 + 서빙 번들 회귀 E2E(red→green) + 시나리오 매니페스트
- 전수 점검: sourcemap 잔존 9확장+코어 3번들 --production 재빌드, untracked .map 3개 삭제
 (+1 bump: gdpr 1.0.3 / tosspayments 1.0.2 / verification_kginicis 1.0.3 /
 verification_nhnkcp 1.0.1 / basic 1.1.1 — 미공개 워킹 5건은 CHANGELOG 누적)
- 리터럴 대조 전수: 기능 drift 는 admin_basic 단독 확정(타 대상 차집합 0), 릴리즈 패리티 7/7 일치
- board/page 사문 build 스크립트 제거 (vite.config 부재 — module:build --all 실패 요인)
- audit 룰 신설: extension-dist-sourcemap-reference(error),
 extension-dist-source-literal-sync(warn) + coverage/룰 테스트/규정 문서 정정
2026-08-12 14:31:26 +09:00

2 lines
8.3 KiB
JavaScript

var SirsoftVerificationNhnkcp=(function(c){"use strict";const i="sirsoft-verification_nhnkcp",M="nhnkcp",k="width=410,height=500,scrollbars=yes,resizable=yes",E="kcp_cert_popup",S="identity-challenge-modal",A="g7.identity.redirectStash",h="sirsoft-verification_nhnkcp.formStash",l={info:(...e)=>console.info(`[${i}]`,...e),warn:(...e)=>console.warn(`[${i}]`,...e),error:(...e)=>console.error(`[${i}]`,...e)};function u(){return window.G7Core??null}const R={9999:`$t:${i}.errors.cancelled`,NOT_ADULT:`$t:${i}.errors.not_adult`,DUPLICATE:`$t:${i}.errors.duplicate`,REMOTE_CALL_FAILED:`$t:${i}.errors.remote_call_failed`,DECRYPT_FAILED:`$t:${i}.errors.decrypt_failed`,INCOMPLETE_IDENTITY:`$t:${i}.errors.incomplete_identity`,NOT_FOUND:`$t:${i}.errors.not_found`,ALREADY_CONSUMED:`$t:${i}.errors.already_consumed`,EXPIRED:`$t:${i}.errors.not_found`,IDENTITY_BINDING_MISMATCH:`$t:${i}.errors.binding_mismatch`,STORAGE_FAILED:`$t:${i}.errors.storage_failed`,PROVIDER_ERROR:`$t:${i}.errors.verify_failed`},v=`$t:${i}.errors.verify_failed`,T=new Set(["NOT_ADULT","DUPLICATE"]);function F(e){return R[e]??v}function g(e,t){const n=R[e];if(n)return n;const r=(t??"").trim();return r===""?v:e?`[${e}] ${r}`:r}const N=1023;function b(){if(typeof window>"u")return!1;const e=window.navigator?.userAgent??"";return/Android|iPhone|iPad|iPod|IEMobile|Opera Mini/i.test(e)?!0:typeof window.innerWidth=="number"&&window.innerWidth<=N}function p(e){const t=u()?.state?.set;typeof t=="function"&&t({identityChallenge:{providerInProgress:e}})}function I(){const e=u()?.identity?.markDomainNoticeShown;if(typeof e=="function")try{e()}catch{}}async function _(e,t="error"){const n=u()?.dispatch;if(typeof n=="function")try{await n({handler:"toast",params:{type:t,message:e}})}catch{}}function O(e,t){const n=document.createElement("form");n.setAttribute("name","kcpCertForm"),n.setAttribute("method","POST"),n.setAttribute("action",e.call_url),n.setAttribute("target",t),n.setAttribute("accept-charset","UTF-8"),n.style.display="none";const r={reg_cert_key:e.reg_cert_key,kcp_page_submit_yn:"Y"};for(const[o,s]of Object.entries(r)){const a=document.createElement("input");a.type="hidden",a.name=o,a.value=s,n.appendChild(a)}document.body.appendChild(n),n.submit(),window.setTimeout(()=>{try{n.remove()}catch{}},0)}function U(){try{window.sessionStorage.setItem(A,JSON.stringify({return_url:window.location.href,payload:{},stashed_at:Date.now()}))}catch(e){l.warn("복귀 주소 보관 실패 — 인증 후 처음 화면으로 돌아갈 수 있습니다.",e)}try{window.sessionStorage.setItem(h,JSON.stringify({fields:G(),stashed_at:Date.now()}))}catch(e){l.warn("입력값 보관 실패",e)}}function G(){const e={};return document.querySelectorAll("input[name], select[name], textarea[name]").forEach(n=>{const r=n.getAttribute("name")??"";if(!r)return;const o=(n.getAttribute("type")??"").toLowerCase();if(o==="password"||o==="file"||o==="hidden")return;if(o==="checkbox"||o==="radio"){n.checked&&(e[r]=String(n.value??"on"));return}const s=String(n.value??"");s!==""&&(e[r]=s)}),e}function H(e){const t=Object.keys(e);if(t.length===0)return;let n=0;const r=window.setInterval(()=>{n+=1;let o=0;t.forEach(s=>{const a=document.querySelector(`[name="${Y(s)}"]`);if(!a)return;const d=(a.getAttribute("type")??"").toLowerCase();if(d==="checkbox"||d==="radio"){const f=a;f.value===e[s]&&!f.checked&&f.click(),o+=1;return}j(a,e[s]),o+=1}),(o===t.length||n>=25)&&window.clearInterval(r)},200)}function Y(e){const t=globalThis.CSS;return t&&typeof t.escape=="function"?t.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function j(e,t){const n=Object.getPrototypeOf(e),r=Object.getOwnPropertyDescriptor(n,"value");r?.set?r.set.call(e,t):e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function K(e){const t=u()?.dispatch;return typeof t!="function"?Promise.resolve():t({handler:"sequence",params:{actions:[{handler:"resolveIdentityChallenge",params:e},{handler:"closeModal",target:S}]}}).catch(()=>{})}const P=new Set;function $(e){e&&P.add(e)}function V(e){return!!e&&P.has(e)}async function B(e){if(!e)return;const t=u()?.api?.getToken?.()??null;try{await fetch(`/api/identity/challenges/${encodeURIComponent(e)}/cancel`,{method:"POST",credentials:"include",headers:{Accept:"application/json",...t?{Authorization:`Bearer ${t}`}:{}}})}catch(n){l.warn("이탈 거래 취소 통보 실패 (재시도 흐름에는 영향 없음)",n)}}async function q(e){const t=u(),n={purpose:e.purpose};e.provider_id&&(n.provider_id=e.provider_id),e.target&&(n.target=e.target);try{const r=t?.api?.getToken?.()??null,o=(()=>{try{return window.localStorage?.getItem("g7_locale")}catch{return null}})(),s=await fetch("/api/identity/challenges",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...o?{"Accept-Language":o}:{},...r?{Authorization:`Bearer ${r}`}:{}},body:JSON.stringify(n)}),a=await s.json().catch(()=>null);if(!s.ok||!a?.success)return l.error("challenge 재발급 실패",a),null;const d=a.data??a,f={...e,challenge_id:d.id,expires_at:d.expires_at,public_payload:d.public_payload??{},error:null};return t?.state?.set?.({identityChallenge:f}),f}catch(r){return l.error("challenge 재발급 중 오류",r),null}}async function y(){const e=u();let t=e?.state?.getGlobal?.()?.identityChallenge??e?.state?.get?.()?.identityChallenge;if(!t){l.error("_global.identityChallenge 미설정 — 코어 모달 진입 흐름 확인 필요");return}if(V(t.challenge_id)){const o=await q(t);if(!o){await _(`$t:${i}.modal.payload_not_ready`);return}t=o}const n=t.public_payload;if(!n?.call_url||!n?.reg_cert_key){l.error("public_payload 의 call_url/reg_cert_key 부재 — 거래등록 응답 확인 필요",n),await _(`$t:${i}.modal.payload_not_ready`);return}if(b()){U(),p(!0),O(n,"_self");return}const r=window.open("",E,k);if(!r){l.error("window.open null — 팝업 차단됨"),await _(`$t:${i}.modal.popup_blocked`);return}p(!0),O(n,E),J(r)}function J(e){let t=!1,n=null,r=null;const o=()=>{r&&(window.removeEventListener("message",r),r=null),n!==null&&(window.clearInterval(n),n=null)};r=s=>{if(s.origin!==window.location.origin)return;const a=s.data;if(!a||a.type!=="identity_result"||t)return;t=!0,o();try{e.close()}catch{}if(p(!1),a.identity_error){const f=a.challenge_id||u()?.state?.getGlobal?.()?.identityChallenge?.challenge_id;$(f),T.has(a.identity_error)&&I(),_(g(a.identity_error,a.identity_error_message),"error");return}const d=a.verification_token?{result:"verified",token:a.verification_token}:{result:"cancelled"};K(d)},window.addEventListener("message",r),n=window.setInterval(()=>{if(t){o();return}if(e.closed){t=!0,o(),p(!1);const s=u()?.state?.getGlobal?.()?.identityChallenge?.challenge_id;$(s),B(s)}},500)}function w(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search),t=e.get("verification_token")??"",n=e.get("identity_error")??"";if(t===""&&n==="")return;const r=W();if(r&&H(r.fields),t!==""){_(`$t:${i}.modal.mobile_return_success`,"success");return}T.has(n)&&I(),_(g(n,e.get("identity_error_message")??void 0),"error"),e.delete("identity_error"),e.delete("identity_error_message");const o=e.toString(),s=window.location.pathname+(o?`?${o}`:"")+window.location.hash;try{window.history.replaceState(null,"",s)}catch{}}function W(){let e=null;try{e=window.sessionStorage.getItem(h),window.sessionStorage.removeItem(h)}catch{return null}if(!e)return null;try{const t=JSON.parse(e);return!t?.fields||typeof t.stashed_at!="number"||Date.now()-t.stashed_at>6e5?null:t}catch{return null}}function C(){const t=u()?.getActionDispatcher;if(typeof t!="function")return!1;const n=t();return!n||typeof n.registerHandler!="function"?!1:(n.registerHandler(`${i}.startAuth`,y,{category:"plugin",source:i}),l.info("startAuth handler registered"),!0)}function D(){if(C())return;let e=0;const t=window.setInterval(()=>{e++,(C()||e>=50)&&(window.clearInterval(t),e>=50&&l.warn("G7Core ActionDispatcher 미준비 — handler 등록 실패"))},100)}function L(){D()}function m(){w(),D()}return m(),window.__SirsoftVerificationNhnkcp={identifier:i,init:m,initPlugin:L,startAuthHandler:y,handleMobileReturn:w},c.FORM_STASH_KEY=h,c.MODAL_ID=S,c.PLUGIN_IDENTIFIER=i,c.PROVIDER_ID=M,c.REDIRECT_STASH_KEY=A,c.handleMobileReturn=w,c.init=m,c.initPlugin=L,c.isMobileEnvironment=b,c.resolveFailureMessage=g,c.resolveFailureMessageKey=F,c.startAuthHandler=y,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),c})({});